parent
3e0dbeb7f7
commit
f76e272990
|
@ -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:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"),
|
||||
])
|
||||
|
|
|
@ -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()
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue