1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     GuiControlManager.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46365 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_COMMON_SCENE_GUICONTROLMANAGER_H_
17 #define NN_COMMON_SCENE_GUICONTROLMANAGER_H_
18 
19 #include "GuiControlBase.h"
20 #include "List.h"
21 
22 namespace scene
23 {
24     /* Please see man pages for details
25 
26     */
27     typedef void (*ControlEventCallback)(ControlEvent event, ControlBase* pControl, s16 x, s16 y, void* pParam);
28 
29     /* Please see man pages for details
30 
31     */
32     typedef List<ControlBase*> ControlList;
33 
34     /* Please see man pages for details
35 
36     */
37     class ControlManager
38     {
39     public:
40         /* Please see man pages for details
41 
42         */
43         ControlManager();
44 
45         /* Please see man pages for details
46 
47         */
48         virtual ~ControlManager();
49 
50         /* Please see man pages for details
51 
52 
53 
54         */
55         void Add(ControlBase* pControl);
56 
57         /* Please see man pages for details
58 
59         */
60         void Clear();
61 
62         /* Please see man pages for details
63 
64 
65 
66 
67 
68         */
69         ControlBase* FindBy(u32 id);
70 
71         /* Please see man pages for details
72 
73 
74 
75         */
76         List<ControlBase*>* GetList();
77 
78         /* Please see man pages for details
79 
80 
81 
82 
83         */
RegisterControlEventCallback(ControlEventCallback pCallback,void * pParam)84         void RegisterControlEventCallback(ControlEventCallback pCallback, void* pParam)
85         {
86             m_pCallback = pCallback;
87             m_pParam    = pParam;
88         }
89 
90         /* Please see man pages for details
91 
92         */
93         void Update();
94 
95         /* Please see man pages for details
96 
97         */
98         void Draw();
99 
100     protected:
101         // vtable 4byte exists in this position (keep in mind when adjusting padding)
102         // ID of active control
103         u32 m_activeId;
104         // Callbacks
105         ControlEventCallback m_pCallback;
106         // Callback parameters
107         void* m_pParam;
108 
109         // Control list
110         ControlList m_controlList;
111         // Touch panel reader
112         nn::hid::TouchPanelReader m_touchReader;
113         // Touch panel input information
114         nn::hid::TouchPanelStatus m_touchStatus;
115         nn::hid::TouchPanelStatus m_touchStatusOld;
116     };
117 }
118 
119 #endif // NN_COMMON_SCENE_GUICONTROLMANAGER_H_
120