XenevaOS
Loading...
Searching...
No Matches
hu_lib.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
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//
15// DESCRIPTION: none
16//
17
18#ifndef __HULIB__
19#define __HULIB__
20
21// We are referring to patches.
22#include "r_defs.h"
23
24// font stuff
25#define HU_CHARERASE KEY_BACKSPACE
26
27#define HU_MAXLINES 4
28#define HU_MAXLINELENGTH 80
29
30//
31// Typedefs of widgets
32//
33
34// Text Line widget
35// (parent of Scrolling Text and Input Text widgets)
36typedef struct
37{
38 // left-justified position of scrolling text window
39 int x;
40 int y;
41
42 patch_t** f; // font
43 int sc; // start character
44 char l[HU_MAXLINELENGTH+1]; // line of text
45 int len; // current line length
46
47 // whether this line needs to be udpated
49
51
52
53
54// Scrolling Text window widget
55// (child of Text Line widget)
56typedef struct
57{
58 hu_textline_t l[HU_MAXLINES]; // text lines to draw
59 int h; // height in lines
60 int cl; // current line number
61
62 // pointer to boolean stating whether to update window
63 boolean* on;
64 boolean laston; // last value of *->on.
65
67
68
69
70// Input Text Line widget
71// (child of Text Line widget)
72typedef struct
73{
74 hu_textline_t l; // text line to input on
75
76 // left margin past which I am not to delete characters
77 int lm;
78
79 // pointer to boolean stating whether to update window
80 boolean* on;
81 boolean laston; // last value of *->on;
82
84
85
86//
87// Widget creation, access, and update routines
88//
89
90// initializes heads-up widget library
91void HUlib_init(void);
92
93//
94// textline code
95//
96
97// clear a line of text
99
100void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc);
101
102// returns success
103boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
104
105// returns success
107
108// draws tline
109void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
110
111// erases text line
113
114
115//
116// Scrolling Text window widget routines
117//
118
119// ?
120void
122( hu_stext_t* s,
123 int x,
124 int y,
125 int h,
126 patch_t** font,
127 int startchar,
128 boolean* on );
129
130// add a new line
132
133// ?
134void
136( hu_stext_t* s,
137 char* prefix,
138 char* msg );
139
140// draws stext
142
143// erases all stext lines
145
146// Input Text Line widget routines
147void
149( hu_itext_t* it,
150 int x,
151 int y,
152 patch_t** font,
153 int startchar,
154 boolean* on );
155
156// enforces left margin
158
159// enforces left margin
161
162// resets line and left margin
164
165// left of left-margin
166void
168( hu_itext_t* it,
169 char* str );
170
171// whether eaten
172boolean
174( hu_itext_t* it,
175 unsigned char ch );
176
178
179// erases all itext lines
181
182#endif
XETime t
Definition main.cpp:53
const char * f
Definition drm_print.h:205
boolean HUlib_delCharFromTextLine(hu_textline_t *t)
Definition hu_lib.c:80
#define HU_MAXLINES
Definition hu_lib.h:27
void HUlib_delCharFromIText(hu_itext_t *it)
Definition hu_lib.c:278
void HUlib_initSText(hu_stext_t *s, int x, int y, int h, patch_t **font, int startchar, boolean *on)
Definition hu_lib.c:170
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor)
Definition hu_lib.c:95
boolean HUlib_keyInIText(hu_itext_t *it, unsigned char ch)
Definition hu_lib.c:311
void HUlib_initIText(hu_itext_t *it, int x, int y, patch_t **font, int startchar, boolean *on)
Definition hu_lib.c:263
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch)
Definition hu_lib.c:64
void HUlib_clearTextLine(hu_textline_t *t)
Definition hu_lib.c:40
void HUlib_eraseLineFromIText(hu_itext_t *it)
Definition hu_lib.c:284
void HUlib_eraseSText(hu_stext_t *s)
Definition hu_lib.c:246
void HUlib_init(void)
Definition hu_lib.c:36
void HUlib_drawIText(hu_itext_t *it)
Definition hu_lib.c:329
void HUlib_eraseIText(hu_itext_t *it)
Definition hu_lib.c:340
void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc)
Definition hu_lib.c:49
void HUlib_drawSText(hu_stext_t *s)
Definition hu_lib.c:223
void HUlib_resetIText(hu_itext_t *it)
Definition hu_lib.c:291
void HUlib_addMessageToSText(hu_stext_t *s, char *prefix, char *msg)
Definition hu_lib.c:210
#define HU_MAXLINELENGTH
Definition hu_lib.h:28
void HUlib_addPrefixToIText(hu_itext_t *it, char *str)
Definition hu_lib.c:299
void HUlib_eraseTextLine(hu_textline_t *l)
Definition hu_lib.c:137
void HUlib_addLineToSText(hu_stext_t *s)
Definition hu_lib.c:192
int h
Definition layout.c:118
Definition hu_lib.h:73
int lm
Definition hu_lib.h:77
boolean * on
Definition hu_lib.h:80
hu_textline_t l
Definition hu_lib.h:74
boolean laston
Definition hu_lib.h:81
Definition hu_lib.h:57
int cl
Definition hu_lib.h:60
boolean laston
Definition hu_lib.h:64
boolean * on
Definition hu_lib.h:63
int h
Definition hu_lib.h:59
Definition hu_lib.h:37
int sc
Definition hu_lib.h:43
patch_t ** f
Definition hu_lib.h:42
int needsupdate
Definition hu_lib.h:48
int len
Definition hu_lib.h:45
int x
Definition hu_lib.h:39
int y
Definition hu_lib.h:40