A simple control using visuals
[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) 2017 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 /**
35  * @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
36  * depending on which one is focused.
37  *
38  * Inherits from connection tracker to manage connection and disconnection of signals,  In this case PreFocusChangeSignal
39  */
40 class SimpleVisualsApplication : public ConnectionTracker
41 {
42
43 public:
44
45   /**
46    * @brief Constructor.
47    *
48    * @param[in]  application A reference to the Application class.
49    */
50   SimpleVisualsApplication( Application& application );
51
52
53 private:
54   /**
55    *  @brief Listen to Focus change signal
56    *  @param[in] current  Current focused Actor
57    *  @param[in] proposed New actor that is requesting to be focused
58    *  @param[in] direction The direction of the focus event from current actor
59    */
60   Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction );
61
62   /**
63    * @brief Derived from control, enables capture of key presses
64    *
65    * @param[in] event In incoming key event
66    */
67   void OnKeyEvent( const KeyEvent& event );
68
69   /**
70    * @brief Called to initialise the application content
71    *
72    * @param[in] application A reference to the Application class.
73    */
74   void Create( Application& application );
75
76
77 private:
78
79   Application& mApplication;  // Handle to the application that is created and passed in.
80
81   MyControl mMyControl;  //  Handle to first instance of MyControl
82   MyControl mMyControl2; //  Handle to second instance of MyControl
83
84 };
85
86 } // Namespace Demo
87
88
89 #endif // DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H