summaryrefslogtreecommitdiff
path: root/gtk/gtkarrow.c
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2010-05-24 05:18:05 +0200
committerJavier Jardón <jjardon@gnome.org>2010-07-13 19:40:44 +0200
commit3862bf3208c378a9ee32fb43d978ff746187472f (patch)
treea97d6ec58280b17f1630c9a8844d88e61aa0ddaa /gtk/gtkarrow.c
parentfa740ae012fc285833b5a1a425be7055cb4faeb7 (diff)
downloadgtk+-3862bf3208c378a9ee32fb43d978ff746187472f.tar.gz
gtkarrow: Move public members to private structure
Diffstat (limited to 'gtk/gtkarrow.c')
-rw-r--r--gtk/gtkarrow.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c
index 22e48db90c..b3cba00560 100644
--- a/gtk/gtkarrow.c
+++ b/gtk/gtkarrow.c
@@ -52,6 +52,12 @@
#define MIN_ARROW_SIZE 15
+struct _GtkArrowPriv
+{
+ gint16 arrow_type;
+ gint16 shadow_type;
+};
+
enum {
PROP_0,
PROP_ARROW_TYPE,
@@ -112,6 +118,8 @@ gtk_arrow_class_init (GtkArrowClass *class)
P_("Amount of space used up by arrow"),
0.0, 1.0, 0.7,
GTK_PARAM_READABLE));
+
+ g_type_class_add_private (class, sizeof (GtkArrowPriv));
}
static void
@@ -121,17 +129,18 @@ gtk_arrow_set_property (GObject *object,
GParamSpec *pspec)
{
GtkArrow *arrow = GTK_ARROW (object);
+ GtkArrowPriv *priv = arrow->priv;
switch (prop_id)
{
case PROP_ARROW_TYPE:
gtk_arrow_set (arrow,
g_value_get_enum (value),
- arrow->shadow_type);
+ priv->shadow_type);
break;
case PROP_SHADOW_TYPE:
gtk_arrow_set (arrow,
- arrow->arrow_type,
+ priv->arrow_type,
g_value_get_enum (value));
break;
default:
@@ -147,14 +156,15 @@ gtk_arrow_get_property (GObject *object,
GParamSpec *pspec)
{
GtkArrow *arrow = GTK_ARROW (object);
+ GtkArrowPriv *priv = arrow->priv;
switch (prop_id)
{
case PROP_ARROW_TYPE:
- g_value_set_enum (value, arrow->arrow_type);
+ g_value_set_enum (value, priv->arrow_type);
break;
case PROP_SHADOW_TYPE:
- g_value_set_enum (value, arrow->shadow_type);
+ g_value_set_enum (value, priv->shadow_type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -165,13 +175,20 @@ gtk_arrow_get_property (GObject *object,
static void
gtk_arrow_init (GtkArrow *arrow)
{
+ GtkArrowPriv *priv;
+
+ arrow->priv = G_TYPE_INSTANCE_GET_PRIVATE (arrow,
+ GTK_TYPE_ARROW,
+ GtkArrowPriv);
+ priv = arrow->priv;
+
gtk_widget_set_has_window (GTK_WIDGET (arrow), FALSE);
GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
- arrow->arrow_type = GTK_ARROW_RIGHT;
- arrow->shadow_type = GTK_SHADOW_OUT;
+ priv->arrow_type = GTK_ARROW_RIGHT;
+ priv->shadow_type = GTK_SHADOW_OUT;
}
/**
@@ -187,12 +204,15 @@ GtkWidget*
gtk_arrow_new (GtkArrowType arrow_type,
GtkShadowType shadow_type)
{
+ GtkArrowPriv *priv;
GtkArrow *arrow;
arrow = g_object_new (GTK_TYPE_ARROW, NULL);
- arrow->arrow_type = arrow_type;
- arrow->shadow_type = shadow_type;
+ priv = arrow->priv;
+
+ priv->arrow_type = arrow_type;
+ priv->shadow_type = shadow_type;
return GTK_WIDGET (arrow);
}
@@ -210,24 +230,27 @@ gtk_arrow_set (GtkArrow *arrow,
GtkArrowType arrow_type,
GtkShadowType shadow_type)
{
+ GtkArrowPriv *priv;
GtkWidget *widget;
g_return_if_fail (GTK_IS_ARROW (arrow));
- if ( ((GtkArrowType) arrow->arrow_type != arrow_type)
- || ((GtkShadowType) arrow->shadow_type != shadow_type))
+ priv = arrow->priv;
+
+ if (priv->arrow_type != arrow_type
+ || priv->shadow_type != shadow_type)
{
g_object_freeze_notify (G_OBJECT (arrow));
- if ((GtkArrowType) arrow->arrow_type != arrow_type)
+ if ((GtkArrowType) priv->arrow_type != arrow_type)
{
- arrow->arrow_type = arrow_type;
+ priv->arrow_type = arrow_type;
g_object_notify (G_OBJECT (arrow), "arrow-type");
}
- if ((GtkShadowType) arrow->shadow_type != shadow_type)
+ if (priv->shadow_type != shadow_type)
{
- arrow->shadow_type = shadow_type;
+ priv->shadow_type = shadow_type;
g_object_notify (G_OBJECT (arrow), "shadow-type");
}
@@ -247,6 +270,7 @@ gtk_arrow_expose (GtkWidget *widget,
if (gtk_widget_is_drawable (widget))
{
GtkArrow *arrow = GTK_ARROW (widget);
+ GtkArrowPriv *priv = arrow->priv;
GtkMisc *misc = GTK_MISC (widget);
GtkShadowType shadow_type;
gint width, height;
@@ -261,16 +285,16 @@ gtk_arrow_expose (GtkWidget *widget,
width = widget->allocation.width - misc->xpad * 2;
height = widget->allocation.height - misc->ypad * 2;
extent = MIN (width, height) * arrow_scaling;
- effective_arrow_type = arrow->arrow_type;
+ effective_arrow_type = priv->arrow_type;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
xalign = misc->xalign;
else
{
xalign = 1.0 - misc->xalign;
- if (arrow->arrow_type == GTK_ARROW_LEFT)
+ if (priv->arrow_type == GTK_ARROW_LEFT)
effective_arrow_type = GTK_ARROW_RIGHT;
- else if (arrow->arrow_type == GTK_ARROW_RIGHT)
+ else if (priv->arrow_type == GTK_ARROW_RIGHT)
effective_arrow_type = GTK_ARROW_LEFT;
}
@@ -279,7 +303,7 @@ gtk_arrow_expose (GtkWidget *widget,
y = floor (widget->allocation.y + misc->ypad
+ ((widget->allocation.height - extent) * misc->yalign));
- shadow_type = arrow->shadow_type;
+ shadow_type = priv->shadow_type;
if (widget->state == GTK_STATE_ACTIVE)
{