Merge branch 'text-direction'
authorEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 1 Dec 2009 14:55:19 +0000 (14:55 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 1 Dec 2009 14:55:19 +0000 (14:55 +0000)
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration

1  2 
clutter/clutter-box-layout.c
clutter/clutter-main.c
clutter/clutter-text.c
doc/reference/clutter/clutter-sections.txt
tests/interactive/test-box-layout.c

Simple merge
Simple merge
Simple merge
  #include <gmodule.h>
  
  #include <clutter/clutter.h>
+ #include <cogl/cogl.h>
+ #include "pango/cogl-pango.h"
  
 +#define INSTRUCTIONS \
 +        "Press v\t\342\236\236\tSwitch horizontal/vertical\n"           \
 +        "Press p\t\342\236\236\tSwitch pack start/end\n"                \
 +        "Press s\t\342\236\236\tIncrement spacing (up to 12px)\n"       \
 +        "Press q\t\342\236\236\tQuit"
 +
  static ClutterActor *hover_actor = NULL;
+ static guint         last_index  = 0;
+ static void
+ on_paint (ClutterActor *actor,
+           gpointer      user_data)
+ {
+   guint index_ = GPOINTER_TO_UINT (user_data);
+   gchar *text = g_strdup_printf ("%u", index_);
+   ClutterActorBox alloc = { 0, };
+   CoglColor color;
+   gint layout_width, layout_height;
+   gfloat width, height;
+   PangoLayout *layout;
+   clutter_actor_get_allocation_box (actor, &alloc);
+   clutter_actor_box_get_size (&alloc, &width, &height);
+   layout = clutter_actor_create_pango_layout (actor, text);
+   pango_layout_get_size (layout, &layout_width, &layout_height);
+   cogl_color_set_from_4ub (&color, 0, 0, 0, 255);
+   cogl_pango_render_layout (layout,
+                             (width - (layout_width / 1024)) / 2,
+                             (height - (layout_height / 1024)) / 2,
+                             &color, 0);
+   g_object_unref (layout);
+   g_free (text);
+ }
  
  static void
  enter_event (ClutterActor *actor,
@@@ -154,13 -183,9 +189,13 @@@ key_release_cb (ClutterActor     *actor
        break;
  
      case CLUTTER_plus:
-       add_actor (layout);
+       add_actor (layout, last_index++);
        break;
  
 +    case CLUTTER_q:
 +      clutter_main_quit ();
 +      break;
 +
      default:
        return FALSE;
      }