aboutsummaryrefslogtreecommitdiffstats
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
parentNew 1.19 API: elm.Panel.scrollable_content_size_get (diff)
downloadpython-efl-f76e2729901ab880a4aa709c6789b94cf05af59f.tar.gz
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
its contents will be rendered to an image buffer and can be shown other
process's plug image object
+.. data:: ELM_WIN_FAKE
+
+ This window was created using a pre-existing canvas. The window widget can
+ be deleted, but the canvas must be managed externally.
+
+ .. versionadded:: 1.19
+
+.. data:: ELM_WIN_NAVIFRAME_BASIC
+
+ Used for naviframe style replacement with a back button instead of a close
+ button.
+
+ .. versionadded:: 1.19
+
.. _Elm_Win_Indicator_Mode:
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
ELM_WIN_DND = enums.ELM_WIN_DND
ELM_WIN_INLINED_IMAGE = enums.ELM_WIN_INLINED_IMAGE
ELM_WIN_SOCKET_IMAGE = enums.ELM_WIN_SOCKET_IMAGE
+ELM_WIN_FAKE = enums.ELM_WIN_FAKE
+ELM_WIN_NAVIFRAME_BASIC = enums.ELM_WIN_NAVIFRAME_BASIC
ELM_WIN_INDICATOR_UNKNOWN = enums.ELM_WIN_INDICATOR_UNKNOWN
ELM_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):
def noblank_get(self):
return bool(elm_win_noblank_get(self.obj))
+ property stack_id:
+ """Get the stack ID string of the window as an opaque string.
+
+ An opaque string that has no specific format, but identified a specific
+ unique window on the display.
+
+ This ID is immutable and can never be modified. It will be an opaque
+ string that has no specific desfined format or content other than it
+ being a string (no character with a value of 0).
+
+ This string is intended for use as a stack master ID to be use by other
+ windows to make this window part of a stack of windows to be placed on
+ top of eachother as if they are a series of dialogs or questions one
+ after the other and that you may go back through history.
+
+ :type: string (**readonly**)
+
+ .. versionadded:: 1.19
+
+ """
+ def __get__(self):
+ return _ctouni(elm_win_stack_id_get(self.obj))
+
+ def stack_id_get(self):
+ return _ctouni(elm_win_stack_id_get(self.obj))
+
+ property stack_master_id:
+ """ The window stack ID to use as the master top-level.
+
+ This is the ID string to be used as the master top-level window as
+ the base of a stack of windows. This must be set before the first time
+ the window is shown and should never be changed after that point in
+ time ever again.
+
+ :type: string
+
+ .. versionadded:: 1.19
+
+ """
+ def __get__(self):
+ return _ctouni(elm_win_stack_master_id_get(self.obj))
+ def __set__(self, value):
+ if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
+ elm_win_stack_master_id_set(self.obj,
+ <const char *>value if value is not None else NULL)
+
+ def stack_master_id_get(self):
+ return _ctouni(elm_win_stack_master_id_get(self.obj))
+ def stack_master_id_set(self, value):
+ if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
+ elm_win_stack_master_id_set(self.obj,
+ <const char *>value if value is not None else NULL)
+
+ property stack_base:
+ """ The stack base state of this window
+
+ This is a boolean flag that determines if this window will become the
+ base of a stack at all. You must enable this on a base (bottom of a
+ window stack) for things to work correctly.
+
+ This state should be set before a window is shown for the first time
+ and never changed again after that.
+
+ :type: bool
+
+ .. versionadded:: 1.19
+
+ """
+ def __get__(self):
+ return bool(elm_win_stack_base_get(self.obj))
+ def __set__(self, bint base):
+ elm_win_stack_base_set(self.obj, base)
+
+ def stack_base_get(self):
+ return bool(elm_win_stack_base_get(self.obj))
+ def stack_base_set(self, bint base):
+ elm_win_stack_base_set(self.obj, base)
+
+ def stack_pop_to(self):
+ """ Pop (delete) all windows in the stack above this window.
+
+ This will try and delete all the windows in the stack that are above
+ the window.
+
+ .. versionadded:: 1.19
+
+ """
+ elm_win_stack_pop_to(self.obj)
+
def callback_delete_request_add(self, func, *args, **kwargs):
"""The user requested to close the window. See :py:attr:`autodel`."""
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":
Eina_Bool elm_win_noblank_get(const Evas_Object *obj)
void elm_win_noblank_set(Evas_Object *obj, Eina_Bool noblank)
+ const char * elm_win_stack_id_get(const Evas_Object *obj)
+ const char * elm_win_stack_master_id_get(const Evas_Object *obj)
+ void elm_win_stack_master_id_set(const Evas_Object *obj, const char *id)
+ Eina_Bool elm_win_stack_base_get(const Evas_Object *obj)
+ void elm_win_stack_base_set(Evas_Object *obj, Eina_Bool base)
+ void elm_win_stack_pop_to(Evas_Object *obj)
+
# X specific call - won't work on non-x engines (return 0)
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 = [
("Window Standard/Dialog", "test_win_dialog", "window_dialog_clicked"),
("InnerWindow", "test_inwin", "inner_window_clicked"),
("Window States", "test_win", "window_states_clicked"),
+ ("Window Stack", "test_win_stack", "window_stack_clicked"),
("Bg Plain", "test_bg", "bg_plain_clicked"),
("Bg Image", "test_bg", "bg_image_clicked"),
])
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 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EXPAND_BOTH, FILL_BOTH, EXPAND_HORIZ, FILL_HORIZ, FILL_VERT
+
+from efl import elementary as elm
+from efl.elementary import Window, Background, Box, Button, Label
+
+
+level = 0
+popto_win = None
+
+def new_win(stack_top, title):
+ global level
+ global popto_win
+
+ win = Window("window-stack",
+ elm.ELM_WIN_NAVIFRAME_BASIC if level >=3 else elm.ELM_WIN_DIALOG_BASIC,
+ autodel=True, title=title, size=(280, 400))
+
+ bg = Background(win, size_hint_weight=EXPAND_BOTH)
+ win.resize_object_add(bg)
+ bg.show()
+
+ box = Box(win, size_hint_weight=EXPAND_BOTH)
+ win.resize_object_add(box)
+ box.show()
+
+ lb = Label(win, text="Press below to push another window on the stack",
+ size_hint_weight=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
+ box.pack_end(lb)
+ lb.show()
+
+ if level == 3:
+ popto_win = win
+
+ if level > 7:
+ bt = Button(win, text="Pop to level 3", size_hint_fill=FILL_BOTH,
+ size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(lambda w: popto_win.stack_pop_to())
+ box.pack_end(bt)
+ bt.show()
+
+ bt = Button(win, text="Push", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(button_pressed_cb, stack_top)
+ box.pack_end(bt)
+ bt.show()
+
+ return win
+
+def button_pressed_cb(btn, master_win):
+ global level
+
+ level += 1
+ win = new_win(master_win, "Level %d" % level)
+ win.stack_master_id = master_win.stack_id
+ win.show()
+
+
+def window_stack_clicked(obj):
+ win = Window("window-stack", elm.ELM_WIN_BASIC, autodel=True,
+ title="Window Stack", size=(320, 480))
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elm.exit())
+
+ win.stack_base = True
+
+ bg = Background(win, size_hint_weight=EXPAND_BOTH)
+ win.resize_object_add(bg)
+ bg.show()
+
+ box = Box(win, size_hint_weight=EXPAND_BOTH)
+ win.resize_object_add(box)
+ box.show()
+
+ lb = Label(win, text="Press below to push another window on the stack",
+ size_hint_weight=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
+ box.pack_end(lb)
+ lb.show()
+
+ bt = Button(win, text="Push", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(button_pressed_cb, win)
+ box.pack_end(bt)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ window_stack_clicked(None)
+ 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":
ELM_WIN_DND
ELM_WIN_INLINED_IMAGE
ELM_WIN_SOCKET_IMAGE
+ ELM_WIN_FAKE
+ ELM_WIN_NAVIFRAME_BASIC
ctypedef enum Elm_Win_Indicator_Mode:
ELM_WIN_INDICATOR_UNKNOWN