source: golgotha/src/golg/editor/e_state.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 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: 3.7 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 EDITOR_E_STATE_HH
10#define EDITOR_E_STATE_HH
11
12
13#include "reference.hh"
14#include "device/device.hh"
15#include "player_type.hh"
16#include "rotation.hh"
17#include "device/event.hh"
18#include "g1_limits.hh"
19#include "editor/dialogs/scroll_picker.hh"
20
21
22class i4_image_class;
23class i4_spline_class;
24class i4_window_class;
25class i4_graphical_style_class;
26class i4_parent_window_class;
27class i4_graphical_style_class;
28class i4_button_box_class;
29class i4_spline_class;
30class i4_button_class;
31class g1_reference_class;
32class g1_object_class;
33class g1_controller_edit_class;
34class g1_mode_creator;
35
36enum
37{
38  G1_SET_MAJOR_MODE,
39  G1_SET_MINOR_MODE,
40  G1_EDIT_CHANGE_LIGHT_DIRECTION
41};
42
43
44class g1_set_major_mode_event : public i4_user_message_event_class
45
46public:
47  char name[30];
48
49  g1_set_major_mode_event(char *_name)
50    : i4_user_message_event_class(G1_SET_MAJOR_MODE)  { strcpy(name, _name); }
51
52  virtual i4_event  *copy() { return new g1_set_major_mode_event(name); } 
53};
54
55
56class g1_set_minor_mode_event : public g1_set_major_mode_event
57
58public:
59  w8 minor_mode;
60  g1_set_minor_mode_event(char *major_mode_name, w8 minor_mode)
61    : g1_set_major_mode_event(major_mode_name), minor_mode(minor_mode)
62  {
63    sub_type=G1_SET_MINOR_MODE;
64  }
65
66  virtual i4_event  *copy() { return new g1_set_minor_mode_event(name, minor_mode); } 
67};
68
69
70
71class g1_edit_state_class : public i4_event_handler_class
72{
73
74  i4_graphical_style_class *get_style();
75  i4_window_class *create_buttons(w32 height);
76  i4_window_class *tools;
77
78  w32 win_h;
79  i4_parent_window_class *parent;
80
81
82  i4_image_class **icons;
83  int total_icons;
84  void load_icons();
85
86
87
88public:
89  enum { NO_SNAP, SNAP_CENTER, SNAP_ORIGIN } snap;
90  void snap_point(i4_3d_point_class &p, int do_z=0);
91
92 
93  g1_controller_edit_class *current_focus();
94
95  struct context_help_struct
96  {
97    i4_event_handler_reference_class<i4_window_class> window;
98    int mx,my;  // mouse position
99    void show(const i4_const_str &help, int mx, int my);
100    void hide();
101
102  } context_help;
103
104  i4_image_class *get_icon(int i) const
105  {
106    I4_ASSERT(i>=0 || i<total_icons, "bad icon number"); 
107    return icons[i];
108  }
109
110  i4_button_class *create_button(char *res_name, w32 evalue, i4_bool popup,
111                                 i4_event_handler_class *send_to=0,
112                                 i4_event *send_event=0);
113
114  void add_but(i4_button_box_class *box,                     
115               char *res_name,
116               w32 evalue,
117               i4_bool down,
118               i4_event *send_event=0);
119
120
121
122
123  char major_mode[20];
124
125  g1_mode_creator *get_major_mode();
126  i4_bool set_major_mode(char *mode_name);
127  i4_bool set_minor_mode(char *major_mode_name, w32 minor_mode);
128
129  void set_current_team(int team_num);
130  g1_player_type current_team;
131 
132  g1_edit_state_class();
133
134  void show_tools(i4_parent_window_class *parent,  w32 win_h);
135                 
136  void hide_tools();
137  void receive_event(i4_event *ev);
138
139  void uninit();   // free up memory at end of program
140
141  void hide_focus();
142  void show_focus();
143
144  w32 tools_width();
145
146
147  char *name() { return "edit_state"; }
148};
149
150extern g1_edit_state_class g1_edit_state;
151
152#endif
153
Note: See TracBrowser for help on using the repository browser.