summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.c229
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.eo24
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll_part.eo10
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll_private.h17
5 files changed, 281 insertions, 0 deletions
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 8467673..5dcff7b 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -283,6 +283,7 @@ EAPI extern Elm_Version *elm_version;
283# include <efl_ui_text.eo.h> 283# include <efl_ui_text.eo.h>
284# include <efl_ui_popup.eo.h> 284# include <efl_ui_popup.eo.h>
285# include <efl_ui_popup_alert.eo.h> 285# include <efl_ui_popup_alert.eo.h>
286# include <efl_ui_popup_alert_scroll.eo.h>
286# include <efl_ui_text_editable.eo.h> 287# include <efl_ui_text_editable.eo.h>
287# include <efl_ui_text_async.eo.h> 288# include <efl_ui_text_async.eo.h>
288# include <efl_ui_clock.eo.h> 289# include <efl_ui_clock.eo.h>
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.c b/src/lib/elementary/efl_ui_popup_alert_scroll.c
new file mode 100644
index 0000000..ca0fe76
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.c
@@ -0,0 +1,229 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6
7#include "elm_priv.h"
8#include "efl_ui_popup_alert_scroll_private.h"
9#include "efl_ui_popup_alert_scroll_part.eo.h"
10#include "elm_part_helper.h"
11
12#define MY_CLASS EFL_UI_POPUP_ALERT_SCROLL_CLASS
13#define MY_CLASS_NAME "Efl.Ui.Popup.Alert.Scroll"
14
15static void
16_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Evas_Coord minw, Evas_Coord minh)
17{
18 Evas_Coord w, h;
19 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
20
21 if (pd->is_expandable_w && !pd->is_expandable_h)
22 {
23 if ((pd->max_scroll_w > -1) && (minw > pd->max_scroll_w))
24 {
25 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
26 evas_object_resize(obj, pd->max_scroll_w, h);
27 }
28 }
29 else if (!pd->is_expandable_w && pd->is_expandable_h)
30 {
31 if ((pd->max_scroll_h > -1) && (minh > pd->max_scroll_h))
32 {
33 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
34 evas_object_resize(obj, w, pd->max_scroll_h);
35 }
36 }
37 else if (pd->is_expandable_w && pd->is_expandable_h)
38 {
39 Eina_Bool wdir, hdir;
40 wdir = hdir = EINA_FALSE;
41
42 if ((pd->max_scroll_w > -1) && (minw > pd->max_scroll_w))
43 wdir = 1;
44 if ((pd->max_scroll_h > -1) && (minh > pd->max_scroll_h))
45 hdir = 1;
46 if (wdir && !hdir)
47 {
48 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
49 evas_object_resize(obj, pd->max_scroll_w, h);
50 }
51 else if (!wdir && hdir)
52 {
53 elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_FALSE);
54 evas_object_resize(obj, w, pd->max_scroll_h);
55 }
56 else if(wdir && hdir)
57 {
58 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
59 evas_object_resize(obj, pd->max_scroll_w, pd->max_scroll_h);
60 }
61 }
62}
63
64EOLIAN static void
65_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
66{
67 elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
68
69 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
70 Evas_Coord minw = -1, minh = -1;
71
72 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
73 edje_object_size_min_restricted_calc
74 (wd->resize_obj, &minw, &minh, minw, minh);
75 evas_object_size_hint_min_set(obj, minw, minh);
76
77 _scroller_sizing_eval(obj, pd, minw, minh);
78}
79
80static Eina_Bool
81_efl_ui_popup_alert_scroll_content_set(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, const char *part, Evas_Object *content)
82{
83 //For efl_content_set()
84 if (part && !strcmp(part, "elm.swallow.content"))
85 {
86 pd->content = content;
87
88 //Content should have expand propeties since the scroller is not layout layer
89 evas_object_size_hint_weight_set(pd->content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
90 evas_object_size_hint_align_set(pd->content, EVAS_HINT_FILL, EVAS_HINT_FILL);
91
92 efl_content_set(efl_part(pd->scroller, "default"), pd->content);
93 }
94 else
95 {
96 efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
97 }
98
99 return EINA_TRUE;
100}
101
102Evas_Object *
103_efl_ui_popup_alert_scroll_content_get(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, const char *part)
104{
105 //For efl_content_set()
106 if (part && !strcmp(part, "elm.swallow.content"))
107 return pd->content;
108
109 return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
110}
111
112static Evas_Object *
113_efl_ui_popup_alert_scroll_content_unset(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, const char *part)
114{
115 //For efl_content_set()
116 if (part && !strcmp(part, "elm.swallow.content"))
117 {
118 Evas_Object *content = pd->content;
119 if (!content) return content;
120
121 pd->content = NULL;
122
123 return efl_content_unset(efl_part(pd->scroller, "default"));
124 }
125
126 return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
127}
128
129static Eina_Bool
130_efl_ui_popup_alert_scroll_text_set(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd EINA_UNUSED, const char *part, const char *label)
131{
132 efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
133
134 return EINA_TRUE;
135}
136
137const char *
138_efl_ui_popup_alert_scroll_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd EINA_UNUSED, const char *part)
139{
140 return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
141}
142
143static void
144_efl_ui_popup_alert_scroll_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Bool is_expandable_w, Eina_Bool is_expandable_h)
145{
146 if (is_expandable_w && !is_expandable_h)
147 {
148 pd->is_expandable_w = EINA_TRUE;
149 pd->is_expandable_h = EINA_FALSE;
150 elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_FALSE);
151 }
152 else if(!is_expandable_w && is_expandable_h)
153 {
154 pd->is_expandable_w = EINA_FALSE;
155 pd->is_expandable_h = EINA_TRUE;
156 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
157 }
158 else if(is_expandable_w && is_expandable_h)
159 {
160 pd->is_expandable_w = EINA_TRUE;
161 pd->is_expandable_h = EINA_TRUE;
162 elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_TRUE);
163 }
164 else
165 {
166 pd->is_expandable_w = EINA_FALSE;
167 pd->is_expandable_h = EINA_FALSE;
168 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
169 }
170}
171
172static void
173_efl_ui_popup_alert_scroll_efl_gfx_size_hint_hint_max_set(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D size)
174{
175 efl_gfx_size_hint_max_set(efl_super(obj, MY_CLASS), size);
176 pd->max_scroll_w = size.w;
177 pd->max_scroll_h = size.h;
178 elm_layout_sizing_eval(obj);
179}
180
181EOLIAN static void
182_efl_ui_popup_alert_scroll_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
183{
184 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
185
186 efl_canvas_group_add(efl_super(obj, MY_CLASS));
187 elm_widget_sub_object_parent_add(obj);
188
189 pd->scroller = elm_scroller_add(obj);
190 elm_object_style_set(pd->scroller, "popup/no_inset_shadow");
191 elm_scroller_policy_set(pd->scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
192
193 efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"), pd->scroller);
194
195 pd->max_scroll_w = -1;
196 pd->max_scroll_h = -1;
197}
198
199EOLIAN static void
200_efl_ui_popup_alert_scroll_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd EINA_UNUSED)
201{
202 efl_canvas_group_del(efl_super(obj, MY_CLASS));
203}
204
205EOLIAN static void
206_efl_ui_popup_alert_scroll_class_constructor(Efl_Class *klass)
207{
208 evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
209}
210
211/* Efl.Part begin */
212
213ELM_PART_OVERRIDE(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
214ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
215ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
216ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
217ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
218ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL, Efl_Ui_Popup_Alert_Scroll_Data)
219#include "efl_ui_popup_alert_scroll_part.eo.c"
220
221/* Efl.Part end */
222
223/* Internal EO APIs and hidden overrides */
224
225#define EFL_UI_POPUP_ALERT_SCROLL_EXTRA_OPS \
226 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_popup_alert_scroll), \
227 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert_scroll)
228
229#include "efl_ui_popup_alert_scroll.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.eo b/src/lib/elementary/efl_ui_popup_alert_scroll.eo
new file mode 100644
index 0000000..00dadb3
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.eo
@@ -0,0 +1,24 @@
1class Efl.Ui.Popup.Alert.Scroll(Efl.Ui.Popup.Alert)
2{
3 methods {
4 @property expandable {
5 set {
6 [[Set the expandable of popup.
7
8 If the contents of the popup has min size, popup will be increased by min size.
9 If max hint is set, it will be increased to value of max hint,
10 and then scrolling will occur.
11 ]]
12 }
13 values {
14 is_expandable_w: bool;
15 is_expandable_h: bool;
16 }
17 }
18 }
19 implements {
20 class.constructor;
21 Efl.Gfx.Size.Hint.hint_max { set; }
22 Efl.Part.part;
23 }
24}
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll_part.eo b/src/lib/elementary/efl_ui_popup_alert_scroll_part.eo
new file mode 100644
index 0000000..24d9808
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll_part.eo
@@ -0,0 +1,10 @@
1class Efl.Ui.Popup.Alert.Scroll.Part (Efl.Ui.Layout.Part_Content, Efl.Ui.Layout.Part_Text)
2{
3 [[Efl UI Popup Alert Scroll internal part class]]
4 data: null;
5 implements {
6 Efl.Container.content { get; set; }
7 Efl.Container.content_unset;
8 Efl.Text.text { set; get; }
9 }
10}
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll_private.h b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
new file mode 100644
index 0000000..d72e359
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
@@ -0,0 +1,17 @@
1#ifndef EFL_UI_POPUP_ALERT_SCROLL_H
2#define EFL_UI_POPUP_ALERT_SCROLL_H
3
4#include "Elementary.h"
5
6typedef struct _Efl_Ui_Popup_Alert_Scroll_Data Efl_Ui_Popup_Alert_Scroll_Data;
7struct _Efl_Ui_Popup_Alert_Scroll_Data
8{
9 Evas_Object *scroller;
10 Evas_Object *content;
11 Evas_Coord max_scroll_w;
12 Evas_Coord max_scroll_h;
13 Eina_Bool is_expandable_w;
14 Eina_Bool is_expandable_h;
15};
16
17#endif