summaryrefslogtreecommitdiff
path: root/gtk/gtktoolpalette.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-10-26 09:59:02 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-10-26 10:15:56 +0900
commit3fe0fb4ed95a3d5c51a049a24147e628e6965d62 (patch)
tree0f1d9594d0dc787643509012cac76fe3871a6b5e /gtk/gtktoolpalette.c
parent04c1337bdae99b2c45e44e20c9432a72e5e6602c (diff)
downloadgtk+-3fe0fb4ed95a3d5c51a049a24147e628e6965d62.tar.gz
Added GtkScrollablePolicy property to scrollable interface
This patch adds the GtkScrollablePolicy type property to GtkScrollable and implements it in all subclasses. GtkScrolledWindow observes this property to make a good guess about when to show/hide scrollbars for height-for-width content. Most scrollable children do not do height-for-width *yet* but most certainly will (toolpalette, treeview, iconview, textview widgets all TODO), for scrollable widgets that do have a minimum and natural size, it's important for them to observe the state of this property in order to properly drive the scroll adjustments according to the desired GtkScrollablePolicy. This patch makes GtkViewport do this. Patch also adds tests/testscrolledwindow.c to display the effects of this property.
Diffstat (limited to 'gtk/gtktoolpalette.c')
-rw-r--r--gtk/gtktoolpalette.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 6d9c5c13f6..bc60c3d210 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -122,7 +122,9 @@ enum
PROP_ORIENTATION,
PROP_TOOLBAR_STYLE,
PROP_HADJUSTMENT,
- PROP_VADJUSTMENT
+ PROP_VADJUSTMENT,
+ PROP_HSCROLL_POLICY,
+ PROP_VSCROLL_POLICY
};
enum
@@ -159,10 +161,15 @@ struct _GtkToolPalettePrivate
GtkSizeGroup *text_size_group;
- GtkSettings *settings;
- gulong settings_connection;
+ GtkSettings *settings;
+ gulong settings_connection;
guint drag_source : 2;
+
+ /* GtkScrollablePolicy needs to be checked when
+ * driving the scrollable adjustment values */
+ guint hscroll_policy : 1;
+ guint vscroll_policy : 1;
};
struct _GtkToolPaletteDragData
@@ -276,6 +283,16 @@ gtk_tool_palette_set_property (GObject *object,
gtk_tool_palette_set_vadjustment (palette, g_value_get_object (value));
break;
+ case PROP_HSCROLL_POLICY:
+ palette->priv->hscroll_policy = g_value_get_enum (value);
+ gtk_widget_queue_resize (GTK_WIDGET (palette));
+ break;
+
+ case PROP_VSCROLL_POLICY:
+ palette->priv->vscroll_policy = g_value_get_enum (value);
+ gtk_widget_queue_resize (GTK_WIDGET (palette));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -316,6 +333,14 @@ gtk_tool_palette_get_property (GObject *object,
g_value_set_object (value, palette->priv->vadjustment);
break;
+ case PROP_HSCROLL_POLICY:
+ g_value_set_enum (value, palette->priv->hscroll_policy);
+ break;
+
+ case PROP_VSCROLL_POLICY:
+ g_value_set_enum (value, palette->priv->vscroll_policy);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -952,10 +977,12 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
*/
wclass->screen_changed = gtk_tool_palette_screen_changed;
- g_object_class_override_property (oclass, PROP_ORIENTATION, "orientation");
+ g_object_class_override_property (oclass, PROP_ORIENTATION, "orientation");
- g_object_class_override_property (oclass, PROP_HADJUSTMENT, "hadjustment");
- g_object_class_override_property (oclass, PROP_VADJUSTMENT, "vadjustment");
+ g_object_class_override_property (oclass, PROP_HADJUSTMENT, "hadjustment");
+ g_object_class_override_property (oclass, PROP_VADJUSTMENT, "vadjustment");
+ g_object_class_override_property (oclass, PROP_HSCROLL_POLICY, "hscroll-policy");
+ g_object_class_override_property (oclass, PROP_VSCROLL_POLICY, "vscroll-policy");
/**
* GtkToolPalette:icon-size: