[gnome-shell] [StWidget] add API support for right-to-left UI



commit a5edc78fac9f2d1ddb8a91556d6cd02ec8911130
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Sat Nov 14 18:20:31 2009 +0100

    [StWidget] add API support for right-to-left UI
    
    https://bugzilla.gnome.org/show_bug.cgi?id=584662

 src/st/st-widget.c |   36 ++++++++++++++++++++++++++++++++++++
 src/st/st-widget.h |   11 +++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index d606497..482d5c0 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -66,6 +66,8 @@ struct _StWidgetPrivate
   gboolean      draw_border_internal : 1;
 
   StTooltip    *tooltip;
+
+  StTextDirection   direction;
 };
 
 /**
@@ -1272,6 +1274,40 @@ st_widget_ensure_style (StWidget *widget)
     st_widget_recompute_style (widget, NULL);
 }
 
+static StTextDirection default_direction = ST_TEXT_DIRECTION_LTR;
+
+StTextDirection
+st_widget_get_default_direction (void)
+{
+  return default_direction;
+}
+
+void
+st_widget_set_default_direction (StTextDirection dir)
+{
+  g_return_if_fail (dir != ST_TEXT_DIRECTION_NONE);
+
+  default_direction = dir;
+}
+
+StTextDirection
+st_widget_get_direction (StWidget *self)
+{
+  g_return_val_if_fail (ST_IS_WIDGET (self), ST_TEXT_DIRECTION_LTR);
+
+  if (self->priv->direction != ST_TEXT_DIRECTION_NONE)
+    return self->priv->direction;
+  else
+    return default_direction;
+}
+
+void
+st_widget_set_direction (StWidget *self, StTextDirection dir)
+{
+  g_return_if_fail (ST_IS_WIDGET (self));
+  self->priv->direction = dir;
+}
+
 /**
  * st_widget_get_border_image:
  * @actor: A #StWidget
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index 66f7b06..bebe286 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -35,6 +35,12 @@
 
 G_BEGIN_DECLS
 
+typedef enum {
+  ST_TEXT_DIRECTION_NONE,
+  ST_TEXT_DIRECTION_LTR,
+  ST_TEXT_DIRECTION_RTL
+} StTextDirection;
+
 #define ST_TYPE_WIDGET                 (st_widget_get_type ())
 #define ST_WIDGET(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), ST_TYPE_WIDGET, StWidget))
 #define ST_IS_WIDGET(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ST_TYPE_WIDGET))
@@ -103,6 +109,11 @@ void st_widget_hide_tooltip (StWidget *widget);
 
 void st_widget_ensure_style (StWidget *widget);
 
+StTextDirection st_widget_get_default_direction (void);
+void st_widget_set_default_direction (StTextDirection dir);
+
+StTextDirection st_widget_get_direction (StWidget *self);
+void st_widget_set_direction (StWidget *self, StTextDirection dir);
 
 /* Only to be used by sub-classes of StWidget */
 void          st_widget_style_changed        (StWidget  *widget);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]