Revert "Revert "Renamed KeyEvent enum values to comply with coding standards.""
[platform/core/uifw/dali-demo.git] / examples / size-negotiation / size-negotiation-example.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "shared/view.h"
19 #include <dali/dali.h>
20 #include <dali-toolkit/dali-toolkit.h>
21 #include <dali-toolkit/devel-api/controls/popup/popup.h>
22 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
23 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
24
25 using namespace Dali;
26
27 using Dali::Toolkit::TextLabel;
28
29 struct ButtonItem
30 {
31   const char* name;
32   const char* text;
33 };
34
35 namespace
36 {
37
38 const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg";
39 const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";
40 const char* const IMAGE = DEMO_IMAGE_DIR "background-magnifier.jpg";
41
42 const char* const TOOLBAR_TITLE = "Negotiate Size";
43
44 // This example contains size negotiation tests for TableView and Popup.
45 const char* const TABLEVIEW_BUTTON_1CELL_ID = "TABLEVIEW_BUTTON_1CELL";
46 const char* const TABLEVIEW_BUTTON_3CELL_ID = "TABLEVIEW_BUTTON_3CELL";
47 const char* const TABLEVIEW_BUTTON_3X3CELL_ID = "TABLEVIEW_BUTTON_3X3CELL";
48 const char* const TABLEVIEW_BUTTON_FIXED1_ID = "TABLEVIEW_BUTTON_FIXED1";
49 const char* const TABLEVIEW_BUTTON_FIXED2_ID = "TABLEVIEW_BUTTON_FIXED2";
50 const char* const TABLEVIEW_BUTTON_FIT1_ID = "TABLEVIEW_BUTTON_FIT1";
51 const char* const TABLEVIEW_BUTTON_FIT2_ID = "TABLEVIEW_BUTTON_FIT2";
52 const char* const TABLEVIEW_BUTTON_NATURAL1_ID = "TABLEVIEW_BUTTON_NATURAL1";
53 const char* const TABLEVIEW_BUTTON_NATURAL2_ID = "TABLEVIEW_BUTTON_NATURAL2";
54 const char* const TABLEVIEW_BUTTON_NATURAL3_ID = "TABLEVIEW_BUTTON_NATURAL3";
55 const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
56 const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
57 const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
58
59 const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = {
60     { TABLEVIEW_BUTTON_1CELL_ID,                    "1 Cell" },
61     { TABLEVIEW_BUTTON_3CELL_ID,                    "3 Cell" },
62     { TABLEVIEW_BUTTON_3X3CELL_ID,                  "3x3 Cells" },
63     { TABLEVIEW_BUTTON_FIXED1_ID,                   "Fixed 1" },
64     { TABLEVIEW_BUTTON_FIXED2_ID,                   "Fixed 2" },
65     { TABLEVIEW_BUTTON_FIT1_ID,                     "Fit Top Bottom" },
66     { TABLEVIEW_BUTTON_FIT2_ID,                     "Fit Middle" },
67     { TABLEVIEW_BUTTON_NATURAL1_ID,                 "Natural 1" },
68     { TABLEVIEW_BUTTON_NATURAL2_ID,                 "Natural 2" },
69     { TABLEVIEW_BUTTON_NATURAL3_ID,                 "Natural 3" },
70     { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID,          "Image Scale" },
71     { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID,            "Image Fit" },
72     { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID,           "Image Fill" },
73 };
74
75 const unsigned int TABLEVIEW_BUTTON_ITEMS_COUNT = sizeof( TABLEVIEW_BUTTON_ITEMS ) / sizeof( TABLEVIEW_BUTTON_ITEMS[0] );
76
77
78 Actor CreateSolidColor( Vector4 color )
79 {
80   Toolkit::Control control = Toolkit::Control::New();
81
82   Property::Map map;
83   map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
84   map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
85   control.SetProperty( Toolkit::Control::Property::BACKGROUND, map );
86
87   return control;
88 }
89
90 }  // anonymous namespace
91
92
93 /**
94  * This example shows the usage of size negotiation.
95  */
96 class SizeNegotiationController: public ConnectionTracker, public Toolkit::ItemFactory
97 {
98 public:
99
100   SizeNegotiationController( Application& application )
101     : mApplication( application )
102   {
103     // Connect to the Application's Init signal
104     mApplication.InitSignal().Connect( this, &SizeNegotiationController::Create );
105   }
106
107   ~SizeNegotiationController()
108   {
109     // Nothing to do here
110   }
111
112   void Create( Application& application )
113   {
114     // The Init signal is received once (only) during the Application lifetime
115     Window window = application.GetWindow();
116
117     // Respond to key events if not handled
118     window.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
119
120     // Creates a default view with a default tool bar.
121     // The view is added to the window.
122     mContentLayer = DemoHelper::CreateView( application,
123                                             mView,
124                                             mToolBar,
125                                             BACKGROUND_IMAGE,
126                                             TOOLBAR_IMAGE,
127                                             std::string("") );
128
129     mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
130     mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, TOOLBAR_TITLE );
131
132     // Add title to the tool bar.
133     const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding );
134     mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::Padding( padding, padding, padding, padding ) );
135
136     mItemView = Toolkit::ItemView::New( *this );
137     mItemView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
138     mItemView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
139     mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
140
141     // Use a grid layout for tests
142     Vector2 windowSize = window.GetSize();
143     Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
144     Vector3 itemSize;
145     gridLayout->GetItemSize( 0, Vector3( windowSize ), itemSize );
146     itemSize.height = windowSize.y / 10;
147     gridLayout->SetItemSize( itemSize );
148     mItemView.AddLayout( *gridLayout );
149
150     mItemView.ActivateLayout( 0, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
151
152     mContentLayer.Add( mItemView );
153   }
154
155   void ShowPopup( Toolkit::Popup popup )
156   {
157     mApplication.GetWindow().Add( popup );
158     popup.SetDisplayState( Toolkit::Popup::SHOWN );
159   }
160
161   void OnPopupOutsideTouched()
162   {
163     if( mPopup )
164     {
165       mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
166     }
167   }
168
169   void PopupHidden()
170   {
171     if( mPopup )
172     {
173       mPopup.Unparent();
174       mPopup.Reset();
175     }
176   }
177
178   Toolkit::Popup CreatePopup()
179   {
180     Window window = mApplication.GetWindow();
181     const float POPUP_WIDTH_DP = window.GetSize().GetWidth() * 0.75f;
182
183     Toolkit::Popup popup = Toolkit::Popup::New();
184     popup.SetProperty( Dali::Actor::Property::NAME, "popup" );
185     popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
186     popup.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
187     popup.SetProperty( Actor::Property::SIZE, Vector2( POPUP_WIDTH_DP, 0.0f ) );
188     popup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, false );
189
190     popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched );
191     popup.HiddenSignal().Connect( this, &SizeNegotiationController::PopupHidden );
192
193     return popup;
194   }
195
196   bool OnButtonClicked( Toolkit::Button button )
197   {
198     if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_1CELL_ID )
199     {
200       mPopup = CreatePopup();
201       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
202       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
203
204       Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
205       table.SetProperty( Dali::Actor::Property::NAME, "TABLEVIEW_BUTTON_1CELL_ID" );
206       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
207
208       Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
209       backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
210       table.Add( backing );
211
212       mPopup.Add( table );
213
214       ShowPopup( mPopup );
215     }
216     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3CELL_ID )
217     {
218       mPopup = CreatePopup();
219       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
220       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
221
222       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
223       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
224
225       {
226         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
227         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
228         table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
229       }
230       {
231         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
232         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
233         table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
234       }
235       {
236         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
237         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
238         table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
239       }
240
241       mPopup.SetContent( table );
242
243       ShowPopup( mPopup );
244     }
245     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3X3CELL_ID )
246     {
247       mPopup = CreatePopup();
248       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
249       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
250
251       Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
252       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
253
254       // Column 0
255       {
256         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
257         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
258         table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
259       }
260       {
261         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
262         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
263         table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
264       }
265       {
266         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
267         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
268         table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
269       }
270
271       // Column 1
272       {
273         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
274         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
275         table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) );
276       }
277       {
278         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
279         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
280         table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) );
281       }
282       {
283         Actor backing = CreateSolidColor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
284         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
285         table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) );
286       }
287
288       // Column 2
289       {
290         Actor backing = CreateSolidColor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
291         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
292         table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) );
293       }
294       {
295         Actor backing = CreateSolidColor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
296         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
297         table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) );
298       }
299       {
300         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
301         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
302         table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) );
303       }
304
305       mPopup.Add( table );
306
307       ShowPopup( mPopup );
308     }
309     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED1_ID )
310     {
311       mPopup = CreatePopup();
312       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
313       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
314
315       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
316       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
317       table.SetFixedHeight( 0, 50.0f );
318
319       {
320         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
321         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
322         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
323         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
324         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
325         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
326         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
327         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
328         backing.Add( text );
329         table.Add( backing );
330       }
331       {
332         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
333         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
334         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
335         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
336         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
337         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
338         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
339         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
340         backing.Add( text );
341         table.Add( backing );
342       }
343       {
344         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
345         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
346         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
347         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
348         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
349         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
350         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
351         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
352         backing.Add( text );
353         table.Add( backing );
354       }
355
356       mPopup.Add( table );
357
358       ShowPopup( mPopup );
359     }
360     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED2_ID )
361     {
362       mPopup = CreatePopup();
363       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
364       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
365
366       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
367       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
368       table.SetFixedHeight( 0, 50.0f );
369       table.SetFixedHeight( 2, 50.0f );
370
371       {
372         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
373         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
374         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
375         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
376         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
377         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
378         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
379         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
380         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
381
382         backing.Add( text );
383         table.Add( backing );
384       }
385       {
386         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
387         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
388         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
389         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
390         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
391         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
392         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
393         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
394         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
395
396         backing.Add( text );
397         table.Add( backing );
398       }
399       {
400         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
401         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
402         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
403         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
404         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
405         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
406         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
407         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
408         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
409
410         backing.Add( text );
411         table.Add( backing );
412       }
413
414       mPopup.Add( table );
415
416       ShowPopup( mPopup );
417     }
418     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT1_ID )
419     {
420       mPopup = CreatePopup();
421       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
422       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
423
424       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
425       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
426       table.SetFitHeight( 0 );
427       table.SetFitHeight( 2 );
428
429       {
430         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
431         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
432         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 100.0f ) );
433
434         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
435         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
436         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
437         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
438         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
439         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
440         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
441
442         backing.Add( text );
443
444         table.Add( backing );
445       }
446       {
447         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
448         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
449
450         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
451         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
452         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
453         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
454         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
455         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
456         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
457
458         backing.Add( text );
459
460         table.Add( backing );
461       }
462       {
463         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
464         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
465         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 100.0f ) );
466
467         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
468         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
469         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
470         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
471         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
472         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
473         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
474
475         backing.Add( text );
476
477         table.Add( backing );
478       }
479
480       mPopup.Add( table );
481
482       ShowPopup( mPopup );
483     }
484     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT2_ID )
485     {
486       mPopup = CreatePopup();
487       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
488       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
489
490       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
491       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
492       table.SetFitHeight( 1 );
493
494       {
495         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
496         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
497
498         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
499         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
500         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
501         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
502         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
503         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
504         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
505
506         backing.Add( text );
507
508         table.Add( backing );
509       }
510       {
511         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
512         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
513         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 200.0f ) );
514
515         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
516         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
517         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
518         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
519         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
520
521         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
522         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
523         backing.Add( text );
524
525         table.Add( backing );
526       }
527       {
528         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
529         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
530
531         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
532         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
533         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
534         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
535         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
536         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
537         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
538
539         backing.Add( text );
540
541         table.Add( backing );
542       }
543
544       mPopup.Add( table );
545
546       ShowPopup( mPopup );
547     }
548     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL1_ID )
549     {
550       mPopup = CreatePopup();
551       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
552       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 1.0f, 1.0f ) );
553       mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
554
555       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
556       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
557       table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
558       table.SetFitHeight( 0 );
559       table.SetFitHeight( 1 );
560       table.SetFitHeight( 2 );
561
562       {
563         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
564         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
565         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 100.0f ) );
566
567         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
568         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
569         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
570         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
571         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
572         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
573         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
574
575         backing.Add( text );
576
577         table.Add( backing );
578       }
579       {
580         Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
581         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
582         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 200.0f ) );
583
584         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
585         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
586         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
587         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
588         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
589         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
590         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
591
592         backing.Add( text );
593
594         table.Add( backing );
595       }
596       {
597         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
598         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
599         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 300.0f ) );
600
601         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
602         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
603         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
604         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
605         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
606         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
607         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
608
609         backing.Add( text );
610
611         table.Add( backing );
612       }
613
614       mPopup.Add( table );
615
616       ShowPopup( mPopup );
617     }
618     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL2_ID )
619     {
620       mPopup = CreatePopup();
621       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
622       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 1.0f, 1.0f ) );
623       mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
624
625       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
626       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
627       table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
628       table.SetFitHeight( 0 );
629       table.SetFitHeight( 1 );
630
631       {
632         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
633         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
634         backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
635         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 100.0f ) );
636
637         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
638         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
639         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
640         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
641         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
642         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
643         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
644
645         backing.Add( text );
646
647         table.Add( backing );
648       }
649       {
650         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
651         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
652         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 200.0f ) );
653
654         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
655         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
656         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
657         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
658         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
659         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
660         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
661
662         backing.Add( text );
663
664         table.Add( backing );
665       }
666
667       mPopup.Add( table );
668
669       ShowPopup( mPopup );
670     }
671     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL3_ID )
672     {
673       mPopup = CreatePopup();
674       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
675       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 1.0f, 1.0f ) );
676       mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
677
678       Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
679       table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
680       table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
681       table.SetFixedHeight( 0, 20.0f );
682       table.SetFitHeight( 1 );
683
684       {
685         Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
686         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
687
688         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
689         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
690         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
691         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
692         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
693         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
694         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
695
696         backing.Add( text );
697
698         table.Add( backing );
699       }
700       {
701         Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
702         backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
703         backing.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 200.0f ) );
704
705         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
706         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
707         text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
708         text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
709         text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
710         text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
711         text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
712
713         backing.Add( text );
714
715         table.Add( backing );
716       }
717       mPopup.Add( table );
718
719       ShowPopup( mPopup );
720     }
721     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
722     {
723       mPopup = CreatePopup();
724       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
725       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
726
727       Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
728       image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
729
730       mPopup.Add( image );
731
732       ShowPopup( mPopup );
733     }
734     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
735     {
736       mPopup = CreatePopup();
737       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
738       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
739
740       Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
741       image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
742       image.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
743
744       mPopup.Add( image );
745
746       ShowPopup( mPopup );
747     }
748     else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
749     {
750       mPopup = CreatePopup();
751       mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
752       mPopup.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75f, 0.5f, 1.0f ) );
753
754       Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
755       image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
756       image.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
757
758       mPopup.Add( image );
759
760       ShowPopup( mPopup );
761     }
762
763     return true;
764   }
765
766   void OnKeyEvent( const KeyEvent& event )
767   {
768     if( event.GetState() == KeyEvent::DOWN )
769     {
770       if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
771       {
772         // Exit application when click back or escape.
773         mApplication.Quit();
774       }
775     }
776   }
777
778 public: // From ItemFactory
779
780   /**
781    * @brief Return the number of items to display in the item view
782    *
783    * @return Return the number of items to display
784    */
785   virtual unsigned int GetNumberOfItems()
786   {
787     return TABLEVIEW_BUTTON_ITEMS_COUNT;
788   }
789
790   /**
791    * @brief Create a new item to populate the item view with
792    *
793    * @param[in] itemId The index of the item to create
794    * @return Return the created actor for the given ID
795    */
796   virtual Actor NewItem(unsigned int itemId)
797   {
798     Toolkit::PushButton popupButton = Toolkit::PushButton::New();
799     popupButton.SetProperty( Dali::Actor::Property::NAME, TABLEVIEW_BUTTON_ITEMS[ itemId ].name );
800     popupButton.SetProperty( Toolkit::Button::Property::LABEL, TABLEVIEW_BUTTON_ITEMS[ itemId ].text );
801     popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
802
803     popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
804
805     return popupButton;
806   }
807
808 private:
809
810   Application&       mApplication;
811   Toolkit::Control   mView;                  ///< The View instance.
812   Toolkit::ToolBar   mToolBar;               ///< The View's Toolbar.
813   Layer              mContentLayer;          ///< Content layer.
814
815   Toolkit::TextLabel mTitleActor;            ///< Title text.
816   Toolkit::Popup     mMenu;                  ///< The navigation menu.
817   Toolkit::Popup     mPopup;                 ///< The current example popup.
818
819   Toolkit::ItemView  mItemView;              ///< ItemView to hold test images.
820
821 };
822
823 int DALI_EXPORT_API main( int argc, char **argv )
824 {
825   Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
826   SizeNegotiationController test( application );
827   application.MainLoop();
828   return 0;
829 }