summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_panes.c
blob: d0f955df393c0dfd1b8f533f7b9202a546b2dfcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_LAYOUT_PROTECTED
#define EFL_GFX_SIZE_HINT_PROTECTED

#include <Elementary.h>

#include "elm_priv.h"
#include "elm_widget_layout.h"
#include "efl_ui_panes_private.h"

#include "efl_ui_panes_part.eo.h"
#include "elm_part_helper.h"

#define MY_CLASS EFL_UI_PANES_CLASS
#define MY_CLASS_PFX efl_ui_panes

#define MY_CLASS_NAME "Efl.Ui.Panes"
#define MY_CLASS_NAME_LEGACY "elm_panes"
/**
 * TODO
 * Update the minimun height of the bar in the theme.
 * No minimun should be set in the vertical theme
 * Add events (move, start ...)
 */

static const char SIG_CLICKED[] = "clicked";
static const char SIG_PRESS[] = "press";
static const char SIG_UNPRESS[] = "unpress";
static const char SIG_DOUBLE_CLICKED[] = "clicked,double";
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
   {SIG_CLICKED, ""},
   {SIG_PRESS, ""},
   {SIG_UNPRESS, ""},
   {SIG_DOUBLE_CLICKED, ""},
   {NULL, NULL}
};

static const Elm_Layout_Part_Alias_Description _content_aliases[] =
{
   //XXX: change elm.swallow.left/right to *.first/second in new theme.
   {"left", "elm.swallow.left"},
   {"right", "elm.swallow.right"},
   {"top", "elm.swallow.left"},
   {"bottom", "elm.swallow.right"},
   {"first", "elm.swallow.left"},
   {"second", "elm.swallow.right"},
   {NULL, NULL}
};

static void _set_min_size_new(void *data);

EOLIAN static Efl_Ui_Theme_Apply
_efl_ui_panes_elm_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd)
{
   double size;
   Evas_Coord minw = 0, minh = 0;

   Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
   EFL_UI_LAYOUT_DATA_GET(obj, ld);

   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     eina_stringshare_replace(&ld->group, "horizontal");
   else
     eina_stringshare_replace(&ld->group, "vertical");

   evas_object_hide(sd->event);
   elm_coords_finger_size_adjust(1, &minw, 1, &minh);
   evas_object_size_hint_min_set(sd->event, minw, minh);

   int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
   if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;

   size = elm_panes_content_left_size_get(obj);

   if (sd->fixed)
     {
        elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");

        //TODO: remove this signal on EFL 2.0.
        // I left this due to the backward compatibility.
        elm_layout_signal_emit(obj, "elm.panes.fixed", "elm");
     }

   elm_layout_sizing_eval(obj);

   elm_panes_content_left_size_set(obj, size);

   return int_ret;
}

EOLIAN static Eina_Bool
_efl_ui_panes_elm_widget_focus_next(Eo *obj, Efl_Ui_Panes_Data *sd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
{
   Eina_Bool int_ret = EINA_FALSE;

   Eina_List *items = NULL;
   Eina_List *(*list_free)(Eina_List *list);
   void *(*list_data_get)(const Eina_List *list);
   Evas_Object *left = NULL;
   Evas_Object *right = NULL;

   /* Focus chain */
   /* TODO: Change this to use other chain */
   if ((items = (Eina_List *)elm_obj_widget_focus_custom_chain_get(obj)))
     {
        list_data_get = eina_list_data_get;
        list_free = NULL;
     }
   else
     {
        left = elm_layout_content_get(obj, "left");
        if (left)
          items = eina_list_append(items, left);

        right = elm_layout_content_get(obj, "right");
        if (right)
          items = eina_list_append(items, right);

        list_data_get = eina_list_data_get;
        list_free = eina_list_free;

        if (!items) return EINA_FALSE;
     }

   int_ret = elm_widget_focus_list_next_get
      (obj, (const Eina_List *)items, list_data_get, dir, next, next_item);

   if (list_free) list_free((Eina_List *)items);

   return int_ret;
}

static void
_on_clicked(void *data,
            Evas_Object *obj EINA_UNUSED,
            const char *emission EINA_UNUSED,
            const char *source EINA_UNUSED)
{
   efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL);
}

static void
_double_clicked(void *data,
                Evas_Object *obj EINA_UNUSED,
                const char *emission EINA_UNUSED,
                const char *source EINA_UNUSED)
{
   EFL_UI_PANES_DATA_GET(data, sd);

   sd->double_clicked = EINA_TRUE;
}

static void
_on_pressed(void *data,
            Evas_Object *obj EINA_UNUSED,
            const char *emission EINA_UNUSED,
            const char *source EINA_UNUSED)
{
   efl_event_callback_legacy_call(data, ELM_PANES_EVENT_PRESS, NULL);
}

static void
_on_unpressed(void *data,
              Evas_Object *obj EINA_UNUSED,
              const char *emission EINA_UNUSED,
              const char *source EINA_UNUSED)
{
   EFL_UI_PANES_DATA_GET(data, sd);
   efl_event_callback_legacy_call(data, ELM_PANES_EVENT_UNPRESS, NULL);

   if (sd->double_clicked)
     {
        efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL);
        sd->double_clicked = EINA_FALSE;
     }
}

EOLIAN static void
_efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
{
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);

   Eo *first_content, *second_content;
   Eina_Size2D min;

   first_content = efl_content_get(efl_part(obj, "first"));
   second_content = efl_content_get(efl_part(obj, "second"));

   if (first_content)
     {
        if (!sd->first_hint_min_allow)
          sd->first_min = efl_gfx_size_hint_combined_min_get(first_content);
        else
          sd->first_min = efl_gfx_size_hint_min_get(first_content);
     }

   if (second_content)
     {
        if (!sd->second_hint_min_allow)
          sd->second_min = efl_gfx_size_hint_combined_min_get(second_content);
        else
          sd->second_min = efl_gfx_size_hint_min_get(second_content);
     }

   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     {
        min.w = MAX(sd->first_min.w, sd->second_min.w);
        min.h = sd->first_min.h + sd->second_min.h;
     }
   else
     {
        min.w = sd->first_min.w + sd->second_min.w;
        min.h = MAX(sd->first_min.h, sd->second_min.h);
     }

   efl_gfx_size_hint_restricted_min_set(obj, min);
   _set_min_size_new(obj);
}

static void
_set_min_size_new(void *data)
{
   Eo *obj = data;
   EFL_UI_PANES_DATA_GET(obj, sd);
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);

   Eina_Size2D first_min = sd->first_min;
   Eina_Size2D second_min = sd->second_min;
   int w, h;
   double first_min_relative_size = 0.0, second_min_relative_size = 0.0;

   evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);

   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     {
        if (first_min.h + second_min.h > h)
          {
             first_min_relative_size = first_min.h/(first_min.h + second_min.h);
             second_min_relative_size = second_min.h/(first_min.h + second_min.h);
          }
        else
          {
             if (h > 0)
               {
                  first_min_relative_size = first_min.h/(double)h;
                  second_min_relative_size = second_min.h/(double)h;
               }
          }

        first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
        second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);

        edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
                                        0.0, 1.0 - second_min_relative_size);
        edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
                                        0.0, first_min_relative_size);
     }
   else
     {
        if (first_min.w + second_min.w > w)
          {
             first_min_relative_size = first_min.w/(first_min.w + second_min.w);
             second_min_relative_size = second_min.w/(first_min.w + second_min.w);
          }
        else
          {
             if (w > 0)
               {
                  first_min_relative_size = first_min.w/(double)w;
                  second_min_relative_size = second_min.w/(double)w;
               }
          }

        first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
        second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);

        edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
                                        1.0 - second_min_relative_size, 0.0);
        edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
                                        first_min_relative_size, 0.0);
     }
}

static void
_set_min_size(void *data)
{
   EFL_UI_PANES_DATA_GET(data, sd);
   ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);

   double sizer = sd->right_min_relative_size;
   double sizel = sd->left_min_relative_size;
   if ((sd->left_min_relative_size + sd->right_min_relative_size) > 1)
     {
        double sum = sizer + sizel;
        sizer = sizer / sum;
        sizel = sizel / sum;
     }
   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     {
        edje_object_part_drag_value_set
           (wd->resize_obj, "right_constraint", 0.0, (1 - sizer));
        edje_object_part_drag_value_set
           (wd->resize_obj, "left_constraint", 0.0, sizel);
     }
   else
     {
        edje_object_part_drag_value_set
           (wd->resize_obj, "right_constraint", (1 - sizer), 0.0);
        edje_object_part_drag_value_set
           (wd->resize_obj, "left_constraint", sizel, 0.0);
     }
}

