Mercurial > ~dholland > hg > ag > index.cgi
comparison examples/dsl/query.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 | |
3 AnaGram Programming Examples | |
4 | |
5 A Dos Script Language | |
6 Query Table Definitions | |
7 | |
8 Copyright 1993 Parsifal Software. All Rights Reserved. | |
9 | |
10 This software is provided 'as-is', without any express or implied | |
11 warranty. In no event will the authors be held liable for any damages | |
12 arising from the use of this software. | |
13 | |
14 Permission is granted to anyone to use this software for any purpose, | |
15 including commercial applications, and to alter it and redistribute it | |
16 freely, subject to the following restrictions: | |
17 | |
18 1. The origin of this software must not be misrepresented; you must not | |
19 claim that you wrote the original software. If you use this software | |
20 in a product, an acknowledgment in the product documentation would be | |
21 appreciated but is not required. | |
22 2. Altered source versions must be plainly marked as such, and must not be | |
23 misrepresented as being the original software. | |
24 3. This notice may not be removed or altered from any source distribution. | |
25 | |
26 *****/ | |
27 | |
28 #ifndef QUERY_H | |
29 #define QUERY_H | |
30 | |
31 #include "screen.h" | |
32 #include "stack.h" | |
33 #include <stddef.h> | |
34 #include "symbol.h" | |
35 | |
36 struct query_item { | |
37 int id; | |
38 int *value; | |
39 int *prompt; | |
40 int *explanation; | |
41 action_pointer action; | |
42 }; | |
43 | |
44 class screen_descriptor { | |
45 public: | |
46 int *title; | |
47 unsigned char color, entry_color, highlight_color; | |
48 int height, width; | |
49 pair<int> pos; | |
50 screen_descriptor() { | |
51 screen_rect display = at(0,0); | |
52 title = NULL; | |
53 color = entry_color = highlight_color = 0; | |
54 height = display.size.y; | |
55 width = display.size.x; | |
56 pos.x = pos.y = -1; | |
57 } | |
58 }; | |
59 | |
60 class query_table { | |
61 public: | |
62 int *title; | |
63 screen_rect window_box; // window for box | |
64 screen_rect window; // window for data | |
65 char_cell *previous; // previous content of window | |
66 int nq; // number of query items | |
67 query_item *q; // query item array | |
68 screen_rect *sr; // display rectangles | |
69 unsigned char *field_color; | |
70 int nbl; // blank lines to insert between entries | |
71 int first_line; // vertical location of first line | |
72 int title_line; // vertical location of title line | |
73 int exp_line; // vertical location of explanation | |
74 int dx; // horizontal location of data field | |
75 int px; // horizontal location of prompt field | |
76 int pw; // prompt field width | |
77 int dw; // data field width | |
78 int current_field; | |
79 unsigned char color, highlight_color, entry_color; | |
80 int height, width; | |
81 | |
82 | |
83 // Constructor | |
84 | |
85 query_table(stack<query_item> &qs, screen_descriptor *scd); | |
86 | |
87 // Destructor | |
88 | |
89 ~query_table(); | |
90 | |
91 query_table &resize(void); | |
92 query_table &refresh(void); | |
93 int edit_line(void); | |
94 }; | |
95 | |
96 extern stack <query_item> qs; | |
97 | |
98 #endif |