Merge pull request #3618 from siriuzwhite/avformat-hls-fix
[vuplus_xbmc] / xbmc / guilib / GUITextBox.h
1 /*!
2 \file GUITextBox.h
3 \brief
4 */
5
6 #ifndef GUILIB_GUITEXTBOX_H
7 #define GUILIB_GUITEXTBOX_H
8
9 #pragma once
10
11 /*
12  *      Copyright (C) 2005-2013 Team XBMC
13  *      http://xbmc.org
14  *
15  *  This Program is free software; you can redistribute it and/or modify
16  *  it under the terms of the GNU General Public License as published by
17  *  the Free Software Foundation; either version 2, or (at your option)
18  *  any later version.
19  *
20  *  This Program is distributed in the hope that it will be useful,
21  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  *  GNU General Public License for more details.
24  *
25  *  You should have received a copy of the GNU General Public License
26  *  along with XBMC; see the file COPYING.  If not, see
27  *  <http://www.gnu.org/licenses/>.
28  *
29  */
30
31 #include "GUITextLayout.h"
32 #include "GUIControl.h"
33 #include "GUILabel.h"
34
35 /*!
36  \ingroup controls
37  \brief
38  */
39
40 class TiXmlNode;
41
42 class CGUITextBox : public CGUIControl, public CGUITextLayout
43 {
44 public:
45   CGUITextBox(int parentID, int controlID, float posX, float posY, float width, float height,
46               const CLabelInfo &labelInfo, int scrollTime = 200);
47   CGUITextBox(const CGUITextBox &from);
48   virtual ~CGUITextBox(void);
49   virtual CGUITextBox *Clone() const { return new CGUITextBox(*this); };
50
51   virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
52   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
53   virtual void Render();
54   virtual bool OnMessage(CGUIMessage& message);
55
56   void SetPageControl(int pageControl);
57
58   virtual bool CanFocus() const;
59   void SetInfo(const CGUIInfoLabel &info);
60   void SetAutoScrolling(const TiXmlNode *node);
61   void ResetAutoScrolling();
62   CStdString GetLabel(int info) const;
63
64   void Scroll(unsigned int offset);
65
66 protected:
67   virtual void UpdateVisibility(const CGUIListItem *item = NULL);
68   virtual bool UpdateColors();
69   virtual void UpdateInfo(const CGUIListItem *item = NULL);
70   void UpdatePageControl();
71   void ScrollToOffset(int offset, bool autoScroll = false);
72   unsigned int GetRows() const;
73   int GetCurrentPage() const;
74
75   // offset of text in the control for scrolling
76   unsigned int m_offset;
77   float m_scrollOffset;
78   float m_scrollSpeed;
79   int   m_scrollTime;
80   unsigned int m_itemsPerPage;
81   float m_itemHeight;
82   unsigned int m_lastRenderTime;
83
84   CLabelInfo m_label;
85
86   TransformMatrix m_cachedTextMatrix;
87
88   // autoscrolling
89   INFO::InfoPtr m_autoScrollCondition;
90   int          m_autoScrollTime;      // time to scroll 1 line (ms)
91   int          m_autoScrollDelay;     // delay before scroll (ms)
92   unsigned int m_autoScrollDelayTime; // current offset into the delay
93   CAnimation *m_autoScrollRepeatAnim;
94
95   int m_pageControl;
96
97   CGUIInfoLabel m_info;
98 };
99 #endif