2
/******************************************************************************
4
* DESCRIPTION: Graphical user interface for X11
5
* COPYRIGHT : (C) 1999 Joris van der Hoeven
6
*******************************************************************************
7
* This software falls under the GNU general public license and comes WITHOUT
8
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11
******************************************************************************/
19
#include "hashmap.hpp"
24
typedef x_gui_rep* x_gui;
25
typedef x_window_rep* x_window;
32
#include <X11/Xutil.h>
34
#include <X11/Xatom.h>
35
#include <X11/keysym.h>
36
#include <X11/Sunkeysym.h>
38
extern bool true_color;
39
#define CONVERT(c) (true_color? c: gui->cmap[c])
41
/******************************************************************************
42
* For anti aliasing of TeX fonts
43
******************************************************************************/
45
struct x_character_rep: concrete_struct {
51
x_character_rep (int c, font_glyphs fng, int sf, color fg, color bg);
52
friend class x_character;
56
CONCRETE(x_character);
57
x_character (int c=0, font_glyphs fng= font_glyphs (),
58
int sf=1, color fg= 0, color bg= 1);
61
CONCRETE_CODE(x_character);
63
bool operator == (x_character xc1, x_character xc2);
64
bool operator != (x_character xc1, x_character xc2);
65
int hash (x_character xc);
67
/******************************************************************************
69
******************************************************************************/
71
struct message_rep: concrete_struct {
75
message_rep (widget wid, string s, time_t t);
81
message (widget wid, string s, time_t t);
83
CONCRETE_CODE(message);
85
ostream& operator << (ostream& out, message m);
87
/******************************************************************************
89
******************************************************************************/
105
list<widget> grab_ptr;
106
list<widget> grab_kbd;
108
list<message> messages;
109
x_window_rep* gswindow;
118
time_t interrupt_time;
120
hashmap<x_character,pointer> color_scale; // for anti-aliasing
121
hashmap<x_character,pointer> character_bitmap; // bitmaps of all characters
122
hashmap<x_character,pointer> character_pixmap; // pixmaps of all characters
123
hashmap<string,int> xpm_bitmap; // bitmaps of all xpms
124
hashmap<string,int> xpm_pixmap; // pixmaps of all xpms
125
hashmap<int,string> lower_key;
126
hashmap<int,string> upper_key;
128
list<Window> windows_l;
130
hashmap<string,tree> selection_t;
131
hashmap<string,string> selection_s;
134
x_gui_rep (int argc, char** argv);
137
/******************************* Colors ************************************/
138
void prepare_color (int sfactor, color fg, color bg);
140
/****************************** Keyboard ***********************************/
141
void initialize_input_method ();
142
void insert_keysym (array<int>& a, int i, int j);
144
void map (int key, string s);
145
void Map (int key, string s);
146
void initialize_keyboard_pointer ();
147
string look_up_key (XKeyEvent* ev);
148
string look_up_mouse (XButtonEvent* ev);
149
unsigned int get_button_mask (XButtonEvent* ev);
151
/******************************** Fonts ************************************/
152
void set_shrinking_factor (int sfactor);
153
void set_default_font (string name);
154
font default_font_sub (bool tt);
155
font default_font (bool tt= false);
156
void get_ps_char (Font fn, int c, metric& ex, glyph& gl);
157
void load_system_font (string family, int size, int dpi,
158
font_metric& fnm, font_glyphs& fng);
160
/********************* extents, grabbing, selections ***********************/
161
void get_extents (SI& width, SI& height);
162
void get_max_size (SI& width, SI& height);
163
void set_button_state (unsigned int state);
164
void emulate_leave_enter (widget old_widget, widget new_widget);
165
void obtain_mouse_grab (widget wid);
166
void release_mouse_grab ();
167
bool has_mouse_grab (widget w);
169
/*********************** interclient communication *************************/
170
void created_window (Window win);
171
void deleted_window (Window win);
172
void focussed_window (Window win);
173
bool get_selection (string key, tree& t, string& s);
174
bool set_selection (string key, tree t, string s);
175
void clear_selection (string key);
177
/**************************** miscellaneous ********************************/
178
void show_help_balloon (widget wid, SI x, SI y);
180
void unmap_balloon ();
181
void image_auto_gc ();
182
void image_gc (string name);
183
void set_mouse_pointer (widget w, string name);
184
void set_mouse_pointer (widget w, string curs_name, string mask_name);
185
void show_wait_indicator (widget w, string message, string arg);
186
bool check_event (int type);
188
/************************** Event processing *******************************/
189
void process_event (x_window win, XEvent* ev);
192
/*************************** And our friends *******************************/
193
friend class x_drawable_rep;
194
friend class x_window_rep;
195
friend class x_ps_font_rep;
196
friend class x_tex_font_rep;
199
#endif // defined X_GUI_H