Add a manual popover menu example
Reproduce the testpopover popover manually, by packing model buttons into a stack in a popover.
This commit is contained in:
@ -9,7 +9,8 @@ AM_CPPFLAGS = \
|
|||||||
-I$(top_srcdir)/gdk \
|
-I$(top_srcdir)/gdk \
|
||||||
$(GTK_DEBUG_FLAGS) \
|
$(GTK_DEBUG_FLAGS) \
|
||||||
$(GTK_DEP_CFLAGS) \
|
$(GTK_DEP_CFLAGS) \
|
||||||
$(GDK_DEP_CFLAGS)
|
$(GDK_DEP_CFLAGS) \
|
||||||
|
-pthread
|
||||||
|
|
||||||
DEPS = \
|
DEPS = \
|
||||||
$(top_builddir)/gtk/libgtk-3.la
|
$(top_builddir)/gtk/libgtk-3.la
|
||||||
@ -19,8 +20,12 @@ LDADD = \
|
|||||||
$(top_builddir)/gdk/libgdk-3.la \
|
$(top_builddir)/gdk/libgdk-3.la \
|
||||||
$(GTK_DEP_LIBS) \
|
$(GTK_DEP_LIBS) \
|
||||||
$(GDK_DEP_LIBS) \
|
$(GDK_DEP_LIBS) \
|
||||||
|
-lgmodule-2.0 \
|
||||||
-lm
|
-lm
|
||||||
|
|
||||||
|
AM_LDFLAGS = -Wl,--export-dynamic -pthread
|
||||||
|
|
||||||
|
|
||||||
if USE_X11
|
if USE_X11
|
||||||
testsocket_programs = testsocket testsocket_child
|
testsocket_programs = testsocket testsocket_child
|
||||||
endif
|
endif
|
||||||
|
|||||||
598
tests/popover2.ui
Normal file
598
tests/popover2.ui
Normal file
@ -0,0 +1,598 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<interface>
|
||||||
|
<object class="GtkPopover" id="popover">
|
||||||
|
<child>
|
||||||
|
<object class="GtkStack">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="transition-type">slide-left-right</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="main">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="halign">fill</property>
|
||||||
|
<property name="margin">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">Edit</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.cut</property>
|
||||||
|
<property name="text">Cut</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.copy</property>
|
||||||
|
<property name="text">Copy</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.paste</property>
|
||||||
|
<property name="text">Paste</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">3</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">action1</property>
|
||||||
|
<property name="text">No action</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action2</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="text">Toggle</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action2a</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="text">Another Toggle</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">Middle Section</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action3</property>
|
||||||
|
<property name="action-target">'three'</property>
|
||||||
|
<property name="action-role">radio</property>
|
||||||
|
<property name="text">Radio 1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action3</property>
|
||||||
|
<property name="action-target">'four'</property>
|
||||||
|
<property name="action-role">radio</property>
|
||||||
|
<property name="text">Radio 2</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Submenu 1</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<signal name="clicked" handler="open_submenu1"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Submenu 2</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<signal name="clicked" handler="open_submenu2"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">End Section</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action9</property>
|
||||||
|
<property name="text">Another Item 9</property>
|
||||||
|
<property name="icon">icon9</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action10</property>
|
||||||
|
<property name="text">Another Item 10</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">main</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="submenu1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin">10</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Submenu 1</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<property name="inverted">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<signal name="clicked" handler="open_main"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">5555</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action5</property>
|
||||||
|
<property name="text">Item 5</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action5</property>
|
||||||
|
<property name="text">Item 5a</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action5</property>
|
||||||
|
<property name="text">Item 5b</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<property name="halign">fill</property>
|
||||||
|
<property name="margin-top">10</property>
|
||||||
|
<style>
|
||||||
|
<class name="linked"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">List</property>
|
||||||
|
<property name="action-name">top.set-view</property>
|
||||||
|
<property name="action-target">'list'</property>
|
||||||
|
<property name="action-role">radio</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<property name="icon">icon-list</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Grid</property>
|
||||||
|
<property name="action-name">top.set-view</property>
|
||||||
|
<property name="action-target">'grid'</property>
|
||||||
|
<property name="action-role">radio</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<property name="icon">icon-grid</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action5</property>
|
||||||
|
<property name="text">Item 5c</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action5</property>
|
||||||
|
<property name="text">Item 5d</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">Format</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<property name="halign">fill</property>
|
||||||
|
<property name="margin-top">10</property>
|
||||||
|
<style>
|
||||||
|
<class name="linked"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Bold</property>
|
||||||
|
<property name="action-name">top.bold</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Italic</property>
|
||||||
|
<property name="action-name">top.italic</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<property name="icon">icon-italic</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Strikethrough</property>
|
||||||
|
<property name="action-name">top.strikethrough</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<property name="icon">icon-strikethrough</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Underline</property>
|
||||||
|
<property name="action-name">top.underline</property>
|
||||||
|
<property name="action-role">check</property>
|
||||||
|
<property name="iconic">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<property name="icon">icon-underline</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">6</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">6666</property>
|
||||||
|
<style>
|
||||||
|
<class name="separator"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action6</property>
|
||||||
|
<property name="text">Item 6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action6</property>
|
||||||
|
<property name="text">Item 6a</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action6</property>
|
||||||
|
<property name="text">Item 6b</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action6</property>
|
||||||
|
<property name="text">Item 6c</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action6</property>
|
||||||
|
<property name="text">Item 6d</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">submenu1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="submenu2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Submenu 2</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<property name="inverted">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<signal name="clicked" handler="open_main"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action7</property>
|
||||||
|
<property name="text">Item 7</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Subsubmenu</property>
|
||||||
|
<property name="icon">icon9</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<signal name="clicked" handler="open_subsubmenu"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">submenu2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="subsubmenu">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin">10</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="text">Subsubmenu</property>
|
||||||
|
<property name="has-submenu">True</property>
|
||||||
|
<property name="inverted">True</property>
|
||||||
|
<property name="centered">True</property>
|
||||||
|
<signal name="clicked" handler="open_submenu2"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">action8</property>
|
||||||
|
<property name="text">Item 8</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">3</property>
|
||||||
|
<property name="margin-bottom">3</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action9</property>
|
||||||
|
<property name="text">Item 9</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="action-name">top.action10</property>
|
||||||
|
<property name="text">Item 10</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">subsubmenu</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon9">
|
||||||
|
<property name="name">preferences-desktop-font</property>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon-grid">
|
||||||
|
<property name="name">view-grid-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon-list">
|
||||||
|
<property name="name">view-list-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon-italic">
|
||||||
|
<property name="name">format-text-italic-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon-strikethrough">
|
||||||
|
<property name="name">format-text-strikethrough-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<object class="GThemedIcon" id="icon-underline">
|
||||||
|
<property name="name">format-text-underline-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkSizeGroup">
|
||||||
|
<property name="mode">horizontal</property>
|
||||||
|
<widgets>
|
||||||
|
<widget name="main"/>
|
||||||
|
<widget name="submenu1"/>
|
||||||
|
</widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@ -30,16 +30,53 @@ static GActionEntry entries[] = {
|
|||||||
{ "action10", activate, NULL, NULL, NULL }
|
{ "action10", activate, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
static void
|
||||||
|
open_menu (GtkWidget *button, const gchar *name)
|
||||||
|
{
|
||||||
|
GtkWidget *stack;
|
||||||
|
g_print ("open %s\n", name);
|
||||||
|
stack = gtk_widget_get_ancestor (button, GTK_TYPE_STACK);
|
||||||
|
gtk_stack_set_visible_child_name (GTK_STACK (stack), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
open_main (GtkWidget *button)
|
||||||
|
{
|
||||||
|
open_menu (button, "main");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
open_submenu1 (GtkWidget *button)
|
||||||
|
{
|
||||||
|
open_menu (button, "submenu1");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
open_submenu2 (GtkWidget *button)
|
||||||
|
{
|
||||||
|
open_menu (button, "submenu2");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
open_subsubmenu (GtkWidget *button)
|
||||||
|
{
|
||||||
|
open_menu (button, "subsubmenu");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GtkWidget *win;
|
GtkWidget *win;
|
||||||
|
GtkWidget *box;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
GtkWidget *button2;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GMenuModel *model;
|
GMenuModel *model;
|
||||||
GSimpleActionGroup *actions;
|
GSimpleActionGroup *actions;
|
||||||
GtkWidget *overlay;
|
GtkWidget *overlay;
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
GtkWidget *popover;
|
GtkWidget *popover;
|
||||||
|
GtkWidget *popover2;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *check;
|
GtkWidget *check;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
@ -76,30 +113,37 @@ int main (int argc, char *argv[])
|
|||||||
builder = gtk_builder_new_from_file ("popover.ui");
|
builder = gtk_builder_new_from_file ("popover.ui");
|
||||||
model = (GMenuModel *)gtk_builder_get_object (builder, "menu");
|
model = (GMenuModel *)gtk_builder_get_object (builder, "menu");
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||||
button = gtk_menu_button_new ();
|
button = gtk_menu_button_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
button2 = gtk_menu_button_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button2);
|
||||||
|
|
||||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model);
|
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model);
|
||||||
gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), TRUE);
|
gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), TRUE);
|
||||||
|
|
||||||
popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button)));
|
popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button)));
|
||||||
|
|
||||||
g_object_set (button, "margin", 10, NULL);
|
builder = gtk_builder_new_from_file ("popover2.ui");
|
||||||
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_START);
|
popover2 = (GtkWidget *)gtk_builder_get_object (builder, "popover");
|
||||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
|
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button2), popover2);
|
||||||
|
|
||||||
|
g_object_set (box, "margin", 10, NULL);
|
||||||
|
gtk_widget_set_halign (box, GTK_ALIGN_END);
|
||||||
|
gtk_widget_set_valign (box, GTK_ALIGN_START);
|
||||||
|
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), box);
|
||||||
|
|
||||||
label = gtk_label_new ("Popover hexpand");
|
label = gtk_label_new ("Popover hexpand");
|
||||||
check = gtk_check_button_new ();
|
check = gtk_check_button_new ();
|
||||||
g_object_bind_property (popover, "hexpand",
|
g_object_bind_property (check, "active", popover, "hexpand", G_BINDING_DEFAULT);
|
||||||
check, "active",
|
g_object_bind_property (check, "active", popover2, "hexpand", G_BINDING_DEFAULT);
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label , 1, 1, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label , 1, 1, 1, 1);
|
||||||
gtk_grid_attach (GTK_GRID (grid), check, 2, 1, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), check, 2, 1, 1, 1);
|
||||||
|
|
||||||
label = gtk_label_new ("Popover vexpand");
|
label = gtk_label_new ("Popover vexpand");
|
||||||
check = gtk_check_button_new ();
|
check = gtk_check_button_new ();
|
||||||
g_object_bind_property (popover, "vexpand",
|
g_object_bind_property (check, "active", popover, "vexpand", G_BINDING_DEFAULT);
|
||||||
check, "active",
|
g_object_bind_property (check, "active", popover2, "vexpand", G_BINDING_DEFAULT);
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label , 1, 2, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label , 1, 2, 1, 1);
|
||||||
gtk_grid_attach (GTK_GRID (grid), check, 2, 2, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), check, 2, 2, 1, 1);
|
||||||
|
|
||||||
@ -110,9 +154,8 @@ int main (int argc, char *argv[])
|
|||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "left", "Left");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "left", "Left");
|
||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "right", "Right");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "right", "Right");
|
||||||
|
|
||||||
g_object_bind_property (button, "direction",
|
g_object_bind_property (combo, "active", button, "direction", G_BINDING_DEFAULT);
|
||||||
combo, "active",
|
g_object_bind_property (combo, "active", button2, "direction", G_BINDING_DEFAULT);
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1);
|
||||||
gtk_grid_attach (GTK_GRID (grid), combo, 2, 3, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), combo, 2, 3, 1, 1);
|
||||||
|
|
||||||
@ -122,9 +165,7 @@ int main (int argc, char *argv[])
|
|||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
|
||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
|
||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
|
||||||
g_object_bind_property (button, "halign",
|
g_object_bind_property (combo, "active", box, "halign", G_BINDING_DEFAULT);
|
||||||
combo, "active",
|
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label , 1, 4, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label , 1, 4, 1, 1);
|
||||||
gtk_grid_attach (GTK_GRID (grid), combo, 2, 4, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), combo, 2, 4, 1, 1);
|
||||||
|
|
||||||
@ -134,9 +175,7 @@ int main (int argc, char *argv[])
|
|||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
|
||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
|
||||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
|
||||||
g_object_bind_property (button, "valign",
|
g_object_bind_property (combo, "active", box, "valign", G_BINDING_DEFAULT);
|
||||||
combo, "active",
|
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
||||||
gtk_grid_attach (GTK_GRID (grid), label , 1, 5, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label , 1, 5, 1, 1);
|
||||||
gtk_grid_attach (GTK_GRID (grid), combo, 2, 5, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), combo, 2, 5, 1, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user