[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-demo.git] / examples / layouting / grid-example.h
1 #ifndef DALI_DEMO_GRID_EXAMPLE_H
2 #define DALI_DEMO_GRID_EXAMPLE_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include <string>
22 #include <dali/dali.h>
23 #include <dali-toolkit/dali-toolkit.h>
24
25 #include "example.h"
26
27 using namespace Dali;
28 using namespace Dali::Toolkit;
29
30 namespace Demo
31 {
32
33 /**
34  * @file grid-example.hcpp
35  * @brief Example of a Grid Layout
36  */
37 class GridExample final: public ConnectionTracker, public Example
38 {
39 public:
40
41   // Constructor
42   GridExample();
43
44   static const unsigned int MAX_NUMBER_OF_IMAGE_VIEWS = 9;
45   static const unsigned int INITIAL_NUMBER_OF_IMAGE_VIEWS = 5;
46
47   // Create a Grid layout of ImagesViews
48   void Create() override;
49
50   // Remove created Layout
51   void Remove() override;
52
53 private:
54
55   // Callback for button pressed
56   bool ToggleButtonClicked( Toolkit::Button button );
57
58   // Actions to perform in this example
59   void ChangeTo3Columns();
60   void AddItemsInteractively();
61   void AddMarginToItems();
62   void RemoveMarginsFromItems();
63   void MatchParentOnWidth();
64   void WrapContentOnWidth();
65   void SetExactWidth();
66
67 private:
68
69   Toolkit::Control                mRootLayoutControl;
70   Toolkit::Control                mGridContainer;
71   std::vector<Toolkit::ImageView> mImageViews;
72   Toolkit::PushButton             mToggleButton;
73   unsigned int                    mToggleStatus;
74 };
75
76 } // namespace Demo
77
78 #endif // DALI_DEMO_GRID_EXAMPLE_H