PageRenderTime 38ms CodeModel.GetById 14ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/guilib/GUITextBox.h

http://github.com/xbmc/xbmc
C Header | 97 lines | 59 code | 20 blank | 18 comment | 0 complexity | a8d2018a72a30671a1ab7f5e87b397dd MD5 | raw 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
11/*!
12\file GUITextBox.h
13\brief
14*/
15
16#include "GUIControl.h"
17#include "GUILabel.h"
18#include "GUITextLayout.h"
19#include "guilib/guiinfo/GUIInfoLabel.h"
20
21/*!
22 \ingroup controls
23 \brief
24 */
25
26class TiXmlNode;
27
28class CGUITextBox : public CGUIControl, public CGUITextLayout
29{
30public:
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); };
37
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);
44
45  void SetPageControl(int pageControl);
46
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
53  bool GetCondition(int condition, int data) const override;
54  virtual std::string GetLabel(int info) const;
55  std::string GetDescription() const override;
56
57  void Scroll(unsigned int offset);
58
59protected:
60  void UpdateVisibility(const CGUIListItem *item = NULL) override;
61  bool UpdateColors() override;
62  void UpdateInfo(const CGUIListItem *item = NULL) override;
63  void UpdatePageControl();
64  void ScrollToOffset(int offset, bool autoScroll = false);
65  unsigned int GetRows() const;
66  int GetCurrentPage() const;
67  int GetNumPages() const;
68
69  // auto-height
70  float m_minHeight;
71  float m_renderHeight;
72
73  // offset of text in the control for scrolling
74  unsigned int m_offset;
75  float m_scrollOffset;
76  float m_scrollSpeed;
77  int   m_scrollTime;
78  unsigned int m_itemsPerPage;
79  float m_itemHeight;
80  unsigned int m_lastRenderTime;
81
82  CLabelInfo m_label;
83
84  TransformMatrix m_cachedTextMatrix;
85
86  // autoscrolling
87  INFO::InfoPtr m_autoScrollCondition;
88  int          m_autoScrollTime;      // time to scroll 1 line (ms)
89  int          m_autoScrollDelay;     // delay before scroll (ms)
90  unsigned int m_autoScrollDelayTime; // current offset into the delay
91  CAnimation *m_autoScrollRepeatAnim;
92
93  int m_pageControl;
94
95  KODI::GUILIB::GUIINFO::CGUIInfoLabel m_info;
96};
97