Commit 61fe062e authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

added "max-child-expand" style property which limits the space taken by

2006-05-16  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktoolbar.c: added "max-child-expand" style property which
	limits the space taken by expanding tool items. Fixes bug #340722.
parent 014e448e
2006-05-16 Michael Natterer <mitch@imendio.com>
* gtk/gtktoolbar.c: added "max-child-expand" style property which
limits the space taken by expanding tool items. Fixes bug #340722.
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
......
2006-05-16 Michael Natterer <mitch@imendio.com>
* gtk/gtktoolbar.c: added "max-child-expand" style property which
limits the space taken by expanding tool items. Fixes bug #340722.
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
......
......@@ -57,7 +57,7 @@
typedef struct _ToolbarContent ToolbarContent;
#define DEFAULT_IPADDING 0
#define DEFAULT_IPADDING 0
#define DEFAULT_SPACE_SIZE 12
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
......@@ -233,6 +233,7 @@ static gboolean gtk_toolbar_check_old_api (GtkToolbar *toolbar
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
static gint get_internal_padding (GtkToolbar *toolbar);
static gint get_max_child_expand (GtkToolbar *toolbar);
static GtkShadowType get_shadow_type (GtkToolbar *toolbar);
static gint get_space_size (GtkToolbar *toolbar);
static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
......@@ -591,7 +592,16 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
G_MAXINT,
DEFAULT_IPADDING,
GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("max-child-expand",
P_("Maximum toolbar item spacing"),
P_("Maximum space between the toolbar items."),
0,
G_MAXINT,
G_MAXINT,
GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("space-style",
P_("Space style"),
......@@ -1596,10 +1606,14 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
{
gint mexpand = get_max_child_expand (toolbar);
gint extra = size / n_expand_items;
if (size % n_expand_items != 0)
extra++;
if (extra > mexpand)
extra = mexpand;
allocations[i].width += extra;
size -= extra;
n_expand_items--;
......@@ -4751,6 +4765,17 @@ get_internal_padding (GtkToolbar *toolbar)
return ipadding;
}
static gint
get_max_child_expand (GtkToolbar *toolbar)
{
gint mexpand = G_MAXINT;
gtk_widget_style_get (GTK_WIDGET (toolbar),
"max-child-expand", &mexpand,
NULL);
return mexpand;
}
static GtkShadowType
get_shadow_type (GtkToolbar *toolbar)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment