xbmc
GUIScrollBarControl.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 "GUIControl.h"
17 #include "GUITexture.h"
18 
24  public CGUIControl
25 {
26 public:
27  GUIScrollBarControl(int parentID, int controlID, float posX, float posY,
28  float width, float height,
29  const CTextureInfo& backGroundTexture,
30  const CTextureInfo& barTexture, const CTextureInfo& barTextureFocus,
31  const CTextureInfo& nibTexture, const CTextureInfo& nibTextureFocus,
32  ORIENTATION orientation, bool showOnePage);
33  ~GUIScrollBarControl() override = default;
34  GUIScrollBarControl* Clone() const override { return new GUIScrollBarControl(*this); }
35 
36  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
37  void Render() override;
38  bool OnAction(const CAction &action) override;
39  void AllocResources() override;
40  void FreeResources(bool immediately = false) override;
41  void DynamicResourceAlloc(bool bOnOff) override;
42  void SetInvalid() override;
43  virtual void SetRange(int pageSize, int numItems);
44  bool OnMessage(CGUIMessage& message) override;
45  void SetValue(int value);
46  int GetValue() const;
47  std::string GetDescription() const override;
48  bool IsVisible() const override;
49 protected:
50  EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override;
51  bool UpdateColors(const CGUIListItem* item) override;
52  bool UpdateBarSize();
53  bool Move(int iNumSteps);
54  virtual void SetFromPosition(const CPoint &point);
55 
56  std::unique_ptr<CGUITexture> m_guiBackground;
57  std::unique_ptr<CGUITexture> m_guiBarNoFocus;
58  std::unique_ptr<CGUITexture> m_guiBarFocus;
59  std::unique_ptr<CGUITexture> m_guiNibNoFocus;
60  std::unique_ptr<CGUITexture> m_guiNibFocus;
61 
62  int m_numItems;
63  int m_pageSize;
64  int m_offset;
65 
66  bool m_showOnePage;
67  ORIENTATION m_orientation;
68 
69 private:
71 };
72 
Definition: GUIListItem.h:30
EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override
Perform a mouse action.
Definition: GUIScrollBarControl.cpp:317
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: GUITexture.h:51
Definition: GUIMessage.h:365
Definition: GUIScrollBarControl.h:23
Simple class for mouse events.
Definition: Key.h:114