Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RichTextBox.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: RichTextBox.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Rich Text Window - an HTML-like control
13 */
14 
15 #ifndef RichTextBox_h
16 #define RichTextBox_h
17 
18 #include "Types.h"
19 #include "Color.h"
20 #include "Bitmap.h"
21 #include "ScrollWindow.h"
22 #include "EventTarget.h"
23 #include "List.h"
24 #include "Text.h"
25 
26 // +--------------------------------------------------------------------+
27 
28 class RichTextBox : public ScrollWindow
29 {
30 public:
31  static const char* TYPENAME() { return "RichTextBox"; }
32 
33  RichTextBox(ActiveWindow* p, int ax, int ay, int aw, int ah, DWORD aid=0, DWORD astyle=0);
34  RichTextBox(Screen* s, int ax, int ay, int aw, int ah, DWORD aid=0, DWORD astyle=0);
35  virtual ~RichTextBox();
36 
37  int operator == (const RichTextBox& w) const { return id == w.id; }
38 
39  // Operations:
40  virtual void DrawContent(const Rect& ctrl_rect);
41  virtual void SetText(const char* t);
42 
43  // Event Target Interface:
44  virtual int OnMouseMove(int x, int y);
45  virtual int OnLButtonDown(int x, int y);
46  virtual int OnLButtonUp(int x, int y);
47  virtual int OnMouseWheel(int wheel);
48  virtual int OnClick();
49 
50  virtual int OnKeyDown(int vk, int flags);
51 
52 protected:
53  virtual void DrawTabbedText();
54  virtual void DrawRichText(Rect& text_rect);
55  int GetNextTab(int xpos);
56 
57  virtual int find_next_word_start(const char* text, int index);
58  virtual int find_next_word_end(const char* text, int index);
59  virtual int parse_hex_digit(char c);
60  virtual int process_tag(const char* text, int index, Font*& font);
61 
62 };
63 
64 #endif RichTextBox_h
65