Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / text-label / expanding-buttons.h
1 #ifndef DALI_DEMO_EXPANDING_BUTTONS_CONTROL_H
2 #define DALI_DEMO_EXPANDING_BUTTONS_CONTROL_H
3
4 /*
5  * Copyright (c) 2020 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 #include <dali-toolkit/dali-toolkit.h>
21
22 namespace Demo
23 {
24 namespace Internal
25 {
26 class ExpandingButtons;
27 }
28
29 /**
30  * Control which toggles between showing and hiding a set of buttons.
31  */
32 class ExpandingButtons : public Dali::Toolkit::Control
33 {
34 public: // Construction / destruction
35   /**
36    * Create an uninitialized handle
37    */
38   ExpandingButtons();
39
40   /**
41    * Create an ExpandingButton control with the default pressed and released visual.
42    */
43   static ExpandingButtons New();
44
45   /**
46    * Destructor. This is non-virtual since derived Handle types must not
47    * contain data or virtual methods
48    */
49   ~ExpandingButtons();
50
51   /**
52    * Copy Constructor
53    */
54   ExpandingButtons(const ExpandingButtons& expandingButtons);
55
56   /**
57    * Assignment Operator
58    */
59   ExpandingButtons& operator=(const ExpandingButtons& expandingButtons);
60
61   /**
62    * Downcast
63    */
64   static ExpandingButtons DownCast(BaseHandle handle);
65
66 public: // API
67   /**
68    * Add a control (button) to the Expanding button bar. Will be displayed in order of addition.
69    */
70   void RegisterButton(Control& control);
71
72   /**
73    * Expand the registered buttons out from the main button.
74    */
75   void Expand();
76
77   /**
78    * Collapse the expanded buttons back behind the main button.
79    */
80   void Collapse();
81
82 public: // Signals
83         /**
84    * ExpandingButtons signal type
85    */
86   typedef Dali::Signal<bool(ExpandingButtons)> ExpandingButtonsSignalType;
87
88   /**
89    * This signal is emitted when the button is going to collapse.
90    */
91   ExpandingButtonsSignalType& CollapsingSignal();
92
93 public: // Not for public use
94   /**
95    * Create a handle from an implementation
96    */
97   ExpandingButtons(Internal::ExpandingButtons& implementation);
98
99   /**
100    * Allow the creation of an ExpandingButtons handle from an internal CustomActor pointer
101    */
102   ExpandingButtons(Dali::Internal::CustomActor* internal);
103 };
104
105 } // namespace Demo
106
107 #endif // DALI_DEMO_EXPANDING_BUTTONS_CONTROL_H