[Vala] Exposing the CLUTTER_COLOR_* macros in Vala



I've created a patch for Vala [1] that will expose the CLUTTER_COLOR_*
macros in Vala as Clutter.Color.*. It maps e.g. CLUTTER_COLOR_Red to
Clutter.Color.RED and CLUTTER_COLOR_DarkOrange to
Clutter.Color.DARK_ORANGE. This convention disagrees with
ClutterStaticColor (but does agree with CLUTTER_COLOR_*). ebassi, do
you think this convention is OK?

- Kerrick

[1]
Expose the CLUTTER_COLOR_* C macros

Expose the CLUTTER_COLOR_* C macros (which provide a set of pre-defined
colors) as Clutter.Color.*. For example, CLUTTER_COLOR_Red (in C)
becomes Clutter.Color.RED (in Vala).

Note that these names are not quite the same as the StaticColor.* names,
because StaticColor treats light/dark colors inconsistently: it includes
e.g. DARK_GREEN while also including e.g. ORANGE_DARK. In the new
Color.* names, these are DARK_GREEN and DARK_ORANGE, respectively (which
also follows the convention used by CLUTTER_COLOR_*).
---
 vapi/metadata/Clutter-1.0-custom.vala | 90 +++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/vapi/metadata/Clutter-1.0-custom.vala
b/vapi/metadata/Clutter-1.0-custom.vala
index 025c504..44b109b 100644
--- a/vapi/metadata/Clutter-1.0-custom.vala
+++ b/vapi/metadata/Clutter-1.0-custom.vala
@@ -45,6 +45,96 @@ namespace Clutter {
                public Color.from_string (string str);
                [CCode (cname = "clutter_color_from_string")]
                public bool parse_string (string str);
+               [CCode (cname = "(*CLUTTER_COLOR_White)")]
+               public static Color WHITE;
+               [CCode (cname = "(*CLUTTER_COLOR_Black)")]
+               public static Color BLACK;
+               [CCode (cname = "(*CLUTTER_COLOR_Red)")]
+               public static Color RED;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkRed)")]
+               public static Color DARK_RED;
+               [CCode (cname = "(*CLUTTER_COLOR_Green)")]
+               public static Color GREEN;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkGreen)")]
+               public static Color DARK_GREEN;
+               [CCode (cname = "(*CLUTTER_COLOR_Blue)")]
+               public static Color BLUE;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkBlue)")]
+               public static Color DARK_BLUE;
+               [CCode (cname = "(*CLUTTER_COLOR_Cyan)")]
+               public static Color CYAN;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkCyan)")]
+               public static Color DARK_CYAN;
+               [CCode (cname = "(*CLUTTER_COLOR_Magenta)")]
+               public static Color MAGENTA;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkMagenta)")]
+               public static Color DARK_MAGENTA;
+               [CCode (cname = "(*CLUTTER_COLOR_Yellow)")]
+               public static Color YELLOW;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkYellow)")]
+               public static Color DARK_YELLOW;
+               [CCode (cname = "(*CLUTTER_COLOR_Gray)")]
+               public static Color GRAY;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkGray)")]
+               public static Color DARK_GRAY;
+               [CCode (cname = "(*CLUTTER_COLOR_LightGray)")]
+               public static Color LIGHT_GRAY;
+               [CCode (cname = "(*CLUTTER_COLOR_Butter)")]
+               public static Color BUTTER;
+               [CCode (cname = "(*CLUTTER_COLOR_LightButter)")]
+               public static Color LIGHT_BUTTER;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkButter)")]
+               public static Color DARK_BUTTER;
+               [CCode (cname = "(*CLUTTER_COLOR_Orange)")]
+               public static Color ORANGE;
+               [CCode (cname = "(*CLUTTER_COLOR_LightOrange)")]
+               public static Color LIGHT_ORANGE;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkOrange)")]
+               public static Color DARK_ORANGE;
+               [CCode (cname = "(*CLUTTER_COLOR_Chocolate)")]
+               public static Color CHOCOLATE;
+               [CCode (cname = "(*CLUTTER_COLOR_LightChocolate)")]
+               public static Color LIGHT_CHOCOLATE;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkChocolate)")]
+               public static Color DARK_CHOCOLATE;
+               [CCode (cname = "(*CLUTTER_COLOR_Chameleon)")]
+               public static Color CHAMELEON;
+               [CCode (cname = "(*CLUTTER_COLOR_LightChameleon)")]
+               public static Color LIGHT_CHAMELEON;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkChameleon)")]
+               public static Color DARK_CHAMELEON;
+               [CCode (cname = "(*CLUTTER_COLOR_SkyBlue)")]
+               public static Color SKY_BLUE;
+               [CCode (cname = "(*CLUTTER_COLOR_LightSkyBlue)")]
+               public static Color LIGHT_SKY_BLUE;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkSkyBlue)")]
+               public static Color DARK_SKY_BLUE;
+               [CCode (cname = "(*CLUTTER_COLOR_Plum)")]
+               public static Color PLUM;
+               [CCode (cname = "(*CLUTTER_COLOR_LightPlum)")]
+               public static Color LIGHT_PLUM;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkPlum)")]
+               public static Color DARK_PLUM;
+               [CCode (cname = "(*CLUTTER_COLOR_ScarletRed)")]
+               public static Color SCARLET_RED;
+               [CCode (cname = "(*CLUTTER_COLOR_LightScarletRed)")]
+               public static Color LIGHT_SCARLET_RED;
+               [CCode (cname = "(*CLUTTER_COLOR_DarkScarletRed)")]
+               public static Color DARK_SCARLET_RED;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium1)")]
+               public static Color ALUMINIUM_1;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium2)")]
+               public static Color ALUMINIUM_2;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium3)")]
+               public static Color ALUMINIUM_3;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium4)")]
+               public static Color ALUMINIUM_4;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium5)")]
+               public static Color ALUMINIUM_5;
+               [CCode (cname = "(*CLUTTER_COLOR_Aluminium6)")]
+               public static Color ALUMINIUM_6;
+               [CCode (cname = "(*CLUTTER_COLOR_Transparent)")]
+               public static Color TRANSPARENT;
        }

        [CCode (cheader_filename = "clutter/clutter.h", type_id =
"clutter_container_get_type ()")]



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