forked from AuroraMiddleware/gtk
Removed size_request from GtkTearoffMenuItem
This commit is contained in:
parent
292f32dde8
commit
e573a455bb
@ -39,13 +39,17 @@ struct _GtkTearoffMenuItemPrivate
|
|||||||
guint torn_off : 1;
|
guint torn_off : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gtk_tearoff_menu_item_size_request (GtkWidget *widget,
|
static void gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
gint *minimum,
|
||||||
static gboolean gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
gint *natural);
|
||||||
cairo_t *cr);
|
static void gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
|
||||||
static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item);
|
gint *minimum,
|
||||||
static void gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
|
gint *natural);
|
||||||
GtkWidget *previous);
|
static gboolean gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||||
|
cairo_t *cr);
|
||||||
|
static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item);
|
||||||
|
static void gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
|
||||||
|
GtkWidget *previous);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkTearoffMenuItem, gtk_tearoff_menu_item, GTK_TYPE_MENU_ITEM)
|
G_DEFINE_TYPE (GtkTearoffMenuItem, gtk_tearoff_menu_item, GTK_TYPE_MENU_ITEM)
|
||||||
|
|
||||||
@ -65,7 +69,8 @@ gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass)
|
|||||||
menu_item_class = (GtkMenuItemClass*) klass;
|
menu_item_class = (GtkMenuItemClass*) klass;
|
||||||
|
|
||||||
widget_class->draw = gtk_tearoff_menu_item_draw;
|
widget_class->draw = gtk_tearoff_menu_item_draw;
|
||||||
widget_class->size_request = gtk_tearoff_menu_item_size_request;
|
widget_class->get_preferred_width = gtk_tearoff_menu_item_get_preferred_width;
|
||||||
|
widget_class->get_preferred_height = gtk_tearoff_menu_item_get_preferred_height;
|
||||||
widget_class->parent_set = gtk_tearoff_menu_item_parent_set;
|
widget_class->parent_set = gtk_tearoff_menu_item_parent_set;
|
||||||
|
|
||||||
menu_item_class->activate = gtk_tearoff_menu_item_activate;
|
menu_item_class->activate = gtk_tearoff_menu_item_activate;
|
||||||
@ -87,8 +92,23 @@ gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tearoff_menu_item_size_request (GtkWidget *widget,
|
gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
GtkStyle *style;
|
||||||
|
guint border_width;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
*minimum = *natural = (border_width + style->xthickness + BORDER_SPACING) * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
{
|
{
|
||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
GtkWidget *parent;
|
GtkWidget *parent;
|
||||||
@ -97,17 +117,18 @@ gtk_tearoff_menu_item_size_request (GtkWidget *widget,
|
|||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
requisition->width = (border_width + style->xthickness + BORDER_SPACING) * 2;
|
*minimum = *natural = (border_width + style->ythickness) * 2;
|
||||||
requisition->height = (border_width + style->ythickness) * 2;
|
|
||||||
|
|
||||||
parent = gtk_widget_get_parent (widget);
|
parent = gtk_widget_get_parent (widget);
|
||||||
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off)
|
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off)
|
||||||
{
|
{
|
||||||
requisition->height += ARROW_SIZE;
|
*minimum += ARROW_SIZE;
|
||||||
|
*natural += ARROW_SIZE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requisition->height += style->ythickness + 4;
|
*minimum += style->ythickness + 4;
|
||||||
|
*natural += style->ythickness + 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user