#ifndef PAWS_MULTILINE_EDIT_TEXT #define PAWS_MULTILINE_EDIT_TEXT struct iVirtualClock; #include "pawswidget.h" #include #include /** An edit box widget/ */ class pawsMultilineEditTextBox : public pawsWidget { public: pawsMultilineEditTextBox(); virtual ~pawsMultilineEditTextBox(); bool Setup( iDocumentNode* node ); virtual void Draw(); /** Change the text in the edit box. * @param text The text that will replace whatever is currently there. */ void SetText( const char* text, bool publish = true ); const char* GetText(); bool OnScroll( int direction, pawsScrollBar* widget ); virtual bool OnMouseDown( int button, int modifiers, int x, int y ); virtual void OnUpdateData(const char *dataname,PAWSData& data); bool OnKeyDown( int code, int key, int modifiers ); int GetBorderStyle() { return BORDER_SUNKEN; } csArray LayoutText(const csArray& text, int startLine, int& endLine); /** * This function allows a widget to fill in its own contents from an xml node * supplied. This is NOT the same as Setup, which is defining height, width, * styles, etc. This is data. */ bool SelfPopulate( iDocumentNode *node); /** * Set & Get top line funcs */ unsigned int GetTopLine() { return topLine; } void SetTopLine(unsigned int newTopLine) { topLine = newTopLine; } void SetCursorPosition(size_t pos) { cursorPosition = pos; } void Clear(){ SetText(""); } protected: csRef clock; /// The position of the cursor blink size_t cursorPosition; unsigned int cursorLine; /// The current blink status bool blink; /// Keep track of ticks for flashing csTicks blinkTicks; /// Concatenated contents of lines, only valid after GetText() csString text; /// The text, broken into separate lines by OrganizeText() csArray lines; int lineHeight; size_t canDrawLines; unsigned int topLine; bool usingScrollBar; pawsScrollBar* vScrollBar; }; CREATE_PAWS_FACTORY( pawsMultilineEditTextBox ); #endif