1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*!
\file GUIControlGroup.h
\brief
*/
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "GUIControl.h"
/*!
\ingroup controls
\brief group of controls, useful for remembering last control + animating/hiding together
*/
class CGUIControlGroup : public CGUIControl
{
public:
CGUIControlGroup();
CGUIControlGroup(int parentID, int controlID, float posX, float posY, float width, float height);
CGUIControlGroup(const CGUIControlGroup &from);
virtual ~CGUIControlGroup(void);
virtual CGUIControlGroup *Clone() const { return new CGUIControlGroup(*this); };
virtual void Render();
virtual bool OnAction(const CAction &action);
virtual bool OnMessage(CGUIMessage& message);
virtual bool SendControlMessage(CGUIMessage& message);
virtual bool HasFocus() const;
virtual void AllocResources();
virtual void FreeResources();
virtual void DynamicResourceAlloc(bool bOnOff);
virtual bool CanFocus() const;
virtual bool SendMouseEvent(const CPoint &point, const CMouseEvent &event);
virtual void UnfocusFromPoint(const CPoint &point);
virtual void SetInitialVisibility();
virtual void DoRender(unsigned int currentTime);
virtual bool IsAnimating(ANIMATION_TYPE anim);
virtual bool HasAnimation(ANIMATION_TYPE anim);
virtual void QueueAnimation(ANIMATION_TYPE anim);
virtual void ResetAnimation(ANIMATION_TYPE anim);
virtual void ResetAnimations();
virtual bool HasID(int id) const;
virtual bool HasVisibleID(int id) const;
virtual void SetInvalid();
int GetFocusedControlID() const;
CGUIControl *GetFocusedControl() const;
const CGUIControl *GetControl(int id) const;
virtual CGUIControl *GetFirstFocusableControl(int id);
void GetContainers(std::vector<CGUIControl *> &containers) const;
virtual void AddControl(CGUIControl *control, int position = -1);
bool InsertControl(CGUIControl *control, const CGUIControl *insertPoint);
virtual bool RemoveControl(const CGUIControl *control);
virtual void ClearAll();
void SetDefaultControl(int id, bool always) { m_defaultControl = id; m_defaultAlways = always; };
void SetRenderFocusedLast(bool renderLast) { m_renderFocusedLast = renderLast; };
virtual void SaveStates(std::vector<CControlState> &states);
virtual bool IsGroup() const { return true; };
#ifdef _DEBUG
virtual void DumpTextureUse();
#endif
protected:
/*!
\brief Return the coordinates of the top left of the group, in the group's parent coordinates
\return The top left coordinates of the group
*/
virtual CPoint GetPosition() const { return CPoint(m_posX, m_posY); };
/*!
\brief Check whether a given control is valid
Runs through controls and returns whether this control is valid. Only functional
for controls with non-zero id.
\param control to check
\return true if the control is valid, false otherwise.
*/
bool IsValidControl(const CGUIControl *control) const;
// sub controls
std::vector<CGUIControl *> m_children;
typedef std::vector<CGUIControl *>::iterator iControls;
typedef std::vector<CGUIControl *>::const_iterator ciControls;
typedef std::vector<CGUIControl *>::reverse_iterator rControls;
typedef std::vector<CGUIControl *>::const_reverse_iterator crControls;
// fast lookup by id
typedef std::multimap<int, CGUIControl *> LookupMap;
void AddLookup(CGUIControl *control);
void RemoveLookup(CGUIControl *control);
const LookupMap &GetLookup() { return m_lookup; };
LookupMap m_lookup;
int m_defaultControl;
bool m_defaultAlways;
int m_focusedControl;
bool m_renderFocusedLast;
// render time
unsigned int m_renderTime;
};
|