static void
_update_fixed_sides(void *data)
{
   EFL_UI_PANES_DATA_GET(data, sd);
   ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
   Evas_Coord w, h;
   evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);

   if (sd->right_min_size_is_relative)
     {
        if (sd->dir == EFL_UI_DIR_HORIZONTAL)
           sd->right_min_size = (int)(h * sd->right_min_relative_size);
        else
           sd->right_min_size =(int)(w * sd->right_min_relative_size);
     }
   else
     {
        sd->right_min_relative_size = 0;
        if (sd->dir == EFL_UI_DIR_HORIZONTAL && (h > 0))
              sd->right_min_relative_size = sd->right_min_size / (double)h;
        if (sd->dir == EFL_UI_DIR_VERTICAL && (w > 0))
              sd->right_min_relative_size = sd->right_min_size / (double)w;
     }

   if(sd->left_min_size_is_relative)
     {
        if (sd->dir == EFL_UI_DIR_HORIZONTAL)
             sd->left_min_size = (int)(h * sd->left_min_relative_size);
        else
           sd->left_min_size = (int)(w * sd->left_min_relative_size);
     }
   else
     {
        sd->left_min_relative_size = 0;
        if (sd->dir == EFL_UI_DIR_HORIZONTAL && (h > 0))
           sd->left_min_relative_size = sd->left_min_size / (double)h;
        if (sd->dir == EFL_UI_DIR_VERTICAL && (w > 0))
           sd->left_min_relative_size = sd->left_min_size / (double)w;
     }

   _set_min_size(data);
}

static void
_on_resize(void *data,
           Evas *e EINA_UNUSED,
           Evas_Object *obj EINA_UNUSED,
           void *event_info EINA_UNUSED)
{
  if (elm_widget_is_legacy(data)) _update_fixed_sides(data);
  else _set_min_size_new(data);
}

EOLIAN static void
_efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
{
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
   EFL_UI_PANES_DATA_GET(obj, sd);

   efl_canvas_group_add(efl_super(obj, MY_CLASS));
   elm_widget_sub_object_parent_add(obj);

   if (!elm_layout_theme_set
       (obj, "panes", "vertical", elm_widget_style_get(obj)))
     CRI("Failed to set layout!");

   elm_panes_content_left_size_set(obj, 0.5);

   edje_object_signal_callback_add
     (wd->resize_obj, "elm,action,click", "*",
     _on_clicked, obj);
   edje_object_signal_callback_add
     (wd->resize_obj, "elm,action,click,double", "*",
     _double_clicked, obj);
   edje_object_signal_callback_add
     (wd->resize_obj, "elm,action,press", "*",
     _on_pressed, obj);
   edje_object_signal_callback_add
     (wd->resize_obj, "elm,action,unpress", "*",
     _on_unpressed, obj);
   evas_object_event_callback_add
     (wd->resize_obj, EVAS_CALLBACK_RESIZE,
     _on_resize, obj);

   sd->dir = EFL_UI_DIR_VERTICAL;
   sd->right_min_size_is_relative = EINA_TRUE;
   sd->left_min_size_is_relative = EINA_TRUE;
   sd->right_min_size = 0;
   sd->left_min_size = 0;
   sd->right_min_relative_size = 0;
   sd->left_min_relative_size = 0;
   if (elm_widget_is_legacy(obj)) _update_fixed_sides(obj);
   else _set_min_size_new(obj);

   elm_widget_can_focus_set(obj, EINA_FALSE);

   sd->event = evas_object_rectangle_add(evas_object_evas_get(obj));
   evas_object_color_set(sd->event, 0, 0, 0, 0);
   evas_object_pass_events_set(sd->event, EINA_TRUE);
   if (edje_object_part_exists
       (wd->resize_obj, "elm.swallow.event"))
     {
        Evas_Coord minw = 0, minh = 0;

        elm_coords_finger_size_adjust(1, &minw, 1, &minh);
        evas_object_size_hint_min_set(sd->event, minw, minh);
        elm_layout_content_set(obj, "elm.swallow.event", sd->event);
     }
   elm_widget_sub_object_add(obj, sd->event);

   elm_layout_sizing_eval(obj);
}

EOLIAN static Eo *
_efl_ui_panes_efl_object_constructor(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
{
   obj = efl_constructor(efl_super(obj, MY_CLASS));
   efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
   evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
   elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_SPLIT_PANE);

   return obj;
}

EOLIAN static double
_efl_ui_panes_split_ratio_get(Eo *obj, Efl_Ui_Panes_Data *sd)
{
   double w, h;
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0.0);

   edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h);

   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     return h;
   else return w;
}

EOLIAN static void
_efl_ui_panes_split_ratio_set(Eo *obj, Efl_Ui_Panes_Data *sd, double ratio)
{
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);

   if (ratio < 0.0) ratio = 0.0;
   else if (ratio > 1.0) ratio = 1.0;

   if (sd->dir == EFL_UI_DIR_HORIZONTAL)
     edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio);
   else
     edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0);
}

