2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
12 \file GUILabelControl.h
16 #include "GUIControl.h"
18 #include "guilib/guiinfo/GUIInfoLabel.h"
24 class CGUILabelControl
:
28 CGUILabelControl(int parentID
, int controlID
, float posX
, float posY
, float width
, float height
, const CLabelInfo
& labelInfo
, bool wrapMultiLine
, bool bHasPath
);
29 ~CGUILabelControl(void) override
;
30 CGUILabelControl
* Clone() const override
{ return new CGUILabelControl(*this); }
32 void Process(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
) override
;
33 void Render() override
;
34 void UpdateInfo(const CGUIListItem
*item
= NULL
) override
;
35 bool CanFocus() const override
;
36 bool OnMessage(CGUIMessage
& message
) override
;
37 std::string
GetDescription() const override
;
38 float GetWidth() const override
;
39 void SetWidth(float width
) override
;
40 CRect
CalcRenderRegion() const override
;
42 const CLabelInfo
& GetLabelInfo() const { return m_label
.GetLabelInfo(); }
43 void SetLabel(const std::string
&strLabel
);
44 void ShowCursor(bool bShow
= true);
45 void SetCursorPos(int iPos
);
46 int GetCursorPos() const { return m_iCursorPos
; }
47 void SetInfo(const KODI::GUILIB::GUIINFO::CGUIInfoLabel
&labelInfo
);
48 void SetWidthControl(float minWidth
, bool bScroll
);
49 void SetAlignment(uint32_t align
);
50 void SetHighlight(unsigned int start
, unsigned int end
);
51 void SetSelection(unsigned int start
, unsigned int end
);
54 bool UpdateColors(const CGUIListItem
* item
) override
;
55 std::string
ShortenPath(const std::string
&path
);
57 /*! \brief Return the maximum width of this label control.
58 \return Return the width of the control if available, else the width of the current text.
60 float GetMaxWidth() const { return m_width
? m_width
: m_label
.GetTextWidth(); }
67 unsigned int m_dwCounter
;
69 // stuff for autowidth
73 KODI::GUILIB::GUIINFO::CGUIInfoLabel m_infoLabel
;
75 unsigned int m_startHighlight
;
76 unsigned int m_endHighlight
;
77 unsigned int m_startSelection
;
78 unsigned int m_endSelection
;