Planeshift
Classes | Public Member Functions | Protected Member Functions | Protected Attributes

pawsMultilineEditTextBox Class Reference

#include <pawstextbox.h>

List of all members.

Classes

struct  MessageLine
struct  Word
 struct to contain the end boundry of a word and it's spellcheck status More...

Public Member Functions

virtual void CalcMouseClick (int x, int y, size_t &cursorLine, size_t &cursorChar)
void Clear ()
virtual void Draw ()
 Draws the widget and all of it's children.
void DrawWidgetText (const char *text, size_t x, size_t y, int style, int fg, int visLine)
bool EndsWithNewLine (int lineNumber)
char GetAt (size_t destLine, size_t destCursor)
virtual int GetBorderStyle ()
 This returns the BORDER_BUMP style.
void GetCursorLocation (size_t pos, size_t &destLine, size_t &destCursor)
size_t GetCursorPosition ()
size_t GetCursorPosition (size_t destLine, size_t destCursor)
virtual bool GetFocusOverridesControls () const
 Test if the widget should intercept all key presses.
csString GetLine (size_t line)
void GetLinePos (size_t lineNumber, size_t &start, size_t &end)
void GetLineRelative (size_t pos, size_t &start, size_t &end)
int GetLinesPerPage ()
int GetLineWidth (int lineNumber)
unsigned int GetMaxLength () const
 Returns the max length for the text box.
unsigned int GetRemainingChars () const
 Gets the remaining characters that can be input.
bool getSpellChecked () const
 returns if the spellchecker is used in this widget
const char * GetText ()
size_t GetTopLine ()
 Set & Get top line funcs.
unsigned int getTypoColour ()
 Method the get the current colour used for typos.
void LayoutText ()
virtual bool OnClipboard (const csString &content)
 Called as a callback to a request for clipboard content if avaliabe.
virtual bool OnKeyDown (utf32_char code, utf32_char key, int modifiers)
 Process keydown messages.
virtual bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes.
virtual bool OnMouseUp (int button, int modifiers, int x, int y)
 Manage mouse up event.
virtual void OnResize ()
 Sets the new position of the close button.
bool OnScroll (int direction, pawsScrollBar *widget)
 Called whenever a window is scrolled.
virtual void OnUpdateData (const char *dataname, PAWSData &data)
 pawsMultilineEditTextBox ()
 pawsMultilineEditTextBox (const pawsMultilineEditTextBox &origin)
void PushLineInfo (size_t lineLength, size_t lineBreak, int lineExtra)
bool SelfPopulate (iDocumentNode *node)
 This function allows a widget to fill in its own contents from an xml node supplied.
void SetCursorPosition (size_t pos)
void SetMaxLength (unsigned int maxlen)
 Sets the max length for the text box.
void setSpellChecked (const bool check)
 set if the spellchecker should be used
void SetText (const char *text, bool publish=true)
 Change the text in the edit box.
void SetTopLine (size_t newTopLine)
void setTypoColour (unsigned int col)
 Method to set the colour used for typos.
bool Setup (iDocumentNode *node)
 Setup this widget.
virtual void SetupScrollBar ()
void toggleSpellChecked ()
 toggels the current setting of the spellchecker
void UpdateScrollBar ()
virtual ~pawsMultilineEditTextBox ()

Protected Member Functions

void checkSpelling ()
 Helper method that does the actual spellchecking.
void drawTextSpellChecked (iFont *font, int x, int y, int fg, csString str, int visLine)
 Helper method for printing text if the spellchecker is enabled.

Protected Attributes

bool blink
 The current blink status.
csTicks blinkTicks
 Keep track of ticks for flashing.
size_t canDrawLines
csRef< iVirtualClock > clock
size_t cursorLine
size_t cursorLoc
size_t cursorPosition
int lineHeight
csPDelArray< MessageLinelineInfo
csArray< csArray< Word > > lineTypos
int maxHeight
unsigned int maxLen
 The maximum length the text is allowed to be.
int maxWidth
bool spellChecked
csRef< iSpellChecker > spellChecker
csString text
 Concatenated contents of lines, only valid after GetText()
csString tmp
size_t topLine
unsigned int typoColour
 Colour used for typos.
bool usingScrollBar
pawsScrollBarvScrollBar
int vScrollBarWidth
int yPos

Detailed Description

Definition at line 740 of file pawstextbox.h.


Constructor & Destructor Documentation

pawsMultilineEditTextBox::pawsMultilineEditTextBox ( )
virtual pawsMultilineEditTextBox::~pawsMultilineEditTextBox ( ) [virtual]
pawsMultilineEditTextBox::pawsMultilineEditTextBox ( const pawsMultilineEditTextBox origin)

Member Function Documentation

