xbmc
GUIControlGroupList.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
16 #include "GUIControlGroup.h"
17 
19 {
20  CGUIControl* control{nullptr};
21  float offset{0.f};
22 };
23 
29 {
30 public:
31  CGUIControlGroupList(int parentID, int controlID, float posX, float posY, float width, float height, float itemGap, int pageControl, ORIENTATION orientation, bool useControlPositions, uint32_t alignment, const CScroller& scroller);
32  ~CGUIControlGroupList(void) override;
33  CGUIControlGroupList* Clone() const override { return new CGUIControlGroupList(*this); }
34 
35  float GetWidth() const override;
36  float GetHeight() const override;
37  virtual float Size() const;
38  void SetInvalid() override;
39 
40  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
41  void Render() override;
42  bool OnAction(const CAction& action) override;
43  bool OnMessage(CGUIMessage& message) override;
44 
45  EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event) override;
46  void UnfocusFromPoint(const CPoint &point) override;
47 
48  void AddControl(CGUIControl *control, int position = -1) override;
49  void ClearAll() override;
50 
51  virtual std::string GetLabel(int info) const;
52  bool GetCondition(int condition, int data) const override;
56  float GetTotalSize() const;
57  ORIENTATION GetOrientation() const { return m_orientation; }
58 
59  // based on grouplist orientation pick one value as minSize;
60  void SetMinSize(float minWidth, float minHeight);
61  // shut up warning about hiding an overloaded virtual function
62  using CGUIControlGroup::GetFirstFocusableControl;
63 
64 protected:
65  EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override;
66  bool IsControlOnScreen(float pos, const CGUIControl* control) const;
67  void ValidateOffset();
68  void CalculateItemGap();
69  inline float Size(const CGUIControl *control) const;
70  void ScrollTo(float offset);
71  float GetAlignOffset() const;
72 
73  int GetNumItems() const;
74  int GetSelectedItem() const;
81  float GetControlOffset(const CGUIControl* control) const;
90  SGUIControlAndOffset GetFocusableControlAt(float target, int direction) const;
96  void ScrollPages(float pages);
102  void MoveTo(CGUIControl* control, float offset);
106  CGUIControl* GetFirstFocusableControl() const;
110  CGUIControl* GetLastFocusableControl() const;
111 
112  float m_itemGap;
113  int m_pageControl;
114  int m_focusedPosition;
115 
116  float m_totalSize;
117 
118  CScroller m_scroller;
119  int m_lastScrollerValue;
120 
121  bool m_useControlPositions;
122  ORIENTATION m_orientation;
123  uint32_t m_alignment;
124 
125  // for autosizing
126  float m_minSize;
127 };
128 
Definition: GUIControlGroupList.h:18
Base class for controls.
Definition: GUIControl.h:75
Class used to handle scrolling, allow using tweeners.
Definition: VisibleEffect.h:221
EVENT_RESULT
Results of OnMouseEvent() Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was ...
Definition: GUIControl.h:60
list of controls that is scrollable
Definition: GUIControlGroupList.h:28
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
Definition: LibInputPointer.h:13
Definition: GUIMessage.h:365
group of controls, useful for remembering last control + animating/hiding together ...
Definition: GUIControlGroup.h:24
Simple class for mouse events.
Definition: Key.h:114