compile as C
[rofl0r-GfxRip.git] / tdgui.h
blob9bfc0b9e41e0fa52f9bee0e706cd8784698d71b1
1 /*
2 Several constants are re-defined under different names. This is simply
3 because they are used for different purposes. They do exactly the same thing,
4 it is just to make the code easier to read / understand
6 Please note the 90% of the code in here was taken straight out of Allegro,
7 I only made a few small changes to the drawing routines.
8 */
10 #ifndef _TDGUI_H_
11 #define _TDGUI_H_
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 #define BW_UPDATE 0
18 #define BW_BUFFEREDUPDATE 1
19 #define BW_BUFFERED 2
21 #define MODE_EXACTWIN TRUE
22 #define MODE_ALLEGCOMPAT FALSE
24 #define STL_IN 1 //In style. looks like start button.
25 //(this is different from a standard button)
26 #define STL_DOWN STL_IN //Same as above.
27 #define STL_OUT 2 //Opposite of STL_IN
28 #define STL_UP STL_OUT //Same as above.
29 #define STL_FLAT 4 //Makes faces of objects grey.
30 #define STL_FILLED STL_FLAT //Same as above.
31 #define STL_FACE STL_FLAT //Same as above.
32 #define STL_FRAME 8 //Used in conjunction with STL_IN to draw a frame.
33 //Frames are drawn differently from other objects.
34 #define STL_DITHERED 16 //Used for the background of scroll bars.
35 #define STL_FRAMEFILLED 32 //Fills the backgroud with white for the frames.
36 #define STL_BUTTONDOWN 64 //Used when you have called set_gui_mode(1).
37 //Buttons are drawn differently than other
38 //"in" objects.
39 #define STL_TITLEBAR 128 //Window titles and menus.
41 #define SCL_UPBUTTON_DOWN 1 //Flags used with the half-finished scrollbars.
42 #define SCL_DOWNBUTTON_DOWN 2//(Note: the scrollbars on the ListBox are done.
43 // It's the stand-alone ones that aren't)
44 #define SCL_UPARROW 4
45 #define SCL_DOWNARROW 8
46 #define SCL_LEFTARROW 16
47 #define SCL_RIGHTARROW 32
49 #define DIR_HORIZ 1
50 #define DIR_VERT 2
52 #define BILL_CLEAR -1 /*Set this as BG on bill_text and bill_ctext,
53 If you want. It is negative so that if you
54 are converting an old Allegro dialog, you
55 won't accidentally make clear text by not
56 changing the old value.
58 #define BILL_TITLE -2
61 #define GFX_CANCEL 3 //Stuff taken out of allgro.
62 #define GFX_DRIVER_LIST 4
63 #define GFX_MODE_LIST 5
64 #define GFX_DEPTH_LIST 6
66 #define A_S1 0
67 #define A_S2 1
68 #define A_S3 2
69 #define A_B1 3
70 #define A_B2 4
71 #define A_B3 5
73 #define BILL_SMALLPAL_SIZE 10 //This is just the number of colors required
74 //for the bill_init_smallpal
75 #define BILL_VERY_SMALLPAL_SIZE 7 //This is just the number of colors required
76 //for the bill_init_very_smallpal
78 extern int bill_appearexact; //Turned on by set_gui_mode(1)
80 extern float bg_ver;
81 extern char bg_ver_str[];
83 extern RGB bill_light; //The colors used by Bgui
84 extern RGB bill_hlight;
85 extern RGB bill_face;
86 extern RGB bill_shadow;
87 extern RGB bill_dkshadow;
88 extern RGB bill_text;
89 extern RGB bill_activetitle;
90 extern RGB bill_titletext;
91 extern RGB bill_framebg;
92 extern RGB bill_disabledtext;
93 extern PALETTE bill_pal;
95 void memverify_str(void *pointer, char *str);
96 void memverify(void *pointer); /* This is used to verify malloc'd memory
97 before use. Just checks for a NULL pointer
98 and exits if it's found. I encourage you
99 to use this as well, since it's here */
101 void set_gui_mode(int mode); //Right now this only makes the buttons look
102 //more like Win95. Later I hope to add arrows
103 //to the scrollbars on the listbox. Leaving
104 //this off will (after BGui is done) make the
105 //controls fit the same dimentions as their
106 //Allegro counterparts better.
108 int get_gui_mode(); /* tells you what mode the GUI is in. */
110 int get_bill_color(RGB billcolor); //Just returns the closest index of an RGB.
111 void bill_init_pal(); //Gray palette w/ blue for the title bar.
112 void bill_init_smallpal(int start); // use 9 colors of pallete for BGui.
113 void bill_init_very_smallpal(int start); /*Same as smallpal, except it skips
114 repeat colors, and takes the required
115 color count down to 7. DONT USE THIS
116 IF YOU ARE GOING TO CHANGE THE COLOR
117 CONSTANTS
119 void bill_init(); //As of now, this does absolutely nothing.
121 void tdbox(BITMAP *b, int x, int y, int w, int h, int stl);
122 //BGui is based on this routine. You
123 //optimize it, and you are optimizing all
124 //of BGui. If some kind person can make
125 //it a lot faster for me, that would be
126 //great.
128 void tdhline(BITMAP *b, int x, int y, int x2);
129 void tdvline(BITMAP *b, int x, int y, int y2);
131 int is_in(int xa, int ya, int xb, int yb, int w, int h);
132 //Used w/ scrollbar
134 void _draw_scrollable_billframe(DIALOG *d, int listsize, int offset,
135 int height, int fg_color, int bg);
136 //Same as the counterpart function in
137 //Allegro, except it looks like windows
138 //95. (except there are no arrows on the
139 //scroll bar).
141 void _draw_billlistbox(DIALOG *d);
142 void _draw_billtextbox(char *thetext, int *listsize, int draw, int offset,
143 int wword, int tabsize, int x, int y, int w, int h,
144 int disabled, int fore, int deselect, int disable);
146 void _draw_arrow(int x, int y, int basew, int colr, int stl);
147 //Used w/ scrollbar to draw arrows
149 void bill_fade_bmp(BITMAP *bmp, int clr);
150 //You know how Windows fades the screen
151 //when you hit shutdown? That's what this
152 //does. Please note that it's kinda slow.
154 //A quick note about the billalert
155 //functions: If you use these, you may
156 //want to slightly modify your program,
157 //instead of having 3 lines of text, these
158 //have a title bar and 2 lines of text.
159 int billalert3(char *s1, char *s2, char *s3, char *b1, char *b2,
160 char *b3, int c1, int c2, int c3);
161 int billalert(char *s1, char *s2, char *s3, char *b1, char *b2,
162 int c1, int c2);
164 //The following are direct replacements
165 //for the allegro counterparts.
166 int d_hbillscrollbar_proc(int msg, DIALOG *d, int c); //Horizontal ScrollBar
167 int d_vbillscrollbar_proc(int msg, DIALOG *d, int c);
169 int d_billprogress_proc(int msg, DIALOG *d, int c); /*progress bar */
171 int d_billtextbox_proc(int msg, DIALOG *d, int c);
172 int d_billedit_proc(int msg, DIALOG *d, int c);
174 int d_billslider_proc(int msg, DIALOG *d, int c);
175 int d_billwin_proc(int msg, DIALOG *d, int c); //A window (non-moveable)
176 //W/ title bar.
177 int d_billlist_proc(int msg, DIALOG *d, int c);
178 int d_billbutton_proc(int msg, DIALOG *d, int c);
179 int d_ex_billbutton_proc(int msg, DIALOG *d, int c); //Button w/ callback.
180 int d_samplex_billbutton_proc(int msg, DIALOG *d, int c); //Button w/ callback
181 //that was SUPPOSED
182 //to play a sample
183 //(doesn't work)
185 int d_billtext_proc(int msg, DIALOG *d, int c);
186 int d_billctext_proc(int msg, DIALOG *d, int c);
187 int d_billcheck_proc(int msg, DIALOG *d, int c);
189 int d_billclear_proc(int msg, DIALOG *d, int c);
191 int billfile_select(char *message, char *path, char *ext);
193 int d_billmenu_proc(int msg, DIALOG *d, int c);
195 int d_billhline_proc(int msg, DIALOG *d, int c);
196 int d_billvline_proc(int msg, DIALOG *d, int c);
198 int d_billradio_proc(int msg, DIALOG *d, int c);
199 void bill_init_radio_buttons();
201 int d_callback_billbutton_proc(int msg, DIALOG *d, int c);
203 int d_billscrollablebitmap_proc(int msg, DIALOG *d, int c);
204 int d_billgroupbox_proc(int msg, DIALOG *d, int c);
205 int d_billddlist_proc(int msg,DIALOG *d,int c);
207 //Here's some stuff that I threw in as an added bonus :-)
208 void replace_col(BITMAP *b, int oc, int nc); //Replaces color
209 //oc in bitmap b
210 //w/ color nc.
211 void make_solid_pal(PALETTE pal, int start, int stop, int r, int g, int b);
212 //makes palette solid
213 //from start to stop
214 int moveable_do_dialog(DIALOG *dialog, int focus_obj);
215 int init_moveable(DIALOG *dialog);
216 int shutdown_moveable(DIALOG *dialog);
217 int do_billmenu(MENU *menu, int x, int y);
219 #ifdef __cplusplus
221 #endif
222 #endif //_TDGUI_H_