source: golgotha/src/i4/window/style.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 5.2 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef __STYLE_HPP_
10#define __STYLE_HPP_
11
12#include "init/init.hh"
13#include "window/window.hh"
14#include "string/string.hh"
15#include "video/display.hh"
16#include "menu/menu.hh"
17#include "font/font.hh"
18
19class i4_font_hint_class
20{
21public:
22  i4_font_hint_class();
23
24  i4_font_class *normal_font;
25  i4_font_class *small_font;
26
27  ~i4_font_hint_class();
28};
29
30
31class i4_color_hint_class
32{
33public:
34  i4_color black,white;
35
36  i4_color text_foreground,
37           text_background;
38
39  i4_color selected_text_foreground,
40           selected_text_background;
41
42  struct bevel
43  {
44    i4_color bright, medium, dark; 
45  };
46 
47  struct bevel_actor  { bevel active,passive; };
48 
49  bevel_actor window, button;
50
51  i4_color_hint_class();
52
53  i4_color neutral() { return window.passive.medium; }
54};
55
56class i4_cursor_hint_class
57{
58  i4_cursor_class *normal,*text;
59public:
60  i4_cursor_class *normal_cursor() const { return normal; }
61  i4_cursor_class *text_cursor() const { return text; }
62
63  i4_cursor_hint_class();
64  ~i4_cursor_hint_class()
65  {
66    delete normal;
67    delete text;
68  }
69};
70
71
72class i4_icon_hint_class
73{
74public:
75  i4_image_class *close_icon;
76  i4_image_class *up_icon;
77  i4_image_class *down_icon;
78  i4_image_class *left_icon;
79  i4_image_class *right_icon;
80  i4_image_class *plus_icon;
81  i4_image_class *minus_icon;
82  i4_image_class *ok_icon;
83  i4_image_class *cancel_icon;
84
85  i4_image_class *background_bitmap;
86
87  i4_icon_hint_class();
88  ~i4_icon_hint_class();
89} ;
90
91class i4_time_hint_class
92{
93public:
94  w32 button_repeat,     // these are in milli seconds
95      button_delay,
96      double_click;
97
98  i4_time_hint_class();
99};
100
101class i4_graphical_style_class : public i4_init_class
102{
103  virtual void init();
104  void cleanup();
105
106public:
107  virtual void uninit();
108
109  virtual i4_bool available_for_display(i4_display_class *whom) = 0;
110  virtual char *name() = 0;
111
112  // window will automatically be added to parent at location x,y
113  // on_delete will be deleted when the window closes
114  // x=-1 and y=-1 then center window in parent
115  virtual i4_parent_window_class *create_mp_window(i4_coord x, i4_coord y, w16 w, w16 h,
116                                                   const i4_const_str &title,
117                                                   i4_event_reaction_class *on_delete=0
118                                                   ) = 0;
119
120  virtual i4_bool close_mp_window(i4_parent_window_class *created_window) = 0;
121
122  virtual i4_menu_class *create_menu(i4_bool hide_on_pick) = 0;
123
124  virtual void prepare_for_mode(const i4_pal *pal, i4_display_class::mode *mode);
125
126
127  virtual void get_in_deco_size(w32 &left, w32 &top, w32 &right, w32 &bottom) = 0;
128  virtual void get_out_deco_size(w32 &left, w32 &top, w32 &right, w32 &bottom) = 0;
129
130  virtual void deco_neutral_fill(i4_image_class *screen,
131                                 sw32 x1, sw32 y1, sw32 x2, sw32 y2,
132                                 i4_draw_context_class &context) = 0;
133
134  // draw a decoration around an area that looks like it's pressed into the screen
135  virtual void draw_in_deco(i4_image_class *screen,
136                            i4_coord x1, i4_coord y1,
137                            i4_coord x2, i4_coord y2,
138                            i4_bool active,
139                            i4_draw_context_class &context) = 0;
140
141  // draw a decoration around an area that looks like it sticks out the screen
142  virtual void draw_out_deco(i4_image_class *screen,
143                             i4_coord x1, i4_coord y1,
144                             i4_coord x2, i4_coord y2,
145                             i4_bool active,
146                             i4_draw_context_class &context) = 0;
147
148  // this will create a temporary (quick) context help window at the mouse cursor
149  // you are responsible for deleting the window
150  virtual i4_window_class *create_quick_context_help(int mouse_x, int mouse_y,
151                                                     const i4_const_str &str) = 0;
152
153  i4_color_hint_class  *color_hint;
154  i4_font_hint_class   *font_hint;
155  i4_cursor_hint_class *cursor_hint;
156  i4_icon_hint_class   *icon_hint;
157  i4_time_hint_class   *time_hint;
158
159  i4_graphical_style_class *next;
160
161  i4_graphical_style_class()
162  {
163    color_hint=0;
164    font_hint=0;
165    cursor_hint=0;
166    icon_hint=0;
167    time_hint=0;
168  }
169};
170
171
172class i4_style_manager_class
173{
174  i4_graphical_style_class *list;
175public:
176  void add_style(i4_graphical_style_class *which);
177  i4_graphical_style_class *find_style(char *name);
178  i4_graphical_style_class *first_style();
179  i4_graphical_style_class *next_style(i4_graphical_style_class *last);
180};
181
182
183i4_color i4_read_color_from_resource(char *name);
184extern i4_style_manager_class i4_style_man;
185
186#endif
187
Note: See TracBrowser for help on using the repository browser.