xbmc
GUIColorButtonControl.h
1 /*
2  * Copyright (C) 2005-2021 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 
15 #include "GUIButtonControl.h"
16 #include "guilib/GUILabel.h"
18 #include "utils/ColorUtils.h"
19 
25 {
26 public:
27  CGUIColorButtonControl(int parentID,
28  int controlID,
29  float posX,
30  float posY,
31  float width,
32  float height,
33  const CTextureInfo& textureFocus,
34  const CTextureInfo& textureNoFocus,
35  const CLabelInfo& labelInfo,
36  const CTextureInfo& colorMask,
37  const CTextureInfo& colorDisabledMask);
38 
39  ~CGUIColorButtonControl() override = default;
40  CGUIColorButtonControl* Clone() const override { return new CGUIColorButtonControl(*this); }
42 
43  void Process(unsigned int currentTime, CDirtyRegionList& dirtyregions) override;
44  void Render() override;
45  bool OnAction(const CAction& action) override;
46  bool OnMessage(CGUIMessage& message) override;
47  void AllocResources() override;
48  void FreeResources(bool immediately = false) override;
49  void DynamicResourceAlloc(bool bOnOff) override;
50  void SetInvalid() override;
51  void SetPosition(float posX, float posY) override;
52  void SetWidth(float width) override;
53  void SetHeight(float height) override;
54  std::string GetDescription() const override;
55  void SetColorDimensions(float posX, float posY, float width, float height);
56  bool IsSelected() const { return m_bSelected; }
57  void SetImageBoxColor(const std::string& hexColor);
58  void SetImageBoxColor(KODI::GUILIB::GUIINFO::CGUIInfoColor color);
59 
60 protected:
61  bool UpdateColors(const CGUIListItem* item) override;
62  void ProcessInfoText(unsigned int currentTime);
63  void RenderInfoText();
64  CGUILabel::COLOR GetTextColor() const override;
65  std::unique_ptr<CGUITexture> m_imgColorMask;
66  std::unique_ptr<CGUITexture> m_imgColorDisabledMask;
67  float m_colorPosX;
68  float m_colorPosY;
70  CGUILabel m_labelInfo;
71 };
Class for rendering text labels. Handles alignment and rendering of text within a control...
Definition: GUILabel.h:69
Definition: GUIListItem.h:30
Definition: GUIButtonControl.h:27
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
Definition: GUITexture.h:51
Definition: GUIColorButtonControl.h:24
Definition: GUIMessage.h:365
Definition: GUILabel.h:22
COLOR
allowed color categories for labels, as defined by the skin
Definition: GUILabel.h:74
Definition: GUIInfoColor.h:30