Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/guisupport/wdata.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * wdata.h | |
7 */ | |
8 | |
9 #ifndef WDATA_H | |
10 #define WDATA_H | |
11 | |
12 #include "action.h" | |
13 #include "agstring.h" | |
14 #include "agarray.h" | |
15 | |
16 //#define INCLUDE_LOGGING | |
17 //#include "log.h" | |
18 | |
19 class WindowConnector; | |
20 class dc; | |
21 | |
22 class AgDataPanel; | |
23 | |
24 | |
25 class AgMenuItem { | |
26 private: | |
27 static const AgAction nullAction; | |
28 public: | |
29 AgString text; | |
30 AgAction action; | |
31 dc *displayControl; | |
32 AgMenuItem(AgString text_, AgAction action_, dc *displayControl_) : | |
33 text(text_), | |
34 action(action_), | |
35 displayControl(displayControl_) | |
36 { | |
37 //LOGSECTION("AgMenuItem constructor"); | |
38 //LOGV((int) (dc *) displayControl); | |
39 } | |
40 AgMenuItem &operator =(const AgMenuItem &m) { | |
41 text = m.text; | |
42 action = m.action; | |
43 displayControl = m.displayControl; | |
44 return *this; | |
45 } | |
46 AgMenuItem() : | |
47 text(AgString()) | |
48 , action(nullAction) | |
49 , displayControl(0) | |
50 {} | |
51 int operator < (const AgMenuItem &m) const { | |
52 return text < m.text; | |
53 } | |
54 }; | |
55 | |
56 class FindTabs { | |
57 private: | |
58 AgString text; | |
59 char *field; | |
60 char *nextField; | |
61 | |
62 void update() { | |
63 if (nextField == 0) return; | |
64 while (*nextField && *nextField != '\t') nextField++; | |
65 if (*nextField) *nextField++ = 0; | |
66 else nextField = 0; | |
67 } | |
68 | |
69 public: | |
70 FindTabs(char *p) : text(p), field((char *)p), nextField((char *)p) { | |
71 update(); | |
72 } | |
73 char *getField() { | |
74 char *rv = field; | |
75 field = nextField; | |
76 update(); | |
77 return rv; | |
78 } | |
79 }; | |
80 | |
81 class WindowData { | |
82 public: | |
83 virtual int nextChildId() = 0; | |
84 virtual ~WindowData() {} | |
85 virtual AgString getLine(unsigned) { return AgString(); } | |
86 virtual AgString findHelpTopic() { return AgString(); } | |
87 virtual unsigned nLines() { return 0; } | |
88 virtual unsigned nColumns() { return 1; } | |
89 | |
90 virtual AgString fileName() { return AgString(); } | |
91 virtual AgString headTitle() { return AgString(); } | |
92 virtual AgString columnHeadTitle() { return AgString(); } | |
93 virtual AgString footTitle() { return AgString(); } | |
94 virtual void onEnter() {} | |
95 virtual void close() {} | |
96 virtual void show() {} | |
97 virtual AgArray<AgMenuItem> auxMenu() { return AgArray<AgMenuItem>(); } | |
98 | |
99 virtual int syntaxDependent() { return 0; } | |
100 virtual int getCursorLine(){ return 0; } | |
101 virtual void synchCursor(unsigned) {} | |
102 }; | |
103 | |
104 class WindowConnector { | |
105 public: | |
106 virtual void disconnect() {} | |
107 virtual void setFocus() {} | |
108 virtual int getCursorLine(){ return 0; } | |
109 virtual WindowData *windowData() { return NULL; } | |
110 }; | |
111 | |
112 #endif /* WDATA_H */ |