~ubuntu-branches/ubuntu/hardy/texmacs/hardy

« back to all changes in this revision

Viewing changes to src/Window/widget.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2004-04-19 20:34:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040419203400-g4e34ih0315wcn8v
Tags: upstream-1.0.3-R2
ImportĀ upstreamĀ versionĀ 1.0.3-R2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/******************************************************************************
 
3
* MODULE     : widget.hpp
 
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
******************************************************************************/
 
12
 
 
13
#ifndef WIDGET_H
 
14
#define WIDGET_H
 
15
#include "event.hpp"
 
16
#include "url.hpp"
 
17
 
 
18
/******************************************************************************
 
19
* The abstract widget class
 
20
******************************************************************************/
 
21
 
 
22
class widget_rep;
 
23
class widget {
 
24
public:
 
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);
 
31
};
 
32
 
 
33
class widget_rep: public abstract_struct {
 
34
public:
 
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
 
42
 
 
43
  widget_rep (display dis, array<widget> a, array<string> name, gravity grav);
 
44
  virtual ~widget_rep ();
 
45
 
 
46
  virtual operator tree () = 0;
 
47
  virtual bool handle (event ev) = 0;
 
48
 
 
49
  SI       x1 (); SI y1 (); // lower left window coordinates of widget
 
50
  SI       x2 (); SI y2 (); // upper right window coordinates of widget
 
51
  bool     attached ();
 
52
  void     fatal_error (string message, string in="", string fname="");
 
53
 
 
54
  friend   class widget;
 
55
};
 
56
 
 
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; }
 
62
 
 
63
ostream& operator << (ostream& out, widget w);
 
64
widget operator << (widget w, event ev);
 
65
 
 
66
/******************************************************************************
 
67
* Exported special widgets
 
68
******************************************************************************/
 
69
 
 
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);
 
99
 
 
100
#endif // defined WIDGET_H