virtual void pawsMultilineEditTextBox::CalcMouseClick ( int  x,
int  y,
size_t &  cursorLine,
size_t &  cursorChar 
) [virtual]
void pawsMultilineEditTextBox::checkSpelling ( ) [protected]

Helper method that does the actual spellchecking.

Only checks the currently visible text. Called from OnKeyDown and LayoutText

void pawsMultilineEditTextBox::Clear ( ) [inline]

Definition at line 819 of file pawstextbox.h.

virtual void pawsMultilineEditTextBox::Draw ( ) [virtual]

Draws the widget and all of it's children.

Remarks:
Uses clipping rect of it's parent to define drawing area. If the drawing area defined is empty it returns.

Reimplemented from pawsWidget.

void pawsMultilineEditTextBox::drawTextSpellChecked ( iFont *  font,
int  x,
int  y,
int  fg,
csString  str,
int  visLine 
) [protected]

Helper method for printing text if the spellchecker is enabled.

Parameters:
fontThe font used for the text. Needed to determine the width in pixel of words
xX-Position where the text should be printed
yY-Position where the text should be printed
fgThe color of the text. This is only used for correct words. Typos use the typeColour (but the alpha from this color)
strThe text
visLinethe number (counting from top=0) of the current visual line. Needed for the spellchecker to choose the correct word-boundries from lineTypos
void pawsMultilineEditTextBox::DrawWidgetText ( const char *  text,
size_t  x,
size_t  y,
int  style,
int  fg,
int  visLine 
)
bool pawsMultilineEditTextBox::EndsWithNewLine ( int  lineNumber)
char pawsMultilineEditTextBox::GetAt ( size_t  destLine,
size_t  destCursor 
)
virtual int pawsMultilineEditTextBox::GetBorderStyle ( ) [inline, virtual]

This returns the BORDER_BUMP style.

Remarks:
Other styles available include: BORDER_RAISED, BORDER_SUNKEN and BORDER_ETCHED.

Reimplemented from pawsWidget.

Definition at line 789 of file pawstextbox.h.

void pawsMultilineEditTextBox::GetCursorLocation ( size_t  pos,
size_t &  destLine,
size_t &  destCursor 
)
size_t pawsMultilineEditTextBox::GetCursorPosition ( )
size_t pawsMultilineEditTextBox::GetCursorPosition ( size_t  destLine,
size_t  destCursor 
)
virtual bool pawsMultilineEditTextBox::GetFocusOverridesControls ( ) const [inline, virtual]

Test if the widget should intercept all key presses.

Remarks:
False by default, should be true for text entry widgets

Reimplemented from pawsWidget.

Definition at line 782 of file pawstextbox.h.

csString pawsMultilineEditTextBox::GetLine ( size_t  line)
void pawsMultilineEditTextBox::GetLinePos ( size_t  lineNumber,
size_t &  start,
size_t &  end 
)
void pawsMultilineEditTextBox::GetLineRelative ( size_t  pos,
size_t &  start,
size_t &  end 
)
int pawsMultilineEditTextBox::GetLinesPerPage ( ) [inline]

Definition at line 890 of file pawstextbox.h.

int pawsMultilineEditTextBox::GetLineWidth ( int  lineNumber)
unsigned int pawsMultilineEditTextBox::GetMaxLength ( ) const [inline]

Returns the max length for the text box.

Returns:
maxLen

Definition at line 840 of file pawstextbox.h.

unsigned int pawsMultilineEditTextBox::GetRemainingChars ( ) const [inline]

Gets the remaining characters that can be input.

Returns:
Remaining characters or UINT_MAX if no max length specified

Definition at line 848 of file pawstextbox.h.

bool pawsMultilineEditTextBox::getSpellChecked ( ) const [inline]

returns if the spellchecker is used in this widget

Definition at line 857 of file pawstextbox.h.

const char* pawsMultilineEditTextBox::GetText ( )
size_t pawsMultilineEditTextBox::GetTopLine ( ) [inline]

Set & Get top line funcs.

Definition at line 805 of file pawstextbox.h.

unsigned int pawsMultilineEditTextBox::getTypoColour ( ) [inline]

Method the get the current colour used for typos.

Definition at line 878 of file pawstextbox.h.

void pawsMultilineEditTextBox::LayoutText ( )
virtual bool pawsMultilineEditTextBox::OnClipboard ( const csString &  content) [virtual]

Called as a callback to a request for clipboard content if avaliabe.

Note:
Only implemented for unix

Reimplemented from pawsWidget.

virtual bool pawsMultilineEditTextBox::OnKeyDown ( utf32_char  keyCode,
utf32_char  keyChar,
int  modifiers 
) [virtual]

Process keydown messages.

