2
/******************************************************************************
4
* DESCRIPTION: Definition of abstract widgets
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
******************************************************************************/
18
/******************************************************************************
19
* The abstract widget class
20
******************************************************************************/
25
ABSTRACT_NULL(widget);
26
inline widget operator [] (int i);
27
widget operator [] (string s);
28
inline operator tree ();
29
inline bool operator == (widget w);
30
inline bool operator != (widget w);
33
class widget_rep: public abstract_struct {
35
display dis; // underlying display
36
window win; // underlying window
37
SI ox, oy; // origin of widget in window
38
SI w, h; // width and height of widget
39
gravity grav; // position of the origin in the widget
40
array<widget> a; // children of widget
41
array<string> name; // names for the children
43
widget_rep (display dis, array<widget> a, array<string> name, gravity grav);
44
virtual ~widget_rep ();
46
virtual operator tree () = 0;
47
virtual bool handle (event ev) = 0;
49
SI x1 (); SI y1 (); // lower left window coordinates of widget
50
SI x2 (); SI y2 (); // upper right window coordinates of widget
52
void fatal_error (string message, string in="", string fname="");
57
ABSTRACT_NULL_CODE(widget);
58
inline widget widget::operator [] (int i) { return rep->a[i]; }
59
inline widget::operator tree () { return (tree) (*rep); }
60
inline bool widget::operator == (widget w) { return rep == w.rep; }
61
inline bool widget::operator != (widget w) { return rep != w.rep; }
63
ostream& operator << (ostream& out, widget w);
64
widget operator << (widget w, event ev);
66
/******************************************************************************
67
* Exported special widgets
68
******************************************************************************/
70
widget horizontal_list (array<widget> a);
71
widget horizontal_list (array<widget> a, array<string> name);
72
widget vertical_list (array<widget> a);
73
widget vertical_list (array<widget> a, array<string> name);
74
widget vertical_menu (array<widget> a);
75
widget tile (array<widget> a, int cols);
76
widget tile (array<widget> a, int cols, array<string> name);
77
widget horizontal_array (array<widget> a, int stretch_me= -1);
78
widget horizontal_array (array<widget> a, array<string> s, int stretch_me= -1);
79
widget switch_widget (array<widget> a, array<string> name, int init= 0);
80
widget optional_widget (widget w, bool on= true);
81
widget glue_widget (bool hx=true, bool vx=true, SI w=0, SI h=0);
82
widget separator_widget (SI pre=0, SI post=0, bool vert=false);
83
widget text_widget (string s, bool tsp= false, string lan="");
84
widget menu_text_widget (string s, color col, string lan="", bool tt= false);
85
widget xpm_widget (url file_name, bool transp= true);
86
widget command_button (widget w, command cmd, bool button_flag= false);
87
widget command_button (widget lw, widget rw, command cmd);
88
widget command_button (widget lw, widget cw, widget rw, command cmd,
89
bool e=true, bool c=false);
90
widget pulldown_button (widget w, widget m);
91
widget pullright_button (widget w, widget m);
92
widget popup_widget (widget w, gravity quit=center);
93
widget canvas_widget (widget w, gravity grav=north_west);
94
widget input_text_widget (command call_back);
95
widget resize_widget (widget wdgt, SI w, SI h, bool xr= false, bool yr= false);
96
widget file_chooser_widget (command cmd, string type="texmacs", string mgn="");
97
widget balloon_widget (widget w, widget help);
98
widget wait_widget (SI w, SI h, string message);
100
#endif // defined WIDGET_H