1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * GtkToolbar copyright (C) Federico Mena
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28 #include "gtkbutton.h"
29 #include "gtktogglebutton.h"
30 #include "gtkradiobutton.h"
34 #include "gtktoolbar.h"
36 #include "gtkiconfactory.h"
38 #include "gtksettings.h"
40 #include "gtkmarshalers.h"
43 #define DEFAULT_IPADDING 0
44 #define DEFAULT_SPACE_SIZE 5
45 #define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
47 #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
49 #define SPACE_LINE_DIVISION 10
50 #define SPACE_LINE_START 3
51 #define SPACE_LINE_END 7
65 typedef struct _GtkToolbarChildSpace GtkToolbarChildSpace;
66 struct _GtkToolbarChildSpace
68 GtkToolbarChild child;
70 gint alloc_x, alloc_y;
73 static void gtk_toolbar_class_init (GtkToolbarClass *class);
74 static void gtk_toolbar_init (GtkToolbar *toolbar);
75 static void gtk_toolbar_finalize (GObject *object);
76 static void gtk_toolbar_set_property (GObject *object,
80 static void gtk_toolbar_get_property (GObject *object,
84 static void gtk_toolbar_destroy (GtkObject *object);
85 static gint gtk_toolbar_expose (GtkWidget *widget,
86 GdkEventExpose *event);
87 static void gtk_toolbar_size_request (GtkWidget *widget,
88 GtkRequisition *requisition);
89 static void gtk_toolbar_size_allocate (GtkWidget *widget,
90 GtkAllocation *allocation);
91 static void gtk_toolbar_style_set (GtkWidget *widget,
92 GtkStyle *prev_style);
93 static gboolean gtk_toolbar_focus (GtkWidget *widget,
94 GtkDirectionType dir);
95 static void gtk_toolbar_show_all (GtkWidget *widget);
96 static void gtk_toolbar_add (GtkContainer *container,
98 static void gtk_toolbar_remove (GtkContainer *container,
100 static void gtk_toolbar_forall (GtkContainer *container,
101 gboolean include_internals,
102 GtkCallback callback,
103 gpointer callback_data);
105 static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
106 GtkOrientation orientation);
107 static void gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
108 GtkToolbarStyle style);
110 static GtkWidget * gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
111 GtkToolbarChildType type,
114 const char *tooltip_text,
115 const char *tooltip_private_text,
117 GtkSignalFunc callback,
120 gboolean has_mnemonic);
122 static GtkWidget * gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
124 const char *tooltip_text,
125 const char *tooltip_private_text,
127 GtkSignalFunc callback,
130 gboolean has_mnemonic);
132 static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
134 static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
135 static gint get_space_size (GtkToolbar *toolbar);
136 static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
139 static GtkContainerClass *parent_class;
141 static guint toolbar_signals[LAST_SIGNAL] = { 0 };
145 gtk_toolbar_get_type (void)
147 static GtkType toolbar_type = 0;
151 static const GtkTypeInfo toolbar_info =
155 sizeof (GtkToolbarClass),
156 (GtkClassInitFunc) gtk_toolbar_class_init,
157 (GtkObjectInitFunc) gtk_toolbar_init,
158 /* reserved_1 */ NULL,
159 /* reserved_2 */ NULL,
160 (GtkClassInitFunc) NULL,
163 toolbar_type = gtk_type_unique (gtk_container_get_type (), &toolbar_info);
170 gtk_toolbar_class_init (GtkToolbarClass *class)
172 GObjectClass *gobject_class;
173 GtkObjectClass *object_class;
174 GtkWidgetClass *widget_class;
175 GtkContainerClass *container_class;
177 gobject_class = G_OBJECT_CLASS (class);
178 object_class = (GtkObjectClass *) class;
179 widget_class = (GtkWidgetClass *) class;
180 container_class = (GtkContainerClass *) class;
182 parent_class = gtk_type_class (gtk_container_get_type ());
184 gobject_class->finalize = gtk_toolbar_finalize;
186 object_class->destroy = gtk_toolbar_destroy;
187 gobject_class->set_property = gtk_toolbar_set_property;
188 gobject_class->get_property = gtk_toolbar_get_property;
190 widget_class->expose_event = gtk_toolbar_expose;
191 widget_class->size_request = gtk_toolbar_size_request;
192 widget_class->size_allocate = gtk_toolbar_size_allocate;
193 widget_class->style_set = gtk_toolbar_style_set;
194 widget_class->show_all = gtk_toolbar_show_all;
195 widget_class->focus = gtk_toolbar_focus;
197 container_class->add = gtk_toolbar_add;
198 container_class->remove = gtk_toolbar_remove;
199 container_class->forall = gtk_toolbar_forall;
201 class->orientation_changed = gtk_real_toolbar_orientation_changed;
202 class->style_changed = gtk_real_toolbar_style_changed;
204 toolbar_signals[ORIENTATION_CHANGED] =
205 gtk_signal_new ("orientation_changed",
207 GTK_CLASS_TYPE (object_class),
208 GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed),
209 _gtk_marshal_VOID__ENUM,
211 GTK_TYPE_ORIENTATION);
212 toolbar_signals[STYLE_CHANGED] =
213 gtk_signal_new ("style_changed",
215 GTK_CLASS_TYPE (object_class),
216 GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed),
217 _gtk_marshal_VOID__ENUM,
219 GTK_TYPE_TOOLBAR_STYLE);
221 g_object_class_install_property (gobject_class,
223 g_param_spec_enum ("orientation",
225 _("The orientation of the toolbar"),
226 GTK_TYPE_ORIENTATION,
227 GTK_ORIENTATION_HORIZONTAL,
230 g_object_class_install_property (gobject_class,
232 g_param_spec_enum ("toolbar_style",
234 _("How to draw the toolbar"),
235 GTK_TYPE_TOOLBAR_STYLE,
240 gtk_widget_class_install_style_property (widget_class,
241 g_param_spec_int ("space_size",
243 _("Size of spacers"),
249 gtk_widget_class_install_style_property (widget_class,
250 g_param_spec_int ("internal_padding",
251 _("Internal padding"),
252 _("Amount of border space between the toolbar shadow and the buttons"),
258 gtk_widget_class_install_style_property (widget_class,
259 g_param_spec_enum ("space_style",
261 _("Whether spacers are vertical lines or just blank"),
262 GTK_TYPE_TOOLBAR_SPACE_STYLE,
267 gtk_widget_class_install_style_property (widget_class,
268 g_param_spec_enum ("button_relief",
270 _("Type of bevel around toolbar buttons"),
271 GTK_TYPE_RELIEF_STYLE,
275 gtk_widget_class_install_style_property (widget_class,
276 g_param_spec_enum ("shadow_type",
278 _("Style of bevel around the toolbar"),
279 GTK_TYPE_SHADOW_TYPE,
283 gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-style",
285 _("Whether default toolbars have text only, text and icons, icons only, etc."),
286 GTK_TYPE_TOOLBAR_STYLE,
290 gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-icon-size",
291 _("Toolbar icon size"),
292 _("Size of icons in default toolbars"),
294 GTK_ICON_SIZE_LARGE_TOOLBAR,
299 style_change_notify (GObject *object,
305 toolbar = GTK_TOOLBAR (data);
307 if (!toolbar->style_set)
309 /* pretend it was set, then unset, thus reverting to new default */
310 toolbar->style_set = TRUE;
311 gtk_toolbar_unset_style (toolbar);
316 icon_size_change_notify (GObject *object,
322 toolbar = GTK_TOOLBAR (data);
324 if (!toolbar->icon_size_set)
326 /* pretend it was set, then unset, thus reverting to new default */
327 toolbar->icon_size_set = TRUE;
328 gtk_toolbar_unset_icon_size (toolbar);
333 gtk_toolbar_init (GtkToolbar *toolbar)
335 GTK_WIDGET_SET_FLAGS (toolbar, GTK_NO_WINDOW);
336 GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_CAN_FOCUS);
338 toolbar->num_children = 0;
339 toolbar->children = NULL;
340 toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
341 toolbar->icon_size = DEFAULT_ICON_SIZE;
342 toolbar->tooltips = gtk_tooltips_new ();
343 g_object_ref (toolbar->tooltips);
344 gtk_object_sink (GTK_OBJECT (toolbar->tooltips));
346 toolbar->button_maxw = 0;
347 toolbar->button_maxh = 0;
349 toolbar->style_set = FALSE;
350 toolbar->icon_size_set = FALSE;
351 g_object_get (gtk_settings_get_default (),
352 "gtk-toolbar-icon-size",
358 toolbar->style_set_connection =
359 g_signal_connect (G_OBJECT (gtk_settings_get_default ()),
360 "notify::gtk-toolbar-style",
361 G_CALLBACK (style_change_notify),
364 toolbar->icon_size_connection =
365 g_signal_connect (G_OBJECT (gtk_settings_get_default ()),
366 "notify::gtk-toolbar-icon-size",
367 G_CALLBACK (icon_size_change_notify),
372 gtk_toolbar_finalize (GObject *object)
376 toolbar = GTK_TOOLBAR (object);
378 g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_default ()),
379 toolbar->style_set_connection);
380 g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_default ()),
381 toolbar->icon_size_connection);
383 G_OBJECT_CLASS (parent_class)->finalize (object);
387 gtk_toolbar_set_property (GObject *object,
392 GtkToolbar *toolbar = GTK_TOOLBAR (object);
396 case PROP_ORIENTATION:
397 gtk_toolbar_set_orientation (toolbar, g_value_get_enum (value));
399 case PROP_TOOLBAR_STYLE:
400 gtk_toolbar_set_style (toolbar, g_value_get_enum (value));
406 gtk_toolbar_get_property (GObject *object,
411 GtkToolbar *toolbar = GTK_TOOLBAR (object);
415 case PROP_ORIENTATION:
416 g_value_set_enum (value, toolbar->orientation);
418 case PROP_TOOLBAR_STYLE:
419 g_value_set_enum (value, toolbar->style);
422 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
428 gtk_toolbar_new (void)
432 toolbar = gtk_type_new (gtk_toolbar_get_type ());
434 return GTK_WIDGET (toolbar);
438 gtk_toolbar_destroy (GtkObject *object)
443 g_return_if_fail (GTK_IS_TOOLBAR (object));
445 toolbar = GTK_TOOLBAR (object);
447 if (toolbar->tooltips)
449 gtk_object_unref (GTK_OBJECT (toolbar->tooltips));
450 toolbar->tooltips = NULL;
453 for (children = toolbar->children; children; children = children->next)
455 GtkToolbarChild *child;
457 child = children->data;
459 if (child->type != GTK_TOOLBAR_CHILD_SPACE)
461 gtk_widget_ref (child->widget);
462 gtk_widget_unparent (child->widget);
463 gtk_widget_destroy (child->widget);
464 gtk_widget_unref (child->widget);
469 g_list_free (toolbar->children);
470 toolbar->children = NULL;
472 GTK_OBJECT_CLASS (parent_class)->destroy (object);
476 gtk_toolbar_paint_space_line (GtkWidget *widget,
478 GtkToolbarChild *child)
481 GtkToolbarChildSpace *child_space;
484 g_return_if_fail (GTK_IS_TOOLBAR (widget));
485 g_return_if_fail (child != NULL);
486 g_return_if_fail (child->type == GTK_TOOLBAR_CHILD_SPACE);
488 toolbar = GTK_TOOLBAR (widget);
490 child_space = (GtkToolbarChildSpace *) child;
491 space_size = get_space_size (toolbar);
493 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
494 gtk_paint_vline (widget->style, widget->window,
495 GTK_WIDGET_STATE (widget), area, widget,
497 child_space->alloc_y + toolbar->button_maxh *
498 SPACE_LINE_START / SPACE_LINE_DIVISION,
499 child_space->alloc_y + toolbar->button_maxh *
500 SPACE_LINE_END / SPACE_LINE_DIVISION,
501 child_space->alloc_x +
503 widget->style->xthickness) / 2);
505 gtk_paint_hline (widget->style, widget->window,
506 GTK_WIDGET_STATE (widget), area, widget,
508 child_space->alloc_x + toolbar->button_maxw *
509 SPACE_LINE_START / SPACE_LINE_DIVISION,
510 child_space->alloc_x + toolbar->button_maxw *
511 SPACE_LINE_END / SPACE_LINE_DIVISION,
512 child_space->alloc_y +
514 widget->style->ythickness) / 2);
518 gtk_toolbar_expose (GtkWidget *widget,
519 GdkEventExpose *event)
523 GtkToolbarChild *child;
526 g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
527 g_return_val_if_fail (event != NULL, FALSE);
529 border_width = GTK_CONTAINER (widget)->border_width;
531 if (GTK_WIDGET_DRAWABLE (widget))
533 GtkShadowType shadow_type;
535 toolbar = GTK_TOOLBAR (widget);
537 gtk_widget_style_get (widget, "shadow_type", &shadow_type, NULL);
539 gtk_paint_box (widget->style,
541 GTK_WIDGET_STATE (widget),
543 &event->area, widget, "toolbar",
544 widget->allocation.x + border_width,
545 widget->allocation.y + border_width,
546 widget->allocation.width - border_width,
547 widget->allocation.height - border_width);
549 for (children = toolbar->children; children; children = children->next)
551 child = children->data;
553 if (child->type == GTK_TOOLBAR_CHILD_SPACE)
555 if (get_space_style (toolbar) == GTK_TOOLBAR_SPACE_LINE)
556 gtk_toolbar_paint_space_line (widget, &event->area, child);
559 gtk_container_propagate_expose (GTK_CONTAINER (widget),
569 gtk_toolbar_size_request (GtkWidget *widget,
570 GtkRequisition *requisition)
574 GtkToolbarChild *child;
576 gint button_maxw, button_maxh;
577 gint widget_maxw, widget_maxh;
578 GtkRequisition child_requisition;
582 g_return_if_fail (GTK_IS_TOOLBAR (widget));
583 g_return_if_fail (requisition != NULL);
585 toolbar = GTK_TOOLBAR (widget);
587 requisition->width = GTK_CONTAINER (toolbar)->border_width * 2;
588 requisition->height = GTK_CONTAINER (toolbar)->border_width * 2;
595 space_size = get_space_size (toolbar);
597 for (children = toolbar->children; children; children = children->next)
599 child = children->data;
603 case GTK_TOOLBAR_CHILD_SPACE:
604 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
605 requisition->width += space_size;
607 requisition->height += space_size;
611 case GTK_TOOLBAR_CHILD_BUTTON:
612 case GTK_TOOLBAR_CHILD_RADIOBUTTON:
613 case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
614 if (GTK_WIDGET_VISIBLE (child->widget))
616 gtk_widget_size_request (child->widget, &child_requisition);
619 button_maxw = MAX (button_maxw, child_requisition.width);
620 button_maxh = MAX (button_maxh, child_requisition.height);
625 case GTK_TOOLBAR_CHILD_WIDGET:
626 if (GTK_WIDGET_VISIBLE (child->widget))
628 gtk_widget_size_request (child->widget, &child_requisition);
630 widget_maxw = MAX (widget_maxw, child_requisition.width);
631 widget_maxh = MAX (widget_maxh, child_requisition.height);
633 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
634 requisition->width += child_requisition.width;
636 requisition->height += child_requisition.height;
642 g_assert_not_reached ();
646 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
648 requisition->width += nbuttons * button_maxw;
649 requisition->height += MAX (button_maxh, widget_maxh);
653 requisition->width += MAX (button_maxw, widget_maxw);
654 requisition->height += nbuttons * button_maxh;
658 gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
660 requisition->width += 2 * ipadding;
661 requisition->height += 2 * ipadding;
663 toolbar->button_maxw = button_maxw;
664 toolbar->button_maxh = button_maxh;
668 gtk_toolbar_size_allocate (GtkWidget *widget,
669 GtkAllocation *allocation)
673 GtkToolbarChild *child;
674 GtkToolbarChildSpace *child_space;
676 GtkRequisition child_requisition;
677 gint x_border_width, y_border_width;
681 g_return_if_fail (GTK_IS_TOOLBAR (widget));
682 g_return_if_fail (allocation != NULL);
684 toolbar = GTK_TOOLBAR (widget);
685 widget->allocation = *allocation;
687 x_border_width = GTK_CONTAINER (toolbar)->border_width;
688 y_border_width = GTK_CONTAINER (toolbar)->border_width;
690 gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
692 x_border_width += ipadding;
693 y_border_width += ipadding;
695 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
696 alloc.x = allocation->x + x_border_width;
698 alloc.y = allocation->y + y_border_width;
700 space_size = get_space_size (toolbar);
702 for (children = toolbar->children; children; children = children->next)
704 child = children->data;
708 case GTK_TOOLBAR_CHILD_SPACE:
710 child_space = (GtkToolbarChildSpace *) child;
712 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
714 child_space->alloc_x = alloc.x;
715 child_space->alloc_y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
716 alloc.x += space_size;
720 child_space->alloc_x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
721 child_space->alloc_y = alloc.y;
722 alloc.y += space_size;
727 case GTK_TOOLBAR_CHILD_BUTTON:
728 case GTK_TOOLBAR_CHILD_RADIOBUTTON:
729 case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
730 if (!GTK_WIDGET_VISIBLE (child->widget))
733 alloc.width = toolbar->button_maxw;
734 alloc.height = toolbar->button_maxh;
736 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
737 alloc.y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
739 alloc.x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
741 gtk_widget_size_allocate (child->widget, &alloc);
743 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
744 alloc.x += toolbar->button_maxw;
746 alloc.y += toolbar->button_maxh;
750 case GTK_TOOLBAR_CHILD_WIDGET:
751 if (!GTK_WIDGET_VISIBLE (child->widget))
754 gtk_widget_get_child_requisition (child->widget, &child_requisition);
756 alloc.width = child_requisition.width;
757 alloc.height = child_requisition.height;
759 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
760 alloc.y = allocation->y + (allocation->height - child_requisition.height) / 2;
762 alloc.x = allocation->x + (allocation->width - child_requisition.width) / 2;
764 gtk_widget_size_allocate (child->widget, &alloc);
766 if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
767 alloc.x += child_requisition.width;
769 alloc.y += child_requisition.height;
774 g_assert_not_reached ();
780 gtk_toolbar_style_set (GtkWidget *widget,
781 GtkStyle *prev_style)
784 gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget));
788 gtk_toolbar_focus (GtkWidget *widget,
789 GtkDirectionType dir)
791 /* Focus can't go in toolbars */
797 child_show_all (GtkWidget *widget)
799 /* Don't show our own children, since that would
800 * show labels we may intend to hide in icons-only mode
802 if (!g_object_get_data (G_OBJECT (widget),
803 "gtk-toolbar-is-child"))
804 gtk_widget_show_all (widget);
808 gtk_toolbar_show_all (GtkWidget *widget)
810 gtk_container_foreach (GTK_CONTAINER (widget),
811 (GtkCallback) child_show_all,
813 gtk_widget_show (widget);
817 gtk_toolbar_add (GtkContainer *container,
820 g_return_if_fail (GTK_IS_TOOLBAR (container));
821 g_return_if_fail (widget != NULL);
823 gtk_toolbar_append_widget (GTK_TOOLBAR (container), widget, NULL, NULL);
827 gtk_toolbar_remove (GtkContainer *container,
832 GtkToolbarChild *child;
834 g_return_if_fail (GTK_IS_TOOLBAR (container));
835 g_return_if_fail (widget != NULL);
837 toolbar = GTK_TOOLBAR (container);
839 for (children = toolbar->children; children; children = children->next)
841 child = children->data;
843 if ((child->type != GTK_TOOLBAR_CHILD_SPACE) && (child->widget == widget))
845 gboolean was_visible;
847 was_visible = GTK_WIDGET_VISIBLE (widget);
848 gtk_widget_unparent (widget);
850 toolbar->children = g_list_remove_link (toolbar->children, children);
852 g_list_free (children);
853 toolbar->num_children--;
855 if (was_visible && GTK_WIDGET_VISIBLE (container))
856 gtk_widget_queue_resize (GTK_WIDGET (container));
864 gtk_toolbar_forall (GtkContainer *container,
865 gboolean include_internals,
866 GtkCallback callback,
867 gpointer callback_data)
871 GtkToolbarChild *child;
873 g_return_if_fail (GTK_IS_TOOLBAR (container));
874 g_return_if_fail (callback != NULL);
876 toolbar = GTK_TOOLBAR (container);
878 for (children = toolbar->children; children; children = children->next)
880 child = children->data;
882 if (child->type != GTK_TOOLBAR_CHILD_SPACE)
883 (*callback) (child->widget, callback_data);
888 gtk_toolbar_append_item (GtkToolbar *toolbar,
890 const char *tooltip_text,
891 const char *tooltip_private_text,
893 GtkSignalFunc callback,
896 return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
898 tooltip_text, tooltip_private_text,
899 icon, callback, user_data,
900 toolbar->num_children);
904 gtk_toolbar_prepend_item (GtkToolbar *toolbar,
906 const char *tooltip_text,
907 const char *tooltip_private_text,
909 GtkSignalFunc callback,
912 return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
914 tooltip_text, tooltip_private_text,
915 icon, callback, user_data,
920 gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
922 const char *tooltip_text,
923 const char *tooltip_private_text,
925 GtkSignalFunc callback,
928 gboolean has_mnemonic)
930 return gtk_toolbar_internal_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
932 tooltip_text, tooltip_private_text,
933 icon, callback, user_data,
934 position, has_mnemonic);
938 gtk_toolbar_insert_item (GtkToolbar *toolbar,
940 const char *tooltip_text,
941 const char *tooltip_private_text,
943 GtkSignalFunc callback,
947 return gtk_toolbar_internal_insert_item (toolbar,
948 text, tooltip_text, tooltip_private_text,
949 icon, callback, user_data,
954 * gtk_toolbar_set_icon_size:
955 * @toolbar: A #GtkToolbar
956 * @icon_size: The #GtkIconSize that stock icons in the toolbar shall have.
958 * This function sets the size of stock icons in the toolbar. You
959 * can call it both before you add the icons and after they've been
960 * added. The size you set will override user preferences for the default
964 gtk_toolbar_set_icon_size (GtkToolbar *toolbar,
965 GtkIconSize icon_size)
968 GtkToolbarChild *child;
972 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
974 toolbar->icon_size_set = TRUE;
976 if (toolbar->icon_size == icon_size)
979 toolbar->icon_size = icon_size;
981 for (children = toolbar->children; children; children = children->next)
983 child = children->data;
984 if ((child->type == GTK_TOOLBAR_CHILD_BUTTON ||
985 child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON ||
986 child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON) &&
987 GTK_IS_IMAGE (child->icon))
989 image = GTK_IMAGE (child->icon);
990 if (gtk_image_get_storage_type (image) == GTK_IMAGE_STOCK)
992 gtk_image_get_stock (image, &stock_id, NULL);
993 stock_id = g_strdup (stock_id);
994 gtk_image_set_from_stock (image,
1002 gtk_widget_queue_resize (GTK_WIDGET (toolbar));
1006 * gtk_toolbar_get_icon_size:
1007 * @toolbar: a #GtkToolbar
1009 * Retrieves the icon size fo the toolbar. See gtk_toolbar_set_icon_size().
1011 * Return value: the current icon size for the icons on the toolbar.
1014 gtk_toolbar_get_icon_size (GtkToolbar *toolbar)
1016 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_ICON_SIZE_LARGE_TOOLBAR);
1018 return toolbar->icon_size;
1022 * gtk_toolbar_unset_icon_size:
1023 * @toolbar: a #GtkToolbar
1025 * Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that
1026 * user preferences will be used to determine the icon size.
1029 gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
1033 if (toolbar->icon_size_set)
1035 g_object_get (gtk_settings_get_default (),
1036 "gtk-toolbar-icon-size",
1039 if (size != toolbar->icon_size)
1040 gtk_toolbar_set_icon_size (toolbar, size);
1042 toolbar->icon_size_set = FALSE;
1047 * gtk_toolbar_insert_stock:
1048 * @toolbar: A #GtkToolbar
1049 * @stock_id: The id of the stock item you want to insert
1050 * @tooltip_text: The text in the tooltip of the toolbar button
1051 * @tooltip_private_text: The private text of the tooltip
1052 * @callback: The callback called when the toolbar button is clicked.
1053 * @user_data: user data passed to callback
1054 * @position: The position the button shall be inserted at.
1055 * -1 means at the end.
1057 * Inserts a stock item at the specified position of the toolbar. If
1058 * @stock_id is not a known stock item ID, it's inserted verbatim,
1059 * except that underscores are used to mark mnemonics (see
1060 * gtk_label_new_with_mnemonic()).
1062 * Returns: the inserted widget
1065 gtk_toolbar_insert_stock (GtkToolbar *toolbar,
1066 const gchar *stock_id,
1067 const char *tooltip_text,
1068 const char *tooltip_private_text,
1069 GtkSignalFunc callback,
1076 if (gtk_stock_lookup (stock_id, &item))
1078 image = gtk_image_new_from_stock (stock_id, toolbar->icon_size);
1080 return gtk_toolbar_internal_insert_item (toolbar,
1083 tooltip_private_text,
1091 return gtk_toolbar_internal_insert_item (toolbar,
1094 tooltip_private_text,
1105 gtk_toolbar_append_space (GtkToolbar *toolbar)
1107 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
1111 toolbar->num_children);
1115 gtk_toolbar_prepend_space (GtkToolbar *toolbar)
1117 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
1125 gtk_toolbar_insert_space (GtkToolbar *toolbar,
1128 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
1136 * gtk_toolbar_remove_space:
1137 * @toolbar: a #GtkToolbar.
1138 * @position: the index of the space to remove.
1140 * Removes a space from the specified position.
1143 gtk_toolbar_remove_space (GtkToolbar *toolbar,
1147 GtkToolbarChild *child;
1150 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1153 for (children = toolbar->children; children; children = children->next)
1155 child = children->data;
1159 if (child->type == GTK_TOOLBAR_CHILD_SPACE)
1161 toolbar->children = g_list_remove_link (toolbar->children, children);
1163 g_list_free (children);
1164 toolbar->num_children--;
1166 gtk_widget_queue_resize (GTK_WIDGET (toolbar));
1170 g_warning ("Toolbar position %d is not a space", position);
1179 g_warning ("Toolbar position %d doesn't exist", position);
1183 * gtk_toolbar_append_widget:
1184 * @toolbar: a #GtkToolbar.
1185 * @widget: a #GtkWidget to add to the toolbar.
1186 * @tooltip_text: the element's tooltip.
1187 * @tooltip_private_text: used for context-sensitive help about this toolbar element.
1189 * Adds a widget to the end of the given toolbar.
1192 gtk_toolbar_append_widget (GtkToolbar *toolbar,
1194 const gchar *tooltip_text,
1195 const gchar *tooltip_private_text)
1197 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
1199 tooltip_text, tooltip_private_text,
1201 toolbar->num_children);
1205 * gtk_toolbar_prepend_widget:
1206 * @toolbar: a #GtkToolbar.
1207 * @widget: a #GtkWidget to add to the toolbar.
1208 * @tooltip_text: the element's tooltip.
1209 * @tooltip_private_text: used for context-sensitive help about this toolbar element.
1211 * Adds a widget to the beginning of the given toolbar.
1214 gtk_toolbar_prepend_widget (GtkToolbar *toolbar,
1216 const gchar *tooltip_text,
1217 const gchar *tooltip_private_text)
1219 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
1221 tooltip_text, tooltip_private_text,
1227 * gtk_toolbar_insert_widget:
1228 * @toolbar: a #GtkToolbar.
1229 * @widget: a #GtkWidget to add to the toolbar.
1230 * @tooltip_text: the element's tooltip.
1231 * @tooltip_private_text: used for context-sensitive help about this toolbar element.
1232 * @position: the number of widgets to insert this widget after.
1234 * Inserts a widget in the toolbar at the given position.
1237 gtk_toolbar_insert_widget (GtkToolbar *toolbar,
1239 const char *tooltip_text,
1240 const char *tooltip_private_text,
1243 gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
1245 tooltip_text, tooltip_private_text,
1251 gtk_toolbar_append_element (GtkToolbar *toolbar,
1252 GtkToolbarChildType type,
1255 const char *tooltip_text,
1256 const char *tooltip_private_text,
1258 GtkSignalFunc callback,
1261 return gtk_toolbar_insert_element (toolbar, type, widget, text,
1262 tooltip_text, tooltip_private_text,
1263 icon, callback, user_data,
1264 toolbar->num_children);
1268 gtk_toolbar_prepend_element (GtkToolbar *toolbar,
1269 GtkToolbarChildType type,
1272 const char *tooltip_text,
1273 const char *tooltip_private_text,
1275 GtkSignalFunc callback,
1278 return gtk_toolbar_insert_element (toolbar, type, widget, text,
1279 tooltip_text, tooltip_private_text,
1280 icon, callback, user_data, 0);
1284 * gtk_toolbar_insert_element:
1285 * @toolbar: a #GtkToolbar.
1286 * @type: a value of type #GtkToolbarChildType that determines what @widget
1288 * @widget: a #GtkWidget, or %NULL.
1289 * @text: the element's label.
1290 * @tooltip_text: the element's tooltip.
1291 * @tooltip_private_text: used for context-sensitive help about this toolbar element.
1292 * @icon: a #GtkWidget that provides pictorial representation of the element's function.
1293 * @callback: the function to be executed when the button is pressed.
1294 * @user_data: any data you wish to pass to the callback.
1295 * @position: the number of widgets to insert this element after.
1297 * Inserts a new element in the toolbar at the given position.
1299 * If @type == %GTK_TOOLBAR_CHILD_WIDGET, @widget is used as the new element.
1300 * If @type == %GTK_TOOLBAR_CHILD_RADIOBUTTON, @widget is used to determine
1301 * the radio group for the new element. In all other cases, @widget must
1304 * Return value: the new toolbar element as a #GtkWidget.
1307 gtk_toolbar_insert_element (GtkToolbar *toolbar,
1308 GtkToolbarChildType type,
1311 const char *tooltip_text,
1312 const char *tooltip_private_text,
1314 GtkSignalFunc callback,
1318 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
1319 if (type == GTK_TOOLBAR_CHILD_WIDGET)
1321 g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
1323 else if (type != GTK_TOOLBAR_CHILD_RADIOBUTTON)
1324 g_return_val_if_fail (widget == NULL, NULL);
1326 return gtk_toolbar_internal_insert_element (toolbar, type, widget, text,
1327 tooltip_text, tooltip_private_text,
1328 icon, callback, user_data,
1333 gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
1334 GtkToolbarChildType type,
1337 const char *tooltip_text,
1338 const char *tooltip_private_text,
1340 GtkSignalFunc callback,
1343 gboolean has_mnemonic)
1345 GtkToolbarChild *child;
1348 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
1349 if (type == GTK_TOOLBAR_CHILD_WIDGET)
1351 g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
1353 else if (type != GTK_TOOLBAR_CHILD_RADIOBUTTON)
1354 g_return_val_if_fail (widget == NULL, NULL);
1356 if (type == GTK_TOOLBAR_CHILD_SPACE)
1357 child = (GtkToolbarChild *) g_new (GtkToolbarChildSpace, 1);
1359 child = g_new (GtkToolbarChild, 1);
1363 child->label = NULL;
1367 case GTK_TOOLBAR_CHILD_SPACE:
1368 child->widget = NULL;
1369 ((GtkToolbarChildSpace *) child)->alloc_x =
1370 ((GtkToolbarChildSpace *) child)->alloc_y = 0;
1373 case GTK_TOOLBAR_CHILD_WIDGET:
1374 child->widget = widget;
1377 case GTK_TOOLBAR_CHILD_BUTTON:
1378 case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
1379 case GTK_TOOLBAR_CHILD_RADIOBUTTON:
1380 if (type == GTK_TOOLBAR_CHILD_BUTTON)
1382 child->widget = gtk_button_new ();
1383 gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
1385 else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
1387 child->widget = gtk_toggle_button_new ();
1388 gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
1389 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget),
1394 child->widget = gtk_radio_button_new (widget
1395 ? gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget))
1397 gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
1398 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE);
1401 GTK_WIDGET_UNSET_FLAGS (child->widget, GTK_CAN_FOCUS);
1404 gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
1405 callback, user_data);
1407 if (toolbar->style == GTK_TOOLBAR_BOTH_HORIZ)
1408 box = gtk_hbox_new (FALSE, 0);
1410 box = gtk_vbox_new (FALSE, 0);
1411 gtk_container_add (GTK_CONTAINER (child->widget), box);
1412 gtk_widget_show (box);
1417 child->label = gtk_label_new_with_mnemonic (text);
1419 child->label = gtk_label_new (text);
1420 gtk_box_pack_end (GTK_BOX (box), child->label, FALSE, FALSE, 0);
1421 if (toolbar->style != GTK_TOOLBAR_ICONS)
1422 gtk_widget_show (child->label);
1427 child->icon = GTK_WIDGET (icon);
1428 gtk_box_pack_end (GTK_BOX (box), child->icon, FALSE, FALSE, 0);
1429 if (toolbar->style != GTK_TOOLBAR_TEXT)
1430 gtk_widget_show (child->icon);
1433 if (type != GTK_TOOLBAR_CHILD_WIDGET)
1435 /* Mark child as ours */
1436 g_object_set_data (G_OBJECT (child->widget),
1437 "gtk-toolbar-is-child",
1438 GINT_TO_POINTER (TRUE));
1440 gtk_widget_show (child->widget);
1444 g_assert_not_reached ();
1447 if ((type != GTK_TOOLBAR_CHILD_SPACE) && tooltip_text)
1448 gtk_tooltips_set_tip (toolbar->tooltips, child->widget,
1449 tooltip_text, tooltip_private_text);
1451 toolbar->children = g_list_insert (toolbar->children, child, position);
1452 toolbar->num_children++;
1454 if (type != GTK_TOOLBAR_CHILD_SPACE)
1455 gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar));
1457 gtk_widget_queue_resize (GTK_WIDGET (toolbar));
1459 return child->widget;
1463 gtk_toolbar_set_orientation (GtkToolbar *toolbar,
1464 GtkOrientation orientation)
1466 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1468 gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
1472 * gtk_toolbar_get_orientation:
1473 * @toolbar: a #GtkToolbar
1475 * Retrieves the current orientation of the toolbar. See
1476 * gtk_toolbar_set_orientation().
1478 * Return value: the orientation
1481 gtk_toolbar_get_orientation (GtkToolbar *toolbar)
1483 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL);
1485 return toolbar->orientation;
1489 gtk_toolbar_set_style (GtkToolbar *toolbar,
1490 GtkToolbarStyle style)
1492 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1494 toolbar->style_set = TRUE;
1495 gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
1499 * gtk_toolbar_get_style:
1500 * @toolbar: a #GtkToolbar
1502 * Retrieves whether the toolbar has text, icons, or both . See
1503 * gtk_toolbar_set_style().
1505 * Return value: the current style of @toolbar
1508 gtk_toolbar_get_style (GtkToolbar *toolbar)
1510 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);
1512 return toolbar->style;
1516 * gtk_toolbar_unset_style:
1517 * @toolbar: a #GtkToolbar
1519 * Unsets a toolbar style set with gtk_toolbar_set_style(), so that
1520 * user preferences will be used to determine the toolbar style.
1523 gtk_toolbar_unset_style (GtkToolbar *toolbar)
1525 GtkToolbarStyle style;
1527 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1529 if (toolbar->style_set)
1531 g_object_get (gtk_settings_get_default (),
1532 "gtk-toolbar-style",
1536 if (style != toolbar->style)
1537 gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
1539 toolbar->style_set = FALSE;
1544 gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
1547 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1550 gtk_tooltips_enable (toolbar->tooltips);
1552 gtk_tooltips_disable (toolbar->tooltips);
1556 * gtk_toolbar_get_tooltips:
1557 * @toolbar: a #GtkToolbar
1559 * Retrieves whether tooltips are enabled. See
1560 * gtk_toolbar_set_tooltips().
1562 * Return value: %TRUE if tooltips are enabled
1565 gtk_toolbar_get_tooltips (GtkToolbar *toolbar)
1567 g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), FALSE);
1569 return toolbar->tooltips->enabled;
1573 gtk_toolbar_update_button_relief (GtkToolbar *toolbar)
1576 GtkToolbarChild *child;
1577 GtkReliefStyle relief;
1579 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1581 relief = get_button_relief (toolbar);
1583 for (children = toolbar->children; children; children = children->next)
1585 child = children->data;
1586 if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
1587 child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
1588 child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
1589 gtk_button_set_relief (GTK_BUTTON (child->widget), relief);
1594 gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
1595 GtkOrientation orientation)
1597 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1599 if (toolbar->orientation != orientation)
1601 toolbar->orientation = orientation;
1602 gtk_widget_queue_resize (GTK_WIDGET (toolbar));
1603 g_object_notify (G_OBJECT (toolbar), "orientation");
1608 get_first_child (GtkContainer *container)
1610 GList *children = gtk_container_get_children (container);
1611 GtkWidget *result = children ? children->data : NULL;
1612 g_list_free (children);
1618 gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
1619 GtkToolbarStyle style)
1622 GtkToolbarChild *child;
1623 GtkWidget* box = NULL;
1625 g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
1627 if (toolbar->style != style)
1629 toolbar->style = style;
1631 for (children = toolbar->children; children; children = children->next)
1633 child = children->data;
1635 if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
1636 child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
1637 child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
1640 case GTK_TOOLBAR_ICONS:
1641 if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
1642 gtk_widget_show (child->icon);
1644 if (child->label && GTK_WIDGET_VISIBLE (child->label))
1645 gtk_widget_hide (child->label);
1649 case GTK_TOOLBAR_TEXT:
1650 if (child->icon && GTK_WIDGET_VISIBLE (child->icon))
1651 gtk_widget_hide (child->icon);
1653 if (child->label && !GTK_WIDGET_VISIBLE (child->label))
1654 gtk_widget_show (child->label);
1658 case GTK_TOOLBAR_BOTH:
1659 if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
1660 gtk_widget_show (child->icon);
1662 if (child->label && !GTK_WIDGET_VISIBLE (child->label))
1663 gtk_widget_show (child->label);
1665 box = get_first_child (GTK_CONTAINER (child->widget));
1667 if (GTK_IS_HBOX (box))
1671 gtk_object_ref (GTK_OBJECT (child->icon));
1672 gtk_container_remove (GTK_CONTAINER (box),
1677 gtk_object_ref (GTK_OBJECT (child->label));
1678 gtk_container_remove (GTK_CONTAINER (box),
1681 gtk_container_remove (GTK_CONTAINER (child->widget),
1684 box = gtk_vbox_new (FALSE, 0);
1685 gtk_widget_show (box);
1689 gtk_box_pack_end (GTK_BOX (box), child->label, FALSE, FALSE, 0);
1690 gtk_object_unref (GTK_OBJECT (child->label));
1694 gtk_box_pack_end (GTK_BOX (box), child->icon, FALSE, FALSE, 0);
1695 gtk_object_unref (GTK_OBJECT (child->icon));
1697 gtk_container_add (GTK_CONTAINER (child->widget),
1703 case GTK_TOOLBAR_BOTH_HORIZ:
1704 if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
1705 gtk_widget_show (child->icon);
1706 if (child->label && !GTK_WIDGET_VISIBLE (child->label))
1707 gtk_widget_show (child->label);
1709 box = get_first_child (GTK_CONTAINER (child->widget));
1711 if (GTK_IS_VBOX (box))
1715 gtk_object_ref (GTK_OBJECT (child->icon));
1716 gtk_container_remove (GTK_CONTAINER (box),
1721 gtk_object_ref (GTK_OBJECT (child->label));
1722 gtk_container_remove (GTK_CONTAINER (box),
1725 gtk_container_remove (GTK_CONTAINER (child->widget),
1728 box = gtk_hbox_new (FALSE, 0);
1729 gtk_widget_show (box);
1733 gtk_box_pack_end (GTK_BOX (box), child->label, TRUE, TRUE, 0);
1734 gtk_object_unref (GTK_OBJECT (child->label));
1738 gtk_box_pack_end (GTK_BOX (box), child->icon, FALSE, FALSE, 0);
1739 gtk_object_unref (GTK_OBJECT (child->icon));
1741 gtk_container_add (GTK_CONTAINER (child->widget), box);
1748 g_assert_not_reached ();
1752 gtk_widget_queue_resize (GTK_WIDGET (toolbar));
1753 g_object_notify (G_OBJECT (toolbar), "toolbar_style");
1758 static GtkReliefStyle
1759 get_button_relief (GtkToolbar *toolbar)
1761 GtkReliefStyle button_relief = GTK_RELIEF_NORMAL;
1763 gtk_widget_style_get (GTK_WIDGET (toolbar),
1764 "button_relief", &button_relief,
1767 return button_relief;
1771 get_space_size (GtkToolbar *toolbar)
1773 gint space_size = DEFAULT_SPACE_SIZE;
1775 gtk_widget_style_get (GTK_WIDGET (toolbar),
1776 "space_size", &space_size,
1782 static GtkToolbarSpaceStyle
1783 get_space_style (GtkToolbar *toolbar)
1785 GtkToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE;
1787 gtk_widget_style_get (GTK_WIDGET (toolbar),
1788 "space_style", &space_style,