remove correction on x when detail is "menuitem". With the new menu look
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x when detail is "menuitem". With the new menu look is isn't needed anymore. * gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a resize here, so that tool items will get a chance to relayout themselves based on the toolbar configuration. change DEFAULT_SPACE_SIZE to 4 instead of 5 * gtk/gtktoolbar.c Get rid of "!GTK_BIN (item)->child means separator". Separators are widgets in their own right change DEFAULT_SPACE_SIZE to 4 instead of 5 (get_space_size): remove this function (toolbar_item_is_homogeneous): new function * gtk/gtkseparatortoolitem.c (gtk_separator_tool_item_size_request): new function. Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtktoggletoolbutton.h: use private data, add new internal function _gtk_toggle_tool_button_get_button() * gtk/gtktoolbutton.h: move to private data * gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new private data.
This commit is contained in:
parent
b3b16bebcf
commit
7913e63f69
34
ChangeLog
34
ChangeLog
@ -1,3 +1,37 @@
|
||||
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
|
||||
when detail is "menuitem". With the new menu look is isn't needed
|
||||
anymore.
|
||||
|
||||
* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
|
||||
resize here, so that tool items will get a chance to relayout
|
||||
themselves based on the toolbar configuration.
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
Get rid of "!GTK_BIN (item)->child means separator". Separators
|
||||
are widgets in their own right
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
(get_space_size): remove this function
|
||||
(toolbar_item_is_homogeneous): new function
|
||||
|
||||
* gtk/gtkseparatortoolitem.c
|
||||
(gtk_separator_tool_item_size_request): new function.
|
||||
|
||||
Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoggletoolbutton.h: use private data, add new
|
||||
internal function _gtk_toggle_tool_button_get_button()
|
||||
|
||||
* gtk/gtktoolbutton.h: move to private data
|
||||
|
||||
* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
|
||||
private data.
|
||||
|
||||
Tue Jul 8 12:50:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoolbutton.c (gtk_tool_button_get_icon_widget): fix a
|
||||
|
@ -1,3 +1,37 @@
|
||||
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
|
||||
when detail is "menuitem". With the new menu look is isn't needed
|
||||
anymore.
|
||||
|
||||
* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
|
||||
resize here, so that tool items will get a chance to relayout
|
||||
themselves based on the toolbar configuration.
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
Get rid of "!GTK_BIN (item)->child means separator". Separators
|
||||
are widgets in their own right
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
(get_space_size): remove this function
|
||||
(toolbar_item_is_homogeneous): new function
|
||||
|
||||
* gtk/gtkseparatortoolitem.c
|
||||
(gtk_separator_tool_item_size_request): new function.
|
||||
|
||||
Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoggletoolbutton.h: use private data, add new
|
||||
internal function _gtk_toggle_tool_button_get_button()
|
||||
|
||||
* gtk/gtktoolbutton.h: move to private data
|
||||
|
||||
* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
|
||||
private data.
|
||||
|
||||
Tue Jul 8 12:50:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoolbutton.c (gtk_tool_button_get_icon_widget): fix a
|
||||
|
@ -1,3 +1,37 @@
|
||||
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
|
||||
when detail is "menuitem". With the new menu look is isn't needed
|
||||
anymore.
|
||||
|
||||
* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
|
||||
resize here, so that tool items will get a chance to relayout
|
||||
themselves based on the toolbar configuration.
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
Get rid of "!GTK_BIN (item)->child means separator". Separators
|
||||
are widgets in their own right
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
(get_space_size): remove this function
|
||||
(toolbar_item_is_homogeneous): new function
|
||||
|
||||
* gtk/gtkseparatortoolitem.c
|
||||
(gtk_separator_tool_item_size_request): new function.
|
||||
|
||||
Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoggletoolbutton.h: use private data, add new
|
||||
internal function _gtk_toggle_tool_button_get_button()
|
||||
|
||||
* gtk/gtktoolbutton.h: move to private data
|
||||
|
||||
* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
|
||||
private data.
|
||||
|
||||
Tue Jul 8 12:50:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoolbutton.c (gtk_tool_button_get_icon_widget): fix a
|
||||
|
@ -1,3 +1,37 @@
|
||||
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
|
||||
when detail is "menuitem". With the new menu look is isn't needed
|
||||
anymore.
|
||||
|
||||
* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
|
||||
resize here, so that tool items will get a chance to relayout
|
||||
themselves based on the toolbar configuration.
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
Get rid of "!GTK_BIN (item)->child means separator". Separators
|
||||
are widgets in their own right
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
(get_space_size): remove this function
|
||||
(toolbar_item_is_homogeneous): new function
|
||||
|
||||
* gtk/gtkseparatortoolitem.c
|
||||
(gtk_separator_tool_item_size_request): new function.
|
||||
|
||||
Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoggletoolbutton.h: use private data, add new
|
||||
internal function _gtk_toggle_tool_button_get_button()
|
||||
|
||||
* gtk/gtktoolbutton.h: move to private data
|
||||
|
||||
* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
|
||||
private data.
|
||||
|
||||
Tue Jul 8 12:50:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoolbutton.c (gtk_tool_button_get_icon_widget): fix a
|
||||
|
@ -1,3 +1,37 @@
|
||||
Tue Jul 8 19:57:14 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
|
||||
when detail is "menuitem". With the new menu look is isn't needed
|
||||
anymore.
|
||||
|
||||
* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
|
||||
resize here, so that tool items will get a chance to relayout
|
||||
themselves based on the toolbar configuration.
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
Get rid of "!GTK_BIN (item)->child means separator". Separators
|
||||
are widgets in their own right
|
||||
|
||||
change DEFAULT_SPACE_SIZE to 4 instead of 5
|
||||
|
||||
(get_space_size): remove this function
|
||||
(toolbar_item_is_homogeneous): new function
|
||||
|
||||
* gtk/gtkseparatortoolitem.c
|
||||
(gtk_separator_tool_item_size_request): new function.
|
||||
|
||||
Tue Jul 8 14:10:35 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoggletoolbutton.h: use private data, add new
|
||||
internal function _gtk_toggle_tool_button_get_button()
|
||||
|
||||
* gtk/gtktoolbutton.h: move to private data
|
||||
|
||||
* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
|
||||
private data.
|
||||
|
||||
Tue Jul 8 12:50:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtktoolbutton.c (gtk_tool_button_get_icon_widget): fix a
|
||||
|
@ -67,7 +67,8 @@ gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass)
|
||||
static void
|
||||
gtk_radio_tool_button_init (GtkRadioToolButton *button)
|
||||
{
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (GTK_TOOL_BUTTON (button)->button), FALSE);
|
||||
GtkToolButton *tool_button = GTK_TOOL_BUTTON (button);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)), FALSE);
|
||||
}
|
||||
|
||||
GtkToolItem *
|
||||
@ -128,12 +129,18 @@ gtk_radio_tool_button_new_with_stock_from_widget (GtkWidget *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)));
|
||||
}
|
||||
|
||||
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 (GTK_RADIO_BUTTON (GTK_TOOL_BUTTON (button)->button));
|
||||
return gtk_radio_button_get_group (get_radio_button (button));
|
||||
}
|
||||
|
||||
void
|
||||
@ -142,6 +149,6 @@ gtk_radio_tool_button_set_group (GtkRadioToolButton *button,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button));
|
||||
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (GTK_TOOL_BUTTON (button)->button), group);
|
||||
gtk_radio_button_set_group (get_radio_button (button), group);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "gtktoolbar.h"
|
||||
|
||||
/* note: keep in sync with DEFAULT_SPACE_SIZE and DEFAULT_SPACE_STYLE in gtktoolbar.c */
|
||||
#define DEFAULT_SPACE_SIZE 5
|
||||
#define DEFAULT_SPACE_SIZE 4
|
||||
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
|
||||
|
||||
#define SPACE_LINE_DIVISION 10
|
||||
@ -35,6 +35,8 @@
|
||||
#define SPACE_LINE_END 7
|
||||
|
||||
static void gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class);
|
||||
static void gtk_separator_tool_item_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static gboolean gtk_separator_tool_item_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static void gtk_separator_tool_item_add (GtkContainer *container,
|
||||
@ -115,6 +117,7 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
|
||||
toolitem_class = (GtkToolItemClass *)class;
|
||||
widget_class = (GtkWidgetClass *)class;
|
||||
|
||||
widget_class->size_request = gtk_separator_tool_item_size_request;
|
||||
widget_class->expose_event = gtk_separator_tool_item_expose;
|
||||
|
||||
container_class->add = gtk_separator_tool_item_add;
|
||||
@ -127,6 +130,25 @@ gtk_separator_tool_item_add (GtkContainer *container,
|
||||
g_warning("attempt to add a child to an GtkSeparatorToolItem");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_separator_tool_item_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkToolItem *item = GTK_TOOL_ITEM (widget);
|
||||
GtkOrientation orientation = gtk_tool_item_get_orientation (item);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
requisition->width = get_space_size (item);
|
||||
requisition->height = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
requisition->height = get_space_size (item);
|
||||
requisition->width = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_separator_tool_item_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
@ -143,7 +165,7 @@ gtk_separator_tool_item_expose (GtkWidget *widget,
|
||||
allocation = &(widget->allocation);
|
||||
orientation = gtk_tool_item_get_orientation (tool_item);
|
||||
area = &(event->area);
|
||||
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_paint_vline (widget->style, widget->window,
|
||||
|
@ -3095,10 +3095,6 @@ gtk_default_draw_arrow (GtkStyle *style,
|
||||
|
||||
calculate_arrow_geometry (arrow_type, &x, &y, &width, &height);
|
||||
|
||||
if (detail && strcmp (detail, "menuitem") == 0
|
||||
&& gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
x = original_x + original_width - width;
|
||||
|
||||
if (detail && strcmp (detail, "menu_scroll_arrow_up") == 0)
|
||||
y++;
|
||||
|
||||
|
@ -33,6 +33,11 @@ enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
struct _GtkToggleToolButtonPrivate
|
||||
{
|
||||
guint active : 1;
|
||||
};
|
||||
|
||||
static void gtk_toggle_tool_button_init (GtkToggleToolButton *button);
|
||||
static void gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass);
|
||||
|
||||
@ -102,8 +107,10 @@ gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass)
|
||||
static void
|
||||
gtk_toggle_tool_button_init (GtkToggleToolButton *button)
|
||||
{
|
||||
g_signal_connect_object (GTK_TOOL_BUTTON (button)->button, "toggled",
|
||||
G_CALLBACK (button_toggled), button, 0);
|
||||
button->priv = g_new0 (GtkToggleToolButtonPrivate, 1);
|
||||
|
||||
g_signal_connect_object (_gtk_tool_button_get_button (GTK_TOOL_BUTTON (button)),
|
||||
"toggled", G_CALLBACK (button_toggled), button, 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -116,14 +123,21 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
gboolean use_mnemonic = TRUE;
|
||||
const char *label = "";
|
||||
|
||||
if (tool_button->label_widget && GTK_IS_LABEL (tool_button->label_widget))
|
||||
label = gtk_label_get_label (GTK_LABEL (tool_button->label_widget));
|
||||
else if (tool_button->label_text)
|
||||
GtkWidget *label_widget = gtk_tool_button_get_label_widget (tool_button);
|
||||
const gchar *label_text = gtk_tool_button_get_label (tool_button);
|
||||
gboolean use_underline = gtk_tool_button_get_use_underline (tool_button);
|
||||
const gchar *stock_id = gtk_tool_button_get_stock_id (tool_button);
|
||||
|
||||
if (label_widget && GTK_IS_LABEL (label_widget))
|
||||
{
|
||||
label = tool_button->label_text;
|
||||
use_mnemonic = tool_button->use_underline;
|
||||
label = gtk_label_get_label (GTK_LABEL (label_widget));
|
||||
}
|
||||
else if (tool_button->stock_id && gtk_stock_lookup (tool_button->stock_id, &stock_item))
|
||||
else if (label_text)
|
||||
{
|
||||
label = label_text;
|
||||
use_mnemonic = use_underline;
|
||||
}
|
||||
else if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
|
||||
label = stock_item.label;
|
||||
|
||||
if (use_mnemonic)
|
||||
@ -132,7 +146,7 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
menu_item = gtk_check_menu_item_new_with_label (label);
|
||||
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
|
||||
toggle_tool_button->active);
|
||||
toggle_tool_button->priv->active);
|
||||
|
||||
g_signal_connect_closure_by_id (menu_item,
|
||||
g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
|
||||
@ -164,12 +178,12 @@ menu_item_activated (GtkWidget *menu_item,
|
||||
GtkToolButton *tool_button = GTK_TOOL_BUTTON (toggle_tool_button);
|
||||
gboolean menu_active = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_item));
|
||||
|
||||
if (toggle_tool_button->active != menu_active)
|
||||
if (toggle_tool_button->priv->active != menu_active)
|
||||
{
|
||||
toggle_tool_button->active = menu_active;
|
||||
toggle_tool_button->priv->active = menu_active;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tool_button->button),
|
||||
toggle_tool_button->active);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)),
|
||||
toggle_tool_button->priv->active);
|
||||
|
||||
g_signal_emit (G_OBJECT (toggle_tool_button), toggle_signals[TOGGLED], 0);
|
||||
}
|
||||
@ -181,17 +195,17 @@ button_toggled (GtkWidget *widget,
|
||||
{
|
||||
gboolean toggle_active = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
|
||||
if (toggle_tool_button->active != toggle_active)
|
||||
if (toggle_tool_button->priv->active != toggle_active)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
|
||||
toggle_tool_button->active = toggle_active;
|
||||
toggle_tool_button->priv->active = toggle_active;
|
||||
|
||||
if ((menu_item =
|
||||
gtk_tool_item_get_proxy_menu_item (GTK_TOOL_ITEM (toggle_tool_button), MENU_ID)))
|
||||
{
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
|
||||
toggle_tool_button->active);
|
||||
toggle_tool_button->priv->active);
|
||||
}
|
||||
|
||||
g_signal_emit (G_OBJECT (toggle_tool_button), toggle_signals[TOGGLED], 0);
|
||||
@ -231,8 +245,8 @@ gtk_toggle_tool_button_set_active (GtkToggleToolButton *button,
|
||||
|
||||
is_active = is_active != FALSE;
|
||||
|
||||
if (button->active != is_active)
|
||||
gtk_button_clicked (GTK_BUTTON (GTK_TOOL_BUTTON (button)->button));
|
||||
if (button->priv->active != is_active)
|
||||
gtk_button_clicked (GTK_BUTTON (_gtk_tool_button_get_button (GTK_TOOL_BUTTON (button))));
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -240,5 +254,5 @@ gtk_toggle_tool_button_get_active (GtkToggleToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOGGLE_TOOL_BUTTON (button), FALSE);
|
||||
|
||||
return button->active;
|
||||
return button->priv->active;
|
||||
}
|
||||
|
@ -27,24 +27,25 @@
|
||||
|
||||
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 ((obj), 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))
|
||||
#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 ((obj), 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))
|
||||
#define GTK_TOGGLE_TOOL_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TOOL_BUTTON, GtkToggleToolButtonPrivate))
|
||||
#define GTK_TOGGLE_TOOL_BUTTON_GET_PRIVATE(obj) (
|
||||
|
||||
typedef struct _GtkToggleToolButton GtkToggleToolButton;
|
||||
typedef struct _GtkToggleToolButtonClass GtkToggleToolButtonClass;
|
||||
typedef struct _GtkToggleToolButton GtkToggleToolButton;
|
||||
typedef struct _GtkToggleToolButtonClass GtkToggleToolButtonClass;
|
||||
typedef struct _GtkToggleToolButtonPrivate GtkToggleToolButtonPrivate;
|
||||
|
||||
struct _GtkToggleToolButton
|
||||
{
|
||||
GtkToolButton parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkWidget *menu_item;
|
||||
|
||||
guint active : 1;
|
||||
GtkToggleToolButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkToggleToolButtonClass
|
||||
|
@ -51,7 +51,7 @@
|
||||
#define DEFAULT_IPADDING 0
|
||||
|
||||
/* note: keep in sync with DEFAULT_SPACE_SIZE and DEFAULT_SPACE_STYLE in gtkseparatortoolitem.c */
|
||||
#define DEFAULT_SPACE_SIZE 5
|
||||
#define DEFAULT_SPACE_SIZE 4
|
||||
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
|
||||
|
||||
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
@ -161,7 +161,6 @@ static void gtk_toolbar_arrow_button_clicked (GtkWidget *bu
|
||||
GtkToolbar *toolbar);
|
||||
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
|
||||
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
|
||||
static gint get_space_size (GtkToolbar *toolbar);
|
||||
static gint get_internal_padding (GtkToolbar *toolbar);
|
||||
static void gtk_toolbar_remove_tool_item (GtkToolbar *toolbar,
|
||||
GtkToolItem *item);
|
||||
@ -564,6 +563,12 @@ toolbar_item_visible (GtkToolbar *toolbar,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
toolbar_item_is_homogeneous (GtkToolItem *item)
|
||||
{
|
||||
return (gtk_tool_item_get_homogeneous (item) && !GTK_IS_SEPARATOR_TOOL_ITEM (item));
|
||||
}
|
||||
|
||||
static void
|
||||
toolbar_item_set_is_overflow (GtkToolItem *item,
|
||||
gboolean is_overflow)
|
||||
@ -773,7 +778,6 @@ gtk_toolbar_size_request (GtkWidget *widget,
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
||||
GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
|
||||
gint space_size = get_space_size (toolbar);
|
||||
GList *list;
|
||||
gint max_child_height;
|
||||
gint max_child_width;
|
||||
@ -803,7 +807,7 @@ gtk_toolbar_size_request (GtkWidget *widget,
|
||||
max_child_width = MAX (max_child_width, requisition.width);
|
||||
max_child_height = MAX (max_child_height, requisition.height);
|
||||
|
||||
if (gtk_tool_item_get_homogeneous (item) && GTK_BIN (item)->child)
|
||||
if (toolbar_item_is_homogeneous (item))
|
||||
{
|
||||
max_homogeneous_child_width = MAX (max_homogeneous_child_width, requisition.width);
|
||||
max_homogeneous_child_height = MAX (max_homogeneous_child_height, requisition.height);
|
||||
@ -825,11 +829,7 @@ gtk_toolbar_size_request (GtkWidget *widget,
|
||||
if (!toolbar_item_visible (toolbar, item))
|
||||
continue;
|
||||
|
||||
if (!GTK_BIN (item)->child)
|
||||
{
|
||||
size = space_size;
|
||||
}
|
||||
else if (gtk_tool_item_get_homogeneous (item))
|
||||
if (toolbar_item_is_homogeneous (item))
|
||||
{
|
||||
size = homogeneous_size;
|
||||
}
|
||||
@ -922,21 +922,18 @@ get_item_size (GtkToolbar *toolbar,
|
||||
GtkRequisition requisition;
|
||||
GtkToolItem *item = GTK_TOOL_ITEM (child);
|
||||
|
||||
if (!GTK_BIN (item)->child)
|
||||
return get_space_size (toolbar);
|
||||
|
||||
gtk_widget_get_child_requisition (child, &requisition);
|
||||
|
||||
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (gtk_tool_item_get_homogeneous (item))
|
||||
if (toolbar_item_is_homogeneous (item))
|
||||
return toolbar->button_maxw;
|
||||
else
|
||||
return requisition.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_tool_item_get_homogeneous (item))
|
||||
if (toolbar_item_is_homogeneous (item))
|
||||
return toolbar->button_maxh;
|
||||
else
|
||||
return requisition.height;
|
||||
@ -949,7 +946,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
||||
GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
|
||||
gint space_size;
|
||||
GtkAllocation *allocations;
|
||||
GtkAllocation arrow_allocation;
|
||||
gint arrow_size;
|
||||
@ -967,8 +963,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
space_size = get_space_size (toolbar);
|
||||
|
||||
border_width = GTK_CONTAINER (toolbar)->border_width;
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
@ -1093,7 +1087,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (toolbar_item_visible (toolbar, item) &&
|
||||
gtk_tool_item_get_expand (item) &&
|
||||
!toolbar_item_get_is_overflow (item) && GTK_BIN (item)->child)
|
||||
!toolbar_item_get_is_overflow (item) &&
|
||||
!GTK_IS_SEPARATOR_TOOL_ITEM (item))
|
||||
{
|
||||
n_expand_items++;
|
||||
}
|
||||
@ -1104,7 +1099,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||
GtkToolItem *item = list->data;
|
||||
|
||||
if (toolbar_item_visible (toolbar, item) && gtk_tool_item_get_expand (item) &&
|
||||
!toolbar_item_get_is_overflow (item) && GTK_BIN (item)->child)
|
||||
!toolbar_item_get_is_overflow (item) &&
|
||||
!GTK_IS_SEPARATOR_TOOL_ITEM (item))
|
||||
{
|
||||
gint extra = size / n_expand_items;
|
||||
if (size % n_expand_items != 0)
|
||||
@ -2019,18 +2015,6 @@ get_button_relief (GtkToolbar *toolbar)
|
||||
return button_relief;
|
||||
}
|
||||
|
||||
static gint
|
||||
get_space_size (GtkToolbar *toolbar)
|
||||
{
|
||||
gint space_size = DEFAULT_SPACE_SIZE;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (toolbar),
|
||||
"space_size", &space_size,
|
||||
NULL);
|
||||
|
||||
return space_size;
|
||||
}
|
||||
|
||||
static gint
|
||||
get_internal_padding (GtkToolbar *toolbar)
|
||||
{
|
||||
@ -2515,9 +2499,10 @@ gtk_toolbar_remove_space (GtkToolbar *toolbar,
|
||||
return;
|
||||
}
|
||||
|
||||
if (GTK_BIN (item)->child)
|
||||
if (!GTK_IS_SEPARATOR_TOOL_ITEM (item))
|
||||
{
|
||||
g_warning ("Toolbar position %d is not a space", position);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_toolbar_remove_tool_item (toolbar, item);
|
||||
@ -2686,19 +2671,19 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
|
||||
|
||||
case GTK_TOOLBAR_CHILD_BUTTON:
|
||||
item = gtk_tool_button_new (NULL, NULL);
|
||||
child->widget = GTK_TOOL_BUTTON (item)->button;
|
||||
child->widget = _gtk_tool_button_get_button (GTK_TOOL_BUTTON (item));
|
||||
break;
|
||||
|
||||
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
||||
item = gtk_toggle_tool_button_new ();
|
||||
child->widget = GTK_TOOL_BUTTON (item)->button;
|
||||
child->widget = _gtk_tool_button_get_button (GTK_TOOL_BUTTON (item));
|
||||
break;
|
||||
|
||||
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
||||
item = gtk_radio_tool_button_new (widget
|
||||
? gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget))
|
||||
: NULL);
|
||||
child->widget = GTK_TOOL_BUTTON (item)->button;
|
||||
child->widget = _gtk_tool_button_get_button (GTK_TOOL_BUTTON (item));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,18 @@ static void gtk_tool_button_construct_contents (GtkToolItem *tool_item);
|
||||
static GObjectClass *parent_class = NULL;
|
||||
static guint toolbutton_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
struct _GtkToolButtonPrivate
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
gchar *stock_id;
|
||||
gchar *label_text;
|
||||
GtkWidget *label_widget;
|
||||
GtkWidget *icon_widget;
|
||||
|
||||
guint use_underline : 1;
|
||||
};
|
||||
|
||||
GType
|
||||
gtk_tool_button_get_type (void)
|
||||
{
|
||||
@ -212,17 +224,19 @@ gtk_tool_button_init (GtkToolButton *button,
|
||||
GtkToolButtonClass *klass)
|
||||
{
|
||||
GtkToolItem *toolitem = GTK_TOOL_ITEM (button);
|
||||
|
||||
button->priv = g_new0 (GtkToolButtonPrivate, 1);
|
||||
|
||||
gtk_tool_item_set_homogeneous (toolitem, TRUE);
|
||||
|
||||
/* create button */
|
||||
button->button = g_object_new (klass->button_type, NULL);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (button->button), FALSE);
|
||||
g_signal_connect_object (button->button, "clicked",
|
||||
button->priv->button = g_object_new (klass->button_type, NULL);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (button->priv->button), FALSE);
|
||||
g_signal_connect_object (button->priv->button, "clicked",
|
||||
G_CALLBACK (button_clicked), button, 0);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), button->button);
|
||||
gtk_widget_show (button->button);
|
||||
gtk_container_add (GTK_CONTAINER (button), button->priv->button);
|
||||
gtk_widget_show (button->priv->button);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -295,24 +309,24 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
gtk_tool_item_set_proxy_menu_item (tool_item, MENU_ID, NULL);
|
||||
}
|
||||
|
||||
if (button->icon_widget && button->icon_widget->parent)
|
||||
if (button->priv->icon_widget && button->priv->icon_widget->parent)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (button->icon_widget->parent),
|
||||
button->icon_widget);
|
||||
gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
|
||||
button->priv->icon_widget);
|
||||
}
|
||||
|
||||
if (button->label_widget && button->label_widget->parent)
|
||||
if (button->priv->label_widget && button->priv->label_widget->parent)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (button->label_widget->parent),
|
||||
button->label_widget);
|
||||
gtk_container_remove (GTK_CONTAINER (button->priv->label_widget->parent),
|
||||
button->priv->label_widget);
|
||||
}
|
||||
|
||||
if (GTK_BIN (button->button)->child)
|
||||
if (GTK_BIN (button->priv->button)->child)
|
||||
{
|
||||
/* Note: we are not destroying the label_widget or icon_widget
|
||||
* here because they were removed from their containers above
|
||||
*/
|
||||
gtk_widget_destroy (GTK_BIN (button->button)->child);
|
||||
gtk_widget_destroy (GTK_BIN (button->priv->button)->child);
|
||||
}
|
||||
|
||||
style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
|
||||
@ -325,9 +339,9 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
|
||||
if (need_label)
|
||||
{
|
||||
if (button->label_widget)
|
||||
if (button->priv->label_widget)
|
||||
{
|
||||
label = button->label_widget;
|
||||
label = button->priv->label_widget;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -335,12 +349,12 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
gboolean elide;
|
||||
gchar *label_text;
|
||||
|
||||
if (button->label_text)
|
||||
if (button->priv->label_text)
|
||||
{
|
||||
label_text = button->label_text;
|
||||
elide = button->use_underline;
|
||||
label_text = button->priv->label_text;
|
||||
elide = button->priv->use_underline;
|
||||
}
|
||||
else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
|
||||
else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
|
||||
{
|
||||
label_text = stock_item.label;
|
||||
elide = TRUE;
|
||||
@ -367,20 +381,20 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
||||
if (need_icon)
|
||||
{
|
||||
if (button->icon_widget)
|
||||
if (button->priv->icon_widget)
|
||||
{
|
||||
icon = button->icon_widget;
|
||||
icon = button->priv->icon_widget;
|
||||
|
||||
if (GTK_IS_IMAGE (icon))
|
||||
{
|
||||
g_object_set (G_OBJECT (button->icon_widget),
|
||||
g_object_set (G_OBJECT (button->priv->icon_widget),
|
||||
"icon-size", icon_size,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
else if (button->stock_id)
|
||||
else if (button->priv->stock_id)
|
||||
{
|
||||
icon = gtk_image_new_from_stock (button->stock_id, icon_size);
|
||||
icon = gtk_image_new_from_stock (button->priv->stock_id, icon_size);
|
||||
gtk_widget_show (icon);
|
||||
}
|
||||
}
|
||||
@ -389,32 +403,32 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
{
|
||||
case GTK_TOOLBAR_ICONS:
|
||||
if (icon)
|
||||
gtk_container_add (GTK_CONTAINER (button->button), icon);
|
||||
gtk_container_add (GTK_CONTAINER (button->priv->button), icon);
|
||||
break;
|
||||
|
||||
case GTK_TOOLBAR_BOTH:
|
||||
box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (button->button), box);
|
||||
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
||||
break;
|
||||
|
||||
case GTK_TOOLBAR_BOTH_HORIZ:
|
||||
box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), icon, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (button->button), box);
|
||||
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
||||
break;
|
||||
|
||||
case GTK_TOOLBAR_TEXT:
|
||||
gtk_container_add (GTK_CONTAINER (button->button), label);
|
||||
gtk_container_add (GTK_CONTAINER (button->priv->button), label);
|
||||
break;
|
||||
}
|
||||
|
||||
if (box)
|
||||
gtk_widget_show (box);
|
||||
|
||||
gtk_button_set_relief (GTK_BUTTON (button->button),
|
||||
gtk_button_set_relief (GTK_BUTTON (button->priv->button),
|
||||
gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (button)));
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (button));
|
||||
@ -470,10 +484,10 @@ gtk_tool_button_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_tool_button_get_use_underline (button));
|
||||
break;
|
||||
case PROP_STOCK_ID:
|
||||
g_value_set_string (value, button->stock_id);
|
||||
g_value_set_string (value, button->priv->stock_id);
|
||||
break;
|
||||
case PROP_ICON_WIDGET:
|
||||
g_value_set_object (value, button->icon_widget);
|
||||
g_value_set_object (value, button->priv->icon_widget);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -485,8 +499,8 @@ gtk_tool_button_finalize (GObject *object)
|
||||
{
|
||||
GtkToolButton *button = GTK_TOOL_BUTTON (object);
|
||||
|
||||
g_free (button->stock_id);
|
||||
button->stock_id = NULL;
|
||||
g_free (button->priv->stock_id);
|
||||
button->priv->stock_id = NULL;
|
||||
|
||||
parent_class->finalize (object);
|
||||
}
|
||||
@ -539,17 +553,17 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
gboolean use_mnemonic = TRUE;
|
||||
const char *label;
|
||||
|
||||
if (button->label_widget && GTK_IS_LABEL (button->label_widget))
|
||||
if (button->priv->label_widget && GTK_IS_LABEL (button->priv->label_widget))
|
||||
{
|
||||
label = gtk_label_get_label (GTK_LABEL (button->label_widget));
|
||||
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->label_widget));
|
||||
label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
|
||||
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget));
|
||||
}
|
||||
else if (button->label_text)
|
||||
else if (button->priv->label_text)
|
||||
{
|
||||
label = button->label_text;
|
||||
use_mnemonic = button->use_underline;
|
||||
label = button->priv->label_text;
|
||||
use_mnemonic = button->priv->use_underline;
|
||||
}
|
||||
else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
|
||||
else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
|
||||
{
|
||||
label = stock_item.label;
|
||||
use_mnemonic = FALSE;
|
||||
@ -565,14 +579,14 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
else
|
||||
menu_item = gtk_image_menu_item_new_with_label (label);
|
||||
|
||||
if (button->icon_widget && GTK_IS_IMAGE (button->icon_widget))
|
||||
if (button->priv->icon_widget && GTK_IS_IMAGE (button->priv->icon_widget))
|
||||
{
|
||||
menu_image = clone_image_menu_size (GTK_IMAGE (button->icon_widget),
|
||||
menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget),
|
||||
gtk_widget_get_settings (GTK_WIDGET (button)));
|
||||
}
|
||||
else if (button->stock_id)
|
||||
else if (button->priv->stock_id)
|
||||
{
|
||||
menu_image = gtk_image_new_from_stock (button->stock_id, GTK_ICON_SIZE_MENU);
|
||||
menu_image = gtk_image_new_from_stock (button->priv->stock_id, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
if (menu_image)
|
||||
@ -581,7 +595,7 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
g_signal_connect_closure_by_id (menu_item,
|
||||
g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
|
||||
g_cclosure_new_object_swap (G_CALLBACK (gtk_button_clicked),
|
||||
G_OBJECT (GTK_TOOL_BUTTON (button)->button)),
|
||||
G_OBJECT (GTK_TOOL_BUTTON (button)->priv->button)),
|
||||
FALSE);
|
||||
|
||||
gtk_tool_item_set_proxy_menu_item (GTK_TOOL_ITEM (button), MENU_ID, menu_item);
|
||||
@ -642,9 +656,9 @@ gtk_tool_button_set_label (GtkToolButton *button,
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
|
||||
|
||||
old_label = button->label_text;
|
||||
old_label = button->priv->label_text;
|
||||
|
||||
button->label_text = g_strdup (label);
|
||||
button->priv->label_text = g_strdup (label);
|
||||
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
|
||||
|
||||
g_object_notify (G_OBJECT (button), "label");
|
||||
@ -658,7 +672,7 @@ gtk_tool_button_get_label (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return button->label_text;
|
||||
return button->priv->label_text;
|
||||
}
|
||||
|
||||
void
|
||||
@ -669,9 +683,9 @@ gtk_tool_button_set_use_underline (GtkToolButton *button,
|
||||
|
||||
use_underline = use_underline != FALSE;
|
||||
|
||||
if (use_underline != button->use_underline)
|
||||
if (use_underline != button->priv->use_underline)
|
||||
{
|
||||
button->use_underline = use_underline;
|
||||
button->priv->use_underline = use_underline;
|
||||
|
||||
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
|
||||
|
||||
@ -684,7 +698,7 @@ gtk_tool_button_get_use_underline (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), FALSE);
|
||||
|
||||
return button->use_underline;
|
||||
return button->priv->use_underline;
|
||||
}
|
||||
|
||||
void
|
||||
@ -695,9 +709,9 @@ gtk_tool_button_set_stock_id (GtkToolButton *button,
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
|
||||
|
||||
old_stock_id = button->stock_id;
|
||||
old_stock_id = button->priv->stock_id;
|
||||
|
||||
button->stock_id = g_strdup (stock_id);
|
||||
button->priv->stock_id = g_strdup (stock_id);
|
||||
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
|
||||
|
||||
g_object_notify (G_OBJECT (button), "stock_id");
|
||||
@ -710,7 +724,7 @@ gtk_tool_button_get_stock_id (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return button->stock_id;
|
||||
return button->priv->stock_id;
|
||||
}
|
||||
|
||||
void
|
||||
@ -720,10 +734,10 @@ gtk_tool_button_set_icon_widget (GtkToolButton *button,
|
||||
g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
|
||||
g_return_if_fail (icon == NULL || GTK_IS_WIDGET (icon));
|
||||
|
||||
if (icon != button->icon_widget)
|
||||
if (icon != button->priv->icon_widget)
|
||||
{
|
||||
if (button->icon_widget)
|
||||
g_object_unref (G_OBJECT (button->icon_widget));
|
||||
if (button->priv->icon_widget)
|
||||
g_object_unref (G_OBJECT (button->priv->icon_widget));
|
||||
|
||||
if (icon)
|
||||
{
|
||||
@ -731,7 +745,7 @@ gtk_tool_button_set_icon_widget (GtkToolButton *button,
|
||||
gtk_object_sink (GTK_OBJECT (icon));
|
||||
}
|
||||
|
||||
button->icon_widget = icon;
|
||||
button->priv->icon_widget = icon;
|
||||
|
||||
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
|
||||
|
||||
@ -746,10 +760,10 @@ gtk_tool_button_set_label_widget (GtkToolButton *button,
|
||||
g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
|
||||
g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
|
||||
|
||||
if (label_widget != button->label_widget)
|
||||
if (label_widget != button->priv->label_widget)
|
||||
{
|
||||
if (button->label_widget)
|
||||
g_object_unref (button->label_widget);
|
||||
if (button->priv->label_widget)
|
||||
g_object_unref (button->priv->label_widget);
|
||||
|
||||
if (label_widget)
|
||||
{
|
||||
@ -757,7 +771,7 @@ gtk_tool_button_set_label_widget (GtkToolButton *button,
|
||||
gtk_object_sink (GTK_OBJECT (label_widget));
|
||||
}
|
||||
|
||||
button->label_widget = label_widget;
|
||||
button->priv->label_widget = label_widget;
|
||||
|
||||
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (button));
|
||||
|
||||
@ -770,7 +784,7 @@ gtk_tool_button_get_label_widget (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return button->label_widget;
|
||||
return button->priv->label_widget;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@ -778,5 +792,13 @@ gtk_tool_button_get_icon_widget (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return button->icon_widget;
|
||||
return button->priv->icon_widget;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
_gtk_tool_button_get_button (GtkToolButton *button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
|
||||
|
||||
return button->priv->button;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ G_BEGIN_DECLS
|
||||
#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 ((obj), GTK_TYPE_TOOL_BUTTON))
|
||||
#define GTK_TOOL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_TOOL_BUTTON, GtkToolButtonClass))
|
||||
#define GTK_TOOL_ITEM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TOOL_BUTTON, GtkToolButtonPrivate))
|
||||
|
||||
typedef struct _GtkToolButton GtkToolButton;
|
||||
typedef struct _GtkToolButtonClass GtkToolButtonClass;
|
||||
@ -42,14 +43,8 @@ struct _GtkToolButton
|
||||
{
|
||||
GtkToolItem parent;
|
||||
|
||||
GtkWidget *button;
|
||||
|
||||
gchar *stock_id;
|
||||
gchar *label_text;
|
||||
GtkWidget *label_widget;
|
||||
GtkWidget *icon_widget;
|
||||
|
||||
guint use_underline : 1;
|
||||
/*< private >*/
|
||||
GtkToolButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkToolButtonClass
|
||||
@ -84,6 +79,9 @@ void gtk_tool_button_set_label_widget (GtkToolButton *button,
|
||||
GtkWidget *label_widget);
|
||||
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__ */
|
||||
|
@ -508,6 +508,8 @@ gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
|
||||
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));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -43,6 +43,7 @@ struct _GtkToolItem
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkToolItemPrivate *priv;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user