OSDN Git Service

wwww
[proj16/16.git] / 16 / v2 / source / verge / MAPED / GUICOMP.C
1 /*\r
2 Copyright (C) 1998 BJ Eirich (aka vecna)\r
3 This program is free software; you can redistribute it and/or\r
4 modify it under the terms of the GNU General Public License\r
5 as published by the Free Software Foundation; either version 2\r
6 of the License, or (at your option) any later version.\r
7 This program is distributed in the hope that it will be useful,\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
10 See the GNU General Public Lic\r
11 See the GNU General Public License for more details.\r
12 You should have received a copy of the GNU General Public License\r
13 along with this program; if not, write to the Free Software\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
15 */\r
16 \r
17 // Additional code by Richard Lau (aka Ric)\r
18 \r
19 #include "config.h"    // Colour definitions\r
20 #include "vdriver.h"   // Video driver functions\r
21 #include "smalfont.h"\r
22 \r
23 // ================================= Code ====================================\r
24 \r
25 void stdwindow(int x1, int y1, int x2, int y2)\r
26 {\r
27   FilledBox(x1, y1, x2-x1, y2-y1, winbg);\r
28   HLine(x1, y1, x2-x1, black);     /* -- ric: 13/Jun/98 --     */\r
29   VLine(x1, y1, y2-y1, black);     /* Outline window in black */\r
30   HLine(x1+1, y2-1, x2-x1-1, black);\r
31   VLine(x2-1, y1+1, y2-y1-1, black);\r
32 \r
33   HLine(x1+1, y1+1, x2-x1-2, brightw);\r
34   VLine(x1+1, y1+1, y2-y1-2, brightw);\r
35   HLine(x1+2, y2-2, x2-x1-3, darkw);\r
36   VLine(x2-2, y1+2, y2-y1-3, darkw);\r
37 }\r
38 \r
39 void Window(int x1, int y1, int x2, int y2, char *title)\r
40 {\r
41   FilledBox(x1, y1, x2-x1, y2-y1, winbg);\r
42   FilledBox(x1, y1, x2-x1, 8, titlebg);\r
43   HLine(x1, y1, x2-x1, brightw);\r
44   VLine(x1, y1, y2-y1, brightw);\r
45   HLine(x1+1, y2-1, x2-x1-1, darkw);\r
46   VLine(x2-1, y1+1, y2-y1-1, darkw);\r
47   FilledBox(x2-8, y1+2, 5, 5, winbg);\r
48   HLine(x2-8, y1+2, 6, brightw);\r
49   VLine(x2-8, y1+2, 5, brightw);\r
50   HLine(x2-7, y1+6, 4, darkw);\r
51   VLine(x2-3, y1+3, 4, darkw);\r
52 \r
53   GotoXY(x1+2, y1+2);\r
54   printstring(title);\r
55 }\r
56 \r
57 void CheckBox(int x, int y, char checked)\r
58 {\r
59   FilledBox(x, y, 7, 6, 0);\r
60   HLine(x, y, 8, darkw);\r
61   VLine(x, y, 7, darkw);\r
62   HLine(x+1, y+6, 7, brightw);\r
63   VLine(x+7, y+1, 5, brightw);\r
64   if (checked)\r
65   {\r
66     GotoXY(x+2, y+2);\r
67     printstring("*");\r
68   }\r
69 }\r
70 \r
71 void Button(int x, int y, char *str)\r
72 {\r
73   stdwindow(x,y,x+30,y+10);\r
74 //  HLine(x, y, 30, black);      /* -- ric: 13/Jun/98 --     */\r
75 //  VLine(x, y, 10, black);      /* Outline buttons in black */\r
76 /*  HLine(x+1, y+9, 29, black);\r
77   VLine(x+29, y+1, 9, black);\r
78 \r
79   HLine(x+1, y+1, 28, white);\r
80   VLine(x+1, y+1, 8, white);\r
81   HLine(x+2, y+8, 27, darkw);\r
82   VLine(x+28, y+2, 7, darkw); */\r
83   GotoXY(x+(15-(pixels(str)/2)), y+2);\r
84   printstring(str);\r
85 }\r
86 \r
87 void BigButton(int x, int y, char *str)\r
88 {\r
89   stdwindow(x,y,x+50,y+10);\r
90 //  HLine(x, y, 50, black);      /* -- ric: 13/Jun/98 --     */\r
91 //  VLine(x, y, 10, black);      /* Outline buttons in black */\r
92 /*  HLine(x+1, y+9, 49, black);\r
93   VLine(x+49, y+1, 9, black);\r
94 \r
95   HLine(x+1, y+1, 48, white);\r
96   VLine(x+1, y+1, 8, white);\r
97   HLine(x+2, y+8, 47, darkw);\r
98   VLine(x+48, y+2, 7, darkw); */\r
99   GotoXY(x+(25-(pixels(str)/2)), y+2);\r
100   printstring(str);\r
101 }\r
102 \r
103 void ButtonPressed(int x, int y, char *str)\r
104 /* -- ric: 13/Jun/98 --     */\r
105 /* Draws a depressed button */\r
106 {\r
107   stdwindow(x,y,x+30,y+10);\r
108   HLine(x+1, y+1, 28, darkw);\r
109   VLine(x+1, y+1, 8, darkw);\r
110   HLine(x+2, y+8, 27, winbg);\r
111   VLine(x+28, y+2, 7, winbg);\r
112   GotoXY(x+1+(15-(pixels(str)/2)), y+3);\r
113   printstring(str);\r
114 }\r
115 \r
116 void BigButtonPressed(int x, int y, char *str)\r
117 {\r
118   stdwindow(x,y,x+50,y+10);\r
119   HLine(x+1, y+1, 48, darkw);\r
120   VLine(x+1, y+1, 8, darkw);\r
121   HLine(x+2, y+8, 47, winbg);\r
122   VLine(x+48, y+2, 7, winbg);\r
123   GotoXY(x+1+(25-(pixels(str)/2)), y+3);\r
124   printstring(str);\r
125 }\r
126 \r
127 void TextField(int x, int y, int width, char *str, char blink)\r
128 {\r
129   FilledBox(x, y, width, 9, 0);\r
130   HLine(x, y, width+1, darkw);\r
131   VLine(x, y, 9, darkw);\r
132   HLine(x+1, y+8, width-1, brightw);\r
133   VLine(x+width, y+1, 8, brightw);\r
134   GotoXY(x+2, y+2);\r
135   printstring(str);\r
136   if (blink) printstring("_");\r
137 }\r