Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / simple-visuals-control / simple-visuals-application.h
1 #ifndef DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H
2 #define DALI_DEMO_SIMPLE_VISUALS_APPLICATION_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 // EXTERNAL INCLUDES
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <cstdio>
23 #include <sstream>
24
25 // INTERNAL INCLUDES
26 #include "my-control.h"
27
28 using namespace Dali;
29 using namespace Dali::Toolkit;
30
31 namespace Demo
32 {
33 /**
34  * @brief An application that uses the my-control to display 2 icons, if focus is allowed ( by using a keyboard or remote ) then the icons will change
35  * depending on which one is focused.
36  *
37  * Inherits from connection tracker to manage connection and disconnection of signals,  In this case PreFocusChangeSignal
38  */
39 class SimpleVisualsApplication : public ConnectionTracker
40 {
41 public:
42   /**
43    * @brief Constructor.
44    *
45    * @param[in]  application A reference to the Application class.
46    */
47   SimpleVisualsApplication(Application& application);
48
49 private:
50   /**
51    *  @brief Listen to Focus change signal
52    *  @param[in] current  Current focused Actor
53    *  @param[in] proposed New actor that is requesting to be focused
54    *  @param[in] direction The direction of the focus event from current actor
55    */
56   Dali::Actor OnKeyboardPreFocusChange(Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction);
57
58   /**
59    * @brief Derived from control, enables capture of key presses
60    *
61    * @param[in] event In incoming key event
62    */
63   void OnKeyEvent(const KeyEvent& event);
64
65   /**
66    * @brief Called to initialise the application content
67    *
68    * @param[in] application A reference to the Application class.
69    */
70   void Create(Application& application);
71
72 private:
73   Application& mApplication; // Handle to the application that is created and passed in.
74
75   MyControl mMyControl;  //  Handle to first instance of MyControl
76   MyControl mMyControl2; //  Handle to second instance of MyControl
77 };
78
79 } // Namespace Demo
80
81 #endif // DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H