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 
23 {
24 public:
25  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);
26  ~CGUIControlGroupList(void) override;
27  CGUIControlGroupList* Clone() const override { return new CGUIControlGroupList(*this); }
28 
29  float GetWidth() const override;
30  float GetHeight() const override;
31  virtual float Size() const;
32  void SetInvalid() override;
33 
34  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
35  void Render() override;
36  bool OnMessage(CGUIMessage& message) override;
37 
38  EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event) override;
39  void UnfocusFromPoint(const CPoint &point) override;
40 
41  void AddControl(CGUIControl *control, int position = -1) override;
42  void ClearAll() override;
43 
44  virtual std::string GetLabel(int info) const;
45  bool GetCondition(int condition, int data) const override;
49  float GetTotalSize() const;
50  ORIENTATION GetOrientation() const { return m_orientation; }
51 
52  // based on grouplist orientation pick one value as minSize;
53  void SetMinSize(float minWidth, float minHeight);
54 protected:
55  EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override;
56  bool IsControlOnScreen(float pos, const CGUIControl* control) const;
57  bool IsFirstFocusableControl(const CGUIControl *control) const;
58  bool IsLastFocusableControl(const CGUIControl *control) const;
59  void ValidateOffset();
60  void CalculateItemGap();
61  inline float Size(const CGUIControl *control) const;
62  void ScrollTo(float offset);
63  float GetAlignOffset() const;
64 
65  int GetNumItems() const;
66  int GetSelectedItem() const;
67 
68  float m_itemGap;
69  int m_pageControl;
70  int m_focusedPosition;
71 
72  float m_totalSize;
73 
74  CScroller m_scroller;
75  int m_lastScrollerValue;
76 
77  bool m_useControlPositions;
78  ORIENTATION m_orientation;
79  uint32_t m_alignment;
80 
81  // for autosizing
82  float m_minSize;
83 };
84 
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:22
float GetTotalSize() const
Calculate total size of child controls area (including gaps between controls)
Definition: GUIControlGroupList.cpp:590
void UnfocusFromPoint(const CPoint &point) override
Unfocus the control if the given point on screen is not within it's boundary.
Definition: GUIControlGroupList.cpp:406
EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event) override
React to a mouse event.
Definition: GUIControlGroupList.cpp:370
Definition: LibInputPointer.h:13
Definition: GUIMessage.h:365
EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override
Perform a mouse action.
Definition: GUIControlGroupList.cpp:544
group of controls, useful for remembering last control + animating/hiding together ...
Definition: GUIControlGroup.h:24
Simple class for mouse events.
Definition: Key.h:114