Planeshift
pawstextbox.h
Go to the documentation of this file.
1 /*
2  * pawstextbox.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 // pawstextbox.h: interface for the pawsTextBox class.
20 //
22 
23 #ifndef PAWS_TEXT_BOX_HEADER
24 #define PAWS_TEXT_BOX_HEADER
25 
26 struct iVirtualClock;
27 
28 #include "pawswidget.h"
29 #include <csutil/parray.h>
30 #include <ivideo/fontserv.h>
31 #include <iutil/virtclk.h>
32 
33 #include <ispellchecker.h>
34 
42 class pawsTextBox : public pawsWidget
43 {
44 public:
49  {
53  };
54 
59  {
63  };
64 
68  pawsTextBox();
69 
73  virtual ~pawsTextBox();
74 
78  pawsTextBox(const pawsTextBox &origin);
79 
92  bool Setup(iDocumentNode* node);
98  bool SelfPopulate(iDocumentNode* node);
99 
101  void Draw();
102 
107  void SetText(const char* text);
108 
113  void FormatText(const char* fmt, ...);
114 
119  const char* GetText() const
120  {
121  return text;
122  }
123 
128  void SetVertical(bool vertical);
129 
135  void Adjust(pawsHorizAdjust horiz, pawsVertAdjust vert);
140  void HorizAdjust(pawsHorizAdjust horiz);
145  void VertAdjust(pawsVertAdjust vert);
146 
152  void SetSizeByText(int padX,int padY);
153 
158  virtual bool OnGainFocus(bool)
159  {
160  return false;
161  }
162 
167  virtual int GetBorderStyle()
168  {
169  return BORDER_SUNKEN;
170  }
171 
176  inline void Grayed(bool g)
177  {
178  grayed = g;
179  }
180 
185  virtual int GetFontColour();
186 
193  virtual void OnUpdateData(const char* dataname,PAWSData &data);
194 
202  static int CountCodePoints(const char* text, int start = 0, int len = -1);
203 
211  static int RewindCodePoints(const char* text, int start, int count);
212 
220  static int SkipCodePoints(const char* text, int start, int count);
221 
222 protected:
223 
227  void CalcTextPos();
228 
234  void CalcTextSize(int &width, int &height);
235 
239  void CalcLetterSizes();
240 
242  csString text;
243 
245  int colour;
246 
248  bool grayed;
249 
252 
255 
257  bool vertical;
258 
260  int textX;
261 
263  int textY;
264 
267 
270 
271 };
272 
273 //--------------------------------------------------------------------------
275 
276 
277 
278 //--------------------------------------------------------------------------
279 
280 #define MESSAGE_TEXTBOX_MOUSE_SCROLL_AMOUNT 3
281 
286 {
287 public:
289  {
290  int x;
291  csString text;
292  int colour;
293  int size;
294 
295  MessageSegment() : x(0), text(""), colour(0), size(0) { }
296  };
297  struct MessageLine
298  {
299  csString text;
300  int colour;
301  int size;
302  csArray<MessageSegment> segments;
303 
305  {
306  text = "";
307  colour = 0;
308  size = 0;
309  }
310  MessageLine(const MessageLine &origin):text(origin.text),colour(origin.colour),size(origin.size)
311  {
312  for(unsigned int i = 0 ; i < origin.segments.GetSize(); i++)
313  segments.Push(origin.segments[i]);
314  }
315  };
316 
318  pawsMessageTextBox(const pawsMessageTextBox &origin);
319  virtual ~pawsMessageTextBox();
320  virtual bool Setup(iDocumentNode* node);
321  virtual bool Setup(void);
322  virtual bool PostSetup();
323 
329  bool SelfPopulate(iDocumentNode* node);
330 
331  virtual void Draw();
332 
338  void AddMessage(const char* data, int colour = -1);
339 
340  void AppendLastMessage(const char* data);
341  void ReplaceLastMessage(const char* data);
342 
343  virtual void OnResize();
344  virtual void Resize();
345  virtual bool OnScroll(int direction, pawsScrollBar* widget);
346  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
347 
348  void Clear();
349 
350  virtual int GetBorderStyle()
351  {
352  return BORDER_SUNKEN;
353  }
354 
356  void ResetScroll();
357 
359  void FullScroll();
360 
361  virtual void OnUpdateData(const char* dataname,PAWSData &data);
362 
363  bool OnKeyDown(utf32_char code, utf32_char key, int modifiers);
364 
365 
366 protected:
368  int RenderMessage(const char* data, int lineStart, int colour);
369 
371  csPDelArray<MessageLine> messages;
372 
373  //void AdjustMessages();
374 
375  void SplitMessage(const char* newText, int colour, int size, MessageLine* &msgLine, int &startPosition);
376 
378  void CalcLineHeight();
379 
384  pawsScrollBar* GetScrollBar();
385 
386  csPDelArray<MessageLine> adjusted;
387 
389  size_t maxLines;
390 
391  int topLine;
392 
395 
396 private:
397  static const int INITOFFSET = 20;
398  void WriteMessageLine(MessageLine* &msgLine, csString text, int colour);
399  void WriteMessageSegment(MessageLine* &msgLine, csString text, int colour, int startPosition);
400  csString FindStringThatFits(csString stringBuffer, int canDrawLength);
401 };
402 
404 
405 #define EDIT_TEXTBOX_MOUSE_SCROLL_AMOUNT 3
406 #define BLINK_TICKS 1000
407 
410 {
411 public:
412  pawsEditTextBox();
413  virtual ~pawsEditTextBox();
414  pawsEditTextBox(const pawsEditTextBox &origin);
415 
416  virtual void Draw();
417 
418  bool Setup(iDocumentNode* node);
419 
420  bool OnKeyDown(utf32_char code, utf32_char key, int modifiers);
421 
422  const char* GetText()
423  {
424  return text.GetDataSafe();
425  }
426 
427  void SetMultiline(bool multi);
428  void SetPassword(bool pass); //displays astrices instead of text
429 
436  void SetText(const char* text, bool publish = true);
437 
438  virtual void OnUpdateData(const char* dataname,PAWSData &data);
439 
443  void SetSizeByText();
444 
445  void Clear();
446 
447  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
448 
454  virtual bool OnClipboard(const csString &content);
455 
456  virtual int GetBorderStyle()
457  {
458  return BORDER_SUNKEN;
459  }
460 
466  bool SelfPopulate(iDocumentNode* node);
467 
471  unsigned int GetTopLine()
472  {
473  return topLine;
474  }
475  void SetTopLine(unsigned int newTopLine)
476  {
477  topLine = newTopLine;
478  }
479 
480  void SetCursorPosition(size_t pos)
481  {
482  cursorPosition = pos;
483  }
484 
485  virtual bool GetFocusOverridesControls() const
486  {
487  return true;
488  }
489 
494  void SetMaxLength(unsigned int maxlen);
499  inline unsigned int GetMaxLength() const
500  {
501  return maxLen;
502  }
507  inline unsigned int GetRemainingChars() const
508  {
509  if(maxLen)
510  return (unsigned int)(maxLen - text.Length());
511  return UINT_MAX;
512  }
516  inline bool getSpellChecked() const
517  {
518  return spellChecked;
519  };
524  inline void setSpellChecked(const bool check)
525  {
526  spellChecked = check;
527  };
531  inline void toggleSpellChecked()
532  {
533  spellChecked = !spellChecked;
534  };
537  unsigned int getTypoColour()
538  {
539  return typoColour;
540  };
544  void setTypoColour(unsigned int col)
545  {
546  typoColour = col;
547  };
548 protected:
551  void checkSpelling();
554  struct Word
555  {
556  bool correct;
557  int endPos;
558  };
559 
560  bool password;
561  csRef<iVirtualClock> clock;
562 
564  int start;
565 
568  unsigned int cursorLine;
569 
571  bool blink;
572 
574  csTicks blinkTicks;
575 
577  csString text;
578 
579  bool multiLine;
580 
582  size_t maxLines;
583 
584  // This value will always be one less than the number of used lines
585  size_t usedLines;
586 
587  unsigned int topLine;
589  unsigned int maxLen;
590 
594  csRef<iSpellChecker> spellChecker;
600  unsigned int typoColour;
603  csArray<Word> words;
604 };
605 
607 
608 
609 //---------------------------------------------------------------------------------------
610 
611 
612 #define MULTILINE_TEXTBOX_MOUSE_SCROLL_AMOUNT 3
614 {
615 public:
618  virtual ~pawsMultiLineTextBox();
619 
620  bool Setup(iDocumentNode* node);
621  bool PostSetup();
622 
623  void Draw();
624 
625  void SetText(const char* text);
626  const char* GetText()
627  {
628  return text;
629  }
630  void Resize();
631  bool OnScroll(int direction, pawsScrollBar* widget);
632  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
633 
634  // Normal text boxes should not be focused.
635  virtual bool OnGainFocus(bool /*notifyParent*/ = true)
636  {
637  return false;
638  }
639  virtual void OnUpdateData(const char* dataname,PAWSData &data);
640 
641 protected:
642 
643  void OrganizeText(const char* text);
644 
649  pawsScrollBar* GetScrollBar();
650 
652  csString text;
654  csArray<csString> lines;
655 
656  //where our scrollbar at?
657  size_t startLine;
658  //Number of lines that we can fit in the box
659  size_t canDrawLines;
661  int maxWidth;
664 };
665 
666 //--------------------------------------------------------------------------
668 
669 
671 {
672 public:
675  virtual ~pawsMultiPageTextBox();
676 
677  bool Setup(iDocumentNode* node);
678  bool PostSetup();
679 
680 
681 
682 
683  void Draw();
684 
685  void SetText(const char* text);
686  const char* GetText()
687  {
688  return text;
689  }
690  void Resize();
691  bool OnScroll(int direction, pawsScrollBar* widget);
692 
693  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
694 
695  // Normal text boxes should not be focused.
696  virtual bool OnGainFocus(bool /*notifyParent*/ = true)
697  {
698  return false;
699  }
700  virtual void OnUpdateData(const char* dataname,PAWSData &data);
701 
702  // Added these member functions for dealing with pages
703  int GetNumPages();
704  void SetCurrentPageNum(int n);
705  int GetCurrentPageNum();
706 protected:
707 
708  // splits the given text in separate lines filling the 'lines' variable
709  void OrganizeText(const char* text);
710 
715  pawsScrollBar* GetScrollBar();
716 
717 
719  csString text;
721  csArray<csString> lines;
722 
723  //where our scrollbar at?and that d
724  size_t startLine;
725  //Number of lines that we can fit in the box
726  size_t canDrawLines;
728  int maxWidth;
732  int numPages;
733 };
734 
735 //--------------------------------------------------------------------------
737 
738 
739 /* An edit box widget */
741 {
742 public:
744  virtual ~pawsMultilineEditTextBox();
746  struct MessageLine
747  {
748  size_t lineLength; //Stores length of the line.
749  size_t breakLine; //Stores real text position of where break occurs.
750  int lineExtra; //Stores 1 if line ends with a \n, or 0 if it does not.
751  };
752 
753  bool Setup(iDocumentNode* node);
754 
755  virtual void Draw();
756  void DrawWidgetText(const char* text, size_t x, size_t y, int style, int fg, int visLine);
757 
764  void SetText(const char* text, bool publish = true);
765  const char* GetText();
766  void UpdateScrollBar();
767  virtual void SetupScrollBar();
768 
769  bool OnScroll(int direction, pawsScrollBar* widget);
770  virtual void OnResize();
771  virtual bool OnMouseUp(int button, int modifiers, int x, int y);
772  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
777  virtual bool OnClipboard(const csString &content);
778  virtual void OnUpdateData(const char* dataname,PAWSData &data);
779  virtual bool OnKeyDown(utf32_char code, utf32_char key, int modifiers);
780  virtual void CalcMouseClick(int x, int y, size_t &cursorLine, size_t &cursorChar);
781 
782  virtual bool GetFocusOverridesControls() const
783  {
784  return true;
785  }
786 
787  void PushLineInfo(size_t lineLength, size_t lineBreak, int lineExtra);
788 
789  virtual int GetBorderStyle()
790  {
791  return BORDER_SUNKEN;
792  }
793  void LayoutText();
794 
800  bool SelfPopulate(iDocumentNode* node);
801 
805  size_t GetTopLine()
806  {
807  return topLine;
808  }
809  void SetTopLine(size_t newTopLine)
810  {
811  topLine = newTopLine;
812  }
813  size_t GetCursorPosition();
814  size_t GetCursorPosition(size_t destLine, size_t destCursor);
815  void SetCursorPosition(size_t pos)
816  {
817  cursorPosition = pos;
818  }
819  void Clear()
820  {
821  SetText("");
822  }
823  csString GetLine(size_t line);
824  int GetLineWidth(int lineNumber);
825  void GetLinePos(size_t lineNumber, size_t &start, size_t &end);
826  void GetLineRelative(size_t pos, size_t &start, size_t &end);
827  bool EndsWithNewLine(int lineNumber);
828  void GetCursorLocation(size_t pos, size_t &destLine, size_t &destCursor);
829  char GetAt(size_t destLine, size_t destCursor);
830 
835  void SetMaxLength(unsigned int maxlen);
840  inline unsigned int GetMaxLength() const
841  {
842  return maxLen;
843  }
848  inline unsigned int GetRemainingChars() const
849  {
850  if(maxLen)
851  return (unsigned int)(maxLen - text.Length());
852  return UINT_MAX;
853  }
857  inline bool getSpellChecked() const
858  {
859  return spellChecked;
860  };
865  inline void setSpellChecked(const bool check)
866  {
867  spellChecked = check;
868  };
872  inline void toggleSpellChecked()
873  {
874  spellChecked = !spellChecked;
875  };
878  unsigned int getTypoColour()
879  {
880  return typoColour;
881  };
885  void setTypoColour(unsigned int col)
886  {
887  typoColour = col;
888  };
889 
891  {
892  return canDrawLines;
893  }
894 protected:
898  void checkSpelling();
907  void drawTextSpellChecked(iFont* font, int x, int y, int fg, csString str, int visLine);
908 
909 
912  struct Word
913  {
914  bool correct;
915  int endPos;
916  };
917 
918  csRef<iVirtualClock> clock;
919 
920  // The position of the cursor blink
922 
923  // The position of the cursor in an array (Used by draw method).
924  size_t cursorLine;
925  size_t cursorLoc;
926 
928  bool blink;
929 
931  csTicks blinkTicks;
932 
934  csString text;
935  csPDelArray<MessageLine> lineInfo;
937 
938  // Width of the vertical scroll bar
940  size_t canDrawLines;
941 
942  size_t topLine;
944 
946 
947  int maxWidth;
949 
950  int yPos;
951  csString tmp;
952 
954  unsigned int maxLen;
955  /* PS spellChecker plugin
956  */
957  csRef<iSpellChecker> spellChecker;
958  /* Should the text be checked by the spellchecker plugin (if available)
959  */
963  unsigned int typoColour;
964 
965  csArray<csArray<Word> > lineTypos;
966 };
967 
969 
970 
971 
973 #define FADE_TIME 1000 // Time for the onscreen message to fade away
974 #define MESG_TIME 3000 // Time for the onscreen message to be shown ( not including fading)
975 
977 {
978 public:
980  virtual ~pawsFadingTextBox() {};
981  pawsFadingTextBox(const pawsFadingTextBox &origin);
982  bool Setup(iDocumentNode* /*node*/)
983  {
984  return true; // Shouldn't be created in XML, only by code
985  }
986 
987  void Draw();
988 
989  void Fade(); // Force fading
990  void SetText(const char* newtext, iFont* font1,iFont* font2, int color,int time=MESG_TIME,int fadetime=FADE_TIME);
991 
992  void GetSize(int &w, int &h);
993 private:
994  void DrawBorderText(const char* text, iFont* font,int x);
995 
996  csString text;
997  csString first;
998 
999  csRef<iFont> firstFont; // used for the first letter
1000  csRef<iFont> font; // used for the rest
1001 
1002  int org_color;
1003  int color;
1004  int scolor;
1005  csTicks start;
1006 
1007  int ymod;
1008 
1009  int time,fadetime;
1010 };
1011 
1015 {
1016  unsigned int width;
1017  unsigned int height;
1018  csString srcString;
1019  unsigned int align;
1020  unsigned int padding[4];
1021 };
1023 {
1024 public:
1025  pawsDocumentView();
1026  pawsDocumentView(const pawsDocumentView &origin);
1027  virtual ~pawsDocumentView();
1040  void SetText(const char* text);
1044  void Draw();
1045  void Resize();
1046 protected:
1054  void OrganizeContent(const char* text);
1055 
1064  unsigned int ProcessPictureInfo(iDocumentNode* node);
1065 
1066  csArray<PictureInfo> picsInfo;
1067 };
1069 
1070 
1072 {
1073 public:
1076  virtual ~pawsMultiPageDocumentView();
1090  void SetText(const char* text);
1091 
1095  void Draw();
1096 
1097  void Resize();
1098 protected:
1106  void OrganizeContent(const char* text);
1107 
1116  unsigned int ProcessPictureInfo(iDocumentNode* node);
1117  csArray<PictureInfo> picsInfo;
1118 };
1120 
1123 #endif
1124 
csArray< PictureInfo > picsInfo
Hold all the info parse from xml document.
Definition: pawstextbox.h:1066
bool grayed
Whether the text is currently being grayed out.
Definition: pawstextbox.h:248
void VertAdjust(pawsVertAdjust vert)
Alters how the text box is laid out vertically in its container.
csString srcString
The file or source info for pictures.
Definition: pawstextbox.h:1018
unsigned int align
Align of the picture in.
Definition: pawstextbox.h:1019
pawsHorizAdjust
Various positions to center the text on horizontally.
Definition: pawstextbox.h:58
csTicks blinkTicks
Keep track of ticks for flashing.
Definition: pawstextbox.h:574
void Adjust(pawsHorizAdjust horiz, pawsVertAdjust vert)
Alters how the text box is laid out in its container.
unsigned int GetMaxLength() const
Returns the max length for the text box.
Definition: pawstextbox.h:499
csArray< Word > words
Array that contains the boundries of the words and if the spellchecker recognizes them or not...
Definition: pawstextbox.h:603
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
virtual bool OnKeyDown(utf32_char keyCode, utf32_char keyChar, int modifiers)
Process keydown messages.
psPoint * letterSizes
Array containing the size of each letter in text (only used when vertical is true) ...
Definition: pawstextbox.h:269
void DrawWidgetText(const char *text, int x, int y, int style=-1)
Draw text in the widget at specified location.
void SetCursorPosition(size_t pos)
Definition: pawstextbox.h:480
int start
Position of first character that we display.
Definition: pawstextbox.h:564
unsigned int height
Height of pictures.
Definition: pawstextbox.h:1017
virtual bool OnGainFocus(bool)
Normal text boxes should not be focused.
Definition: pawstextbox.h:158
void SetTopLine(size_t newTopLine)
Definition: pawstextbox.h:809
unsigned int GetRemainingChars() const
Gets the remaining characters that can be input.
Definition: pawstextbox.h:848
csRef< iSpellChecker > spellChecker
Definition: pawstextbox.h:957
CREATE_PAWS_FACTORY(pawsTextBox)
virtual void Resize()
Resize a widget based on it&#39;s parent&#39;s size.
virtual ~pawsTextBox()
Basic deconstructor.
void SetText(const char *text)
Sets the text to display.
static int SkipCodePoints(const char *text, int start, int count)
Utility function to skip a UTF-8 string by a certain number of codepoints.
bool SelfPopulate(iDocumentNode *node)
Sets the text from the node using either the text attribute or the node&#39;s content.
int textX
X-Position of text inside the widget (relative to adjustment)
Definition: pawstextbox.h:260
pawsScrollBar * scrollBar
Definition: pawstextbox.h:730
unsigned int typoColour
Colour used for typos.
Definition: pawstextbox.h:963
const char * GetText()
Definition: pawstextbox.h:626
csString text
The text for this box.
Definition: pawstextbox.h:652
void CalcLetterSizes()
Fills &#39;letterSizes&#39; array.
int textY
X-Position of text inside the widget (relative to adjustment)
Definition: pawstextbox.h:263
virtual int GetBorderStyle()
Gets the border style for the text box.
Definition: pawstextbox.h:167
size_t cursorPosition
The position of the cursor blink (in code units not points)
Definition: pawstextbox.h:567
virtual bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
Definition: pawswidget.h:709
Adjusted to left.
Definition: pawstextbox.h:60
csString text
The text for this box.
Definition: pawstextbox.h:719
#define BORDER_SUNKEN
Definition: pawswidget.h:79
bool getSpellChecked() const
returns if the spellchecker is used in this widget
Definition: pawstextbox.h:516
unsigned int topLine
Definition: pawstextbox.h:587
#define FADE_TIME
pawsFadingTextBox - Used for mainly on screen messages, deletes itself upon 100% fade ...
Definition: pawstextbox.h:973
const char * GetText()
Definition: pawstextbox.h:422
csString text
Concatenated contents of lines, only valid after GetText()
Definition: pawstextbox.h:934
void CalcTextPos()
Calculates textX and textY attributes.
static int CountCodePoints(const char *text, int start=0, int len=-1)
Utility function to calculate number of code points in a substring.
unsigned int getTypoColour()
Method the get the current colour used for typos.
Definition: pawstextbox.h:537
pawsVertAdjust vertAdjust
The current vertical alignment for the text box.
Definition: pawstextbox.h:254
pawsScrollBar * vScrollBar
Definition: pawstextbox.h:591
virtual bool OnGainFocus(bool=true)
Changes hasFocus to TRUE and reports status to parent.
Definition: pawstextbox.h:696
virtual int GetBorderStyle()
This returns the BORDER_BUMP style.
Definition: pawstextbox.h:789
bool Setup(iDocumentNode *)
Setup this widget.
Definition: pawstextbox.h:982
unsigned int GetMaxLength() const
Returns the max length for the text box.
Definition: pawstextbox.h:840
An edit box widget/.
Definition: pawstextbox.h:409
static int RewindCodePoints(const char *text, int start, int count)
Utility function to rewind a UTF-8 string by a certain number of codepoints.
virtual int GetBorderStyle()
This returns the BORDER_BUMP style.
Definition: pawstextbox.h:350
csArray< csString > lines
The text, broken into separate lines by OrganizeText()
Definition: pawstextbox.h:721
virtual bool OnScroll(int scrollDirection, pawsScrollBar *widget)
Called whenever a window is scrolled.
Definition: pawswidget.h:1219
bool vertical
Whether the text box is rendering vertically (up-down rather than left-right)
Definition: pawstextbox.h:257
size_t GetTopLine()
Set & Get top line funcs.
Definition: pawstextbox.h:805
csPDelArray< MessageLine > adjusted
Definition: pawstextbox.h:386
void SetCursorPosition(size_t pos)
Definition: pawstextbox.h:815
pawsHorizAdjust horizAdjust
The current horizontal alignment for the text box.
Definition: pawstextbox.h:251
PictureInfo hold the information of pictures that would be display in the same row with the same form...
Definition: pawstextbox.h:1014
bool blink
The current blink status.
Definition: pawstextbox.h:928
csPDelArray< MessageLine > messages
List of messages this box has.
Definition: pawstextbox.h:371
virtual ~pawsFadingTextBox()
Definition: pawstextbox.h:980
virtual bool OnMouseUp(int button, int modifiers, int x, int y)
Manage mouse up event.
void Grayed(bool g)
Sets if the text box is having its text grayed.
Definition: pawstextbox.h:176
unsigned int cursorLine
Definition: pawstextbox.h:568
csString text
Current input line.
Definition: pawstextbox.h:577
void setTypoColour(unsigned int col)
Method to set the colour used for typos.
Definition: pawstextbox.h:544
csString text
The text for this box.
Definition: pawstextbox.h:242
unsigned int maxLen
The maximum length the text is allowed to be.
Definition: pawstextbox.h:589
struct to contain the end boundry of a word and it&#39;s spellcheck status
Definition: pawstextbox.h:912
pawsScrollBar * scrollBar
Definition: pawstextbox.h:663
bool spellChecked
Should the text be checked by the spellchecker plugin (if available)
Definition: pawstextbox.h:597
csArray< PictureInfo > picsInfo
Hold all the info parse from xml document.
Definition: pawstextbox.h:1117
void CalcTextSize(int &width, int &height)
Calculates size of text.
Adjusted to bottom.
Definition: pawstextbox.h:51
unsigned int typoColour
Colour used for typos.
Definition: pawstextbox.h:600
csArray< csString > lines
The text, broken into separate lines by OrganizeText()
Definition: pawstextbox.h:654
virtual void OnResize()
Sets the new position of the close button.
pawsTextBox()
Basic constructor.
Adjusted to top.
Definition: pawstextbox.h:50
void toggleSpellChecked()
toggels the current setting of the spellchecker
Definition: pawstextbox.h:872
bool blink
The current blink status.
Definition: pawstextbox.h:571
A simple scroll bar widget.
Definition: pawscrollbar.h:64
void SetTopLine(unsigned int newTopLine)
Definition: pawstextbox.h:475
void Draw()
Draws the text box.
unsigned int maxLen
The maximum length the text is allowed to be.
Definition: pawstextbox.h:954
const char * GetText() const
Gets the text that is displayed by this text box.
Definition: pawstextbox.h:119
unsigned int GetTopLine()
Set & Get top line funcs.
Definition: pawstextbox.h:471
void setSpellChecked(const bool check)
set if the spellchecker should be used
Definition: pawstextbox.h:865
virtual bool OnGainFocus(bool=true)
Changes hasFocus to TRUE and reports status to parent.
Definition: pawstextbox.h:635
int textWidth
Width of vertical column of letters (only used when vertical is true)
Definition: pawstextbox.h:266
Adjusted to centre.
Definition: pawstextbox.h:62
const char * GetText()
Definition: pawstextbox.h:686
virtual int GetBorderStyle()
This returns the BORDER_BUMP style.
Definition: pawstextbox.h:456
int colour
The colour of the text.
Definition: pawstextbox.h:245
pawsScrollBar * vScrollBar
Definition: pawstextbox.h:943
csRef< iVirtualClock > clock
Definition: pawstextbox.h:918
void FormatText(const char *fmt,...)
Sets the text to display using formatting.
virtual bool OnMouseDown(int button, int modifiers, int x, int y)
Manage mouse down event to test for and apply window changes.
void setTypoColour(unsigned int col)
Method to set the colour used for typos.
Definition: pawstextbox.h:885
virtual bool OnClipboard(const csString &content)
Process Clipboard content, as a response to RequestClipboardContent.
This is a special type of text box that is used for messages.
Definition: pawstextbox.h:285
unsigned int GetRemainingChars() const
Gets the remaining characters that can be input.
Definition: pawstextbox.h:507
csTicks blinkTicks
Keep track of ticks for flashing.
Definition: pawstextbox.h:931
void SetVertical(bool vertical)
Sets if this text box should be rendered vertically (top to bottom)
virtual void OnUpdateData(const char *dataname, PAWSData &data)
Called whenever subscribed data gets updated Sets the text to either the data&#39;s string value or a pro...
virtual bool GetFocusOverridesControls() const
Test if the widget should intercept all key presses.
Definition: pawstextbox.h:782
Adjusted to right.
Definition: pawstextbox.h:61
bool getSpellChecked() const
returns if the spellchecker is used in this widget
Definition: pawstextbox.h:857
csArray< csArray< Word > > lineTypos
Definition: pawstextbox.h:965
virtual bool GetFocusOverridesControls() const
Test if the widget should intercept all key presses.
Definition: pawstextbox.h:485
#define MESG_TIME
Definition: pawstextbox.h:974
struct to contain the end boundry of a word and it&#39;s spellcheck status
Definition: pawstextbox.h:554
pawsScrollBar * scrollBar
Definition: pawstextbox.h:393
bool Setup(iDocumentNode *node)
Sets up the text box from a document node Possible attributes in the node:
void toggleSpellChecked()
toggels the current setting of the spellchecker
Definition: pawstextbox.h:531
csRef< iVirtualClock > clock
Definition: pawstextbox.h:561
void setSpellChecked(const bool check)
set if the spellchecker should be used
Definition: pawstextbox.h:524
unsigned int getTypoColour()
Method the get the current colour used for typos.
Definition: pawstextbox.h:878
void HorizAdjust(pawsHorizAdjust horiz)
Alters how the text box is laid out horizontally in its container.
MessageLine(const MessageLine &origin)
Definition: pawstextbox.h:310
virtual int GetFontColour()
Gets the font color based on the set colour and if grayed is set.
Adjusted to centre.
Definition: pawstextbox.h:52
csPDelArray< MessageLine > lineInfo
Definition: pawstextbox.h:935
unsigned int width
Width of pictures.
Definition: pawstextbox.h:1016
csArray< MessageSegment > segments
Definition: pawstextbox.h:302
A basic text box widget.
Definition: pawstextbox.h:42
pawsVertAdjust
Various positions to center the text on vertically.
Definition: pawstextbox.h:48
csRef< iSpellChecker > spellChecker
PS spellChecker plugin.
Definition: pawstextbox.h:594
void SetSizeByText(int padX, int padY)
Sets the size of the widget to fit the text that it displays.