5a653dc004bb9f0052bffeae4899b18b7fd36c52
[platform/core/uifw/dali-demo.git] / examples / layouting / linear-example.h
1 #ifndef DALI_DEMO_LINEAR_EXAMPLE_H
2 #define DALI_DEMO_LINEAR_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 <dali/dali.h>
22 #include <dali-toolkit/dali-toolkit.h>
23
24 #include "example.h"
25
26 using namespace Dali;
27 using namespace Dali::Toolkit;
28
29 namespace Demo
30 {
31
32 /**
33  * @file linear-example.hcpp
34  * @brief Example of a Linear Layout with mirror feature and
35  * transition from horizontal to vertical.
36  */
37 class LinearExample final: public ConnectionTracker, public Example
38 {
39 public:
40   LinearExample();
41
42   // Creates a Linear Layout Example and displays it.
43   virtual void Create() override;
44
45   // Remove and destroy this layout
46   virtual void Remove() override;
47
48 private:
49
50   // Changes the direction of the items.
51   bool OnDirectionClicked( Button button );
52
53   // Alternates the linear layout from horizontal to vertical
54   bool OnRotateClicked( Button button );
55
56   // Cycles through alignment options
57   bool OnAlignmentClicked( Button button );
58
59   // Justifies linear layout children using weight property
60   bool OnWeightClicked( Button button );
61
62 private:
63   PushButton mDirectionButton;
64   PushButton mAlignmentButton;
65   PushButton mWeightButton;
66   PushButton mRotateButton;
67   std::vector< Toolkit::ImageView > mImages;
68   Control mLinearContainer;
69   bool mLTRDirection;
70   bool mImagesWeighted;
71 }; // class LinearContainer
72
73 } // namespace Demo
74
75 #endif //DALI_DEMO_LINEAR_CONTAINER_H