forked from AuroraMiddleware/gtk
notebook: add an 'initial-gap' style property
It adds a gap before the first tab in the notebook. https://bugzilla.gnome.org/show_bug.cgi?id=643841
This commit is contained in:
parent
f632956166
commit
5215f72bd7
@ -903,6 +903,23 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkNotebook:initial-gap:
|
||||
*
|
||||
* The "initial-gap" property defines the minimum size for the initial
|
||||
* gap between the first tab.
|
||||
*
|
||||
* Since: 3.2
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("initial-gap",
|
||||
P_("Initial gap"),
|
||||
P_("Initial gap before the first tab"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkNotebook::switch-page:
|
||||
* @notebook: the object which received the signal.
|
||||
@ -5276,6 +5293,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
|
||||
gint i;
|
||||
guint border_width;
|
||||
GtkBorder padding;
|
||||
gint initial_gap;
|
||||
|
||||
widget = GTK_WIDGET (notebook);
|
||||
children = priv->children;
|
||||
@ -5287,6 +5305,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
|
||||
"arrow-spacing", &arrow_spacing,
|
||||
"scroll-arrow-hlength", &scroll_arrow_hlength,
|
||||
"scroll-arrow-vlength", &scroll_arrow_vlength,
|
||||
"initial-gap", &initial_gap,
|
||||
NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
|
||||
@ -5294,6 +5313,9 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
allocation.x += initial_gap;
|
||||
allocation.width -= 2 * initial_gap;
|
||||
|
||||
switch (tab_pos)
|
||||
{
|
||||
case GTK_POS_TOP:
|
||||
|
Loading…
Reference in New Issue
Block a user