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.
16 #include "GUIControl.h"
18 #include "GUITextLayout.h"
19 #include "guilib/guiinfo/GUIInfoLabel.h"
28 class CGUITextBox
: public CGUIControl
, public CGUITextLayout
31 CGUITextBox(int parentID
, int controlID
, float posX
, float posY
, float width
, float height
,
32 const CLabelInfo
&labelInfo
, int scrollTime
= 200,
33 const CLabelInfo
* labelInfoMono
= nullptr);
34 CGUITextBox(const CGUITextBox
&from
);
35 ~CGUITextBox(void) override
;
36 CGUITextBox
* Clone() const override
{ return new CGUITextBox(*this); }
38 void DoProcess(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
) override
;
39 void Process(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
) override
;
40 void Render() override
;
41 bool OnMessage(CGUIMessage
& message
) override
;
42 float GetHeight() const override
;
43 void SetMinHeight(float minHeight
);
45 void SetPageControl(int pageControl
);
47 bool CanFocus() const override
;
48 void SetInfo(const KODI::GUILIB::GUIINFO::CGUIInfoLabel
&info
);
49 void SetAutoScrolling(const TiXmlNode
*node
);
50 void SetAutoScrolling(int delay
, int time
, int repeatTime
, const std::string
&condition
= "");
51 void ResetAutoScrolling();
52 void AssignDepth() override
;
54 bool GetCondition(int condition
, int data
) const override
;
55 virtual std::string
GetLabel(int info
) const;
56 std::string
GetDescription() const override
;
58 void Scroll(unsigned int offset
);
61 void UpdateVisibility(const CGUIListItem
*item
= NULL
) override
;
62 bool UpdateColors(const CGUIListItem
* item
) override
;
63 void UpdateInfo(const CGUIListItem
*item
= NULL
) override
;
64 void UpdatePageControl();
65 void ScrollToOffset(int offset
, bool autoScroll
= false);
66 unsigned int GetRows() const;
67 int GetCurrentPage() const;
68 int GetNumPages() const;
74 // offset of text in the control for scrolling
75 unsigned int m_offset
;
79 unsigned int m_itemsPerPage
;
81 unsigned int m_lastRenderTime
;
85 TransformMatrix m_cachedTextMatrix
;
88 INFO::InfoPtr m_autoScrollCondition
;
89 int m_autoScrollTime
; // time to scroll 1 line (ms)
90 int m_autoScrollDelay
; // delay before scroll (ms)
91 unsigned int m_autoScrollDelayTime
; // current offset into the delay
92 CAnimation
*m_autoScrollRepeatAnim
;
96 KODI::GUILIB::GUIINFO::CGUIInfoLabel m_info
;