FIX: [droid] set "remote as keyboard" default to true
[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   virtual float GetHeight() const;
56   void SetMinHeight(float minHeight);
57
58   void SetPageControl(int pageControl);
59
60   virtual bool CanFocus() const;
61   void SetInfo(const CGUIInfoLabel &info);
62   void SetAutoScrolling(const TiXmlNode *node);
63   void ResetAutoScrolling();
64   CStdString GetLabel(int info) const;
65
66   void Scroll(unsigned int offset);
67
68 protected:
69   virtual void UpdateVisibility(const CGUIListItem *item = NULL);
70   virtual bool UpdateColors();
71   virtual void UpdateInfo(const CGUIListItem *item = NULL);
72   void UpdatePageControl();
73   void ScrollToOffset(int offset, bool autoScroll = false);
74   unsigned int GetRows() const;
75   int GetCurrentPage() const;
76
77   // auto-height
78   float m_minHeight;
79   float m_renderHeight;
80
81   // offset of text in the control for scrolling
82   unsigned int m_offset;
83   float m_scrollOffset;
84   float m_scrollSpeed;
85   int   m_scrollTime;
86   unsigned int m_itemsPerPage;
87   float m_itemHeight;
88   unsigned int m_lastRenderTime;
89
90   CLabelInfo m_label;
91
92   TransformMatrix m_cachedTextMatrix;
93
94   // autoscrolling
95   INFO::InfoPtr m_autoScrollCondition;
96   int          m_autoScrollTime;      // time to scroll 1 line (ms)
97   int          m_autoScrollDelay;     // delay before scroll (ms)
98   unsigned int m_autoScrollDelayTime; // current offset into the delay
99   CAnimation *m_autoScrollRepeatAnim;
100
101   int m_pageControl;
102
103   CGUIInfoLabel m_info;
104 };
105 #endif