summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-02-25 12:58:42 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-02-25 12:58:42 +0100
commitf76e2729901ab880a4aa709c6789b94cf05af59f (patch)
treef815194a33ec704739e4019805f32db65d05cedb
parent3e0dbeb7f779a5b312c4e96e690f001c9e6da378 (diff)
New 1.19 API: elm.Win.stack_*
with test
-rw-r--r--doc/elementary/window.rst14
-rw-r--r--efl/elementary/__init__.pyx2
-rw-r--r--efl/elementary/window.pxi89
-rw-r--r--efl/elementary/window_cdef.pxi7
-rwxr-xr-xexamples/elementary/test.py1
-rw-r--r--examples/elementary/test_win_stack.py94
-rw-r--r--include/efl.elementary.enums.pxd2
7 files changed, 209 insertions, 0 deletions
diff --git a/doc/elementary/window.rst b/doc/elementary/window.rst
index b97c0c0..bd3c769 100644
--- a/doc/elementary/window.rst
+++ b/doc/elementary/window.rst
@@ -206,6 +206,20 @@ Window types
206 its contents will be rendered to an image buffer and can be shown other 206 its contents will be rendered to an image buffer and can be shown other
207 process's plug image object 207 process's plug image object
208 208
209.. data:: ELM_WIN_FAKE
210
211 This window was created using a pre-existing canvas. The window widget can
212 be deleted, but the canvas must be managed externally.
213
214 .. versionadded:: 1.19
215
216.. data:: ELM_WIN_NAVIFRAME_BASIC
217
218 Used for naviframe style replacement with a back button instead of a close
219 button.
220
221 .. versionadded:: 1.19
222
209 223
210.. _Elm_Win_Indicator_Mode: 224.. _Elm_Win_Indicator_Mode:
211 225
diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx
index 2f5709e..4061014 100644
--- a/efl/elementary/__init__.pyx
+++ b/efl/elementary/__init__.pyx
@@ -613,6 +613,8 @@ ELM_WIN_COMBO = enums.ELM_WIN_COMBO
613ELM_WIN_DND = enums.ELM_WIN_DND 613ELM_WIN_DND = enums.ELM_WIN_DND
614ELM_WIN_INLINED_IMAGE = enums.ELM_WIN_INLINED_IMAGE 614ELM_WIN_INLINED_IMAGE = enums.ELM_WIN_INLINED_IMAGE
615ELM_WIN_SOCKET_IMAGE = enums.ELM_WIN_SOCKET_IMAGE 615ELM_WIN_SOCKET_IMAGE = enums.ELM_WIN_SOCKET_IMAGE
616ELM_WIN_FAKE = enums.ELM_WIN_FAKE
617ELM_WIN_NAVIFRAME_BASIC = enums.ELM_WIN_NAVIFRAME_BASIC
616 618
617ELM_WIN_INDICATOR_UNKNOWN = enums.ELM_WIN_INDICATOR_UNKNOWN 619ELM_WIN_INDICATOR_UNKNOWN = enums.ELM_WIN_INDICATOR_UNKNOWN
618ELM_WIN_INDICATOR_HIDE = enums.ELM_WIN_INDICATOR_HIDE 620ELM_WIN_INDICATOR_HIDE = enums.ELM_WIN_INDICATOR_HIDE
diff --git a/efl/elementary/window.pxi b/efl/elementary/window.pxi
index add3abd..56afb91 100644
--- a/efl/elementary/window.pxi
+++ b/efl/elementary/window.pxi
@@ -1359,6 +1359,95 @@ cdef class Window(Object):
1359 def noblank_get(self): 1359 def noblank_get(self):
1360 return bool(elm_win_noblank_get(self.obj)) 1360 return bool(elm_win_noblank_get(self.obj))
1361 1361
1362 property stack_id:
1363 """Get the stack ID string of the window as an opaque string.
1364
1365 An opaque string that has no specific format, but identified a specific
1366 unique window on the display.
1367
1368 This ID is immutable and can never be modified. It will be an opaque
1369 string that has no specific desfined format or content other than it
1370 being a string (no character with a value of 0).
1371
1372 This string is intended for use as a stack master ID to be use by other
1373 windows to make this window part of a stack of windows to be placed on
1374 top of eachother as if they are a series of dialogs or questions one
1375 after the other and that you may go back through history.
1376
1377 :type: string (**readonly**)
1378
1379 .. versionadded:: 1.19
1380
1381 """
1382 def __get__(self):
1383 return _ctouni(elm_win_stack_id_get(self.obj))
1384
1385 def stack_id_get(self):
1386 return _ctouni(elm_win_stack_id_get(self.obj))
1387
1388 property stack_master_id:
1389 """ The window stack ID to use as the master top-level.
1390
1391 This is the ID string to be used as the master top-level window as
1392 the base of a stack of windows. This must be set before the first time
1393 the window is shown and should never be changed after that point in
1394 time ever again.
1395
1396 :type: string
1397
1398 .. versionadded:: 1.19
1399
1400 """
1401 def __get__(self):
1402 return _ctouni(elm_win_stack_master_id_get(self.obj))
1403 def __set__(self, value):
1404 if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
1405 elm_win_stack_master_id_set(self.obj,
1406 <const char *>value if value is not None else NULL)
1407
1408 def stack_master_id_get(self):
1409 return _ctouni(elm_win_stack_master_id_get(self.obj))
1410 def stack_master_id_set(self, value):
1411 if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
1412 elm_win_stack_master_id_set(self.obj,
1413 <const char *>value if value is not None else NULL)
1414
1415 property stack_base:
1416 """ The stack base state of this window
1417
1418 This is a boolean flag that determines if this window will become the
1419 base of a stack at all. You must enable this on a base (bottom of a
1420 window stack) for things to work correctly.
1421
1422 This state should be set before a window is shown for the first time
1423 and never changed again after that.
1424
1425 :type: bool
1426
1427 .. versionadded:: 1.19
1428
1429 """
1430 def __get__(self):
1431 return bool(elm_win_stack_base_get(self.obj))
1432 def __set__(self, bint base):
1433 elm_win_stack_base_set(self.obj, base)
1434
1435 def stack_base_get(self):
1436 return bool(elm_win_stack_base_get(self.obj))
1437 def stack_base_set(self, bint base):
1438 elm_win_stack_base_set(self.obj, base)
1439
1440 def stack_pop_to(self):
1441 """ Pop (delete) all windows in the stack above this window.
1442
1443 This will try and delete all the windows in the stack that are above
1444 the window.
1445
1446 .. versionadded:: 1.19
1447
1448 """
1449 elm_win_stack_pop_to(self.obj)
1450
1362 def callback_delete_request_add(self, func, *args, **kwargs): 1451 def callback_delete_request_add(self, func, *args, **kwargs):
1363 """The user requested to close the window. See :py:attr:`autodel`.""" 1452 """The user requested to close the window. See :py:attr:`autodel`."""
1364 self._callback_add("delete,request", func, args, kwargs) 1453 self._callback_add("delete,request", func, args, kwargs)
diff --git a/efl/elementary/window_cdef.pxi b/efl/elementary/window_cdef.pxi
index 011a2bf..5a5ebe0 100644
--- a/efl/elementary/window_cdef.pxi
+++ b/efl/elementary/window_cdef.pxi
@@ -126,5 +126,12 @@ cdef extern from "Elementary.h":
126 Eina_Bool elm_win_noblank_get(const Evas_Object *obj) 126 Eina_Bool elm_win_noblank_get(const Evas_Object *obj)
127 void elm_win_noblank_set(Evas_Object *obj, Eina_Bool noblank) 127 void elm_win_noblank_set(Evas_Object *obj, Eina_Bool noblank)
128 128
129 const char * elm_win_stack_id_get(const Evas_Object *obj)
130 const char * elm_win_stack_master_id_get(const Evas_Object *obj)
131 void elm_win_stack_master_id_set(const Evas_Object *obj, const char *id)
132 Eina_Bool elm_win_stack_base_get(const Evas_Object *obj)
133 void elm_win_stack_base_set(Evas_Object *obj, Eina_Bool base)
134 void elm_win_stack_pop_to(Evas_Object *obj)
135
129 # X specific call - won't work on non-x engines (return 0) 136 # X specific call - won't work on non-x engines (return 0)
130 unsigned int elm_win_xwindow_get(const Evas_Object *obj) 137 unsigned int elm_win_xwindow_get(const Evas_Object *obj)
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 573dc57..312af39 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -268,6 +268,7 @@ items = [
268 ("Window Standard/Dialog", "test_win_dialog", "window_dialog_clicked"), 268 ("Window Standard/Dialog", "test_win_dialog", "window_dialog_clicked"),
269 ("InnerWindow", "test_inwin", "inner_window_clicked"), 269 ("InnerWindow", "test_inwin", "inner_window_clicked"),
270 ("Window States", "test_win", "window_states_clicked"), 270 ("Window States", "test_win", "window_states_clicked"),
271 ("Window Stack", "test_win_stack", "window_stack_clicked"),
271 ("Bg Plain", "test_bg", "bg_plain_clicked"), 272 ("Bg Plain", "test_bg", "bg_plain_clicked"),
272 ("Bg Image", "test_bg", "bg_image_clicked"), 273 ("Bg Image", "test_bg", "bg_image_clicked"),
273 ]) 274 ])
diff --git a/examples/elementary/test_win_stack.py b/examples/elementary/test_win_stack.py
new file mode 100644
index 0000000..34a2ff4
--- /dev/null
+++ b/examples/elementary/test_win_stack.py
@@ -0,0 +1,94 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
4from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
5 EXPAND_BOTH, FILL_BOTH, EXPAND_HORIZ, FILL_HORIZ, FILL_VERT
6
7from efl import elementary as elm
8from efl.elementary import Window, Background, Box, Button, Label
9
10
11level = 0
12popto_win = None
13
14def new_win(stack_top, title):
15 global level
16 global popto_win
17
18 win = Window("window-stack",
19 elm.ELM_WIN_NAVIFRAME_BASIC if level >=3 else elm.ELM_WIN_DIALOG_BASIC,
20 autodel=True, title=title, size=(280, 400))
21
22 bg = Background(win, size_hint_weight=EXPAND_BOTH)
23 win.resize_object_add(bg)
24 bg.show()
25
26 box = Box(win, size_hint_weight=EXPAND_BOTH)
27 win.resize_object_add(box)
28 box.show()
29
30 lb = Label(win, text="Press below to push another window on the stack",
31 size_hint_weight=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
32 box.pack_end(lb)
33 lb.show()
34
35 if level == 3:
36 popto_win = win
37
38 if level > 7:
39 bt = Button(win, text="Pop to level 3", size_hint_fill=FILL_BOTH,
40 size_hint_weight=EXPAND_HORIZ)
41 bt.callback_clicked_add(lambda w: popto_win.stack_pop_to())
42 box.pack_end(bt)
43 bt.show()
44
45 bt = Button(win, text="Push", size_hint_align=FILL_HORIZ,
46 size_hint_weight=EXPAND_HORIZ)
47 bt.callback_clicked_add(button_pressed_cb, stack_top)
48 box.pack_end(bt)
49 bt.show()
50
51 return win
52
53def button_pressed_cb(btn, master_win):
54 global level
55
56 level += 1
57 win = new_win(master_win, "Level %d" % level)
58 win.stack_master_id = master_win.stack_id
59 win.show()
60
61
62def window_stack_clicked(obj):
63 win = Window("window-stack", elm.ELM_WIN_BASIC, autodel=True,
64 title="Window Stack", size=(320, 480))
65 if obj is None:
66 win.callback_delete_request_add(lambda o: elm.exit())
67
68 win.stack_base = True
69
70 bg = Background(win, size_hint_weight=EXPAND_BOTH)
71 win.resize_object_add(bg)
72 bg.show()
73
74 box = Box(win, size_hint_weight=EXPAND_BOTH)
75 win.resize_object_add(box)
76 box.show()
77
78 lb = Label(win, text="Press below to push another window on the stack",
79 size_hint_weight=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
80 box.pack_end(lb)
81 lb.show()
82
83 bt = Button(win, text="Push", size_hint_align=FILL_HORIZ,
84 size_hint_weight=EXPAND_HORIZ)
85 bt.callback_clicked_add(button_pressed_cb, win)
86 box.pack_end(bt)
87 bt.show()
88
89 win.show()
90
91
92if __name__ == "__main__":
93 window_stack_clicked(None)
94 elm.run()
diff --git a/include/efl.elementary.enums.pxd b/include/efl.elementary.enums.pxd
index 77833f4..7db4d50 100644
--- a/include/efl.elementary.enums.pxd
+++ b/include/efl.elementary.enums.pxd
@@ -705,6 +705,8 @@ cdef extern from "Elementary.h":
705 ELM_WIN_DND 705 ELM_WIN_DND
706 ELM_WIN_INLINED_IMAGE 706 ELM_WIN_INLINED_IMAGE
707 ELM_WIN_SOCKET_IMAGE 707 ELM_WIN_SOCKET_IMAGE
708 ELM_WIN_FAKE
709 ELM_WIN_NAVIFRAME_BASIC
708 710
709 ctypedef enum Elm_Win_Indicator_Mode: 711 ctypedef enum Elm_Win_Indicator_Mode:
710 ELM_WIN_INDICATOR_UNKNOWN 712 ELM_WIN_INDICATOR_UNKNOWN