Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
244 chris 1
#ifndef __TEXTWIDGET_H__
2
#define __TEXTWIDGET_H__
3
 
4
#include "Widget.h"
5
#include "ScrollListener.h"
6
 
7
namespace Sexy
8
{
9
 
10
class ScrollbarWidget;
11
class Font;
12
 
13
typedef std::vector<SexyString> SexyStringVector;
14
typedef std::vector<int> IntVector;
15
 
16
class TextWidget : public Widget, public ScrollListener
17
{
18
public:
19
        Font*                           mFont;
20
        ScrollbarWidget*        mScrollbar;            
21
 
22
        SexyStringVector        mLogicalLines;
23
        SexyStringVector        mPhysicalLines;
24
        IntVector                       mLineMap;
25
        double                          mPosition;
26
        double                          mPageSize;     
27
        bool                            mStickToBottom;
28
        int                                     mHiliteArea[2][2];
29
        int                                     mMaxLines;
30
 
31
public:
32
        TextWidget();
33
 
34
        virtual SexyStringVector GetLines();
35
        virtual void SetLines(SexyStringVector theNewLines);   
36
        virtual void Clear();          
37
        virtual void DrawColorString(Graphics* g, const SexyString& theString, int x, int y, bool useColors);                  
38
        virtual void DrawColorStringHilited(Graphics* g, const SexyString& theString, int x, int y, int theStartPos, int theEndPos);           
39
        virtual int GetStringIndex(const SexyString& theString, int thePixel);
40
 
41
        virtual int GetColorStringWidth(const SexyString& theString);
42
        virtual void Resize(int theX, int theY, int theWidth, int theHeight);          
43
        virtual Color GetLastColor(const SexyString& theString);               
44
        virtual void AddToPhysicalLines(int theIdx, const SexyString& theLine);
45
 
46
        virtual void AddLine(const SexyString& theString);
47
        virtual bool SelectionReversed();              
48
        virtual void GetSelectedIndices(int theLineIdx, int* theIndices);              
49
        virtual void Draw(Graphics* g);
50
        virtual void ScrollPosition(int theId, double thePosition);            
51
        virtual void GetTextIndexAt(int x, int y, int* thePosArray);
52
        virtual SexyString GetSelection();             
53
 
54
        virtual void MouseDown(int x, int y, int theClickCount);               
55
        virtual void MouseDrag(int x, int y);  
56
 
57
        virtual void KeyDown(KeyCode theKey);
58
};
59
 
60
}
61
 
62
#endif //__TEXTWIDGET_H__