EOLIAN static void
_efl_ui_panes_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Panes_Data *sd, Efl_Ui_Dir dir)
{
   double size = elm_panes_content_left_size_get(obj);
   if (efl_ui_dir_is_horizontal(dir, EINA_FALSE))
     dir = EFL_UI_DIR_HORIZONTAL;
   else
     dir = EFL_UI_DIR_VERTICAL;

   sd->dir = dir;
   elm_obj_widget_theme_apply(obj);
   if (elm_widget_is_legacy(obj)) _update_fixed_sides(obj);
   else _set_min_size_new(obj);

   elm_panes_content_left_size_set(obj, size);
}

EOLIAN static Efl_Ui_Dir
_efl_ui_panes_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
{
   return sd->dir;
}

EOLIAN static void
_efl_ui_panes_fixed_set(Eo *obj, Efl_Ui_Panes_Data *sd, Eina_Bool fixed)
{
   sd->fixed = !!fixed;
   if (sd->fixed == EINA_TRUE)
     {
        elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");

        //TODO: remove this signal on EFL 2.0.
        // I left this due to the backward compatibility.
        elm_layout_signal_emit(obj, "elm.panes.fixed", "elm");
     }
   else
     {
        elm_layout_signal_emit(obj, "elm,panes,unfixed", "elm");

        //TODO: remove this signal on EFL 2.0.
        // I left this due to the backward compatibility.
        elm_layout_signal_emit(obj, "elm.panes.unfixed", "elm");
     }
}

EOLIAN static Eina_Bool
_efl_ui_panes_fixed_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
{
   return sd->fixed;
}

EOLIAN static Eina_Bool
_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
{
   return EINA_TRUE;
}

static void
_efl_ui_panes_class_constructor(Efl_Class *klass)
{
   evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}

/* Efl.Part begin */

ELM_PART_OVERRIDE(efl_ui_panes, EFL_UI_PANES, EFL_UI_LAYOUT, Efl_Ui_Panes_Data, Elm_Part_Data)

EOLIAN static void
_efl_ui_panes_part_hint_min_allow_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, Eina_Bool allow)
{
   Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_PART_CLASS);
   Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);

   if (!strcmp(pd->part, "first"))
     {
        if (sd->first_hint_min_allow == allow) return;
        sd->first_hint_min_allow = allow;
        elm_layout_sizing_eval(pd->obj);
     }
   else if (!strcmp(pd->part, "second"))
     {
        if (sd->second_hint_min_allow == allow) return;
        sd->second_hint_min_allow = allow;
        elm_layout_sizing_eval(pd->obj);
     }
}

EOLIAN static Eina_Bool
_efl_ui_panes_part_hint_min_allow_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
{
   Eina_Bool ret = EINA_FALSE;
   Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_PART_CLASS);
   Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);

   if (!strcmp(pd->part, "first"))
     {
        ret = sd->first_hint_min_allow;
     }
   else if (!strcmp(pd->part, "second"))
     {
        ret = sd->second_hint_min_allow;
     }

   return ret;
}

EOLIAN static double
_efl_ui_panes_part_split_ratio_min_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
{
   Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_PART_CLASS);
   Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
   double ret = 0.0;

   if (!strcmp(pd->part, "first"))
     ret = sd->first_min_split_ratio;
   else if (!strcmp(pd->part, "second"))
     ret = sd->second_min_split_ratio;

   return ret;
}

EOLIAN static void
_efl_ui_panes_part_split_ratio_min_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, double ratio)
{
   Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_PART_CLASS);
   Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);

   if (!strcmp(pd->part, "first"))
     {
        sd->first_min_split_ratio = ratio;
        if (sd->first_min_split_ratio < 0) sd->first_min_split_ratio = 0;
        _set_min_size_new(pd->obj);
     }
   else if (!strcmp(pd->part, "second"))
     {
        sd->second_min_split_ratio = ratio;
        if (sd->second_min_split_ratio < 0) sd->second_min_split_ratio = 0;
        _set_min_size_new(pd->obj);
     }
}

#include "efl_ui_panes_part.eo.c"

/* Efl.Part end */

/* Internal EO APIs and hidden overrides */

ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX);

#define EFL_UI_PANES_EXTRA_OPS \
   EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \
   ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
   ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_panes)

/* Legacy APIs */

EAPI Evas_Object *
elm_panes_add(Evas_Object *parent)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
   return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
}

