Commit ba4775240c68ad4be7ac19700b29ddd8894e23b8
Committed by
Víctor Cebollada
1 parent
140cc98f
Alignment option added.
Change-Id: I5f0e4ad2e2b52cd25aa8661dd95f688ac6c41a8b Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
Showing
1 changed file
with
24 additions
and
1 deletions
examples/text-label/text-label-example.cpp
| @@ -36,8 +36,18 @@ namespace | @@ -36,8 +36,18 @@ namespace | ||
| 36 | { | 36 | { |
| 37 | const unsigned int KEY_ZERO = 10; | 37 | const unsigned int KEY_ZERO = 10; |
| 38 | const unsigned int KEY_ONE = 11; | 38 | const unsigned int KEY_ONE = 11; |
| 39 | + const unsigned int KEY_A = 38; | ||
| 39 | const unsigned int KEY_M = 58; | 40 | const unsigned int KEY_M = 58; |
| 40 | const unsigned int KEY_L = 46; | 41 | const unsigned int KEY_L = 46; |
| 42 | + | ||
| 43 | + const char* ALIGNMENT_STRING_TABLE[] = | ||
| 44 | + { | ||
| 45 | + "BEGIN", | ||
| 46 | + "CENTER", | ||
| 47 | + "END" | ||
| 48 | + }; | ||
| 49 | + | ||
| 50 | + const unsigned int ALIGNMENT_STRING_COUNT = sizeof( ALIGNMENT_STRING_TABLE ) / sizeof( ALIGNMENT_STRING_TABLE[0u] ); | ||
| 41 | } | 51 | } |
| 42 | 52 | ||
| 43 | /** | 53 | /** |
| @@ -49,7 +59,8 @@ public: | @@ -49,7 +59,8 @@ public: | ||
| 49 | 59 | ||
| 50 | TextLabelExample( Application& application ) | 60 | TextLabelExample( Application& application ) |
| 51 | : mApplication( application ), | 61 | : mApplication( application ), |
| 52 | - mLanguageId( 0u ) | 62 | + mLanguageId( 0u ), |
| 63 | + mAlignment( 0u ) | ||
| 53 | { | 64 | { |
| 54 | // Connect to the Application's Init signal | 65 | // Connect to the Application's Init signal |
| 55 | mApplication.InitSignal().Connect( this, &TextLabelExample::Create ); | 66 | mApplication.InitSignal().Connect( this, &TextLabelExample::Create ); |
| @@ -108,6 +119,16 @@ public: | @@ -108,6 +119,16 @@ public: | ||
| 108 | mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 ); | 119 | mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 ); |
| 109 | break; | 120 | break; |
| 110 | } | 121 | } |
| 122 | + case KEY_A: | ||
| 123 | + { | ||
| 124 | + if( ++mAlignment >= ALIGNMENT_STRING_COUNT ) | ||
| 125 | + { | ||
| 126 | + mAlignment = 0u; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + mLabel.SetProperty( TextLabel::Property::ALIGNMENT, ALIGNMENT_STRING_TABLE[ mAlignment ] ); | ||
| 130 | + break; | ||
| 131 | + } | ||
| 111 | case KEY_M: | 132 | case KEY_M: |
| 112 | { | 133 | { |
| 113 | bool multiLine = mLabel.GetProperty<bool>( TextLabel::Property::MULTI_LINE ); | 134 | bool multiLine = mLabel.GetProperty<bool>( TextLabel::Property::MULTI_LINE ); |
| @@ -124,6 +145,7 @@ public: | @@ -124,6 +145,7 @@ public: | ||
| 124 | { | 145 | { |
| 125 | mLanguageId = 0u; | 146 | mLanguageId = 0u; |
| 126 | } | 147 | } |
| 148 | + break; | ||
| 127 | } | 149 | } |
| 128 | } | 150 | } |
| 129 | } | 151 | } |
| @@ -137,6 +159,7 @@ private: | @@ -137,6 +159,7 @@ private: | ||
| 137 | TextLabel mLabel; | 159 | TextLabel mLabel; |
| 138 | 160 | ||
| 139 | unsigned int mLanguageId; | 161 | unsigned int mLanguageId; |
| 162 | + unsigned int mAlignment; | ||
| 140 | }; | 163 | }; |
| 141 | 164 | ||
| 142 | void RunTest( Application& application ) | 165 | void RunTest( Application& application ) |