mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
By popular request give toolbuttons a border.
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk> By popular request give toolbuttons a border. * gtk/gtktoolitem.c (gtk_tool_item_size_allocate): (gtk_tool_item_size_request): don't request and allocate a border around the child * gtk/gtktoolbutton.c (gtk_tool_button_size_allocate): (gtk_tool_button_size_request): remove these functions * gtk/gtktoolbar.c (gtk_toolbar_size_request): (gtk_toolbar_size_allocate): request and allocate a border if we have a shadow.
This commit is contained in:
parent
62a7160df0
commit
80560b9d3d
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
|||||||
|
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
By popular request give toolbuttons a border.
|
||||||
|
|
||||||
|
* gtk/gtktoolitem.c
|
||||||
|
(gtk_tool_item_size_allocate):
|
||||||
|
(gtk_tool_item_size_request): don't request and allocate a border
|
||||||
|
around the child
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c
|
||||||
|
(gtk_tool_button_size_allocate):
|
||||||
|
(gtk_tool_button_size_request): remove these functions
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c
|
||||||
|
(gtk_toolbar_size_request):
|
||||||
|
(gtk_toolbar_size_allocate): request and allocate a border if we
|
||||||
|
have a shadow.
|
||||||
|
|
||||||
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
Merged from stable.
|
Merged from stable.
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
By popular request give toolbuttons a border.
|
||||||
|
|
||||||
|
* gtk/gtktoolitem.c
|
||||||
|
(gtk_tool_item_size_allocate):
|
||||||
|
(gtk_tool_item_size_request): don't request and allocate a border
|
||||||
|
around the child
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c
|
||||||
|
(gtk_tool_button_size_allocate):
|
||||||
|
(gtk_tool_button_size_request): remove these functions
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c
|
||||||
|
(gtk_toolbar_size_request):
|
||||||
|
(gtk_toolbar_size_allocate): request and allocate a border if we
|
||||||
|
have a shadow.
|
||||||
|
|
||||||
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
Merged from stable.
|
Merged from stable.
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
By popular request give toolbuttons a border.
|
||||||
|
|
||||||
|
* gtk/gtktoolitem.c
|
||||||
|
(gtk_tool_item_size_allocate):
|
||||||
|
(gtk_tool_item_size_request): don't request and allocate a border
|
||||||
|
around the child
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c
|
||||||
|
(gtk_tool_button_size_allocate):
|
||||||
|
(gtk_tool_button_size_request): remove these functions
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c
|
||||||
|
(gtk_toolbar_size_request):
|
||||||
|
(gtk_toolbar_size_allocate): request and allocate a border if we
|
||||||
|
have a shadow.
|
||||||
|
|
||||||
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
Merged from stable.
|
Merged from stable.
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
By popular request give toolbuttons a border.
|
||||||
|
|
||||||
|
* gtk/gtktoolitem.c
|
||||||
|
(gtk_tool_item_size_allocate):
|
||||||
|
(gtk_tool_item_size_request): don't request and allocate a border
|
||||||
|
around the child
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c
|
||||||
|
(gtk_tool_button_size_allocate):
|
||||||
|
(gtk_tool_button_size_request): remove these functions
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c
|
||||||
|
(gtk_toolbar_size_request):
|
||||||
|
(gtk_toolbar_size_allocate): request and allocate a border if we
|
||||||
|
have a shadow.
|
||||||
|
|
||||||
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
Merged from stable.
|
Merged from stable.
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Fri Jul 18 18:43:01 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
By popular request give toolbuttons a border.
|
||||||
|
|
||||||
|
* gtk/gtktoolitem.c
|
||||||
|
(gtk_tool_item_size_allocate):
|
||||||
|
(gtk_tool_item_size_request): don't request and allocate a border
|
||||||
|
around the child
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c
|
||||||
|
(gtk_tool_button_size_allocate):
|
||||||
|
(gtk_tool_button_size_request): remove these functions
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c
|
||||||
|
(gtk_toolbar_size_request):
|
||||||
|
(gtk_toolbar_size_allocate): request and allocate a border if we
|
||||||
|
have a shadow.
|
||||||
|
|
||||||
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
Thu Jul 17 19:24:51 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
Merged from stable.
|
Merged from stable.
|
||||||
|
@ -162,6 +162,7 @@ static void gtk_toolbar_arrow_button_clicked (GtkWidget *bu
|
|||||||
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
|
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
|
||||||
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
|
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
|
||||||
static gint get_internal_padding (GtkToolbar *toolbar);
|
static gint get_internal_padding (GtkToolbar *toolbar);
|
||||||
|
static GtkShadowType get_shadow_type (GtkToolbar *toolbar);
|
||||||
static void gtk_toolbar_remove_tool_item (GtkToolbar *toolbar,
|
static void gtk_toolbar_remove_tool_item (GtkToolbar *toolbar,
|
||||||
GtkToolItem *item);
|
GtkToolItem *item);
|
||||||
static gboolean gtk_toolbar_popup_menu (GtkWidget *toolbar);
|
static gboolean gtk_toolbar_popup_menu (GtkWidget *toolbar);
|
||||||
@ -733,14 +734,10 @@ gtk_toolbar_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (widget))
|
if (GTK_WIDGET_DRAWABLE (widget))
|
||||||
{
|
{
|
||||||
GtkShadowType shadow_type;
|
|
||||||
|
|
||||||
gtk_widget_style_get (widget, "shadow_type", &shadow_type, NULL);
|
|
||||||
|
|
||||||
gtk_paint_box (widget->style,
|
gtk_paint_box (widget->style,
|
||||||
widget->window,
|
widget->window,
|
||||||
GTK_WIDGET_STATE (widget),
|
GTK_WIDGET_STATE (widget),
|
||||||
shadow_type,
|
get_shadow_type (toolbar),
|
||||||
&event->area, widget, "toolbar",
|
&event->area, widget, "toolbar",
|
||||||
border_width + widget->allocation.x,
|
border_width + widget->allocation.x,
|
||||||
border_width + widget->allocation.y,
|
border_width + widget->allocation.y,
|
||||||
@ -884,6 +881,12 @@ gtk_toolbar_size_request (GtkWidget *widget,
|
|||||||
|
|
||||||
requisition->width += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
|
requisition->width += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
|
||||||
requisition->height += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
|
requisition->height += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
|
||||||
|
|
||||||
|
if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
|
||||||
|
{
|
||||||
|
requisition->width += 2 * widget->style->xthickness;
|
||||||
|
requisition->height += 2 * widget->style->ythickness;
|
||||||
|
}
|
||||||
|
|
||||||
toolbar->button_maxw = max_homogeneous_child_width;
|
toolbar->button_maxw = max_homogeneous_child_width;
|
||||||
toolbar->button_maxh = max_homogeneous_child_height;
|
toolbar->button_maxh = max_homogeneous_child_height;
|
||||||
@ -979,12 +982,24 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
available_size = size = allocation->width - 2 * border_width;
|
available_size = size = allocation->width - 2 * border_width;
|
||||||
short_size = allocation->height - 2 * border_width;
|
short_size = allocation->height - 2 * border_width;
|
||||||
arrow_size = arrow_requisition.width;
|
arrow_size = arrow_requisition.width;
|
||||||
|
|
||||||
|
if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
|
||||||
|
{
|
||||||
|
available_size -= 2 * widget->style->xthickness;
|
||||||
|
short_size -= 2 * widget->style->ythickness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
available_size = size = allocation->height - 2 * border_width;
|
available_size = size = allocation->height - 2 * border_width;
|
||||||
short_size = allocation->width - 2 * border_width;
|
short_size = allocation->width - 2 * border_width;
|
||||||
arrow_size = arrow_requisition.height;
|
arrow_size = arrow_requisition.height;
|
||||||
|
|
||||||
|
if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
|
||||||
|
{
|
||||||
|
available_size -= 2 * widget->style->ythickness;
|
||||||
|
short_size -= 2 * widget->style->xthickness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n_items = g_list_length (priv->items);
|
n_items = g_list_length (priv->items);
|
||||||
@ -1015,7 +1030,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
GtkAllocation *allocation = &(allocations[n_items - i - 1]);
|
GtkAllocation *allocation = &(allocations[n_items - i - 1]);
|
||||||
gint item_size;
|
gint item_size;
|
||||||
|
|
||||||
if (!gtk_tool_item_get_pack_end (item) || !toolbar_item_visible (toolbar, item))
|
if (!gtk_tool_item_get_pack_end (item) ||
|
||||||
|
!toolbar_item_visible (toolbar, item))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_size = get_item_size (toolbar, GTK_WIDGET (item));
|
item_size = get_item_size (toolbar, GTK_WIDGET (item));
|
||||||
@ -1173,12 +1189,24 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
allocations[i].x += allocation->x;
|
allocations[i].x += allocation->x;
|
||||||
allocations[i].y += allocation->y;
|
allocations[i].y += allocation->y;
|
||||||
|
|
||||||
|
if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
|
||||||
|
{
|
||||||
|
allocations[i].x += widget->style->xthickness;
|
||||||
|
allocations[i].y += widget->style->ythickness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_arrow)
|
if (need_arrow)
|
||||||
{
|
{
|
||||||
arrow_allocation.x += allocation->x;
|
arrow_allocation.x += allocation->x;
|
||||||
arrow_allocation.y += allocation->y;
|
arrow_allocation.y += allocation->y;
|
||||||
|
|
||||||
|
if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
|
||||||
|
{
|
||||||
|
arrow_allocation.x += widget->style->xthickness;
|
||||||
|
arrow_allocation.y += widget->style->ythickness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally allocate the items */
|
/* finally allocate the items */
|
||||||
@ -2022,6 +2050,18 @@ get_internal_padding (GtkToolbar *toolbar)
|
|||||||
return ipadding;
|
return ipadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkShadowType
|
||||||
|
get_shadow_type (GtkToolbar *toolbar)
|
||||||
|
{
|
||||||
|
GtkShadowType shadow_type;
|
||||||
|
|
||||||
|
gtk_widget_style_get (GTK_WIDGET (toolbar),
|
||||||
|
"shadow_type", &shadow_type,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
return shadow_type;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_toolbar_check_old_api (GtkToolbar *toolbar)
|
gtk_toolbar_check_old_api (GtkToolbar *toolbar)
|
||||||
{
|
{
|
||||||
|
@ -54,10 +54,6 @@ enum {
|
|||||||
static void gtk_tool_button_init (GtkToolButton *button,
|
static void gtk_tool_button_init (GtkToolButton *button,
|
||||||
GtkToolButtonClass *klass);
|
GtkToolButtonClass *klass);
|
||||||
static void gtk_tool_button_class_init (GtkToolButtonClass *klass);
|
static void gtk_tool_button_class_init (GtkToolButtonClass *klass);
|
||||||
static void gtk_tool_button_size_request (GtkWidget *widget,
|
|
||||||
GtkRequisition *requisition);
|
|
||||||
static void gtk_tool_button_size_allocate (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation);
|
|
||||||
static void gtk_tool_button_set_property (GObject *object,
|
static void gtk_tool_button_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
@ -134,9 +130,6 @@ gtk_tool_button_class_init (GtkToolButtonClass *klass)
|
|||||||
object_class->get_property = gtk_tool_button_get_property;
|
object_class->get_property = gtk_tool_button_get_property;
|
||||||
object_class->finalize = gtk_tool_button_finalize;
|
object_class->finalize = gtk_tool_button_finalize;
|
||||||
|
|
||||||
widget_class->size_request = gtk_tool_button_size_request;
|
|
||||||
widget_class->size_allocate = gtk_tool_button_size_allocate;
|
|
||||||
|
|
||||||
tool_item_class->create_menu_proxy = gtk_tool_button_create_menu_proxy;
|
tool_item_class->create_menu_proxy = gtk_tool_button_create_menu_proxy;
|
||||||
tool_item_class->toolbar_reconfigured = gtk_tool_button_toolbar_reconfigured;
|
tool_item_class->toolbar_reconfigured = gtk_tool_button_toolbar_reconfigured;
|
||||||
|
|
||||||
@ -241,56 +234,6 @@ gtk_tool_button_init (GtkToolButton *button,
|
|||||||
gtk_widget_show (button->priv->button);
|
gtk_widget_show (button->priv->button);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_tool_button_size_request (GtkWidget *widget,
|
|
||||||
GtkRequisition *requisition)
|
|
||||||
{
|
|
||||||
GtkWidget *child = GTK_BIN (widget)->child;
|
|
||||||
|
|
||||||
if (child && GTK_WIDGET_VISIBLE (child))
|
|
||||||
{
|
|
||||||
gtk_widget_size_request (child, requisition);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
requisition->width = 0;
|
|
||||||
requisition->height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
requisition->width += GTK_CONTAINER (widget)->border_width * 2;
|
|
||||||
requisition->height += GTK_CONTAINER (widget)->border_width * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_tool_button_size_allocate (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation)
|
|
||||||
{
|
|
||||||
GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
|
|
||||||
GtkAllocation child_allocation;
|
|
||||||
gint border_width;
|
|
||||||
GtkWidget *child = GTK_BIN (widget)->child;
|
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
|
||||||
border_width = GTK_CONTAINER (widget)->border_width;
|
|
||||||
|
|
||||||
if (gtk_tool_item_get_use_drag_window (toolitem) && GTK_WIDGET_REALIZED (widget))
|
|
||||||
gdk_window_move_resize (_gtk_tool_item_get_drag_window (toolitem),
|
|
||||||
widget->allocation.x + border_width,
|
|
||||||
widget->allocation.y + border_width,
|
|
||||||
widget->allocation.width - border_width * 2,
|
|
||||||
widget->allocation.height - border_width * 2);
|
|
||||||
|
|
||||||
if (child && GTK_WIDGET_VISIBLE (child))
|
|
||||||
{
|
|
||||||
child_allocation.x = allocation->x + border_width;
|
|
||||||
child_allocation.y = allocation->y + border_width;
|
|
||||||
child_allocation.width = allocation->width - 2 * border_width;
|
|
||||||
child_allocation.height = allocation->height - 2 * border_width;
|
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||||
{
|
{
|
||||||
|
@ -400,13 +400,10 @@ gtk_tool_item_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (child && GTK_WIDGET_VISIBLE (child))
|
if (child && GTK_WIDGET_VISIBLE (child))
|
||||||
{
|
{
|
||||||
gint xthickness = widget->style->xthickness;
|
child_allocation.x = allocation->x + border_width;
|
||||||
gint ythickness = widget->style->ythickness;
|
child_allocation.y = allocation->y + border_width;
|
||||||
|
child_allocation.width = allocation->width - 2 * border_width;
|
||||||
child_allocation.x = allocation->x + border_width + xthickness;
|
child_allocation.height = allocation->height - 2 * border_width;
|
||||||
child_allocation.y = allocation->y + border_width + ythickness;
|
|
||||||
child_allocation.width = allocation->width - 2 * (xthickness + border_width);
|
|
||||||
child_allocation.height = allocation->height - 2 * (ythickness + border_width);
|
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
gtk_widget_size_allocate (child, &child_allocation);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user