EAPI void
elm_panes_content_left_min_size_set(Evas_Object *obj, int size)
{
   EFL_UI_PANES_DATA_GET(obj, sd);

   sd->left_min_size = size;
   if (sd->left_min_size < 0) sd->left_min_size = 0;
   sd->left_min_size_is_relative = EINA_FALSE;
   _update_fixed_sides(obj);
}

EAPI int
elm_panes_content_left_min_size_get(const Evas_Object *obj)
{
   EFL_UI_PANES_DATA_GET(obj, sd);
   return sd->left_min_size;
}

EAPI void
elm_panes_content_right_min_size_set(Evas_Object *obj, int size)
{
   EFL_UI_PANES_DATA_GET(obj, sd);

   sd->right_min_size = size;
   if (sd->right_min_size < 0) sd->right_min_size = 0;
   sd->right_min_size_is_relative = EINA_FALSE;
   _update_fixed_sides(obj);
}

EAPI int
elm_panes_content_right_min_size_get(const Evas_Object *obj)
{
   EFL_UI_PANES_DATA_GET(obj, sd);
   return sd->right_min_size;
}

EAPI double
elm_panes_content_left_size_get(const Evas_Object *obj)
{
   return efl_ui_panes_split_ratio_get(obj);
}

EAPI void
elm_panes_content_left_size_set(Evas_Object *obj, double size)
{
   efl_ui_panes_split_ratio_set(obj, size);
}

EAPI double
elm_panes_content_right_size_get(const Evas_Object *obj)
{
   return 1.0 - elm_panes_content_left_size_get(obj);
}

EAPI void
elm_panes_content_right_size_set(Evas_Object *obj, double size)
{
   elm_panes_content_left_size_set(obj, (1.0 - size));
}

EAPI void
elm_panes_content_left_min_relative_size_set(Evas_Object *obj, double size)
{
   EFL_UI_PANES_DATA_GET(obj, sd);
   sd->left_min_relative_size = size;
   if (sd->left_min_relative_size < 0) sd->left_min_relative_size = 0;
   sd->left_min_size_is_relative = EINA_TRUE;
   _update_fixed_sides(obj);
}

EAPI double
elm_panes_content_left_min_relative_size_get(const Evas_Object *obj)
{
   EFL_UI_PANES_DATA_GET(obj, sd);
   return sd->left_min_relative_size;
}

EAPI void
elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size)
{
   EFL_UI_PANES_DATA_GET(obj, sd);

   sd->right_min_relative_size = size;
   if (sd->right_min_relative_size < 0) sd->right_min_relative_size = 0;
   sd->right_min_size_is_relative = EINA_TRUE;
   _update_fixed_sides(obj);
}

EAPI double
elm_panes_content_right_min_relative_size_get(const Evas_Object *obj)
{
   EFL_UI_PANES_DATA_GET(obj, sd);
   return sd->right_min_relative_size;
}

EAPI void
elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
   Efl_Ui_Dir dir;

   if (horizontal)
     dir = EFL_UI_DIR_HORIZONTAL;
   else
     dir = EFL_UI_DIR_VERTICAL;

   efl_ui_direction_set(obj, dir);
}

EAPI Eina_Bool
elm_panes_horizontal_get(const Evas_Object *obj)
{
   Efl_Ui_Dir dir = efl_ui_direction_get(obj);

   if (dir == EFL_UI_DIR_HORIZONTAL)
     return EINA_TRUE;

   return EINA_FALSE;
}

EINA_DEPRECATED EAPI void
elm_panes_content_left_set(Evas_Object *obj,
                           Evas_Object *content)
{
   elm_layout_content_set(obj, "left", content);
}

EINA_DEPRECATED EAPI void
elm_panes_content_right_set(Evas_Object *obj,
                            Evas_Object *content)
{
   elm_layout_content_set(obj, "right", content);
}

EINA_DEPRECATED EAPI Evas_Object *
elm_panes_content_left_get(const Evas_Object *obj)
{
   return elm_layout_content_get(obj, "left");
}

EINA_DEPRECATED EAPI Evas_Object *
elm_panes_content_right_get(const Evas_Object *obj)
{
   return elm_layout_content_get(obj, "right");
}

EINA_DEPRECATED EAPI Evas_Object *
elm_panes_content_left_unset(Evas_Object *obj)
{
   return elm_layout_content_unset(obj, "left");
}

EINA_DEPRECATED EAPI Evas_Object *
elm_panes_content_right_unset(Evas_Object *obj)
{
   return elm_layout_content_unset(obj, "right");
}

/* Legacy APIs end  */

#include "efl_ui_panes.eo.c"