From: Elliot Smith Date: Fri, 27 Aug 2010 14:29:09 +0000 (+0100) Subject: cookbook: Use nicknames for enumeration values X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79a4dbb32908043223e0d5a085214850166124f5;p=profile%2Fivi%2Fclutter.git cookbook: Use nicknames for enumeration values GEnum nicknames can be used to set properties in JSON definitions, so added a callout to the JSON example explaining this, and showing how to derive the nickname for an enumeration value. Modified the example code to use nicknames as well. --- diff --git a/doc/cookbook/examples/script-ui.json b/doc/cookbook/examples/script-ui.json index 83b1451..d7b8f9a 100644 --- a/doc/cookbook/examples/script-ui.json +++ b/doc/cookbook/examples/script-ui.json @@ -16,8 +16,8 @@ "layout-manager" : { "type" : "ClutterBinLayout", - "x-align" : "CLUTTER_BIN_ALIGNMENT_CENTER", - "y-align" : "CLUTTER_BIN_ALIGNMENT_CENTER" + "x-align" : "center", + "y-align" : "center" }, "children" : [ diff --git a/doc/cookbook/script.xml b/doc/cookbook/script.xml index f15d6b8..690f570 100644 --- a/doc/cookbook/script.xml +++ b/doc/cookbook/script.xml @@ -108,8 +108,8 @@ "layout-manager" : { "type" : "ClutterBinLayout", - "x-align" : "CLUTTER_BIN_ALIGNMENT_CENTER", - "y-align" : "CLUTTER_BIN_ALIGNMENT_CENTER" + "x-align" : "center", + "y-align" : "center" }, "children" : [ @@ -175,6 +175,29 @@ within the list. The two can be mixed in a single list of children. + + This uses the nickname for a value in an enumeration + (in this case, the nickname for + CLUTTER_BIN_ALIGNMENT_CENTER). + To get the nickname for an enumeration value, take + the component which is unique to that value in the + enumeration, lowercase it, and replace any underscores + with hyphens. Some examples: + + + CLUTTER_ALIGN_X_AXIS has + the nickname x-axis + + + CLUTTER_GRAVITY_NORTH has + the nickname north + + + CLUTTER_REQUEST_HEIGHT_FOR_WIDTH + has the nickname height-for-width + + +