Commit ba4775240c68ad4be7ac19700b29ddd8894e23b8

Authored by Victor Cebollada
Committed by Víctor Cebollada
1 parent 140cc98f

Alignment option added.

Change-Id: I5f0e4ad2e2b52cd25aa8661dd95f688ac6c41a8b
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
examples/text-label/text-label-example.cpp
... ... @@ -36,8 +36,18 @@ namespace
36 36 {
37 37 const unsigned int KEY_ZERO = 10;
38 38 const unsigned int KEY_ONE = 11;
  39 + const unsigned int KEY_A = 38;
39 40 const unsigned int KEY_M = 58;
40 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 59  
50 60 TextLabelExample( Application& application )
51 61 : mApplication( application ),
52   - mLanguageId( 0u )
  62 + mLanguageId( 0u ),
  63 + mAlignment( 0u )
53 64 {
54 65 // Connect to the Application's Init signal
55 66 mApplication.InitSignal().Connect( this, &TextLabelExample::Create );
... ... @@ -108,6 +119,16 @@ public:
108 119 mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 );
109 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 132 case KEY_M:
112 133 {
113 134 bool multiLine = mLabel.GetProperty<bool>( TextLabel::Property::MULTI_LINE );
... ... @@ -124,6 +145,7 @@ public:
124 145 {
125 146 mLanguageId = 0u;
126 147 }
  148 + break;
127 149 }
128 150 }
129 151 }
... ... @@ -137,6 +159,7 @@ private:
137 159 TextLabel mLabel;
138 160  
139 161 unsigned int mLanguageId;
  162 + unsigned int mAlignment;
140 163 };
141 164  
142 165 void RunTest( Application& application )
... ...