mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 13:10:07 +00:00
Merge branch 'wip/otte/toolbar' into 'master'
remove GtkToolbar See merge request GNOME/gtk!1383
This commit is contained in:
commit
24e28309fb
@ -14,7 +14,7 @@ typedef struct {
|
||||
GtkWidget *message;
|
||||
GtkWidget *infobar;
|
||||
GtkWidget *status;
|
||||
GtkWidget *menutool;
|
||||
GtkWidget *menubutton;
|
||||
GMenuModel *toolmenu;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
@ -428,8 +428,8 @@ demo_application_window_init (DemoApplicationWindow *window)
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (window));
|
||||
|
||||
popover = gtk_popover_menu_new_from_model (window->menutool, window->toolmenu);
|
||||
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (window->menutool), popover);
|
||||
popover = gtk_popover_menu_new_from_model (window->menubutton, window->toolmenu);
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->menubutton), popover);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
@ -528,7 +528,7 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, infobar);
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, status);
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, buffer);
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, menutool);
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, menubutton);
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, toolmenu);
|
||||
gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, update_statusbar);
|
||||
|
@ -8,27 +8,24 @@
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkMenuToolButton" id="menutool">
|
||||
<object class="GtkMenuButton" id="menubutton">
|
||||
<property name="icon-name">document-open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">application-exit</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem"/>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">applications-other</property>
|
||||
<property name="action-name">win.logo</property>
|
||||
</object>
|
||||
|
@ -63,7 +63,6 @@ GtkWidget *
|
||||
do_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *toolbar;
|
||||
GActionGroup *actions;
|
||||
|
||||
if (!window)
|
||||
@ -77,9 +76,6 @@ do_builder (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar1"));
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
|
||||
"primary-toolbar");
|
||||
actions = (GActionGroup*)g_simple_action_group_new ();
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (actions),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
@ -62,22 +62,19 @@ GtkWidget *
|
||||
create_toolbar (void)
|
||||
{
|
||||
GtkWidget *toolbar;
|
||||
GtkToolItem *item;
|
||||
GtkWidget *item;
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER);
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
item = gtk_button_new_from_icon_name ("go-next");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
item = gtk_button_new_from_icon_name ("go-previous");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
||||
|
||||
item = gtk_tool_button_new (NULL, "Hello World");
|
||||
gtk_tool_item_set_is_important (item, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
item = gtk_button_new_with_label ("Hello World");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), item);
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
@ -111,53 +111,52 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-toolbar">
|
||||
<property name="AtkObject::accessible-name">The toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
<property name="tooltip-text" translatable="yes">Create a new file</property>
|
||||
<property name="icon-name">document-new</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Open</property>
|
||||
<property name="tooltip-text" translatable="yes">Open a file</property>
|
||||
<property name="icon-name">document-open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
<property name="tooltip-text" translatable="yes">Save a file</property>
|
||||
<property name="icon-name">document-save</property>
|
||||
<property name="is-important">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem"/>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Copy</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property>
|
||||
<property name="icon-name">edit-copy</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Cut</property>
|
||||
<property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property>
|
||||
<property name="icon-name">edit-cut</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Paste</property>
|
||||
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
|
||||
<property name="icon-name">edit-paste</property>
|
||||
|
@ -26,7 +26,7 @@ enum
|
||||
|
||||
static GdkPixbuf *file_pixbuf, *folder_pixbuf;
|
||||
gchar *parent;
|
||||
GtkToolItem *up_button;
|
||||
GtkWidget *up_button;
|
||||
|
||||
/* Loads the images for the demo and returns whether the operation succeeded */
|
||||
static void
|
||||
@ -188,8 +188,8 @@ item_activated (GtkIconView *icon_view,
|
||||
}
|
||||
|
||||
static void
|
||||
up_clicked (GtkToolItem *item,
|
||||
gpointer user_data)
|
||||
up_clicked (GtkButton *item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
gchar *dir_name;
|
||||
@ -209,8 +209,8 @@ up_clicked (GtkToolItem *item,
|
||||
}
|
||||
|
||||
static void
|
||||
home_clicked (GtkToolItem *item,
|
||||
gpointer user_data)
|
||||
home_clicked (GtkButton *item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
|
||||
@ -248,7 +248,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
GtkListStore *store;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *tool_bar;
|
||||
GtkToolItem *home_button;
|
||||
GtkWidget *home_button;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
@ -265,23 +265,15 @@ do_iconview (GtkWidget *do_widget)
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
tool_bar = gtk_toolbar_new ();
|
||||
tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
|
||||
|
||||
up_button = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (up_button), _("_Up"));
|
||||
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (up_button), TRUE);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (up_button), "go-up");
|
||||
gtk_tool_item_set_is_important (up_button, TRUE);
|
||||
up_button = gtk_button_new_with_mnemonic ("_Up");
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), up_button, -1);
|
||||
gtk_container_add (GTK_CONTAINER (tool_bar), up_button);
|
||||
|
||||
home_button = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (home_button), _("_Home"));
|
||||
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (home_button), TRUE);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (home_button), "go-home");
|
||||
gtk_tool_item_set_is_important (home_button, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), home_button, -1);
|
||||
home_button = gtk_button_new_with_mnemonic ("_Home");
|
||||
gtk_container_add (GTK_CONTAINER (tool_bar), home_button);
|
||||
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
@ -15,104 +15,6 @@
|
||||
<property name="margin">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="show-arrow">0</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-chars">10</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip_text">Switch it</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
@ -143,68 +45,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
|
@ -4,103 +4,6 @@
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="show-arrow">0</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip_text">Switch it</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
@ -131,68 +34,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
|
@ -4,8 +4,8 @@
|
||||
* with widgets to inform the theme about intended rendering.
|
||||
*
|
||||
* This demo shows some common examples where theming features
|
||||
* of GTK are used for certain effects: primary toolbars,
|
||||
* inline toolbars and linked buttons.
|
||||
* of GTK are used for certain effects: primary toolbars
|
||||
* and linked buttons.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -1815,26 +1815,26 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<object class="GtkBox" id="toolbar">
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
<property name="icon-name">document-new</property>
|
||||
<property name="tooltip-text" translatable="yes">Create a new document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
<property name="icon-name">document-save</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem"/>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="action-name">win.search</property>
|
||||
@ -1842,7 +1842,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insert</property>
|
||||
<property name="icon-name">insert-image</property>
|
||||
@ -2007,27 +2007,26 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="toolbar-style">icons</property>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="decrease_button">
|
||||
<object class="GtkButton" id="decrease_button">
|
||||
<property name="icon-name">zoom-out-symbolic</property>
|
||||
<property name="tooltip-text">Normal icons</property>
|
||||
<signal name="clicked" handler="decrease_icon_size" object="iconview1" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="increase_button">
|
||||
<object class="GtkButton" id="increase_button">
|
||||
<property name="icon-name">zoom-in-symbolic</property>
|
||||
<property name="tooltip-text">Large icons</property>
|
||||
<signal name="clicked" handler="increase_icon_size" object="iconview1" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="reset_button">
|
||||
<object class="GtkButton" id="reset_button">
|
||||
<property name="icon-name">zoom-original-symbolic</property>
|
||||
<property name="tooltip-text">Inherited icon size</property>
|
||||
<signal name="clicked" handler="reset_icon_size" object="iconview1" swapped="yes"/>
|
||||
@ -2478,26 +2477,25 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton1">
|
||||
<object class="GtkButton" id="toolbutton1">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton2">
|
||||
<object class="GtkButton" id="toolbutton2">
|
||||
<property name="icon-name">send-to-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton3">
|
||||
<object class="GtkButton" id="toolbutton3">
|
||||
<property name="icon-name">view-fullscreen-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton4">
|
||||
<object class="GtkButton" id="toolbutton4">
|
||||
<property name="icon-name">star-new-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -2557,7 +2555,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<child type="overlay">
|
||||
<object class="GtkToolbar" id="totem_like_osd">
|
||||
<object class="GtkBox" id="totem_like_osd">
|
||||
<property name="visible">0</property>
|
||||
<property name="opacity">0.9</property>
|
||||
<property name="margin">20</property>
|
||||
@ -2566,48 +2564,36 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<class name="osd"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<property name="expand-item">1</property>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkScale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkVolumeButton">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="value">.5</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkVolumeButton">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="value">.5</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -214,17 +214,9 @@
|
||||
</chapter>
|
||||
|
||||
<chapter id="MenusAndCombos">
|
||||
<title>Menus, Combo Box, Toolbar</title>
|
||||
<title>Menus, Combo Box</title>
|
||||
<xi:include href="xml/gtkcombobox.xml" />
|
||||
<xi:include href="xml/gtkcomboboxtext.xml" />
|
||||
<xi:include href="xml/gtktoolshell.xml" />
|
||||
<xi:include href="xml/gtktoolbar.xml" />
|
||||
<xi:include href="xml/gtktoolitem.xml" />
|
||||
<xi:include href="xml/gtkseparatortoolitem.xml" />
|
||||
<xi:include href="xml/gtktoolbutton.xml" />
|
||||
<xi:include href="xml/gtkmenutoolbutton.xml" />
|
||||
<xi:include href="xml/gtktoggletoolbutton.xml" />
|
||||
<xi:include href="xml/gtkradiotoolbutton.xml" />
|
||||
<xi:include href="xml/gtkpopover.xml" />
|
||||
<xi:include href="xml/gtkpopovermenu.xml" />
|
||||
<xi:include href="xml/gtkpopovermenubar.xml" />
|
||||
|
@ -3003,218 +3003,6 @@ gtk_toggle_button_get_type
|
||||
GtkToggleButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoolshell</FILE>
|
||||
<TITLE>GtkToolShell</TITLE>
|
||||
GtkToolShell
|
||||
GtkToolShellIface
|
||||
gtk_tool_shell_get_ellipsize_mode
|
||||
gtk_tool_shell_get_orientation
|
||||
gtk_tool_shell_get_style
|
||||
gtk_tool_shell_get_text_alignment
|
||||
gtk_tool_shell_get_text_orientation
|
||||
gtk_tool_shell_rebuild_menu
|
||||
gtk_tool_shell_get_text_size_group
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_IS_TOOL_SHELL
|
||||
GTK_TOOL_SHELL
|
||||
GTK_TOOL_SHELL_GET_IFACE
|
||||
GTK_TYPE_TOOL_SHELL
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_tool_shell_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoolbar</FILE>
|
||||
<TITLE>GtkToolbar</TITLE>
|
||||
GtkToolbar
|
||||
gtk_toolbar_new
|
||||
gtk_toolbar_insert
|
||||
gtk_toolbar_get_item_index
|
||||
gtk_toolbar_get_n_items
|
||||
gtk_toolbar_get_nth_item
|
||||
gtk_toolbar_get_drop_index
|
||||
gtk_toolbar_set_drop_highlight_item
|
||||
gtk_toolbar_set_show_arrow
|
||||
gtk_toolbar_get_show_arrow
|
||||
gtk_toolbar_get_style
|
||||
|
||||
gtk_toolbar_set_style
|
||||
gtk_toolbar_unset_style
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TOOLBAR
|
||||
GTK_IS_TOOLBAR
|
||||
GTK_TYPE_TOOLBAR
|
||||
GTK_TOOLBAR_CLASS
|
||||
GTK_IS_TOOLBAR_CLASS
|
||||
GTK_TOOLBAR_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_toolbar_get_type
|
||||
GtkToolbarPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoolitem</FILE>
|
||||
<TITLE>GtkToolItem</TITLE>
|
||||
GtkToolItem
|
||||
GtkToolItemClass
|
||||
gtk_tool_item_new
|
||||
gtk_tool_item_set_homogeneous
|
||||
gtk_tool_item_get_homogeneous
|
||||
gtk_tool_item_set_expand
|
||||
gtk_tool_item_get_expand
|
||||
gtk_tool_item_set_tooltip_text
|
||||
gtk_tool_item_set_tooltip_markup
|
||||
gtk_tool_item_set_visible_horizontal
|
||||
gtk_tool_item_get_visible_horizontal
|
||||
gtk_tool_item_set_visible_vertical
|
||||
gtk_tool_item_get_visible_vertical
|
||||
gtk_tool_item_set_is_important
|
||||
gtk_tool_item_get_is_important
|
||||
gtk_tool_item_get_ellipsize_mode
|
||||
gtk_tool_item_get_orientation
|
||||
gtk_tool_item_get_toolbar_style
|
||||
gtk_tool_item_get_text_alignment
|
||||
gtk_tool_item_get_text_orientation
|
||||
gtk_tool_item_set_overflow_text
|
||||
gtk_tool_item_get_overflow_text
|
||||
gtk_tool_item_rebuild_menu
|
||||
gtk_tool_item_toolbar_reconfigured
|
||||
gtk_tool_item_get_text_size_group
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_TOOL_ITEM
|
||||
GTK_TOOL_ITEM
|
||||
GTK_TOOL_ITEM_CLASS
|
||||
GTK_IS_TOOL_ITEM
|
||||
GTK_IS_TOOL_ITEM_CLASS
|
||||
GTK_TOOL_ITEM_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_tool_item_get_type
|
||||
GtkToolItemPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkseparatortoolitem</FILE>
|
||||
<TITLE>GtkSeparatorToolItem</TITLE>
|
||||
GtkSeparatorToolItem
|
||||
gtk_separator_tool_item_new
|
||||
gtk_separator_tool_item_set_draw
|
||||
gtk_separator_tool_item_get_draw
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SEPARATOR_TOOL_ITEM
|
||||
GTK_SEPARATOR_TOOL_ITEM
|
||||
GTK_SEPARATOR_TOOL_ITEM_CLASS
|
||||
GTK_IS_SEPARATOR_TOOL_ITEM
|
||||
GTK_IS_SEPARATOR_TOOL_ITEM_CLASS
|
||||
GTK_SEPARATOR_TOOL_ITEM_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_separator_tool_item_get_type
|
||||
GtkSeparatorToolItemPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoolbutton</FILE>
|
||||
<TITLE>GtkToolButton</TITLE>
|
||||
GtkToolButton
|
||||
GtkToolButtonClass
|
||||
gtk_tool_button_new
|
||||
gtk_tool_button_set_label
|
||||
gtk_tool_button_get_label
|
||||
gtk_tool_button_set_use_underline
|
||||
gtk_tool_button_get_use_underline
|
||||
gtk_tool_button_set_icon_name
|
||||
gtk_tool_button_get_icon_name
|
||||
gtk_tool_button_set_icon_widget
|
||||
gtk_tool_button_get_icon_widget
|
||||
gtk_tool_button_set_label_widget
|
||||
gtk_tool_button_get_label_widget
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_TOOL_BUTTON
|
||||
GTK_TOOL_BUTTON
|
||||
GTK_TOOL_BUTTON_CLASS
|
||||
GTK_IS_TOOL_BUTTON
|
||||
GTK_IS_TOOL_BUTTON_CLASS
|
||||
GTK_TOOL_BUTTON_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_tool_button_get_type
|
||||
GtkToolButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenutoolbutton</FILE>
|
||||
<TITLE>GtkMenuToolButton</TITLE>
|
||||
GtkMenuToolButton
|
||||
gtk_menu_tool_button_new
|
||||
gtk_menu_tool_button_set_popover
|
||||
gtk_menu_tool_button_get_popover
|
||||
gtk_menu_tool_button_set_arrow_tooltip_text
|
||||
gtk_menu_tool_button_set_arrow_tooltip_markup
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_MENU_TOOL_BUTTON
|
||||
GTK_MENU_TOOL_BUTTON
|
||||
GTK_MENU_TOOL_BUTTON_CLASS
|
||||
GTK_IS_MENU_TOOL_BUTTON
|
||||
GTK_IS_MENU_TOOL_BUTTON_CLASS
|
||||
GTK_MENU_TOOL_BUTTON_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_menu_tool_button_get_type
|
||||
GtkMenuToolButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkradiotoolbutton</FILE>
|
||||
<TITLE>GtkRadioToolButton</TITLE>
|
||||
GtkRadioToolButton
|
||||
gtk_radio_tool_button_new
|
||||
gtk_radio_tool_button_new_from_widget
|
||||
gtk_radio_tool_button_get_group
|
||||
gtk_radio_tool_button_set_group
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_RADIO_TOOL_BUTTON
|
||||
GTK_RADIO_TOOL_BUTTON
|
||||
GTK_RADIO_TOOL_BUTTON_CLASS
|
||||
GTK_IS_RADIO_TOOL_BUTTON
|
||||
GTK_IS_RADIO_TOOL_BUTTON_CLASS
|
||||
GTK_RADIO_TOOL_BUTTON_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_radio_tool_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoggletoolbutton</FILE>
|
||||
<TITLE>GtkToggleToolButton</TITLE>
|
||||
GtkToggleToolButton
|
||||
GtkToggleToolButtonClass
|
||||
gtk_toggle_tool_button_new
|
||||
gtk_toggle_tool_button_set_active
|
||||
gtk_toggle_tool_button_get_active
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_TOGGLE_TOOL_BUTTON
|
||||
GTK_TOGGLE_TOOL_BUTTON
|
||||
GTK_TOGGLE_TOOL_BUTTON_CLASS
|
||||
GTK_IS_TOGGLE_TOOL_BUTTON
|
||||
GTK_IS_TOGGLE_TOOL_BUTTON_CLASS
|
||||
GTK_TOGGLE_TOOL_BUTTON_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_toggle_tool_button_get_type
|
||||
GtkToggleToolButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktooltip</FILE>
|
||||
<TITLE>GtkTooltip</TITLE>
|
||||
@ -4743,7 +4531,6 @@ GTK_STYLE_CLASS_HIGHLIGHT
|
||||
GTK_STYLE_CLASS_HORIZONTAL
|
||||
GTK_STYLE_CLASS_IMAGE
|
||||
GTK_STYLE_CLASS_INFO
|
||||
GTK_STYLE_CLASS_INLINE_TOOLBAR
|
||||
GTK_STYLE_CLASS_INSERTION_CURSOR
|
||||
GTK_STYLE_CLASS_LABEL
|
||||
GTK_STYLE_CLASS_LEFT
|
||||
@ -4765,7 +4552,6 @@ GTK_STYLE_CLASS_PANE_SEPARATOR
|
||||
GTK_STYLE_CLASS_PAPER
|
||||
GTK_STYLE_CLASS_POPUP
|
||||
GTK_STYLE_CLASS_POPOVER
|
||||
GTK_STYLE_CLASS_PRIMARY_TOOLBAR
|
||||
GTK_STYLE_CLASS_PROGRESSBAR
|
||||
GTK_STYLE_CLASS_PULSE
|
||||
GTK_STYLE_CLASS_QUESTION
|
||||
@ -4977,7 +4763,6 @@ GtkScrollType
|
||||
GtkSelectionMode
|
||||
GtkShadowType
|
||||
GtkStateFlags
|
||||
GtkToolbarStyle
|
||||
GtkSortType
|
||||
GtkIconSize
|
||||
|
||||
|
@ -123,7 +123,6 @@ gtk_media_controls_get_type
|
||||
gtk_media_file_get_type
|
||||
gtk_media_stream_get_type
|
||||
gtk_menu_button_get_type
|
||||
gtk_menu_tool_button_get_type
|
||||
gtk_message_dialog_get_type
|
||||
gtk_mount_operation_get_type
|
||||
gtk_native_get_type
|
||||
@ -151,7 +150,6 @@ gtk_print_settings_get_type
|
||||
@DISABLE_ON_W32@gtk_print_unix_dialog_get_type
|
||||
gtk_progress_bar_get_type
|
||||
gtk_radio_button_get_type
|
||||
gtk_radio_tool_button_get_type
|
||||
gtk_range_get_type
|
||||
gtk_recent_manager_get_type
|
||||
gtk_revealer_get_type
|
||||
@ -165,7 +163,6 @@ gtk_search_bar_get_type
|
||||
gtk_search_entry_get_type
|
||||
gtk_selection_model_get_type
|
||||
gtk_separator_get_type
|
||||
gtk_separator_tool_item_get_type
|
||||
gtk_settings_get_type
|
||||
gtk_shortcut_label_get_type
|
||||
gtk_shortcuts_window_get_type
|
||||
@ -197,10 +194,6 @@ gtk_text_tag_get_type
|
||||
gtk_text_tag_table_get_type
|
||||
gtk_text_view_get_type
|
||||
gtk_toggle_button_get_type
|
||||
gtk_toggle_tool_button_get_type
|
||||
gtk_toolbar_get_type
|
||||
gtk_tool_button_get_type
|
||||
gtk_tool_item_get_type
|
||||
gtk_tree_drag_dest_get_type
|
||||
gtk_tree_drag_source_get_type
|
||||
gtk_tree_list_model_get_type
|
||||
|
@ -877,20 +877,19 @@
|
||||
switching to menu models and actions.
|
||||
</para>
|
||||
<para>
|
||||
Since menus are gone, GtkMenuButton and GtkMenuToolButton also lost their
|
||||
ability to show menus, and need to be used with popovers in GTK 4.
|
||||
Since menus are gone, GtkMenuButton also lost its ability to show menus,
|
||||
and needs to be used with popovers in GTK 4.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkToolbar overflow handling has changed</title>
|
||||
<title>GtkToolbar has been removed</title>
|
||||
<para>
|
||||
The handling of overflow in toolbars has been simplified.
|
||||
Instead of creating a proxy menuitem and setting it with
|
||||
gtk_tool_item_set_proxy_menu_item(), you simply provide
|
||||
a label for the overflow menu with gtk_tool_item_set_overflow_text().
|
||||
GTK will figure out itself whether to create a check- or
|
||||
radioitem as proxy.
|
||||
Toolbars were using outdated concepts such as requiring special toolitem
|
||||
widgets.
|
||||
</para>
|
||||
<para>
|
||||
Toolbars should be replaced by using a GtkBox with regular widgets instead.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
@ -162,9 +162,6 @@
|
||||
<link linkend="GtkPaned">
|
||||
<inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkToolbar">
|
||||
<inlinegraphic fileref="toolbar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkPlacesSidebar">
|
||||
<inlinegraphic fileref="placessidebar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
|
@ -213,7 +213,7 @@ new_window (GApplication *app,
|
||||
{
|
||||
GtkWidget *window, *grid, *scrolled, *view;
|
||||
GtkWidget *toolbar;
|
||||
GtkToolItem *button;
|
||||
GtkWidget *button;
|
||||
GtkWidget *sw, *box, *label;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
@ -224,37 +224,31 @@ new_window (GApplication *app,
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
button = gtk_toggle_tool_button_new ();
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-left");
|
||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-left");
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), button);
|
||||
|
||||
button = gtk_toggle_tool_button_new ();
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-center");
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-center");
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), button);
|
||||
|
||||
button = gtk_toggle_tool_button_new ();
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-right");
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-right");
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), button);
|
||||
|
||||
button = gtk_separator_tool_item_new ();
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
|
||||
gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_tool_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_container_add (GTK_CONTAINER (button), box);
|
||||
gtk_widget_set_halign (box, GTK_ALIGN_END);
|
||||
label = gtk_label_new ("Fullscreen:");
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
sw = gtk_switch_new ();
|
||||
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
|
||||
gtk_container_add (GTK_CONTAINER (box), sw);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), box);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkimageaccessible.h"
|
||||
#include "gtktoolbarprivate.h"
|
||||
#include "gtkimageprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
@ -129,6 +128,50 @@ static const NameMapEntry name_map[] = {
|
||||
{ "zoom-out", NC_("Stock label", "Zoom _Out") }
|
||||
};
|
||||
|
||||
/* GTK+ internal methods */
|
||||
static gchar *
|
||||
elide_underscores (const gchar *original)
|
||||
{
|
||||
gchar *q, *result;
|
||||
const gchar *p, *end;
|
||||
gsize len;
|
||||
gboolean last_underscore;
|
||||
|
||||
if (!original)
|
||||
return NULL;
|
||||
|
||||
len = strlen (original);
|
||||
q = result = g_malloc (len + 1);
|
||||
last_underscore = FALSE;
|
||||
|
||||
end = original + len;
|
||||
for (p = original; p < end; p++)
|
||||
{
|
||||
if (!last_underscore && *p == '_')
|
||||
last_underscore = TRUE;
|
||||
else
|
||||
{
|
||||
last_underscore = FALSE;
|
||||
if (original + 2 <= p && p + 1 <= end &&
|
||||
p[-2] == '(' && p[-1] == '_' && p[0] != '_' && p[1] == ')')
|
||||
{
|
||||
q--;
|
||||
*q = '\0';
|
||||
p++;
|
||||
}
|
||||
else
|
||||
*q++ = *p;
|
||||
}
|
||||
}
|
||||
|
||||
if (last_underscore)
|
||||
*q++ = '_';
|
||||
|
||||
*q = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
name_from_icon_name (const gchar *icon_name)
|
||||
{
|
||||
@ -147,7 +190,7 @@ name_from_icon_name (const gchar *icon_name)
|
||||
label = g_dpgettext2 (GETTEXT_PACKAGE, "Stock label", name_map[i].label);
|
||||
g_free (name);
|
||||
|
||||
return _gtk_toolbar_elide_underscores (label);
|
||||
return elide_underscores (label);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLinkButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListStore, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLockButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuToolButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMessageDialog, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMountOperation, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkNotebook, g_object_unref)
|
||||
@ -121,7 +120,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPrintOperationPreview, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPrintSettings, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkProgressBar, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioToolButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRange, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRecentManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRevealer, g_object_unref)
|
||||
@ -133,7 +131,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScrolledWindow, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSearchBar, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSearchEntry, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSeparator, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSeparatorToolItem, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSettings, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStackSidebar, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSizeGroup, g_object_unref)
|
||||
@ -152,11 +149,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextTag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextTagTable, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextView, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToggleButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToggleToolButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToolButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToolItem, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToolShell, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToolbar, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTooltip, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeDragDest, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeDragSource, g_object_unref)
|
||||
|
@ -157,7 +157,6 @@
|
||||
#include <gtk/gtkmediafile.h>
|
||||
#include <gtk/gtkmediastream.h>
|
||||
#include <gtk/gtkmenubutton.h>
|
||||
#include <gtk/gtkmenutoolbutton.h>
|
||||
#include <gtk/gtkmessagedialog.h>
|
||||
#include <gtk/gtkmountoperation.h>
|
||||
#include <gtk/gtknative.h>
|
||||
@ -181,7 +180,6 @@
|
||||
#include <gtk/gtkprintsettings.h>
|
||||
#include <gtk/gtkprogressbar.h>
|
||||
#include <gtk/gtkradiobutton.h>
|
||||
#include <gtk/gtkradiotoolbutton.h>
|
||||
#include <gtk/gtkrange.h>
|
||||
#include <gtk/gtkrecentmanager.h>
|
||||
#include <gtk/gtkrender.h>
|
||||
@ -197,7 +195,6 @@
|
||||
#include <gtk/gtkselection.h>
|
||||
#include <gtk/gtkselectionmodel.h>
|
||||
#include <gtk/gtkseparator.h>
|
||||
#include <gtk/gtkseparatortoolitem.h>
|
||||
#include <gtk/gtksettings.h>
|
||||
#include <gtk/gtkshortcutlabel.h>
|
||||
#include <gtk/gtkshortcutsgroup.h>
|
||||
@ -229,11 +226,6 @@
|
||||
#include <gtk/gtktexttagtable.h>
|
||||
#include <gtk/gtktextview.h>
|
||||
#include <gtk/gtktogglebutton.h>
|
||||
#include <gtk/gtktoggletoolbutton.h>
|
||||
#include <gtk/gtktoolbar.h>
|
||||
#include <gtk/gtktoolbutton.h>
|
||||
#include <gtk/gtktoolitem.h>
|
||||
#include <gtk/gtktoolshell.h>
|
||||
#include <gtk/gtktooltip.h>
|
||||
#include <gtk/gtktestutils.h>
|
||||
#include <gtk/gtktreednd.h>
|
||||
|
@ -990,30 +990,6 @@ wrap_in_frame (const gchar *label,
|
||||
return frame;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
toolbutton_new (GtkCustomPaperUnixDialog *dialog,
|
||||
GIcon *icon,
|
||||
gboolean sensitive,
|
||||
gboolean show,
|
||||
GCallback callback)
|
||||
{
|
||||
GtkToolItem *item;
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
image = gtk_image_new_from_gicon (icon);
|
||||
gtk_widget_show (image);
|
||||
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (item), sensitive);
|
||||
g_signal_connect_swapped (item, "clicked", callback, dialog);
|
||||
|
||||
if (show)
|
||||
gtk_widget_show (GTK_WIDGET (item));
|
||||
|
||||
return GTK_WIDGET (item);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
{
|
||||
@ -1027,7 +1003,6 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *selection;
|
||||
GtkUnit user_units;
|
||||
GIcon *icon;
|
||||
GtkStyleContext *context;
|
||||
|
||||
content_area = gtk_dialog_get_content_area (cpu_dialog);
|
||||
@ -1072,25 +1047,22 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), treeview);
|
||||
gtk_widget_show (treeview);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
context = gtk_widget_get_style_context (toolbar);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
|
||||
gtk_style_context_add_class (context, "linked");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), toolbar);
|
||||
gtk_widget_show (toolbar);
|
||||
|
||||
icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic");
|
||||
button = toolbutton_new (dialog, icon, TRUE, TRUE, G_CALLBACK (add_custom_paper));
|
||||
g_object_unref (icon);
|
||||
button = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_custom_paper), dialog);
|
||||
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (button), 0);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), button);
|
||||
|
||||
icon = g_themed_icon_new_with_default_fallbacks ("list-remove-symbolic");
|
||||
button = toolbutton_new (dialog, icon, TRUE, TRUE, G_CALLBACK (remove_custom_paper));
|
||||
g_object_unref (icon);
|
||||
button = gtk_button_new_from_icon_name ("list-remove-symbolic");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (remove_custom_paper), dialog);
|
||||
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (button), 1);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), button);
|
||||
|
||||
user_units = _gtk_print_get_default_user_units ();
|
||||
|
||||
|
@ -332,7 +332,7 @@ typedef enum
|
||||
* @GTK_ORIENTATION_VERTICAL: The element is in vertical orientation.
|
||||
*
|
||||
* Represents the orientation of widgets and other objects which can be switched
|
||||
* between horizontal and vertical orientation on the fly, like #GtkToolbar or
|
||||
* between horizontal and vertical orientation on the fly, like #GtkBox or
|
||||
* #GtkGesturePan.
|
||||
*/
|
||||
typedef enum
|
||||
@ -494,28 +494,6 @@ typedef enum
|
||||
|
||||
/* Widget states */
|
||||
|
||||
/**
|
||||
* GtkToolbarStyle:
|
||||
* @GTK_TOOLBAR_ICONS: Buttons display only icons in the toolbar.
|
||||
* @GTK_TOOLBAR_TEXT: Buttons display only text labels in the toolbar.
|
||||
* @GTK_TOOLBAR_BOTH: Buttons display text and icons in the toolbar.
|
||||
* @GTK_TOOLBAR_BOTH_HORIZ: Buttons display icons and text alongside each
|
||||
* other, rather than vertically stacked
|
||||
*
|
||||
* Used to customize the appearance of a #GtkToolbar. Note that
|
||||
* setting the toolbar style overrides the user’s preferences
|
||||
* for the default toolbar style. Note that if the button has only
|
||||
* a label set and GTK_TOOLBAR_ICONS is used, the label will be
|
||||
* visible, and vice versa.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_TOOLBAR_ICONS,
|
||||
GTK_TOOLBAR_TEXT,
|
||||
GTK_TOOLBAR_BOTH,
|
||||
GTK_TOOLBAR_BOTH_HORIZ
|
||||
} GtkToolbarStyle;
|
||||
|
||||
/**
|
||||
* GtkWrapMode:
|
||||
* @GTK_WRAP_NONE: do not wrap lines; just make the text area wider
|
||||
|
@ -1,438 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
* Copyright (C) 2003 Ricardo Fernandez Pascual
|
||||
* Copyright (C) 2004 Paolo Borelli
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkmenutoolbutton.h"
|
||||
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkmenubutton.h"
|
||||
#include "gtkmenubuttonprivate.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkmenutoolbutton
|
||||
* @Short_description: A GtkToolItem containing a button with an additional dropdown menu
|
||||
* @Title: GtkMenuToolButton
|
||||
* @See_also: #GtkToolbar, #GtkToolButton
|
||||
*
|
||||
* A #GtkMenuToolButton is a #GtkToolItem that contains a button and
|
||||
* a small additional button with an arrow. When clicked, the arrow
|
||||
* button pops up a dropdown menu.
|
||||
*
|
||||
* Use gtk_menu_tool_button_new() to create a new
|
||||
* #GtkMenuToolButton.
|
||||
*
|
||||
* # GtkMenuToolButton as GtkBuildable
|
||||
*
|
||||
* The GtkMenuToolButton implementation of the GtkBuildable interface
|
||||
* supports adding a popover by specifying “popover” as the “type” attribute
|
||||
* of a <child> element.
|
||||
* ]|
|
||||
*/
|
||||
|
||||
typedef struct _GtkMenuToolButtonClass GtkMenuToolButtonClass;
|
||||
typedef struct _GtkMenuToolButtonPrivate GtkMenuToolButtonPrivate;
|
||||
|
||||
struct _GtkMenuToolButton
|
||||
{
|
||||
GtkToolButton parent;
|
||||
|
||||
GtkMenuToolButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkMenuToolButtonClass
|
||||
{
|
||||
GtkToolButtonClass parent_class;
|
||||
|
||||
void (*show_menu) (GtkMenuToolButton *button);
|
||||
};
|
||||
|
||||
|
||||
struct _GtkMenuToolButtonPrivate
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *arrow_button;
|
||||
GtkWidget *box;
|
||||
};
|
||||
|
||||
static void gtk_menu_tool_button_buildable_interface_init (GtkBuildableIface *iface);
|
||||
static void gtk_menu_tool_button_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type);
|
||||
|
||||
enum
|
||||
{
|
||||
SHOW_MENU,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_POPOVER
|
||||
};
|
||||
|
||||
static gint signals[LAST_SIGNAL];
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkMenuToolButton, gtk_menu_tool_button, GTK_TYPE_TOOL_BUTTON,
|
||||
G_ADD_PRIVATE (GtkMenuToolButton)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_menu_tool_button_buildable_interface_init))
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button)
|
||||
{
|
||||
GtkMenuToolButtonPrivate *priv = button->priv;
|
||||
GtkWidget *box;
|
||||
GtkWidget *parent;
|
||||
GtkOrientation orientation;
|
||||
|
||||
orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_menu_button_set_direction (GTK_MENU_BUTTON (priv->arrow_button), GTK_ARROW_DOWN);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkTextDirection direction;
|
||||
GtkArrowType type;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
direction = gtk_widget_get_direction (GTK_WIDGET (button));
|
||||
type = (direction == GTK_TEXT_DIR_LTR ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT);
|
||||
gtk_menu_button_set_direction (GTK_MENU_BUTTON (priv->arrow_button), type);
|
||||
}
|
||||
|
||||
parent = gtk_widget_get_parent (priv->button);
|
||||
if (priv->button && parent)
|
||||
{
|
||||
g_object_ref (priv->button);
|
||||
gtk_container_remove (GTK_CONTAINER (parent),
|
||||
priv->button);
|
||||
gtk_container_add (GTK_CONTAINER (box), priv->button);
|
||||
g_object_unref (priv->button);
|
||||
}
|
||||
|
||||
parent = gtk_widget_get_parent (priv->arrow_button);
|
||||
if (priv->arrow_button && parent)
|
||||
{
|
||||
g_object_ref (priv->arrow_button);
|
||||
gtk_container_remove (GTK_CONTAINER (parent),
|
||||
priv->arrow_button);
|
||||
gtk_container_add (GTK_CONTAINER (box), priv->arrow_button);
|
||||
g_object_unref (priv->arrow_button);
|
||||
}
|
||||
|
||||
if (priv->box)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
/* Transfer a possible tooltip to the new box */
|
||||
g_object_get (priv->box, "tooltip-markup", &tmp, NULL);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
g_object_set (box, "tooltip-markup", tmp, NULL);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* Note: we are not destroying the button and the arrow_button
|
||||
* here because they were removed from their container above
|
||||
*/
|
||||
gtk_widget_destroy (priv->box);
|
||||
}
|
||||
|
||||
priv->box = box;
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), priv->box);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (button));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_toolbar_reconfigured (GtkToolItem *toolitem)
|
||||
{
|
||||
gtk_menu_tool_button_construct_contents (GTK_MENU_TOOL_BUTTON (toolitem));
|
||||
|
||||
/* chain up */
|
||||
GTK_TOOL_ITEM_CLASS (gtk_menu_tool_button_parent_class)->toolbar_reconfigured (toolitem);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_POPOVER:
|
||||
gtk_menu_tool_button_set_popover (button, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_POPOVER:
|
||||
g_value_set_object (value, gtk_menu_button_get_popover (GTK_MENU_BUTTON (button->priv->arrow_button)));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_class_init (GtkMenuToolButtonClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkToolItemClass *toolitem_class;
|
||||
|
||||
object_class = (GObjectClass *)klass;
|
||||
toolitem_class = (GtkToolItemClass *)klass;
|
||||
|
||||
object_class->set_property = gtk_menu_tool_button_set_property;
|
||||
object_class->get_property = gtk_menu_tool_button_get_property;
|
||||
|
||||
toolitem_class->toolbar_reconfigured = gtk_menu_tool_button_toolbar_reconfigured;
|
||||
|
||||
/**
|
||||
* GtkMenuToolButton::show-menu:
|
||||
* @button: the object on which the signal is emitted
|
||||
*
|
||||
* The ::show-menu signal is emitted before the menu is shown.
|
||||
*
|
||||
* It can be used to populate the menu on demand, using
|
||||
* gtk_menu_tool_button_set_menu().
|
||||
|
||||
* Note that even if you populate the menu dynamically in this way,
|
||||
* you must set an empty menu on the #GtkMenuToolButton beforehand,
|
||||
* since the arrow is made insensitive if the menu is not set.
|
||||
*/
|
||||
signals[SHOW_MENU] =
|
||||
g_signal_new (I_("show-menu"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkMenuToolButtonClass, show_menu),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_POPOVER,
|
||||
g_param_spec_object ("popover",
|
||||
P_("Popover"),
|
||||
P_("The dropdown popover"),
|
||||
GTK_TYPE_POPOVER,
|
||||
GTK_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_init (GtkMenuToolButton *button)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *arrow_button;
|
||||
GtkWidget *real_button;
|
||||
|
||||
button->priv = gtk_menu_tool_button_get_instance_private (button);
|
||||
|
||||
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (button), FALSE);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
real_button = gtk_bin_get_child (GTK_BIN (button));
|
||||
g_object_ref (real_button);
|
||||
gtk_container_remove (GTK_CONTAINER (button), real_button);
|
||||
gtk_container_add (GTK_CONTAINER (box), real_button);
|
||||
g_object_unref (real_button);
|
||||
|
||||
arrow_button = gtk_menu_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), arrow_button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), box);
|
||||
gtk_menu_button_set_align_widget (GTK_MENU_BUTTON (arrow_button),
|
||||
GTK_WIDGET (button));
|
||||
|
||||
button->priv->button = real_button;
|
||||
button->priv->arrow_button = arrow_button;
|
||||
button->priv->box = box;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (type && strcmp (type, "popover") == 0)
|
||||
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (buildable),
|
||||
GTK_WIDGET (child));
|
||||
else
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tool_button_buildable_interface_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
iface->add_child = gtk_menu_tool_button_buildable_add_child;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_tool_button_new:
|
||||
* @icon_widget: (allow-none): a widget that will be used as icon widget, or %NULL
|
||||
* @label: (allow-none): a string that will be used as label, or %NULL
|
||||
*
|
||||
* Creates a new #GtkMenuToolButton using @icon_widget as icon and
|
||||
* @label as label.
|
||||
*
|
||||
* Returns: the new #GtkMenuToolButton
|
||||
**/
|
||||
GtkToolItem *
|
||||
gtk_menu_tool_button_new (GtkWidget *icon_widget,
|
||||
const gchar *label)
|
||||
{
|
||||
GtkMenuToolButton *button;
|
||||
|
||||
button = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL);
|
||||
|
||||
if (label)
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), label);
|
||||
|
||||
if (icon_widget)
|
||||
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (button), icon_widget);
|
||||
|
||||
return GTK_TOOL_ITEM (button);
|
||||
}
|
||||
|
||||
static void
|
||||
_show_menu_emit (GtkMenuButton *menu_button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkMenuToolButton *button = (GtkMenuToolButton *) user_data;
|
||||
g_signal_emit (button, signals[SHOW_MENU], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_menu_tool_button_set_popover (GtkMenuToolButton *button,
|
||||
GtkWidget *popover)
|
||||
{
|
||||
GtkMenuToolButtonPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));
|
||||
g_return_if_fail (GTK_IS_POPOVER (popover) || popover == NULL);
|
||||
|
||||
priv = button->priv;
|
||||
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->arrow_button), popover);
|
||||
gtk_menu_button_set_create_popup_func (GTK_MENU_BUTTON (priv->arrow_button),
|
||||
_show_menu_emit, NULL, NULL);
|
||||
|
||||
g_object_notify (G_OBJECT (button), "popover");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_tool_button_get_popover:
|
||||
* @menu_button: a #GtkMenuToolButton
|
||||
*
|
||||
* Returns the #GtkPopover that pops out of the button.
|
||||
* If the button is not using a #GtkPopover, this function
|
||||
* returns %NULL.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a #GtkPopover or %NULL
|
||||
**/
|
||||
GtkWidget *
|
||||
gtk_menu_tool_button_get_popover (GtkMenuToolButton *button)
|
||||
{
|
||||
GtkPopover *ret;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_MENU_TOOL_BUTTON (button), NULL);
|
||||
|
||||
ret = gtk_menu_button_get_popover (GTK_MENU_BUTTON (button->priv->arrow_button));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
return GTK_WIDGET (ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_tool_button_set_arrow_tooltip_text:
|
||||
* @button: a #GtkMenuToolButton
|
||||
* @text: text to be used as tooltip text for button’s arrow button
|
||||
*
|
||||
* Sets the tooltip text to be used as tooltip for the arrow button which
|
||||
* pops up the menu. See gtk_tool_item_set_tooltip_text() for setting a tooltip
|
||||
* on the whole #GtkMenuToolButton.
|
||||
**/
|
||||
void
|
||||
gtk_menu_tool_button_set_arrow_tooltip_text (GtkMenuToolButton *button,
|
||||
const gchar *text)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));
|
||||
|
||||
gtk_widget_set_tooltip_text (button->priv->arrow_button, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_tool_button_set_arrow_tooltip_markup:
|
||||
* @button: a #GtkMenuToolButton
|
||||
* @markup: markup text to be used as tooltip text for button’s arrow button
|
||||
*
|
||||
* Sets the tooltip markup text to be used as tooltip for the arrow button
|
||||
* which pops up the menu. See gtk_tool_item_set_tooltip_text() for setting
|
||||
* a tooltip on the whole #GtkMenuToolButton.
|
||||
**/
|
||||
void
|
||||
gtk_menu_tool_button_set_arrow_tooltip_markup (GtkMenuToolButton *button,
|
||||
const gchar *markup)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));
|
||||
|
||||
gtk_widget_set_tooltip_markup (button->priv->arrow_button, markup);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
* Copyright (C) 2003 Ricardo Fernandez Pascual
|
||||
* Copyright (C) 2004 Paolo Borelli
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_MENU_TOOL_BUTTON_H__
|
||||
#define __GTK_MENU_TOOL_BUTTON_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtktoolbutton.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_MENU_TOOL_BUTTON (gtk_menu_tool_button_get_type ())
|
||||
#define GTK_MENU_TOOL_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_MENU_TOOL_BUTTON, GtkMenuToolButton))
|
||||
#define GTK_IS_MENU_TOOL_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_MENU_TOOL_BUTTON))
|
||||
|
||||
typedef struct _GtkMenuToolButton GtkMenuToolButton;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_menu_tool_button_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_menu_tool_button_new (GtkWidget *icon_widget,
|
||||
const gchar *label);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_menu_tool_button_set_popover (GtkMenuToolButton *button,
|
||||
GtkWidget *popover);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget *gtk_menu_tool_button_get_popover (GtkMenuToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_menu_tool_button_set_arrow_tooltip_text (GtkMenuToolButton *button,
|
||||
const gchar *text);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_menu_tool_button_set_arrow_tooltip_markup (GtkMenuToolButton *button,
|
||||
const gchar *markup);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_MENU_TOOL_BUTTON_H__ */
|
@ -1,217 +0,0 @@
|
||||
/* gtkradiotoolbutton.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.og>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gtkradiotoolbutton.h"
|
||||
#include "gtkradiobutton.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkradiotoolbutton
|
||||
* @Short_description: A toolbar item that contains a radio button
|
||||
* @Title: GtkRadioToolButton
|
||||
* @See_also: #GtkToolbar, #GtkToolButton
|
||||
*
|
||||
* A #GtkRadioToolButton is a #GtkToolItem that contains a radio button,
|
||||
* that is, a button that is part of a group of toggle buttons where only
|
||||
* one button can be active at a time.
|
||||
*
|
||||
* Use gtk_radio_tool_button_new() to create a new GtkRadioToolButton. Use
|
||||
* gtk_radio_tool_button_new_from_widget() to create a new GtkRadioToolButton
|
||||
* that is part of the same group as an existing GtkRadioToolButton.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkRadioToolButton has a single CSS node with name toolbutton.
|
||||
*/
|
||||
|
||||
typedef struct _GtkRadioToolButtonClass GtkRadioToolButtonClass;
|
||||
|
||||
struct _GtkRadioToolButton
|
||||
{
|
||||
GtkToggleToolButton parent;
|
||||
};
|
||||
|
||||
struct _GtkRadioToolButtonClass
|
||||
{
|
||||
GtkToggleToolButtonClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_GROUP
|
||||
};
|
||||
|
||||
static void gtk_radio_tool_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
G_DEFINE_TYPE (GtkRadioToolButton, gtk_radio_tool_button, GTK_TYPE_TOGGLE_TOOL_BUTTON)
|
||||
|
||||
static void
|
||||
gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkToolButtonClass *toolbutton_class;
|
||||
|
||||
object_class = (GObjectClass *)klass;
|
||||
toolbutton_class = (GtkToolButtonClass *)klass;
|
||||
|
||||
object_class->set_property = gtk_radio_tool_button_set_property;
|
||||
|
||||
toolbutton_class->button_type = GTK_TYPE_RADIO_BUTTON;
|
||||
|
||||
/**
|
||||
* GtkRadioToolButton:group:
|
||||
*
|
||||
* Sets a new group for a radio tool button.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_GROUP,
|
||||
g_param_spec_object ("group",
|
||||
P_("Group"),
|
||||
P_("The radio tool button whose group this button belongs to."),
|
||||
GTK_TYPE_RADIO_TOOL_BUTTON,
|
||||
GTK_PARAM_WRITABLE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_radio_tool_button_init (GtkRadioToolButton *button)
|
||||
{
|
||||
GtkToolButton *tool_button = GTK_TOOL_BUTTON (button);
|
||||
gtk_check_button_set_draw_indicator (GTK_CHECK_BUTTON (_gtk_tool_button_get_button (tool_button)), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_radio_tool_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRadioToolButton *button;
|
||||
|
||||
button = GTK_RADIO_TOOL_BUTTON (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_GROUP:
|
||||
{
|
||||
GtkRadioToolButton *arg;
|
||||
GSList *slist = NULL;
|
||||
if (G_VALUE_HOLDS_OBJECT (value))
|
||||
{
|
||||
arg = GTK_RADIO_TOOL_BUTTON (g_value_get_object (value));
|
||||
if (arg)
|
||||
slist = gtk_radio_tool_button_get_group (arg);
|
||||
gtk_radio_tool_button_set_group (button, slist);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_radio_tool_button_new:
|
||||
* @group: (allow-none) (element-type GtkRadioButton): An
|
||||
* existing radio button group, or %NULL if you are creating a new group
|
||||
*
|
||||
* Creates a new #GtkRadioToolButton, adding it to @group.
|
||||
*
|
||||
* Returns: The new #GtkRadioToolButton
|
||||
**/
|
||||
GtkToolItem *
|
||||
gtk_radio_tool_button_new (GSList *group)
|
||||
{
|
||||
GtkRadioToolButton *button;
|
||||
|
||||
button = g_object_new (GTK_TYPE_RADIO_TOOL_BUTTON,
|
||||
NULL);
|
||||
|
||||
gtk_radio_tool_button_set_group (button, group);
|
||||
|
||||
return GTK_TOOL_ITEM (button);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_radio_tool_button_new_from_widget: (constructor)
|
||||
* @group: (allow-none): An existing #GtkRadioToolButton, or %NULL
|
||||
*
|
||||
* Creates a new #GtkRadioToolButton adding it to the same group as @gruup
|
||||
*
|
||||
* Returns: (transfer none): The new #GtkRadioToolButton
|
||||
**/
|
||||
GtkToolItem *
|
||||
gtk_radio_tool_button_new_from_widget (GtkRadioToolButton *group)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
|
||||
g_return_val_if_fail (group == NULL || GTK_IS_RADIO_TOOL_BUTTON (group), NULL);
|
||||
|
||||
if (group != NULL)
|
||||
list = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (group));
|
||||
|
||||
return gtk_radio_tool_button_new (list);
|
||||
}
|
||||
|
||||
static GtkRadioButton *
|
||||
get_radio_button (GtkRadioToolButton *button)
|
||||
{
|
||||
return GTK_RADIO_BUTTON (_gtk_tool_button_get_button (GTK_TOOL_BUTTON (button)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_radio_tool_button_get_group:
|
||||
* @button: a #GtkRadioToolButton
|
||||
*
|
||||
* Returns the radio button group @button belongs to.
|
||||
*
|
||||
* Returns: (transfer none) (element-type GtkRadioButton): The group @button belongs to.
|
||||
*/
|
||||
GSList *
|
||||
gtk_radio_tool_button_get_group (GtkRadioToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return gtk_radio_button_get_group (get_radio_button (button));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_radio_tool_button_set_group:
|
||||
* @button: a #GtkRadioToolButton
|
||||
* @group: (element-type GtkRadioButton) (allow-none): an existing radio button group, or %NULL
|
||||
*
|
||||
* Adds @button to @group, removing it from the group it belonged to before.
|
||||
**/
|
||||
void
|
||||
gtk_radio_tool_button_set_group (GtkRadioToolButton *button,
|
||||
GSList *group)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button));
|
||||
|
||||
gtk_radio_button_set_group (get_radio_button (button), group);
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/* gtkradiotoolbutton.h
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RADIO_TOOL_BUTTON_H__
|
||||
#define __GTK_RADIO_TOOL_BUTTON_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtktoggletoolbutton.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RADIO_TOOL_BUTTON (gtk_radio_tool_button_get_type ())
|
||||
#define GTK_RADIO_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_TOOL_BUTTON, GtkRadioToolButton))
|
||||
#define GTK_IS_RADIO_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RADIO_TOOL_BUTTON))
|
||||
|
||||
typedef struct _GtkRadioToolButton GtkRadioToolButton;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_radio_tool_button_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_radio_tool_button_new (GSList *group);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_radio_tool_button_new_from_widget (GtkRadioToolButton *group);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GSList * gtk_radio_tool_button_get_group (GtkRadioToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_radio_tool_button_set_group (GtkRadioToolButton *button,
|
||||
GSList *group);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RADIO_TOOL_BUTTON_H__ */
|
@ -1,228 +0,0 @@
|
||||
/* gtkseparatortoolitem.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkseparatortoolitem.h"
|
||||
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtktoolbarprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkseparatortoolitem
|
||||
* @Short_description: A toolbar item that separates groups of other
|
||||
* toolbar items
|
||||
* @Title: GtkSeparatorToolItem
|
||||
* @See_also: #GtkToolbar, #GtkRadioToolButton
|
||||
*
|
||||
* A #GtkSeparatorToolItem is a #GtkToolItem that separates groups of other
|
||||
* #GtkToolItems. Depending on the theme, a #GtkSeparatorToolItem will
|
||||
* often look like a vertical line on horizontally docked toolbars.
|
||||
*
|
||||
* If the #GtkToolbar child property “expand” is %TRUE and the property
|
||||
* #GtkSeparatorToolItem:draw is %FALSE, a #GtkSeparatorToolItem will act as
|
||||
* a “spring” that forces other items to the ends of the toolbar.
|
||||
*
|
||||
* Use gtk_separator_tool_item_new() to create a new #GtkSeparatorToolItem.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkSeparatorToolItem has a single CSS node with name separator.
|
||||
*/
|
||||
|
||||
typedef struct _GtkSeparatorToolItemClass GtkSeparatorToolItemClass;
|
||||
|
||||
struct _GtkSeparatorToolItem
|
||||
{
|
||||
GtkToolItem parent_instance;
|
||||
};
|
||||
|
||||
struct _GtkSeparatorToolItemClass
|
||||
{
|
||||
GtkToolItemClass parent_class;
|
||||
};
|
||||
|
||||
#define MENU_ID "gtk-separator-tool-item-menu-id"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DRAW
|
||||
};
|
||||
|
||||
static void gtk_separator_tool_item_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_separator_tool_item_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_separator_tool_item_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
|
||||
G_DEFINE_TYPE (GtkSeparatorToolItem, gtk_separator_tool_item, GTK_TYPE_TOOL_ITEM)
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkContainerClass *container_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GObjectClass *)class;
|
||||
container_class = (GtkContainerClass *)class;
|
||||
widget_class = (GtkWidgetClass *)class;
|
||||
|
||||
object_class->set_property = gtk_separator_tool_item_set_property;
|
||||
object_class->get_property = gtk_separator_tool_item_get_property;
|
||||
|
||||
container_class->add = gtk_separator_tool_item_add;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DRAW,
|
||||
g_param_spec_boolean ("draw",
|
||||
P_("Draw"),
|
||||
P_("Whether the separator is drawn, or just blank"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("separator"));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_init (GtkSeparatorToolItem *separator_item)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_warning ("attempt to add a child to a GtkSeparatorToolItem");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkSeparatorToolItem *item = GTK_SEPARATOR_TOOL_ITEM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DRAW:
|
||||
gtk_separator_tool_item_set_draw (item, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkSeparatorToolItem *item = GTK_SEPARATOR_TOOL_ITEM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DRAW:
|
||||
g_value_set_boolean (value, gtk_separator_tool_item_get_draw (item));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_separator_tool_item_new:
|
||||
*
|
||||
* Create a new #GtkSeparatorToolItem
|
||||
*
|
||||
* Returns: the new #GtkSeparatorToolItem
|
||||
*/
|
||||
GtkToolItem *
|
||||
gtk_separator_tool_item_new (void)
|
||||
{
|
||||
GtkToolItem *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_SEPARATOR_TOOL_ITEM,
|
||||
NULL);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_separator_tool_item_get_draw:
|
||||
* @item: a #GtkSeparatorToolItem
|
||||
*
|
||||
* Returns whether @item is drawn as a line, or just blank.
|
||||
* See gtk_separator_tool_item_set_draw().
|
||||
*
|
||||
* Returns: %TRUE if @item is drawn as a line, or just blank.
|
||||
*/
|
||||
gboolean
|
||||
gtk_separator_tool_item_get_draw (GtkSeparatorToolItem *item)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SEPARATOR_TOOL_ITEM (item), FALSE);
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (item));
|
||||
|
||||
return !gtk_style_context_has_class (context, "invisible");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_separator_tool_item_set_draw:
|
||||
* @item: a #GtkSeparatorToolItem
|
||||
* @draw: whether @item is drawn as a vertical line
|
||||
*
|
||||
* Whether @item is drawn as a vertical line, or just blank.
|
||||
* Setting this to %FALSE along with gtk_tool_item_set_expand() is useful
|
||||
* to create an item that forces following items to the end of the toolbar.
|
||||
*/
|
||||
void
|
||||
gtk_separator_tool_item_set_draw (GtkSeparatorToolItem *item,
|
||||
gboolean draw)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SEPARATOR_TOOL_ITEM (item));
|
||||
|
||||
draw = !!draw;
|
||||
|
||||
if (draw == gtk_separator_tool_item_get_draw (item))
|
||||
return;
|
||||
|
||||
if (draw)
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (item)),
|
||||
"invisible");
|
||||
else
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (item)),
|
||||
"invisible");
|
||||
|
||||
g_object_notify (G_OBJECT (item), "draw");
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* gtktoggletoolbutton.h
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SEPARATOR_TOOL_ITEM_H__
|
||||
#define __GTK_SEPARATOR_TOOL_ITEM_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtktoolitem.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SEPARATOR_TOOL_ITEM (gtk_separator_tool_item_get_type ())
|
||||
#define GTK_SEPARATOR_TOOL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEPARATOR_TOOL_ITEM, GtkSeparatorToolItem))
|
||||
#define GTK_IS_SEPARATOR_TOOL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEPARATOR_TOOL_ITEM))
|
||||
|
||||
typedef struct _GtkSeparatorToolItem GtkSeparatorToolItem;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_separator_tool_item_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_separator_tool_item_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_separator_tool_item_get_draw (GtkSeparatorToolItem *item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_separator_tool_item_set_draw (GtkSeparatorToolItem *item,
|
||||
gboolean draw);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SEPARATOR_TOOL_ITEM_H__ */
|
@ -240,24 +240,6 @@ struct _GtkStyleContextClass
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_TOOLBAR "toolbar"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_PRIMARY_TOOLBAR:
|
||||
*
|
||||
* A CSS class to match primary toolbars.
|
||||
*
|
||||
* Refer to individual widget documentation for used style classes.
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_PRIMARY_TOOLBAR "primary-toolbar"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_INLINE_TOOLBAR:
|
||||
*
|
||||
* A CSS class to match inline toolbars.
|
||||
*
|
||||
* Refer to individual widget documentation for used style classes.
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_INLINE_TOOLBAR "inline-toolbar"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_STATUSBAR:
|
||||
*
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "gtktexthandleprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtktoolbar.h"
|
||||
#include "gtkmagnifierprivate.h"
|
||||
#include "gtkemojichooser.h"
|
||||
#include "gtkpango.h"
|
||||
|
@ -1,258 +0,0 @@
|
||||
/* gtktoggletoolbutton.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gtktoggletoolbutton.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkradiotoolbutton.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktoggletoolbutton
|
||||
* @Short_description: A GtkToolItem containing a toggle button
|
||||
* @Title: GtkToggleToolButton
|
||||
* @See_also: #GtkToolbar, #GtkToolButton, #GtkSeparatorToolItem
|
||||
*
|
||||
* A #GtkToggleToolButton is a #GtkToolItem that contains a toggle
|
||||
* button.
|
||||
*
|
||||
* Use gtk_toggle_tool_button_new() to create a new GtkToggleToolButton.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkToggleToolButton has a single CSS node with name togglebutton.
|
||||
*/
|
||||
|
||||
|
||||
#define MENU_ID "gtk-toggle-tool-button-menu-id"
|
||||
|
||||
enum {
|
||||
TOGGLED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ACTIVE
|
||||
};
|
||||
|
||||
|
||||
struct _GtkToggleToolButtonPrivate
|
||||
{
|
||||
guint active : 1;
|
||||
};
|
||||
|
||||
|
||||
static void gtk_toggle_tool_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_toggle_tool_button_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void button_toggled (GtkWidget *widget,
|
||||
GtkToggleToolButton *button);
|
||||
|
||||
|
||||
static guint toggle_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkToggleToolButton, gtk_toggle_tool_button, GTK_TYPE_TOOL_BUTTON,
|
||||
G_ADD_PRIVATE (GtkToggleToolButton));
|
||||
|
||||
static void
|
||||
gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkToolButtonClass *toolbutton_class;
|
||||
|
||||
object_class = (GObjectClass *)klass;
|
||||
toolbutton_class = (GtkToolButtonClass *)klass;
|
||||
|
||||
object_class->set_property = gtk_toggle_tool_button_set_property;
|
||||
object_class->get_property = gtk_toggle_tool_button_get_property;
|
||||
|
||||
toolbutton_class->button_type = GTK_TYPE_TOGGLE_BUTTON;
|
||||
|
||||
/**
|
||||
* GtkToggleToolButton:active:
|
||||
*
|
||||
* If the toggle tool button should be pressed in.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ACTIVE,
|
||||
g_param_spec_boolean ("active",
|
||||
P_("Active"),
|
||||
P_("If the toggle button should be pressed in"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToggleToolButton::toggled:
|
||||
* @toggle_tool_button: the object that emitted the signal
|
||||
*
|
||||
* Emitted whenever the toggle tool button changes state.
|
||||
**/
|
||||
toggle_signals[TOGGLED] =
|
||||
g_signal_new (I_("toggled"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkToggleToolButtonClass, toggled),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toggle_tool_button_init (GtkToggleToolButton *button)
|
||||
{
|
||||
GtkToolButton *tool_button = GTK_TOOL_BUTTON (button);
|
||||
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button));
|
||||
|
||||
button->priv = gtk_toggle_tool_button_get_instance_private (button);
|
||||
|
||||
/* If the real button is a radio button, it may have been
|
||||
* active at the time it was created.
|
||||
*/
|
||||
button->priv->active = gtk_toggle_button_get_active (toggle_button);
|
||||
|
||||
g_signal_connect_object (toggle_button,
|
||||
"toggled", G_CALLBACK (button_toggled), button, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toggle_tool_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
gtk_toggle_tool_button_set_active (button,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toggle_tool_button_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, gtk_toggle_tool_button_get_active (button));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
button_toggled (GtkWidget *widget,
|
||||
GtkToggleToolButton *toggle_tool_button)
|
||||
{
|
||||
gboolean toggle_active;
|
||||
|
||||
toggle_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
||||
|
||||
if (toggle_tool_button->priv->active != toggle_active)
|
||||
{
|
||||
toggle_tool_button->priv->active = toggle_active;
|
||||
|
||||
g_object_notify (G_OBJECT (toggle_tool_button), "active");
|
||||
g_signal_emit (toggle_tool_button, toggle_signals[TOGGLED], 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toggle_tool_button_new:
|
||||
*
|
||||
* Returns a new #GtkToggleToolButton
|
||||
*
|
||||
* Returns: a newly created #GtkToggleToolButton
|
||||
**/
|
||||
GtkToolItem *
|
||||
gtk_toggle_tool_button_new (void)
|
||||
{
|
||||
GtkToolButton *button;
|
||||
|
||||
button = g_object_new (GTK_TYPE_TOGGLE_TOOL_BUTTON,
|
||||
NULL);
|
||||
|
||||
return GTK_TOOL_ITEM (button);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toggle_tool_button_set_active:
|
||||
* @button: a #GtkToggleToolButton
|
||||
* @is_active: whether @button should be active
|
||||
*
|
||||
* Sets the status of the toggle tool button. Set to %TRUE if you
|
||||
* want the GtkToggleButton to be “pressed in”, and %FALSE to raise it.
|
||||
* This action causes the toggled signal to be emitted.
|
||||
**/
|
||||
void
|
||||
gtk_toggle_tool_button_set_active (GtkToggleToolButton *button,
|
||||
gboolean is_active)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOGGLE_TOOL_BUTTON (button));
|
||||
|
||||
is_active = is_active != FALSE;
|
||||
|
||||
if (button->priv->active != is_active)
|
||||
{
|
||||
g_signal_emit_by_name (_gtk_tool_button_get_button (GTK_TOOL_BUTTON (button)), "clicked");
|
||||
g_object_notify (G_OBJECT (button), "active");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toggle_tool_button_get_active:
|
||||
* @button: a #GtkToggleToolButton
|
||||
*
|
||||
* Queries a #GtkToggleToolButton and returns its current state.
|
||||
* Returns %TRUE if the toggle button is pressed in and %FALSE if it is raised.
|
||||
*
|
||||
* Returns: %TRUE if the toggle tool button is pressed in, %FALSE if not
|
||||
**/
|
||||
gboolean
|
||||
gtk_toggle_tool_button_get_active (GtkToggleToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOGGLE_TOOL_BUTTON (button), FALSE);
|
||||
|
||||
return button->priv->active;
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/* gtktoggletoolbutton.h
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOGGLE_TOOL_BUTTON_H__
|
||||
#define __GTK_TOGGLE_TOOL_BUTTON_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtktoolbutton.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_TOGGLE_TOOL_BUTTON (gtk_toggle_tool_button_get_type ())
|
||||
#define GTK_TOGGLE_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOGGLE_TOOL_BUTTON, GtkToggleToolButton))
|
||||
#define GTK_TOGGLE_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_TOOL_BUTTON, GtkToggleToolButtonClass))
|
||||
#define GTK_IS_TOGGLE_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOGGLE_TOOL_BUTTON))
|
||||
#define GTK_IS_TOGGLE_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_TOOL_BUTTON))
|
||||
#define GTK_TOGGLE_TOOL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_TOGGLE_TOOL_BUTTON, GtkToggleToolButtonClass))
|
||||
|
||||
typedef struct _GtkToggleToolButton GtkToggleToolButton;
|
||||
typedef struct _GtkToggleToolButtonClass GtkToggleToolButtonClass;
|
||||
typedef struct _GtkToggleToolButtonPrivate GtkToggleToolButtonPrivate;
|
||||
|
||||
struct _GtkToggleToolButton
|
||||
{
|
||||
GtkToolButton parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkToggleToolButtonPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkToggleToolButtonClass:
|
||||
* @parent_class: The parent class.
|
||||
* @toggled: Signal emitted whenever the toggle tool button changes state.
|
||||
*/
|
||||
struct _GtkToggleToolButtonClass
|
||||
{
|
||||
GtkToolButtonClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
|
||||
/* signal */
|
||||
void (* toggled) (GtkToggleToolButton *button);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_toggle_tool_button_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_toggle_tool_button_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toggle_tool_button_set_active (GtkToggleToolButton *button,
|
||||
gboolean is_active);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_toggle_tool_button_get_active (GtkToggleToolButton *button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOGGLE_TOOL_BUTTON_H__ */
|
2897
gtk/gtktoolbar.c
2897
gtk/gtktoolbar.c
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
* GtkToolbar copyright (C) Federico Mena
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOOLBAR_H__
|
||||
#define __GTK_TOOLBAR_H__
|
||||
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkcontainer.h>
|
||||
#include <gtk/gtktoolitem.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GTK_TYPE_TOOLBAR (gtk_toolbar_get_type ())
|
||||
#define GTK_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOLBAR, GtkToolbar))
|
||||
#define GTK_IS_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOLBAR))
|
||||
|
||||
typedef struct _GtkToolbar GtkToolbar;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_toolbar_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_toolbar_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_insert (GtkToolbar *toolbar,
|
||||
GtkToolItem *item,
|
||||
gint pos);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_toolbar_get_item_index (GtkToolbar *toolbar,
|
||||
GtkToolItem *item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_toolbar_get_n_items (GtkToolbar *toolbar);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
|
||||
gint n);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar,
|
||||
gboolean show_arrow);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_set_style (GtkToolbar *toolbar,
|
||||
GtkToolbarStyle style);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_unset_style (GtkToolbar *toolbar);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar,
|
||||
gint x,
|
||||
gint y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar,
|
||||
GtkToolItem *tool_item,
|
||||
gint index_);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOOLBAR_H__ */
|
@ -1,41 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
* GtkToolbar copyright (C) Federico Mena
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOOLBAR_PRIVATE_H__
|
||||
#define __GTK_TOOLBAR_PRIVATE_H__
|
||||
|
||||
#include <gtk/gtktoolbar.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gchar * _gtk_toolbar_elide_underscores (const gchar *original);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOOLBAR_PRIVATE_H__ */
|
1025
gtk/gtktoolbutton.c
1025
gtk/gtktoolbutton.c
File diff suppressed because it is too large
Load Diff
@ -1,112 +0,0 @@
|
||||
/* gtktoolbutton.h
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOOL_BUTTON_H__
|
||||
#define __GTK_TOOL_BUTTON_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtktoolitem.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_TOOL_BUTTON (gtk_tool_button_get_type ())
|
||||
#define GTK_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOL_BUTTON, GtkToolButton))
|
||||
#define GTK_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOL_BUTTON, GtkToolButtonClass))
|
||||
#define GTK_IS_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOL_BUTTON))
|
||||
#define GTK_IS_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOL_BUTTON))
|
||||
#define GTK_TOOL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_TOOL_BUTTON, GtkToolButtonClass))
|
||||
|
||||
typedef struct _GtkToolButton GtkToolButton;
|
||||
typedef struct _GtkToolButtonClass GtkToolButtonClass;
|
||||
typedef struct _GtkToolButtonPrivate GtkToolButtonPrivate;
|
||||
|
||||
struct _GtkToolButton
|
||||
{
|
||||
GtkToolItem parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkToolButtonPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkToolButtonClass:
|
||||
* @parent_class: The parent class.
|
||||
* @button_type:
|
||||
* @clicked: Signal emitted when the tool button is clicked with the
|
||||
* mouse or activated with the keyboard.
|
||||
*/
|
||||
struct _GtkToolButtonClass
|
||||
{
|
||||
GtkToolItemClass parent_class;
|
||||
|
||||
GType button_type;
|
||||
|
||||
/*< public >*/
|
||||
|
||||
/* signal */
|
||||
void (* clicked) (GtkToolButton *tool_item);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_tool_button_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_tool_button_new (GtkWidget *icon_widget,
|
||||
const gchar *label);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_button_set_label (GtkToolButton *button,
|
||||
const gchar *label);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar * gtk_tool_button_get_label (GtkToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_button_set_use_underline (GtkToolButton *button,
|
||||
gboolean use_underline);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_button_get_use_underline (GtkToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_button_set_icon_name (GtkToolButton *button,
|
||||
const gchar *icon_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar * gtk_tool_button_get_icon_name (GtkToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_button_set_icon_widget (GtkToolButton *button,
|
||||
GtkWidget *icon_widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_tool_button_get_icon_widget (GtkToolButton *button);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_button_set_label_widget (GtkToolButton *button,
|
||||
GtkWidget *label_widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_tool_button_get_label_widget (GtkToolButton *button);
|
||||
|
||||
|
||||
/* internal function */
|
||||
GtkWidget *_gtk_tool_button_get_button (GtkToolButton *button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOOL_BUTTON_H__ */
|
@ -1,822 +0,0 @@
|
||||
/* gtktoolitem.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtktoolitem.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtktoolshell.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtktoolitem
|
||||
* @short_description: The base class of widgets that can be added to GtkToolShell
|
||||
* @Title: GtkToolItem
|
||||
* @see_also: #GtkToolbar, #GtkToolButton, #GtkSeparatorToolItem
|
||||
*
|
||||
* #GtkToolItems are widgets that can appear on a toolbar. To
|
||||
* create a toolbar item that contain something else than a button, use
|
||||
* gtk_tool_item_new(). Use gtk_container_add() to add a child
|
||||
* widget to the tool item.
|
||||
*
|
||||
* For toolbar items that contain buttons, see the #GtkToolButton,
|
||||
* #GtkToggleToolButton and #GtkRadioToolButton classes.
|
||||
*
|
||||
* See the #GtkToolbar class for a description of the toolbar widget, and
|
||||
* #GtkToolShell for a description of the tool shell interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GtkToolItem:
|
||||
*
|
||||
* The GtkToolItem struct contains only private data.
|
||||
* It should only be accessed through the functions described below.
|
||||
*/
|
||||
|
||||
enum {
|
||||
CREATE_MENU_PROXY,
|
||||
TOOLBAR_RECONFIGURED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_VISIBLE_HORIZONTAL,
|
||||
PROP_VISIBLE_VERTICAL,
|
||||
PROP_IS_IMPORTANT,
|
||||
PROP_HOMOGENEOUS,
|
||||
PROP_EXPAND_ITEM,
|
||||
PROP_OVERFLOW_TEXT
|
||||
};
|
||||
|
||||
|
||||
struct _GtkToolItemPrivate
|
||||
{
|
||||
guint visible_horizontal : 1;
|
||||
guint visible_vertical : 1;
|
||||
guint homogeneous : 1;
|
||||
guint expand : 1;
|
||||
guint is_important : 1;
|
||||
|
||||
char *overflow_text;
|
||||
};
|
||||
|
||||
static void gtk_tool_item_finalize (GObject *object);
|
||||
static void gtk_tool_item_parent_cb (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data);
|
||||
static void gtk_tool_item_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_tool_item_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static guint toolitem_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkToolItem, gtk_tool_item, GTK_TYPE_BIN,
|
||||
G_ADD_PRIVATE (GtkToolItem));
|
||||
|
||||
static void
|
||||
gtk_tool_item_class_init (GtkToolItemClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GObjectClass *)klass;
|
||||
widget_class = (GtkWidgetClass *)klass;
|
||||
|
||||
object_class->set_property = gtk_tool_item_set_property;
|
||||
object_class->get_property = gtk_tool_item_get_property;
|
||||
object_class->finalize = gtk_tool_item_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_VISIBLE_HORIZONTAL,
|
||||
g_param_spec_boolean ("visible-horizontal",
|
||||
P_("Visible when horizontal"),
|
||||
P_("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_VISIBLE_VERTICAL,
|
||||
g_param_spec_boolean ("visible-vertical",
|
||||
P_("Visible when vertical"),
|
||||
P_("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_IS_IMPORTANT,
|
||||
g_param_spec_boolean ("is-important",
|
||||
P_("Is important"),
|
||||
P_("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_EXPAND_ITEM,
|
||||
g_param_spec_boolean ("expand-item",
|
||||
P_("Expand Item"),
|
||||
P_("Whether the item should receive extra space when the toolbar grows"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HOMOGENEOUS,
|
||||
g_param_spec_boolean ("homogeneous",
|
||||
P_("Homogeneous"),
|
||||
P_("Whether the item should be the same size as other homogeneous items"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolItem:overflow-text:
|
||||
*
|
||||
* The text to use as label in the overflow menu item for this
|
||||
* toolitem.
|
||||
*
|
||||
* If unset, #GtkToolButton:label is used for #GtkToolButtons.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_OVERFLOW_TEXT,
|
||||
g_param_spec_string ("overflow-text",
|
||||
P_("Overflow text"),
|
||||
P_("Label to use in the overflow menu"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolItem::toolbar-reconfigured:
|
||||
* @tool_item: the object the signal was emitted on
|
||||
*
|
||||
* This signal is emitted when some property of the toolbar that the
|
||||
* item is a child of changes. For custom subclasses of #GtkToolItem,
|
||||
* the default handler of this signal use the functions
|
||||
* - gtk_tool_shell_get_orientation()
|
||||
* - gtk_tool_shell_get_style()
|
||||
* - gtk_tool_shell_get_icon_size()
|
||||
* to find out what the toolbar should look like and change
|
||||
* themselves accordingly.
|
||||
**/
|
||||
toolitem_signals[TOOLBAR_RECONFIGURED] =
|
||||
g_signal_new (I_("toolbar-reconfigured"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkToolItemClass, toolbar_reconfigured),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("toolitem"));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_init (GtkToolItem *toolitem)
|
||||
{
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (toolitem), FALSE);
|
||||
|
||||
toolitem->priv = gtk_tool_item_get_instance_private (toolitem);
|
||||
toolitem->priv->visible_horizontal = TRUE;
|
||||
toolitem->priv->visible_vertical = TRUE;
|
||||
toolitem->priv->homogeneous = FALSE;
|
||||
toolitem->priv->expand = FALSE;
|
||||
|
||||
g_signal_connect (toolitem, "notify::parent", G_CALLBACK (gtk_tool_item_parent_cb), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_finalize (GObject *object)
|
||||
{
|
||||
GtkToolItemPrivate *priv = gtk_tool_item_get_instance_private (GTK_TOOL_ITEM (object));
|
||||
|
||||
g_clear_pointer (&priv->overflow_text, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gtk_tool_item_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_parent_cb (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkToolItem *toolitem = GTK_TOOL_ITEM (object);
|
||||
|
||||
if (gtk_widget_get_parent (GTK_WIDGET (toolitem)) != NULL)
|
||||
gtk_tool_item_toolbar_reconfigured (toolitem);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkToolItem *toolitem = GTK_TOOL_ITEM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VISIBLE_HORIZONTAL:
|
||||
gtk_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_VISIBLE_VERTICAL:
|
||||
gtk_tool_item_set_visible_vertical (toolitem, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_IS_IMPORTANT:
|
||||
gtk_tool_item_set_is_important (toolitem, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_EXPAND_ITEM:
|
||||
gtk_tool_item_set_expand (toolitem, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
gtk_tool_item_set_homogeneous (toolitem, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_OVERFLOW_TEXT:
|
||||
gtk_tool_item_set_overflow_text (toolitem, g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkToolItem *toolitem = GTK_TOOL_ITEM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VISIBLE_HORIZONTAL:
|
||||
g_value_set_boolean (value, toolitem->priv->visible_horizontal);
|
||||
break;
|
||||
case PROP_VISIBLE_VERTICAL:
|
||||
g_value_set_boolean (value, toolitem->priv->visible_vertical);
|
||||
break;
|
||||
case PROP_IS_IMPORTANT:
|
||||
g_value_set_boolean (value, toolitem->priv->is_important);
|
||||
break;
|
||||
case PROP_EXPAND_ITEM:
|
||||
g_value_set_boolean (value, toolitem->priv->expand);
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, toolitem->priv->homogeneous);
|
||||
break;
|
||||
case PROP_OVERFLOW_TEXT:
|
||||
g_value_set_string (value, toolitem->priv->overflow_text);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_new:
|
||||
*
|
||||
* Creates a new #GtkToolItem
|
||||
*
|
||||
* Returns: the new #GtkToolItem
|
||||
**/
|
||||
GtkToolItem *
|
||||
gtk_tool_item_new (void)
|
||||
{
|
||||
GtkToolItem *item;
|
||||
|
||||
item = g_object_new (GTK_TYPE_TOOL_ITEM, NULL);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_ellipsize_mode:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the ellipsize mode used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function to find out how text should
|
||||
* be ellipsized.
|
||||
*
|
||||
* Returns: a #PangoEllipsizeMode indicating how text in @tool_item
|
||||
* should be ellipsized.
|
||||
**/
|
||||
PangoEllipsizeMode
|
||||
gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), PANGO_ELLIPSIZE_NONE);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return PANGO_ELLIPSIZE_NONE;
|
||||
|
||||
return gtk_tool_shell_get_ellipsize_mode (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_orientation:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the orientation used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function to find out what size icons
|
||||
* they should use.
|
||||
*
|
||||
* Returns: a #GtkOrientation indicating the orientation
|
||||
* used for @tool_item
|
||||
**/
|
||||
GtkOrientation
|
||||
gtk_tool_item_get_orientation (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
return gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_toolbar_style:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the toolbar style used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function in the handler of the
|
||||
* GtkToolItem::toolbar_reconfigured signal to find out in what style
|
||||
* the toolbar is displayed and change themselves accordingly
|
||||
*
|
||||
* Possibilities are:
|
||||
* - %GTK_TOOLBAR_BOTH, meaning the tool item should show
|
||||
* both an icon and a label, stacked vertically
|
||||
* - %GTK_TOOLBAR_ICONS, meaning the toolbar shows only icons
|
||||
* - %GTK_TOOLBAR_TEXT, meaning the tool item should only show text
|
||||
* - %GTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show
|
||||
* both an icon and a label, arranged horizontally
|
||||
*
|
||||
* Returns: A #GtkToolbarStyle indicating the toolbar style used
|
||||
* for @tool_item.
|
||||
**/
|
||||
GtkToolbarStyle
|
||||
gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return GTK_TOOLBAR_ICONS;
|
||||
|
||||
return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_text_alignment:
|
||||
* @tool_item: a #GtkToolItem:
|
||||
*
|
||||
* Returns the text alignment used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function to find out how text should
|
||||
* be aligned.
|
||||
*
|
||||
* Returns: a #gfloat indicating the horizontal text alignment
|
||||
* used for @tool_item
|
||||
**/
|
||||
gfloat
|
||||
gtk_tool_item_get_text_alignment (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return 0.5;
|
||||
|
||||
return gtk_tool_shell_get_text_alignment (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_text_orientation:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the text orientation used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function to find out how text should
|
||||
* be orientated.
|
||||
*
|
||||
* Returns: a #GtkOrientation indicating the text orientation
|
||||
* used for @tool_item
|
||||
*/
|
||||
GtkOrientation
|
||||
gtk_tool_item_get_text_orientation (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
return gtk_tool_shell_get_text_orientation (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_text_size_group:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the size group used for labels in @tool_item.
|
||||
* Custom subclasses of #GtkToolItem should call this function
|
||||
* and use the size group for labels.
|
||||
*
|
||||
* Returns: (transfer none): a #GtkSizeGroup
|
||||
*/
|
||||
GtkSizeGroup *
|
||||
gtk_tool_item_get_text_size_group (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return NULL;
|
||||
|
||||
return gtk_tool_shell_get_text_size_group (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_expand:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @expand: Whether @tool_item is allocated extra space
|
||||
*
|
||||
* Sets whether @tool_item is allocated extra space when there
|
||||
* is more room on the toolbar then needed for the items. The
|
||||
* effect is that the item gets bigger when the toolbar gets bigger
|
||||
* and smaller when the toolbar gets smaller.
|
||||
*/
|
||||
void
|
||||
gtk_tool_item_set_expand (GtkToolItem *tool_item,
|
||||
gboolean expand)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
expand = expand != FALSE;
|
||||
|
||||
if (tool_item->priv->expand != expand)
|
||||
{
|
||||
tool_item->priv->expand = expand;
|
||||
g_object_notify (G_OBJECT (tool_item), "expand-item");
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_expand:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns whether @tool_item is allocated extra space.
|
||||
* See gtk_tool_item_set_expand().
|
||||
*
|
||||
* Returns: %TRUE if @tool_item is allocated extra space.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tool_item_get_expand (GtkToolItem *tool_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
||||
|
||||
return tool_item->priv->expand;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_homogeneous:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @homogeneous: whether @tool_item is the same size as other homogeneous items
|
||||
*
|
||||
* Sets whether @tool_item is to be allocated the same size as other
|
||||
* homogeneous items. The effect is that all homogeneous items will have
|
||||
* the same width as the widest of the items.
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
|
||||
gboolean homogeneous)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
homogeneous = homogeneous != FALSE;
|
||||
|
||||
if (tool_item->priv->homogeneous != homogeneous)
|
||||
{
|
||||
tool_item->priv->homogeneous = homogeneous;
|
||||
g_object_notify (G_OBJECT (tool_item), "homogeneous");
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_homogeneous:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns whether @tool_item is the same size as other homogeneous
|
||||
* items. See gtk_tool_item_set_homogeneous().
|
||||
*
|
||||
* Returns: %TRUE if the item is the same size as other homogeneous
|
||||
* items.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tool_item_get_homogeneous (GtkToolItem *tool_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
||||
|
||||
return tool_item->priv->homogeneous;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_is_important:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns whether @tool_item is considered important. See
|
||||
* gtk_tool_item_set_is_important()
|
||||
*
|
||||
* Returns: %TRUE if @tool_item is considered important.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tool_item_get_is_important (GtkToolItem *tool_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
||||
|
||||
return tool_item->priv->is_important;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_is_important:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @is_important: whether the tool item should be considered important
|
||||
*
|
||||
* Sets whether @tool_item should be considered important. The #GtkToolButton
|
||||
* class uses this property to determine whether to show or hide its label
|
||||
* when the toolbar style is %GTK_TOOLBAR_BOTH_HORIZ. The result is that
|
||||
* only tool buttons with the “is_important” property set have labels, an
|
||||
* effect known as “priority text”
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_is_important (GtkToolItem *tool_item, gboolean is_important)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
is_important = is_important != FALSE;
|
||||
|
||||
if (is_important != tool_item->priv->is_important)
|
||||
{
|
||||
tool_item->priv->is_important = is_important;
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
||||
|
||||
g_object_notify (G_OBJECT (tool_item), "is-important");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_tooltip_text:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @text: text to be used as tooltip for @tool_item
|
||||
*
|
||||
* Sets the text to be displayed as tooltip on the item.
|
||||
* See gtk_widget_set_tooltip_text().
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_tooltip_text (GtkToolItem *tool_item,
|
||||
const gchar *text)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (tool_item));
|
||||
if (child)
|
||||
gtk_widget_set_tooltip_text (child, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_tooltip_markup:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @markup: markup text to be used as tooltip for @tool_item
|
||||
*
|
||||
* Sets the markup text to be displayed as tooltip on the item.
|
||||
* See gtk_widget_set_tooltip_markup().
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
|
||||
const gchar *markup)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (tool_item));
|
||||
if (child)
|
||||
gtk_widget_set_tooltip_markup (child, markup);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_visible_horizontal:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @visible_horizontal: Whether @tool_item is visible when in horizontal mode
|
||||
*
|
||||
* Sets whether @tool_item is visible when the toolbar is docked horizontally.
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_visible_horizontal (GtkToolItem *toolitem,
|
||||
gboolean visible_horizontal)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
|
||||
|
||||
visible_horizontal = visible_horizontal != FALSE;
|
||||
|
||||
if (toolitem->priv->visible_horizontal != visible_horizontal)
|
||||
{
|
||||
toolitem->priv->visible_horizontal = visible_horizontal;
|
||||
|
||||
g_object_notify (G_OBJECT (toolitem), "visible-horizontal");
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (toolitem));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_visible_horizontal:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns whether the @tool_item is visible on toolbars that are
|
||||
* docked horizontally.
|
||||
*
|
||||
* Returns: %TRUE if @tool_item is visible on toolbars that are
|
||||
* docked horizontally.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tool_item_get_visible_horizontal (GtkToolItem *toolitem)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
|
||||
|
||||
return toolitem->priv->visible_horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_visible_vertical:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @visible_vertical: whether @tool_item is visible when the toolbar
|
||||
* is in vertical mode
|
||||
*
|
||||
* Sets whether @tool_item is visible when the toolbar is docked
|
||||
* vertically. Some tool items, such as text entries, are too wide to be
|
||||
* useful on a vertically docked toolbar. If @visible_vertical is %FALSE
|
||||
* @tool_item will not appear on toolbars that are docked vertically.
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_set_visible_vertical (GtkToolItem *toolitem,
|
||||
gboolean visible_vertical)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
|
||||
|
||||
visible_vertical = visible_vertical != FALSE;
|
||||
|
||||
if (toolitem->priv->visible_vertical != visible_vertical)
|
||||
{
|
||||
toolitem->priv->visible_vertical = visible_vertical;
|
||||
|
||||
g_object_notify (G_OBJECT (toolitem), "visible-vertical");
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (toolitem));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_visible_vertical:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns whether @tool_item is visible when the toolbar is docked vertically.
|
||||
* See gtk_tool_item_set_visible_vertical().
|
||||
*
|
||||
* Returns: Whether @tool_item is visible when the toolbar is docked vertically
|
||||
**/
|
||||
gboolean
|
||||
gtk_tool_item_get_visible_vertical (GtkToolItem *toolitem)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
|
||||
|
||||
return toolitem->priv->visible_vertical;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_rebuild_menu:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Calling this function signals to the toolbar that the
|
||||
* overflow menu item for @tool_item has changed. If the
|
||||
* overflow menu is visible when this function it called,
|
||||
* the menu will be rebuilt.
|
||||
*
|
||||
* The function must be called when the tool item changes what it
|
||||
* will do in response to the #GtkToolItem::create-menu-proxy signal.
|
||||
*/
|
||||
void
|
||||
gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
widget = GTK_WIDGET (tool_item);
|
||||
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (GTK_IS_TOOL_SHELL (parent))
|
||||
gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_toolbar_reconfigured:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Emits the signal #GtkToolItem::toolbar_reconfigured on @tool_item.
|
||||
* #GtkToolbar and other #GtkToolShell implementations use this function
|
||||
* to notify children, when some aspect of their configuration changes.
|
||||
**/
|
||||
void
|
||||
gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
|
||||
{
|
||||
/* The slightely inaccurate name "gtk_tool_item_toolbar_reconfigured" was
|
||||
* choosen over "gtk_tool_item_tool_shell_reconfigured", since the function
|
||||
* emits the "toolbar-reconfigured" signal, not "tool-shell-reconfigured".
|
||||
* It's not possible to rename the signal, and emitting another name than
|
||||
* indicated by the function name would be quite confusing. That's the
|
||||
* price of providing stable APIs.
|
||||
*/
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
g_signal_emit (tool_item, toolitem_signals[TOOLBAR_RECONFIGURED], 0);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_set_overflow_text:
|
||||
* @tool_item: a #GtkToolItem
|
||||
* @overflow_text: (nullable): Label to use in the overflow menu
|
||||
*
|
||||
* Sets the label to use for @tool_item in the overflow menu.
|
||||
*/
|
||||
void
|
||||
gtk_tool_item_set_overflow_text (GtkToolItem *tool_item,
|
||||
const char *overflow_text)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
||||
|
||||
g_free (tool_item->priv->overflow_text);
|
||||
tool_item->priv->overflow_text = g_strdup (overflow_text);
|
||||
|
||||
g_object_notify (G_OBJECT (tool_item), "overflow-text");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_overflow_text:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Gets the label that is used for @tool_item in the overflow menu.
|
||||
*
|
||||
* Return: the overflow menu label for @tool_item
|
||||
*/
|
||||
const char *
|
||||
gtk_tool_item_get_overflow_text (GtkToolItem *tool_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
|
||||
|
||||
return tool_item->priv->overflow_text;
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
/* gtktoolitem.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOOL_ITEM_H__
|
||||
#define __GTK_TOOL_ITEM_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkbin.h>
|
||||
#include <gtk/gtksizegroup.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_TOOL_ITEM (gtk_tool_item_get_type ())
|
||||
#define GTK_TOOL_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_TOOL_ITEM, GtkToolItem))
|
||||
#define GTK_TOOL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOL_ITEM, GtkToolItemClass))
|
||||
#define GTK_IS_TOOL_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_TOOL_ITEM))
|
||||
#define GTK_IS_TOOL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOL_ITEM))
|
||||
#define GTK_TOOL_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GTK_TYPE_TOOL_ITEM, GtkToolItemClass))
|
||||
|
||||
typedef struct _GtkToolItem GtkToolItem;
|
||||
typedef struct _GtkToolItemClass GtkToolItemClass;
|
||||
typedef struct _GtkToolItemPrivate GtkToolItemPrivate;
|
||||
|
||||
struct _GtkToolItem
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkToolItemPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkToolItemClass:
|
||||
* @parent_class: The parent class.
|
||||
* @toolbar_reconfigured: Signal emitted when some property of the
|
||||
* toolbar that the item is a child of changes.
|
||||
*/
|
||||
struct _GtkToolItemClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* toolbar_reconfigured) (GtkToolItem *tool_item);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_tool_item_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolItem *gtk_tool_item_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
|
||||
gboolean homogeneous);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_item_get_homogeneous (GtkToolItem *tool_item);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_expand (GtkToolItem *tool_item,
|
||||
gboolean expand);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_item_get_expand (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_tooltip_text (GtkToolItem *tool_item,
|
||||
const gchar *text);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
|
||||
const gchar *markup);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_visible_horizontal (GtkToolItem *tool_item,
|
||||
gboolean visible_horizontal);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_item_get_visible_horizontal (GtkToolItem *tool_item);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_visible_vertical (GtkToolItem *tool_item,
|
||||
gboolean visible_vertical);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_item_get_visible_vertical (GtkToolItem *tool_item);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_item_get_is_important (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_is_important (GtkToolItem *tool_item,
|
||||
gboolean is_important);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoEllipsizeMode gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_item_get_orientation (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolbarStyle gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gfloat gtk_tool_item_get_text_alignment (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_item_get_text_orientation (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSizeGroup * gtk_tool_item_get_text_size_group (GtkToolItem *tool_item);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char * gtk_tool_item_get_overflow_text (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_set_overflow_text (GtkToolItem *tool_item,
|
||||
const char *overflow_text);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_rebuild_menu (GtkToolItem *tool_item);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item);
|
||||
|
||||
/* private */
|
||||
|
||||
gboolean _gtk_tool_item_create_menu_proxy (GtkToolItem *tool_item);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOOL_ITEM_H__ */
|
@ -1,203 +0,0 @@
|
||||
/* gtktoolshell.c
|
||||
* Copyright (C) 2007 Openismus GmbH
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Mathias Hasselmann
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gtktoolshell.h"
|
||||
#include "gtkwidget.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktoolshell
|
||||
* @Short_description: Interface for containers containing GtkToolItem widgets
|
||||
* @Title: GtkToolShell
|
||||
* @see_also: #GtkToolbar, #GtkToolItem
|
||||
*
|
||||
* The #GtkToolShell interface allows container widgets to provide additional
|
||||
* information when embedding #GtkToolItem widgets.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GtkToolShell:
|
||||
*
|
||||
* Dummy structure for accessing instances of #GtkToolShellIface.
|
||||
*/
|
||||
|
||||
|
||||
typedef GtkToolShellIface GtkToolShellInterface;
|
||||
G_DEFINE_INTERFACE (GtkToolShell, gtk_tool_shell, GTK_TYPE_WIDGET);
|
||||
|
||||
static GtkOrientation gtk_tool_shell_real_get_text_orientation (GtkToolShell *shell);
|
||||
static gfloat gtk_tool_shell_real_get_text_alignment (GtkToolShell *shell);
|
||||
static PangoEllipsizeMode gtk_tool_shell_real_get_ellipsize_mode (GtkToolShell *shell);
|
||||
|
||||
static void
|
||||
gtk_tool_shell_default_init (GtkToolShellInterface *iface)
|
||||
{
|
||||
iface->get_text_orientation = gtk_tool_shell_real_get_text_orientation;
|
||||
iface->get_text_alignment = gtk_tool_shell_real_get_text_alignment;
|
||||
iface->get_ellipsize_mode = gtk_tool_shell_real_get_ellipsize_mode;
|
||||
}
|
||||
|
||||
static GtkOrientation
|
||||
gtk_tool_shell_real_get_text_orientation (GtkToolShell *shell)
|
||||
{
|
||||
return GTK_ORIENTATION_HORIZONTAL;
|
||||
}
|
||||
|
||||
static gfloat
|
||||
gtk_tool_shell_real_get_text_alignment (GtkToolShell *shell)
|
||||
{
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
static PangoEllipsizeMode
|
||||
gtk_tool_shell_real_get_ellipsize_mode (GtkToolShell *shell)
|
||||
{
|
||||
return PANGO_ELLIPSIZE_NONE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_orientation:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the current orientation for the tool shell. Tool items must not
|
||||
* call this function directly, but rely on gtk_tool_item_get_orientation()
|
||||
* instead.
|
||||
*
|
||||
* Returns: the current orientation of @shell
|
||||
**/
|
||||
GtkOrientation
|
||||
gtk_tool_shell_get_orientation (GtkToolShell *shell)
|
||||
{
|
||||
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_orientation (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_style:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves whether the tool shell has text, icons, or both. Tool items must
|
||||
* not call this function directly, but rely on gtk_tool_item_get_toolbar_style()
|
||||
* instead.
|
||||
*
|
||||
* Returns: the current style of @shell
|
||||
**/
|
||||
GtkToolbarStyle
|
||||
gtk_tool_shell_get_style (GtkToolShell *shell)
|
||||
{
|
||||
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_style (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_rebuild_menu:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Calling this function signals the tool shell that the overflow menu item for
|
||||
* tool items have changed. If there is an overflow menu and if it is visible
|
||||
* when this function it called, the menu will be rebuilt.
|
||||
*
|
||||
* Tool items must not call this function directly, but rely on
|
||||
* gtk_tool_item_rebuild_menu() instead.
|
||||
**/
|
||||
void
|
||||
gtk_tool_shell_rebuild_menu (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
||||
|
||||
if (iface->rebuild_menu)
|
||||
iface->rebuild_menu (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_text_orientation:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the current text orientation for the tool shell. Tool items must not
|
||||
* call this function directly, but rely on gtk_tool_item_get_text_orientation()
|
||||
* instead.
|
||||
*
|
||||
* Returns: the current text orientation of @shell
|
||||
**/
|
||||
GtkOrientation
|
||||
gtk_tool_shell_get_text_orientation (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
||||
|
||||
return iface->get_text_orientation (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_text_alignment:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the current text alignment for the tool shell. Tool items must not
|
||||
* call this function directly, but rely on gtk_tool_item_get_text_alignment()
|
||||
* instead.
|
||||
*
|
||||
* Returns: the current text alignment of @shell
|
||||
**/
|
||||
gfloat
|
||||
gtk_tool_shell_get_text_alignment (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
||||
|
||||
return iface->get_text_alignment (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_ellipsize_mode:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the current ellipsize mode for the tool shell. Tool items must not
|
||||
* call this function directly, but rely on gtk_tool_item_get_ellipsize_mode()
|
||||
* instead.
|
||||
*
|
||||
* Returns: the current ellipsize mode of @shell
|
||||
**/
|
||||
PangoEllipsizeMode
|
||||
gtk_tool_shell_get_ellipsize_mode (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
||||
|
||||
return iface->get_ellipsize_mode (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_text_size_group:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the current text size group for the tool shell. Tool items must not
|
||||
* call this function directly, but rely on gtk_tool_item_get_text_size_group()
|
||||
* instead.
|
||||
*
|
||||
* Returns: (transfer none): the current text size group of @shell
|
||||
**/
|
||||
GtkSizeGroup *
|
||||
gtk_tool_shell_get_text_size_group (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
||||
|
||||
if (iface->get_text_size_group)
|
||||
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_size_group (shell);
|
||||
|
||||
return NULL;
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2007 Openismus GmbH
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Mathias Hasselmann
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TOOL_SHELL_H__
|
||||
#define __GTK_TOOL_SHELL_H__
|
||||
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkenums.h>
|
||||
#include <pango/pango.h>
|
||||
#include <gtk/gtksizegroup.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_TOOL_SHELL (gtk_tool_shell_get_type ())
|
||||
#define GTK_TOOL_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOL_SHELL, GtkToolShell))
|
||||
#define GTK_IS_TOOL_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOL_SHELL))
|
||||
#define GTK_TOOL_SHELL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TOOL_SHELL, GtkToolShellIface))
|
||||
|
||||
typedef struct _GtkToolShell GtkToolShell; /* dummy typedef */
|
||||
typedef struct _GtkToolShellIface GtkToolShellIface;
|
||||
|
||||
/**
|
||||
* GtkToolShellIface:
|
||||
* @get_orientation: mandatory implementation of gtk_tool_shell_get_orientation().
|
||||
* @get_style: mandatory implementation of gtk_tool_shell_get_style().
|
||||
* @rebuild_menu: optional implementation of gtk_tool_shell_rebuild_menu().
|
||||
* @get_text_orientation: optional implementation of gtk_tool_shell_get_text_orientation().
|
||||
* @get_text_alignment: optional implementation of gtk_tool_shell_get_text_alignment().
|
||||
* @get_ellipsize_mode: optional implementation of gtk_tool_shell_get_ellipsize_mode().
|
||||
* @get_text_size_group: optional implementation of gtk_tool_shell_get_text_size_group().
|
||||
*
|
||||
* Virtual function table for the #GtkToolShell interface.
|
||||
*/
|
||||
struct _GtkToolShellIface
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/*< public >*/
|
||||
GtkOrientation (*get_orientation) (GtkToolShell *shell);
|
||||
GtkToolbarStyle (*get_style) (GtkToolShell *shell);
|
||||
void (*rebuild_menu) (GtkToolShell *shell);
|
||||
GtkOrientation (*get_text_orientation) (GtkToolShell *shell);
|
||||
gfloat (*get_text_alignment) (GtkToolShell *shell);
|
||||
PangoEllipsizeMode (*get_ellipsize_mode) (GtkToolShell *shell);
|
||||
GtkSizeGroup * (*get_text_size_group) (GtkToolShell *shell);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_tool_shell_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_shell_get_orientation (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolbarStyle gtk_tool_shell_get_style (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_shell_rebuild_menu (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_shell_get_text_orientation (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gfloat gtk_tool_shell_get_text_alignment (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoEllipsizeMode gtk_tool_shell_get_ellipsize_mode (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSizeGroup * gtk_tool_shell_get_text_size_group (GtkToolShell *shell);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TOOL_SHELL_H__ */
|
@ -278,7 +278,6 @@ gtk_public_sources = files([
|
||||
'gtkmediafile.c',
|
||||
'gtkmediastream.c',
|
||||
'gtkmenubutton.c',
|
||||
'gtkmenutoolbutton.c',
|
||||
'gtkmessagedialog.c',
|
||||
'gtkmodelbutton.c',
|
||||
'gtkmodules.c',
|
||||
@ -306,7 +305,6 @@ gtk_public_sources = files([
|
||||
'gtkprogressbar.c',
|
||||
'gtkpropertylookuplistmodel.c',
|
||||
'gtkradiobutton.c',
|
||||
'gtkradiotoolbutton.c',
|
||||
'gtkrange.c',
|
||||
'gtktreerbtree.c',
|
||||
'gtkrecentmanager.c',
|
||||
@ -329,7 +327,6 @@ gtk_public_sources = files([
|
||||
'gtkselection.c',
|
||||
'gtkselectionmodel.c',
|
||||
'gtkseparator.c',
|
||||
'gtkseparatortoolitem.c',
|
||||
'gtksettings.c',
|
||||
'gtkshortcutlabel.c',
|
||||
'gtkshortcutsgroup.c',
|
||||
@ -370,11 +367,6 @@ gtk_public_sources = files([
|
||||
'gtktextutil.c',
|
||||
'gtktextview.c',
|
||||
'gtktogglebutton.c',
|
||||
'gtktoggletoolbutton.c',
|
||||
'gtktoolbar.c',
|
||||
'gtktoolbutton.c',
|
||||
'gtktoolitem.c',
|
||||
'gtktoolshell.c',
|
||||
'gtktooltip.c',
|
||||
'gtktooltipwindow.c',
|
||||
'gtktreednd.c',
|
||||
@ -531,7 +523,6 @@ gtk_public_headers = files([
|
||||
'gtkmediafile.h',
|
||||
'gtkmediastream.h',
|
||||
'gtkmenubutton.h',
|
||||
'gtkmenutoolbutton.h',
|
||||
'gtkmessagedialog.h',
|
||||
'gtkmountoperation.h',
|
||||
'gtknative.h',
|
||||
@ -555,7 +546,6 @@ gtk_public_headers = files([
|
||||
'gtkprintsettings.h',
|
||||
'gtkprogressbar.h',
|
||||
'gtkradiobutton.h',
|
||||
'gtkradiotoolbutton.h',
|
||||
'gtkrange.h',
|
||||
'gtkrecentmanager.h',
|
||||
'gtkrender.h',
|
||||
@ -571,7 +561,6 @@ gtk_public_headers = files([
|
||||
'gtkselection.h',
|
||||
'gtkselectionmodel.h',
|
||||
'gtkseparator.h',
|
||||
'gtkseparatortoolitem.h',
|
||||
'gtksettings.h',
|
||||
'gtkshortcutlabel.h',
|
||||
'gtkshortcutsgroup.h',
|
||||
@ -604,11 +593,6 @@ gtk_public_headers = files([
|
||||
'gtktexttagtable.h',
|
||||
'gtktextview.h',
|
||||
'gtktogglebutton.h',
|
||||
'gtktoggletoolbutton.h',
|
||||
'gtktoolbar.h',
|
||||
'gtktoolbutton.h',
|
||||
'gtktoolitem.h',
|
||||
'gtktoolshell.h',
|
||||
'gtktooltip.h',
|
||||
'gtktreednd.h',
|
||||
'gtktreelistmodel.h',
|
||||
|
@ -825,11 +825,6 @@ button {
|
||||
> box > box > label { font-weight: bold; }
|
||||
}
|
||||
|
||||
// inline-toolbar buttons
|
||||
.inline-toolbar & { @extend %linked; }
|
||||
|
||||
.primary-toolbar & { -gtk-icon-shadow: none; } // tango icons don't need shadows
|
||||
|
||||
.linked:not(.vertical) > & { @extend %linked; }
|
||||
|
||||
.linked.vertical > & { @extend %linked_vertical; }
|
||||
@ -867,52 +862,6 @@ button {
|
||||
}
|
||||
|
||||
|
||||
// all the following is for the +|- buttons on inline toolbars, that way
|
||||
// should really be deprecated...
|
||||
.inline-toolbar toolbutton > button { // redefining the button look is
|
||||
// needed since those are flat...
|
||||
@include button(normal);
|
||||
|
||||
&:hover { @include button(hover); }
|
||||
|
||||
&:active,
|
||||
&:checked{ @include button(active); }
|
||||
|
||||
&:disabled {
|
||||
@include button(insensitive);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(insensitive-active); }
|
||||
}
|
||||
|
||||
&:backdrop {
|
||||
@include button(backdrop);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(backdrop-active); }
|
||||
|
||||
&:disabled {
|
||||
@include button(backdrop-insensitive);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(backdrop-insensitive-active); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// More inline toolbar buttons
|
||||
toolbar.inline-toolbar toolbutton {
|
||||
&:dir(ltr) {
|
||||
&:not(:first-child) > button.flat { @extend %linked_not_left; }
|
||||
&:not(:last-child) > button.flat { @extend %linked_not_right; }
|
||||
}
|
||||
|
||||
&:dir(rtl) {
|
||||
&:not(:first-child) > button.flat { @extend %linked_not_right; }
|
||||
&:not(:last-child) > button.flat { @extend %linked_not_left; }
|
||||
}
|
||||
}
|
||||
|
||||
%linked_not_left {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
@ -1384,29 +1333,9 @@ toolbar {
|
||||
// toolbar separators
|
||||
&.horizontal separator { margin: 0 7px 1px 6px; }
|
||||
&.vertical separator { margin: 6px 1px 7px 0; }
|
||||
|
||||
&:not(.inline-toolbar):not(.osd) {
|
||||
// workaround: add margins to the children of tool items to simulate
|
||||
// spacing, ignore the overflow button (.toggle) and the overflow menu
|
||||
// (.popup)
|
||||
> *:not(.toggle):not(.popup) > * {
|
||||
margin-right: 1px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//searchbar, location-bar & inline-toolbar
|
||||
.inline-toolbar {
|
||||
@extend %toolbar;
|
||||
|
||||
@extend %darkbar;
|
||||
|
||||
padding: 3px;
|
||||
border-width: 0 1px 1px;
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
//searchbar & location-bar
|
||||
searchbar {
|
||||
padding: 0px;
|
||||
>revealer>box {
|
||||
|
@ -686,11 +686,6 @@ button {
|
||||
}
|
||||
}
|
||||
|
||||
//inline-toolbar buttons
|
||||
.inline-toolbar & { @extend %linked; }
|
||||
|
||||
.primary-toolbar & { -gtk-icon-shadow: none; } // tango icons don't need shadows
|
||||
|
||||
.linked:not(.vertical) > & { @extend %linked; }
|
||||
|
||||
.linked.vertical > & { @extend %linked_vertical; }
|
||||
@ -710,52 +705,6 @@ button {
|
||||
}
|
||||
|
||||
|
||||
// all the following is for the +|- buttons on inline toolbars, that way
|
||||
// should really be deprecated...
|
||||
.inline-toolbar toolbutton > button { // redefining the button look is
|
||||
// needed since those are flat...
|
||||
@include button(normal);
|
||||
|
||||
&:hover { @include button(hover); }
|
||||
|
||||
&:active,
|
||||
&:checked{ @include button(active); }
|
||||
|
||||
&:disabled {
|
||||
@include button(insensitive);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(insensitive-active); }
|
||||
}
|
||||
|
||||
&:backdrop {
|
||||
@include button(backdrop);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(backdrop-active); }
|
||||
|
||||
&:disabled {
|
||||
@include button(backdrop-insensitive);
|
||||
|
||||
&:active,
|
||||
&:checked { @include button(backdrop-insensitive-active); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// More inline toolbar buttons
|
||||
toolbar.inline-toolbar toolbutton {
|
||||
&:dir(ltr) {
|
||||
&:not(:first-child) > button.flat { @extend %linked_not_left; }
|
||||
&:not(:last-child) > button.flat { @extend %linked_not_right; }
|
||||
}
|
||||
|
||||
&:dir(rtl) {
|
||||
&:not(:first-child) > button.flat { @extend %linked_not_right; }
|
||||
&:not(:last-child) > button.flat { @extend %linked_not_left; }
|
||||
}
|
||||
}
|
||||
|
||||
%linked_not_left {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
@ -1155,13 +1104,7 @@ toolbar { //FIXME: why is all this being ignored?
|
||||
padding: 12px;
|
||||
& label { color: $osd_fg_color; }
|
||||
}
|
||||
//searchbar & inline-toolbar
|
||||
&.inline-toolbar {
|
||||
@extend %inset-bar;
|
||||
border-width: 0 1px 1px;
|
||||
padding: 3px;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
//searchbar
|
||||
&.vertical {
|
||||
border-right: 1px solid $borders_color;
|
||||
&:dir(rtl) {
|
||||
|
@ -353,9 +353,6 @@ testsuite/tools/simplify-data-3to4/notebook.ui
|
||||
testsuite/tools/simplify-data-3to4/office-runner.ui
|
||||
testsuite/tools/simplify-data-3to4/stack.ui
|
||||
testsuite/tools/simplify-data/test3.ui
|
||||
tests/visuals/inline-toolbar-horizontal.ui
|
||||
tests/visuals/inline-toolbar-vertical.ui
|
||||
tests/visuals/linked-buttons-horizontal.ui
|
||||
tests/visuals/linked-buttons-vertical.ui
|
||||
tests/visuals/primary-toolbar.ui
|
||||
tests/visuals/suggested-action-buttons.ui
|
||||
|
@ -313,9 +313,6 @@ testsuite/tools/simplify-data-3to4/notebook.ui
|
||||
testsuite/tools/simplify-data-3to4/office-runner.ui
|
||||
testsuite/tools/simplify-data-3to4/stack.ui
|
||||
testsuite/tools/simplify-data/test3.ui
|
||||
tests/visuals/inline-toolbar-horizontal.ui
|
||||
tests/visuals/inline-toolbar-vertical.ui
|
||||
tests/visuals/linked-buttons-horizontal.ui
|
||||
tests/visuals/linked-buttons-vertical.ui
|
||||
tests/visuals/primary-toolbar.ui
|
||||
tests/visuals/suggested-action-buttons.ui
|
||||
|
@ -73,9 +73,7 @@ gtk_tests = [
|
||||
['testscale'],
|
||||
['testselectionmode'],
|
||||
['testspinbutton'],
|
||||
['testtoolbar'],
|
||||
['testtoolbar2'],
|
||||
['stresstest-toolbar'],
|
||||
['testtreechanging'],
|
||||
['testtreednd'],
|
||||
['testtreeedit'],
|
||||
|
@ -1,157 +0,0 @@
|
||||
/* stresstest-toolbar.c
|
||||
*
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef struct _Info Info;
|
||||
struct _Info
|
||||
{
|
||||
GtkWindow *window;
|
||||
GtkToolbar *toolbar;
|
||||
gint counter;
|
||||
};
|
||||
|
||||
static void
|
||||
add_random (GtkToolbar *toolbar, gint n)
|
||||
{
|
||||
gint n_items;
|
||||
gint position;
|
||||
gchar *label = g_strdup_printf ("Button %d", n);
|
||||
|
||||
GtkToolItem *toolitem = gtk_tool_button_new (NULL, label);
|
||||
gtk_tool_item_set_tooltip_text (toolitem, "Bar");
|
||||
|
||||
g_free (label);
|
||||
|
||||
n_items = gtk_toolbar_get_n_items (toolbar);
|
||||
if (n_items == 0)
|
||||
position = 0;
|
||||
else
|
||||
position = g_random_int_range (0, n_items);
|
||||
|
||||
gtk_toolbar_insert (toolbar, toolitem, position);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_random (GtkToolbar *toolbar)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
gint n_items;
|
||||
gint position;
|
||||
|
||||
n_items = gtk_toolbar_get_n_items (toolbar);
|
||||
|
||||
if (n_items == 0)
|
||||
return;
|
||||
|
||||
position = g_random_int_range (0, n_items);
|
||||
|
||||
tool_item = gtk_toolbar_get_nth_item (toolbar, position);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (toolbar),
|
||||
GTK_WIDGET (tool_item));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
stress_test_old_api (gpointer data)
|
||||
{
|
||||
typedef enum {
|
||||
ADD_RANDOM,
|
||||
REMOVE_RANDOM,
|
||||
LAST_ACTION
|
||||
} Action;
|
||||
|
||||
Info *info = data;
|
||||
Action action;
|
||||
gint n_items;
|
||||
|
||||
if (info->counter++ == 200)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->toolbar)
|
||||
{
|
||||
info->toolbar = GTK_TOOLBAR (gtk_toolbar_new ());
|
||||
gtk_container_add (GTK_CONTAINER (info->window),
|
||||
GTK_WIDGET (info->toolbar));
|
||||
gtk_widget_show (GTK_WIDGET (info->toolbar));
|
||||
}
|
||||
|
||||
n_items = gtk_toolbar_get_n_items (info->toolbar);
|
||||
if (n_items == 0)
|
||||
{
|
||||
add_random (info->toolbar, info->counter);
|
||||
return TRUE;
|
||||
}
|
||||
else if (n_items > 50)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 25; i++)
|
||||
remove_random (info->toolbar);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
action = g_random_int_range (0, LAST_ACTION);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case ADD_RANDOM:
|
||||
add_random (info->toolbar, info->counter);
|
||||
break;
|
||||
|
||||
case REMOVE_RANDOM:
|
||||
remove_random (info->toolbar);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
main (gint argc, gchar **argv)
|
||||
{
|
||||
Info info;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
info.toolbar = NULL;
|
||||
info.counter = 0;
|
||||
info.window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (info.window));
|
||||
|
||||
g_idle_add (stress_test_old_api, &info);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (info.window));
|
||||
|
||||
gtk_main ();
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (info.window));
|
||||
|
||||
info.toolbar = NULL;
|
||||
info.window = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,642 +0,0 @@
|
||||
/* testtoolbar.c
|
||||
*
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
|
||||
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
||||
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
change_orientation (GtkWidget *button, GtkWidget *toolbar)
|
||||
{
|
||||
GtkWidget *grid;
|
||||
GtkOrientation orientation;
|
||||
|
||||
grid = gtk_widget_get_parent (toolbar);
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
|
||||
orientation = GTK_ORIENTATION_VERTICAL;
|
||||
else
|
||||
orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
g_object_ref (toolbar);
|
||||
gtk_container_remove (GTK_CONTAINER (grid), toolbar);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar), orientation);
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_widget_set_hexpand (toolbar, TRUE);
|
||||
gtk_widget_set_vexpand (toolbar, FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_hexpand (toolbar, FALSE);
|
||||
gtk_widget_set_vexpand (toolbar, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 5);
|
||||
}
|
||||
g_object_unref (toolbar);
|
||||
}
|
||||
|
||||
static void
|
||||
change_show_arrow (GtkWidget *button, GtkWidget *toolbar)
|
||||
{
|
||||
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar),
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
|
||||
}
|
||||
|
||||
static void
|
||||
set_toolbar_style_toggled (GtkCheckButton *button, GtkToolbar *toolbar)
|
||||
{
|
||||
GtkWidget *option_menu;
|
||||
int style;
|
||||
|
||||
option_menu = g_object_get_data (G_OBJECT (button), "option-menu");
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
|
||||
{
|
||||
style = gtk_combo_box_get_active (GTK_COMBO_BOX (option_menu));
|
||||
|
||||
gtk_toolbar_set_style (toolbar, style);
|
||||
gtk_widget_set_sensitive (option_menu, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toolbar_unset_style (toolbar);
|
||||
gtk_widget_set_sensitive (option_menu, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
change_toolbar_style (GtkWidget *option_menu, GtkWidget *toolbar)
|
||||
{
|
||||
GtkToolbarStyle style;
|
||||
|
||||
style = gtk_combo_box_get_active (GTK_COMBO_BOX (option_menu));
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style);
|
||||
}
|
||||
|
||||
static void
|
||||
set_visible_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
|
||||
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
gboolean visible;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &tool_item, -1);
|
||||
|
||||
g_object_get (tool_item, "visible", &visible, NULL);
|
||||
g_object_set (cell, "active", visible, NULL);
|
||||
g_object_unref (tool_item);
|
||||
}
|
||||
|
||||
static void
|
||||
visibile_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkToolItem *tool_item;
|
||||
gboolean visible;
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
|
||||
g_object_get (tool_item, "visible", &visible, NULL);
|
||||
g_object_set (tool_item, "visible", !visible, NULL);
|
||||
g_object_unref (tool_item);
|
||||
|
||||
gtk_tree_model_row_changed (model, path, &iter);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
set_expand_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
|
||||
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &tool_item, -1);
|
||||
|
||||
g_object_set (cell, "active", gtk_tool_item_get_expand (tool_item), NULL);
|
||||
g_object_unref (tool_item);
|
||||
}
|
||||
|
||||
static void
|
||||
expand_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
|
||||
gtk_tool_item_set_expand (tool_item, !gtk_tool_item_get_expand (tool_item));
|
||||
g_object_unref (tool_item);
|
||||
|
||||
gtk_tree_model_row_changed (model, path, &iter);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
set_homogeneous_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
|
||||
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &tool_item, -1);
|
||||
|
||||
g_object_set (cell, "active", gtk_tool_item_get_homogeneous (tool_item), NULL);
|
||||
g_object_unref (tool_item);
|
||||
}
|
||||
|
||||
static void
|
||||
homogeneous_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
|
||||
gtk_tool_item_set_homogeneous (tool_item, !gtk_tool_item_get_homogeneous (tool_item));
|
||||
g_object_unref (tool_item);
|
||||
|
||||
gtk_tree_model_row_changed (model, path, &iter);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_important_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
|
||||
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &tool_item, -1);
|
||||
|
||||
g_object_set (cell, "active", gtk_tool_item_get_is_important (tool_item), NULL);
|
||||
g_object_unref (tool_item);
|
||||
}
|
||||
|
||||
static void
|
||||
important_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
|
||||
gtk_tool_item_set_is_important (tool_item, !gtk_tool_item_get_is_important (tool_item));
|
||||
g_object_unref (tool_item);
|
||||
|
||||
gtk_tree_model_row_changed (model, path, &iter);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static GtkListStore *
|
||||
create_items_list (GtkWidget **tree_view_p)
|
||||
{
|
||||
GtkWidget *tree_view;
|
||||
GtkListStore *list_store;
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
list_store = gtk_list_store_new (2, GTK_TYPE_TOOL_ITEM, G_TYPE_STRING);
|
||||
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
|
||||
|
||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Tool Item",
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", 1, NULL);
|
||||
|
||||
cell = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (cell, "toggled", G_CALLBACK (visibile_toggled),
|
||||
list_store);
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Visible",
|
||||
cell,
|
||||
set_visible_func, NULL, NULL);
|
||||
|
||||
cell = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (cell, "toggled", G_CALLBACK (expand_toggled),
|
||||
list_store);
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Expand",
|
||||
cell,
|
||||
set_expand_func, NULL, NULL);
|
||||
|
||||
cell = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (cell, "toggled", G_CALLBACK (homogeneous_toggled),
|
||||
list_store);
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Homogeneous",
|
||||
cell,
|
||||
set_homogeneous_func, NULL,NULL);
|
||||
|
||||
cell = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (cell, "toggled", G_CALLBACK (important_toggled),
|
||||
list_store);
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Important",
|
||||
cell,
|
||||
set_important_func, NULL,NULL);
|
||||
|
||||
g_object_unref (list_store);
|
||||
|
||||
*tree_view_p = tree_view;
|
||||
|
||||
return list_store;
|
||||
}
|
||||
|
||||
static void
|
||||
add_item_to_list (GtkListStore *store, GtkToolItem *item, const gchar *text)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, item,
|
||||
1, text,
|
||||
-1);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
bold_toggled (GtkToggleToolButton *button)
|
||||
{
|
||||
g_message ("Bold toggled (active=%d)",
|
||||
gtk_toggle_tool_button_get_active (button));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
toolbar_drag_drop (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
gint x, gint y,
|
||||
GtkWidget *label)
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
|
||||
gchar buf[32];
|
||||
|
||||
g_snprintf(buf, sizeof(buf), "%d",
|
||||
gtk_toolbar_get_drop_index (GTK_TOOLBAR (widget), x, y));
|
||||
gtk_label_set_label (GTK_LABEL (label), buf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *target_table[] = {
|
||||
"application/x-toolbar-item"
|
||||
};
|
||||
|
||||
static void
|
||||
rtl_toggled (GtkCheckButton *check)
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
|
||||
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
|
||||
else
|
||||
gtk_widget_set_default_direction (GTK_TEXT_DIR_LTR);
|
||||
}
|
||||
|
||||
static GtkToolItem *drag_item = NULL;
|
||||
|
||||
static gboolean
|
||||
toolbar_drag_motion (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkToolbar *toolbar)
|
||||
{
|
||||
gint index;
|
||||
|
||||
if (!drag_item)
|
||||
{
|
||||
drag_item = gtk_tool_button_new (NULL, "A quite long button");
|
||||
g_object_ref_sink (g_object_ref (drag_item));
|
||||
}
|
||||
|
||||
gdk_drop_status (drop, GDK_ACTION_MOVE);
|
||||
|
||||
index = gtk_toolbar_get_drop_index (toolbar, x, y);
|
||||
|
||||
gtk_toolbar_set_drop_highlight_item (toolbar, drag_item, index);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
toolbar_drag_leave (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
GtkToolbar *toolbar)
|
||||
{
|
||||
if (drag_item)
|
||||
{
|
||||
g_object_unref (drag_item);
|
||||
drag_item = NULL;
|
||||
}
|
||||
|
||||
gtk_toolbar_set_drop_highlight_item (toolbar, NULL, 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
timeout_cb (GtkWidget *widget)
|
||||
{
|
||||
static gboolean sensitive = TRUE;
|
||||
|
||||
sensitive = !sensitive;
|
||||
|
||||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
timeout_cb1 (GtkWidget *widget)
|
||||
{
|
||||
static gboolean sensitive = TRUE;
|
||||
sensitive = !sensitive;
|
||||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc, gchar **argv)
|
||||
{
|
||||
GtkWidget *window, *toolbar, *grid, *treeview, *scrolled_window;
|
||||
GtkWidget *hbox, *hbox1, *hbox2, *checkbox, *option_menu, *menu;
|
||||
gint i;
|
||||
GdkContentFormats *targets;
|
||||
GdkContentProvider *content;
|
||||
GtkDragSource *source;
|
||||
GtkDropTarget *dest;
|
||||
static const gchar *toolbar_styles[] = { "icons", "text", "both (vertical)",
|
||||
"both (horizontal)" };
|
||||
GtkToolItem *item;
|
||||
GtkListStore *store;
|
||||
GtkWidget *image;
|
||||
GtkWidget *menuitem;
|
||||
GtkWidget *box;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GIcon *gicon;
|
||||
GSList *group;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 2, 1);
|
||||
|
||||
hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
|
||||
gtk_grid_attach (GTK_GRID (grid), hbox1, 1, 1, 1, 1);
|
||||
|
||||
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||
gtk_grid_attach (GTK_GRID (grid), hbox2, 1, 2, 1, 1);
|
||||
|
||||
checkbox = gtk_check_button_new_with_mnemonic("_Vertical");
|
||||
gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
|
||||
g_signal_connect (checkbox, "toggled",
|
||||
G_CALLBACK (change_orientation), toolbar);
|
||||
|
||||
checkbox = gtk_check_button_new_with_mnemonic("_Show Arrow");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
|
||||
g_signal_connect (checkbox, "toggled",
|
||||
G_CALLBACK (change_show_arrow), toolbar);
|
||||
|
||||
checkbox = gtk_check_button_new_with_mnemonic("_Set Toolbar Style:");
|
||||
g_signal_connect (checkbox, "toggled", G_CALLBACK (set_toolbar_style_toggled), toolbar);
|
||||
gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
|
||||
|
||||
option_menu = gtk_combo_box_text_new ();
|
||||
gtk_widget_set_sensitive (option_menu, FALSE);
|
||||
g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (toolbar_styles); i++)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), toolbar_styles[i]);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu),
|
||||
gtk_toolbar_get_style (GTK_TOOLBAR (toolbar)));
|
||||
gtk_container_add (GTK_CONTAINER (hbox2), option_menu);
|
||||
g_signal_connect (option_menu, "changed",
|
||||
G_CALLBACK (change_toolbar_style), toolbar);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_set_hexpand (scrolled_window, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled_window, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (grid), scrolled_window, 1, 3, 1, 1);
|
||||
|
||||
store = create_items_list (&treeview);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), treeview);
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-new");
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label");
|
||||
add_item_to_list (store, item, "New");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
g_timeout_add (3000, (GSourceFunc) timeout_cb, item);
|
||||
gtk_tool_item_set_expand (item, TRUE);
|
||||
|
||||
menu = gtk_popover_new (NULL);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (menu), box);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
char *text;
|
||||
text = g_strdup_printf ("Menuitem %d", i);
|
||||
menuitem = gtk_button_new_with_label (text);
|
||||
g_free (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), menuitem);
|
||||
}
|
||||
|
||||
item = gtk_menu_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Open");
|
||||
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (item), menu);
|
||||
add_item_to_list (store, item, "Open");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
g_timeout_add (3000, (GSourceFunc) timeout_cb1, item);
|
||||
|
||||
menu = gtk_popover_new (NULL);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (menu), box);
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
char *text;
|
||||
text = g_strdup_printf ("A%d", i);
|
||||
menuitem = gtk_button_new_with_label (text);
|
||||
g_free (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), menuitem);
|
||||
}
|
||||
|
||||
item = gtk_menu_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Back");
|
||||
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (item), menu);
|
||||
add_item_to_list (store, item, "BackWithHistory");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_separator_tool_item_new ();
|
||||
add_item_to_list (store, item, "-----");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
image = gtk_image_new_from_icon_name ("dialog-warning");
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
item = gtk_tool_item_new ();
|
||||
gtk_widget_show (image);
|
||||
gtk_container_add (GTK_CONTAINER (item), image);
|
||||
add_item_to_list (store, item, "(Custom Item)");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Back");
|
||||
add_item_to_list (store, item, "Back");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_separator_tool_item_new ();
|
||||
add_item_to_list (store, item, "-----");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Forward");
|
||||
add_item_to_list (store, item, "Forward");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_toggle_tool_button_new ();
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Bold");
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-text-bold");
|
||||
g_signal_connect (item, "toggled", G_CALLBACK (bold_toggled), NULL);
|
||||
add_item_to_list (store, item, "Bold");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
|
||||
|
||||
item = gtk_separator_tool_item_new ();
|
||||
add_item_to_list (store, item, "-----");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
gtk_tool_item_set_expand (item, TRUE);
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
|
||||
g_assert (gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), 0) != 0);
|
||||
|
||||
item = gtk_radio_tool_button_new (NULL);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Left");
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-left");
|
||||
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
||||
add_item_to_list (store, item, "Left");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
|
||||
item = gtk_radio_tool_button_new (group);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Center");
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-center");
|
||||
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
||||
add_item_to_list (store, item, "Center");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_radio_tool_button_new (group);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Right");
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-right");
|
||||
add_item_to_list (store, item, "Right");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_tool_button_new (gtk_image_new_from_file ("apple-red.png"), "_Apple");
|
||||
add_item_to_list (store, item, "Apple");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE);
|
||||
|
||||
gicon = g_content_type_get_icon ("video/ogg");
|
||||
image = gtk_image_new_from_gicon (gicon);
|
||||
g_object_unref (gicon);
|
||||
item = gtk_tool_button_new (image, "Video");
|
||||
add_item_to_list (store, item, "Video");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
image = gtk_image_new_from_icon_name ("utilities-terminal");
|
||||
item = gtk_tool_button_new (image, "Terminal");
|
||||
add_item_to_list (store, item, "Terminal");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
image = gtk_spinner_new ();
|
||||
gtk_spinner_start (GTK_SPINNER (image));
|
||||
item = gtk_tool_button_new (image, "Spinner");
|
||||
add_item_to_list (store, item, "Spinner");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
||||
gtk_widget_set_hexpand (hbox, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 4, 1, 1);
|
||||
|
||||
button = gtk_button_new_with_label ("Drag me to the toolbar");
|
||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||
|
||||
label = gtk_label_new ("Drop index:");
|
||||
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||
|
||||
|
||||
checkbox = gtk_check_button_new_with_mnemonic("_Right to left");
|
||||
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), FALSE);
|
||||
g_signal_connect (checkbox, "toggled", G_CALLBACK (rtl_toggled), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (hbox), checkbox);
|
||||
|
||||
targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table));
|
||||
content = gdk_content_provider_new_for_bytes (target_table[0], g_bytes_new ("", 1));
|
||||
source = gtk_drag_source_new ();
|
||||
gtk_drag_source_set_content (source, content);
|
||||
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
|
||||
g_object_unref (content);
|
||||
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (source));
|
||||
dest = gtk_drop_target_new (targets, GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag_motion", G_CALLBACK (toolbar_drag_motion), toolbar);
|
||||
g_signal_connect (dest, "drag_leave", G_CALLBACK (toolbar_drag_leave), toolbar);
|
||||
g_signal_connect (dest, "drag_drop", G_CALLBACK (toolbar_drag_drop), label);
|
||||
gtk_widget_add_controller (toolbar, GTK_EVENT_CONTROLLER (dest));
|
||||
gdk_content_formats_unref (targets);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">600</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton1">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton2">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton3">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton4">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton5">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton6">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">go-up-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -1,122 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">300</property>
|
||||
<property name="default_height">350</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton1">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton2">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton3">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton4">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">list-remove-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton5">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton6">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">go-up-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -1,211 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">800</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton1">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton2">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton3">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton4">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">edit-find</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem" id="toolitementry">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem" id="toolitemswitch">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton5">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton6">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
<property name="active">True</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton7">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="toolbutton8">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="active">True</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -639,6 +639,7 @@ test_types (void)
|
||||
{
|
||||
const gchar buffer[] =
|
||||
"<interface>"
|
||||
" <object class=\"GtkBox\" id=\"box\"/>"
|
||||
" <object class=\"GtkButton\" id=\"button\"/>"
|
||||
" <object class=\"GtkCheckButton\" id=\"checkbutton\"/>"
|
||||
" <object class=\"GtkDialog\" id=\"dialog\"/>"
|
||||
@ -657,7 +658,6 @@ test_types (void)
|
||||
" <object class=\"GtkStatusbar\" id=\"statusbar\"/>"
|
||||
" <object class=\"GtkTextView\" id=\"textview\"/>"
|
||||
" <object class=\"GtkToggleButton\" id=\"togglebutton\"/>"
|
||||
" <object class=\"GtkToolbar\" id=\"toolbar\"/>"
|
||||
" <object class=\"GtkTreeStore\" id=\"treestore\"/>"
|
||||
" <object class=\"GtkTreeView\" id=\"treeview\"/>"
|
||||
" <object class=\"GtkViewport\" id=\"viewport\"/>"
|
||||
|
@ -1,6 +1,6 @@
|
||||
@import "reset-to-defaults.css";
|
||||
|
||||
toolbar {
|
||||
box {
|
||||
border-image: url("green-20x20.png") 5000;
|
||||
background-image: none;
|
||||
background-color: #000;
|
||||
|
@ -7,11 +7,10 @@
|
||||
<property name="row_spacing">8</property>
|
||||
<property name="column_spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">1</property>
|
||||
<property name="height_request">1</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="show_arrow">0</property>
|
||||
<layout>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
@ -21,11 +20,10 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar2">
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">1</property>
|
||||
<property name="height_request">1</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="show_arrow">0</property>
|
||||
<layout>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
@ -35,11 +33,10 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar3">
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">1</property>
|
||||
<property name="height_request">1</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="show_arrow">0</property>
|
||||
<layout>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
@ -49,11 +46,10 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar4">
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">1</property>
|
||||
<property name="height_request">1</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="show_arrow">0</property>
|
||||
<layout>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
|
@ -3,11 +3,10 @@
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="type">popup</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar1">
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">10</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="show_arrow">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user