Merge pull request #26350 from jjd-uk/estuary_media_align
[xbmc.git] / xbmc / guilib / GUITextBox.h
blob23c6fc11e3ffc11ae52775e4a3b4d3835ca3c4fc
1 /*
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.
7 */
9 #pragma once
11 /*!
12 \file GUITextBox.h
13 \brief
16 #include "GUIControl.h"
17 #include "GUILabel.h"
18 #include "GUITextLayout.h"
19 #include "guilib/guiinfo/GUIInfoLabel.h"
21 /*!
22 \ingroup controls
23 \brief
26 class TiXmlNode;
28 class CGUITextBox : public CGUIControl, public CGUITextLayout
30 public:
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);
60 protected:
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;
70 // auto-height
71 float m_minHeight;
72 float m_renderHeight;
74 // offset of text in the control for scrolling
75 unsigned int m_offset;
76 float m_scrollOffset;
77 float m_scrollSpeed;
78 int m_scrollTime;
79 unsigned int m_itemsPerPage;
80 float m_itemHeight;
81 unsigned int m_lastRenderTime;
83 CLabelInfo m_label;
85 TransformMatrix m_cachedTextMatrix;
87 // autoscrolling
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;
94 int m_pageControl;
96 KODI::GUILIB::GUIINFO::CGUIInfoLabel m_info;