16 #include "DirtyRegion.h" 17 #include "VisibleEffect.h" 20 #include "utils/ColorUtils.h" 21 #include "windowing/GraphicContext.h" 31 enum ORIENTATION { HORIZONTAL = 0, VERTICAL };
47 unsigned int nCountTotal;
48 unsigned int nCountVisible;
52 nCountTotal = nCountVisible = 0;
61 EVENT_RESULT_HANDLED = 0x01,
62 EVENT_RESULT_PAN_HORIZONTAL = 0x02,
63 EVENT_RESULT_PAN_VERTICAL = 0x04,
64 EVENT_RESULT_PAN_VERTICAL_WITHOUT_INERTIA = 0x08,
65 EVENT_RESULT_PAN_HORIZONTAL_WITHOUT_INERTIA = 0x10,
66 EVENT_RESULT_ROTATE = 0x20,
67 EVENT_RESULT_ZOOM = 0x40,
68 EVENT_RESULT_SWIPE = 0x80
79 CGUIControl(
int parentID,
int controlID,
float posX,
float posY,
float width,
float height);
84 virtual void DoProcess(
unsigned int currentTime, CDirtyRegionList &dirtyregions);
85 virtual void Process(
unsigned int currentTime, CDirtyRegionList &dirtyregions);
86 virtual void DoRender();
87 virtual void Render() {}
90 virtual void RenderEx() {}
102 virtual bool OnAction(
const CAction &action);
106 virtual void OnDown();
107 virtual void OnLeft();
108 virtual void OnRight();
109 virtual bool OnBack();
110 virtual bool OnInfo();
111 virtual void OnNextControl();
112 virtual void OnPrevControl();
113 virtual void OnFocus() {}
114 virtual void OnUnFocus() {}
140 return EVENT_RESULT_UNHANDLED;
147 virtual void UnfocusFromPoint(
const CPoint &point);
154 virtual bool HitTest(
const CPoint &point)
const;
157 virtual int GetID(
void)
const;
158 virtual void SetID(
int id) { m_controlID = id; }
159 int GetParentID()
const;
160 virtual bool HasFocus()
const;
161 virtual void AllocResources();
162 virtual void FreeResources(
bool immediately =
false);
163 virtual void DynamicResourceAlloc(
bool bOnOff);
164 virtual bool IsDynamicallyAllocated() {
return false; }
165 virtual bool CanFocus()
const;
166 virtual bool IsVisible()
const;
167 bool IsVisibleFromSkin()
const {
return m_visibleFromSkinCondition; }
168 virtual bool IsDisabled()
const;
169 virtual void SetPosition(
float posX,
float posY);
170 virtual void SetHitRect(
const CRect& rect,
const UTILS::COLOR::Color& color);
171 virtual void SetCamera(
const CPoint &camera);
172 virtual void SetStereoFactor(
const float &factor);
174 CPoint GetRenderPosition()
const;
175 virtual float GetXPosition()
const;
176 virtual float GetYPosition()
const;
177 virtual float GetWidth()
const;
178 virtual float GetHeight()
const;
180 void MarkDirtyRegion(
const unsigned int dirtyState = DIRTY_STATE_CONTROL);
181 bool IsControlDirty()
const {
return m_controlDirtyState != 0; }
189 virtual CRect CalcRenderRegion()
const;
196 void SetActions(
const ActionMap &
actions);
205 void SetAction(
int actionID,
const CGUIAction &action,
bool replace =
true);
214 bool Navigate(
int direction)
const;
215 virtual void SetFocus(
bool focus);
216 virtual void SetWidth(
float width);
217 virtual void SetHeight(
float height);
218 virtual void SetVisible(
bool bVisible,
bool setVisState =
false);
219 void SetVisibleCondition(
const std::string &expression,
const std::string &allowHiddenFocus =
"");
220 bool HasVisibleCondition()
const {
return m_visibleCondition != NULL; }
221 void SetEnableCondition(
const std::string &expression);
222 virtual void UpdateVisibility(
const CGUIListItem *item);
223 virtual void SetInitialVisibility();
224 virtual void SetEnabled(
bool bEnable);
225 virtual void SetInvalid() { m_bInvalidated =
true; }
226 virtual void SetPulseOnSelect(
bool pulse) { m_pulseOnSelect = pulse; }
227 virtual std::string GetDescription()
const {
return ""; }
228 virtual std::string GetDescriptionByIndex(
int index)
const {
return ""; }
230 void SetAnimations(
const std::vector<CAnimation> &animations);
231 const std::vector<CAnimation>& GetAnimations()
const {
return m_animations; }
233 virtual void QueueAnimation(ANIMATION_TYPE anim);
234 virtual bool IsAnimating(ANIMATION_TYPE anim);
235 virtual bool HasAnimation(ANIMATION_TYPE anim);
236 CAnimation *GetAnimation(ANIMATION_TYPE type,
bool checkConditions =
true);
237 virtual void ResetAnimation(ANIMATION_TYPE type);
238 virtual void ResetAnimations();
241 virtual void UpdateInfo(
const CGUIListItem* item = NULL) {}
242 virtual void SetPushUpdates(
bool pushUpdates) { m_pushedUpdates = pushUpdates; }
244 virtual bool IsGroup()
const {
return false; }
245 virtual bool IsContainer()
const {
return false; }
246 virtual bool GetCondition(
int condition,
int data)
const {
return false; }
248 void SetParentControl(
CGUIControl* control) { m_parentControl = control; }
249 CGUIControl* GetParentControl(
void)
const {
return m_parentControl; }
250 virtual void SaveStates(std::vector<CControlState> &states);
251 virtual CGUIControl *GetControl(
int id, std::vector<CGUIControl*> *idCollector =
nullptr);
254 void SetControlStats(
GUICONTROLSTATS* controlStats) { m_controlStats = controlStats; }
255 virtual void UpdateControlStats();
261 GUICONTROL_FADELABEL,
263 GUICONTROL_BORDEREDIMAGE,
265 GUICONTROL_LISTGROUP,
270 GUICONTROL_SETTINGS_SLIDER,
274 GUICONTROL_TOGGLEBUTTON,
280 GUICONTROL_VISUALISATION,
281 GUICONTROL_RENDERADDON,
282 GUICONTROL_MULTI_IMAGE,
284 GUICONTROL_GROUPLIST,
285 GUICONTROL_SCROLLBAR,
286 GUICONTROL_LISTLABEL,
287 GUICONTROL_GAMECONTROLLER,
289 GUICONTAINER_WRAPLIST,
290 GUICONTAINER_FIXEDLIST,
291 GUICONTAINER_EPGGRID,
294 GUICONTROL_COLORBUTTON
296 GUICONTROLTYPES GetControlType()
const {
return ControlType; }
298 enum GUIVISIBLE { HIDDEN = 0, DELAYED, VISIBLE };
300 enum GUISCROLLVALUE { FOCUS = 0, NEVER, ALWAYS };
303 virtual void DumpTextureUse() {}
317 virtual bool OnMouseOver(
const CPoint &point);
324 virtual bool CanFocusFromPoint(
const CPoint &point)
const;
327 virtual bool Animate(
unsigned int currentTime);
328 virtual bool CheckAnimation(ANIMATION_TYPE animType);
329 void UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentProcess, ANIMATION_STATE currentState);
330 bool SendWindowMessage(
CGUIMessage &message)
const;
340 UTILS::COLOR::Color m_hitColor = 0xffffffff;
347 bool m_pulseOnSelect;
348 GUICONTROLTYPES ControlType;
354 INFO::InfoPtr m_visibleCondition;
355 GUIVISIBLE m_visible;
356 bool m_visibleFromSkinCondition;
361 INFO::InfoPtr m_enableCondition;
364 bool m_pushedUpdates;
367 std::vector<CAnimation> m_animations;
373 bool m_isCulled{
true};
375 static const unsigned int DIRTY_STATE_CONTROL = 1;
376 static const unsigned int DIRTY_STATE_CHILD = 2;
378 unsigned int m_controlDirtyState;
379 CRect m_renderRegion;
Definition: GUIControl.h:45
Definition: GUIInfoBool.h:29
std::map< int, CGUIAction > ActionMap
Set actions to perform on navigation.
Definition: GUIControl.h:195
Definition: GUIListItem.h:30
virtual CPoint GetPosition() const
Return the coordinates of the top left of the control, in the control's parent coordinates.
Definition: GUIControl.h:310
bool HasProcessed() const
Returns whether or not we have processed.
Definition: GUIControl.h:93
Definition: VisibleEffect.h:151
const CRect & GetRenderRegion() const
return the render region in screen coordinates of this control
Definition: GUIControl.h:185
Base class for controls.
Definition: GUIControl.h:75
EVENT_RESULT
Results of OnMouseEvent() Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was ...
Definition: GUIControl.h:60
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
Definition: GUIMessage.h:365
virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event)
Perform a mouse action.
Definition: GUIControl.h:138
Definition: GUIControl.h:33
Definition: GUIInfoColor.h:30
Simple class for mouse events.
Definition: Key.h:114
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21