Commit 4ab26450a7695a6a15b3a173e29801db4216763a

Authored by Eunki, Hong
1 parent 5736e5cf

Sample for DevelVisual::Property::BORDERLINE_WIDTH

Make image-view.example can test for borderline feature.

Change-Id: I7fbbe4588fd27e24a853dc0669b195d7a86496ff
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
examples/image-view/image-view-example.cpp
... ... @@ -70,6 +70,21 @@ std::string EXAMPLE_INSTRUCTIONS =
70 70 "on/off takes the ImageView and it's current visual on or off window.";
71 71  
72 72 const float CORNER_RADIUS_VALUE(20.0f);
  73 +const float BORDERLINE_WIDTH_VALUE(10.0f);
  74 +const float BORDERLINE_OFFSET_VALUE(-1.0f); ///< draw borderline inside of imageview.
  75 +enum {
  76 + STATUS_NORMAL = 0,
  77 + STATUS_ROUND = 1,
  78 + STATUS_BORDERLINE = 2,
  79 + STATUS_ROUNDED_BORDERLINE = 3,
  80 + NUMBER_OF_STATUS,
  81 +};
  82 +const char* BUTTON_LABEL[NUMBER_OF_STATUS] = {
  83 + "Normal",
  84 + "Round",
  85 + "Borderline",
  86 + "RoundBorderline",
  87 +};
73 88  
74 89 } // namespace
75 90  
... ... @@ -147,7 +162,7 @@ public:
147 162 mTable.AddChild(button2, Toolkit::TableView::CellPosition(CellPlacement::MID_BUTTON, x));
148 163  
149 164 Toolkit::PushButton button3 = Toolkit::PushButton::New();
150   - button3.SetProperty(Toolkit::Button::Property::LABEL, "Round");
  165 + button3.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(STATUS_NORMAL + 1) % NUMBER_OF_STATUS]);
151 166 button3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
152 167 button3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
153 168 button3.ClickedSignal().Connect(this, &ImageViewController::RoundedCornerClicked);
... ... @@ -170,7 +185,7 @@ public:
170 185 // Set changeable counter and toggle for each ImageView
171 186 mImageViewImageIndexStatus[x] = 0;
172 187 mImageViewToggleStatus[x] = true;
173   - mImageViewRoundedCornerStatus[x] = false;
  188 + mImageViewRoundedCornerStatus[x] = STATUS_NORMAL;
174 189 }
175 190  
176 191 application.GetWindow().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent);
... ... @@ -220,7 +235,8 @@ private:
220 235 }
221 236  
222 237 // Reset corner radius state value
223   - mImageViewRoundedCornerStatus[buttonIndex] = false;
  238 + mImageViewRoundedCornerStatus[buttonIndex] = STATUS_NORMAL;
  239 + button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]);
224 240  
225 241 Property::Map imagePropertyMap;
226 242 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
... ... @@ -236,12 +252,16 @@ private:
236 252  
237 253 if(mImageViews[buttonIndex].GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
238 254 {
239   - mImageViewRoundedCornerStatus[buttonIndex] = !mImageViewRoundedCornerStatus[buttonIndex];
  255 + mImageViewRoundedCornerStatus[buttonIndex] = (mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS;
  256 +
  257 + button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]);
240 258  
241 259 Property::Map imagePropertyMap;
242 260 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
243 261 imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]);
244   - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImageViewRoundedCornerStatus[buttonIndex] ? CORNER_RADIUS_VALUE : 0.0f);
  262 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImageViewRoundedCornerStatus[buttonIndex] & 1 ? CORNER_RADIUS_VALUE : 0.0f);
  263 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_WIDTH_VALUE : 0.0f);
  264 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_OFFSET_VALUE : 0.0f);
245 265  
246 266 mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap);
247 267 }
... ... @@ -271,7 +291,7 @@ private:
271 291 Toolkit::TableView mTable;
272 292 Toolkit::ImageView mImageViews[NUMBER_OF_IMAGES];
273 293 bool mImageViewToggleStatus[NUMBER_OF_IMAGES];
274   - bool mImageViewRoundedCornerStatus[NUMBER_OF_IMAGES];
  294 + unsigned int mImageViewRoundedCornerStatus[NUMBER_OF_IMAGES];
275 295 unsigned int mImageViewImageIndexStatus[NUMBER_OF_IMAGES];
276 296  
277 297 Toolkit::TableView::CellPosition mCurrentPositionToggle;
... ...