Parameters:
keyCodeThe code for the pressed key.
keyCharThe key pressed.
modifiersUsed to modify tab behavior.
Returns:
bool TRUE for success FALSE if no action.
Remarks:
If you override this, be sure to also override GetFocusOverridesControls() as returning true

Reimplemented from pawsWidget.

virtual bool pawsMultilineEditTextBox::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse down event to test for and apply window changes.

Parameters:
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns:
bool TRUE if movable or resizable.
Remarks:
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

virtual bool pawsMultilineEditTextBox::OnMouseUp ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse up event.

Returns:
bool Parent's result or FALSE if no parent.
Remarks:
Acts recursively on it's parents.

Reimplemented from pawsWidget.

virtual void pawsMultilineEditTextBox::OnResize ( ) [virtual]

Sets the new position of the close button.

Reimplemented from pawsWidget.

bool pawsMultilineEditTextBox::OnScroll ( int  scrollDirection,
pawsScrollBar widget 
) [virtual]

Called whenever a window is scrolled.

Parameters:
scrollDirectionThe direction to move.
widgetThe scrollbar widget being manipulated.
Returns:
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

virtual void pawsMultilineEditTextBox::OnUpdateData ( const char *  dataname,
PAWSData data 
) [virtual]

Reimplemented from pawsWidget.

void pawsMultilineEditTextBox::PushLineInfo ( size_t  lineLength,
size_t  lineBreak,
int  lineExtra 
)
bool pawsMultilineEditTextBox::SelfPopulate ( iDocumentNode *  node) [virtual]

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.

Reimplemented from pawsWidget.

void pawsMultilineEditTextBox::SetCursorPosition ( size_t  pos) [inline]

Definition at line 815 of file pawstextbox.h.

void pawsMultilineEditTextBox::SetMaxLength ( unsigned int  maxlen)

Sets the max length for the text box.

Parameters:
maxlenThe value to set for the max length
void pawsMultilineEditTextBox::setSpellChecked ( const bool  check) [inline]

set if the spellchecker should be used

Parameters:
checktrue if the spellchecker should be used (the spellchecker will still be only used if the plugin is available)

Definition at line 865 of file pawstextbox.h.

void pawsMultilineEditTextBox::SetText ( const char *  text,
bool  publish = true 
)

Change the text in the edit box.

Parameters:
textThe text that will replace whatever is currently there.
publishPublish the text.
void pawsMultilineEditTextBox::SetTopLine ( size_t  newTopLine) [inline]

Definition at line 809 of file pawstextbox.h.

void pawsMultilineEditTextBox::setTypoColour ( unsigned int  col) [inline]

Method to set the colour used for typos.

Parameters:
colThe new colour to be used for typos

Definition at line 885 of file pawstextbox.h.

bool pawsMultilineEditTextBox::Setup ( iDocumentNode *  ) [virtual]

Setup this widget.

Reimplemented from pawsWidget.

virtual void pawsMultilineEditTextBox::SetupScrollBar ( ) [virtual]
void pawsMultilineEditTextBox::toggleSpellChecked ( ) [inline]

toggels the current setting of the spellchecker

Definition at line 872 of file pawstextbox.h.

void pawsMultilineEditTextBox::UpdateScrollBar ( )

Member Data Documentation

The current blink status.

Definition at line 928 of file pawstextbox.h.

Keep track of ticks for flashing.

Definition at line 931 of file pawstextbox.h.

Definition at line 940 of file pawstextbox.h.

csRef<iVirtualClock> pawsMultilineEditTextBox::clock [protected]

Definition at line 918 of file pawstextbox.h.

Definition at line 924 of file pawstextbox.h.

Definition at line 925 of file pawstextbox.h.

Definition at line 921 of file pawstextbox.h.

Definition at line 936 of file pawstextbox.h.

Definition at line 935 of file pawstextbox.h.

Definition at line 965 of file pawstextbox.h.

Definition at line 948 of file pawstextbox.h.

The maximum length the text is allowed to be.

Definition at line 954 of file pawstextbox.h.

Definition at line 947 of file pawstextbox.h.

Definition at line 960 of file pawstextbox.h.

csRef<iSpellChecker> pawsMultilineEditTextBox::spellChecker [protected]

Definition at line 957 of file pawstextbox.h.

csString pawsMultilineEditTextBox::text [protected]

Concatenated contents of lines, only valid after GetText()

Definition at line 934 of file pawstextbox.h.

csString pawsMultilineEditTextBox::tmp [protected]

Definition at line 951 of file pawstextbox.h.

Definition at line 942 of file pawstextbox.h.

Colour used for typos.

Definition at line 963 of file pawstextbox.h.

Definition at line 945 of file pawstextbox.h.

Definition at line 943 of file pawstextbox.h.

Definition at line 939 of file pawstextbox.h.

Definition at line 950 of file pawstextbox.h.


The documentation for this class was generated from the following file: