source: branches/profile/WINDOW/aw_window.hxx

Last change on this file was 12926, checked in by westram, 10 years ago
  • remove at_set_min_size() (unused)
  • remove last (external) call to set_window_size() (from GDE; already implicitely called via load_xfig just above)
  • sync in load_xfig
  • mark more functions of AW_window as local (IN_ARB_WINDOW)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.9 KB
Line 
1#ifndef AW_WINDOW_HXX
2#define AW_WINDOW_HXX
3
4#ifndef AW_BASE_HXX
5#include "aw_base.hxx"
6#endif
7#ifndef ARBDB_BASE_H
8#include <arbdb_base.h>
9#endif
10#ifndef ARB_ASSERT_H
11#include <arb_assert.h>
12#endif
13#ifndef AW_KEYSYM_HXX
14#include "aw_keysym.hxx"
15#endif
16#ifndef ARBTOOLS_H
17#include <arbtools.h>
18#endif
19#ifndef CB_H
20#include <cb.h>
21#endif
22
23#if defined(ARB_GTK)
24# if defined(ARB_MOTIF)
25#  error ARB_GTK and ARB_MOTIF cannot both be defined
26# endif
27#else // !defined(ARB_GTK)
28# if !defined(ARB_MOTIF)
29#  error Either ARB_GTK or ARB_MOTIF has to be defined
30# endif
31#endif
32
33class AW_window;
34class AW_xfig;
35class AW_device;
36struct AW_screen_area;
37struct GB_HASH;
38class AW_device_click;
39class AW_device_print;
40class AW_device_size;
41
42// --------------------------------------------------------------------------------
43
44#define AW_MESSAGE_TIME 2000
45#define AW_HEADER_MAIN  extern "C" { int XtAppInitialize(); } void aw_never_called_main() { XtAppInitialize(); }
46
47// ======= Used in Tune background function =================================
48#define TUNE_BUTTON    8
49#define TUNE_INPUT     (-TUNE_BUTTON)
50#define TUNE_SUBMENU   0
51#define TUNE_MENUTOPIC (-12)
52#define TUNE_BRIGHT    (256+30)
53#define TUNE_DARK      (-TUNE_BRIGHT)
54// ==========================================================================
55
56#ifndef AW_AT_HXX
57class AW_at;
58#endif
59
60enum AW_orientation { AW_HORIZONTAL, AW_VERTICAL };
61
62typedef const char *AW_label;       // label for buttons menus etc
63// "fsdf" simple label  // no '/' symbol !!!
64// "awarname/asdf"  // awar name (any '/' in string)
65// "#file.xpm"   // pixmap in $ARBHOME/lib/pixmaps/file.xpm
66
67const char *AW_get_pixmapPath(const char *pixmapName);
68
69void AW_POPDOWN(AW_window *);
70void AW_POPUP(AW_window*, AW_CL, AW_CL) __ATTR__DEPRECATED_TODO("directly pass CreateWindowCallback");
71
72enum AW_event_type {
73    AW_Keyboard_Press   = 1,
74    AW_Keyboard_Release = 2,
75    AW_Mouse_Press      = 3,
76    AW_Mouse_Release    = 4,
77    AW_Mouse_Drag       = 5
78};
79
80enum AW_MouseButton {
81    AW_BUTTON_NONE   = 0,
82    AW_BUTTON_LEFT   = 1,
83    AW_BUTTON_MIDDLE = 2,
84    AW_BUTTON_RIGHT  = 3,
85    AW_WHEEL_UP      = 4,
86    AW_WHEEL_DOWN    = 5,
87};
88
89struct AW_event {
90    // fields always valid
91    AW_event_type type;             // AW_Keyboard or AW_Mouse
92    unsigned long time;             // time in msec, when event occurred
93    AW_key_mod    keymodifier;      // control, alt/meta (shift only for type == AW_Mouse)
94
95    // fields valid for type == AW_Mouse
96    AW_MouseButton button;
97    int            x, y;            // pointer x,y coordinates in the event window
98
99    // fields valid for type == AW_Keyboard
100    AW_key_code keycode;            // which key type was pressed
101    char        character;          // the c character
102};
103
104void AW_help_popup(AW_window *aw, const char *help_file);
105inline WindowCallback makeHelpCallback(const char *helpfile) { return makeWindowCallback(AW_help_popup, helpfile); }
106
107void AW_help_entry_pressed(AW_window *);
108void AW_clock_cursor(AW_root *);
109void AW_normal_cursor(AW_root *);
110
111void AW_openURL(AW_root *aw_root, const char *url);
112
113typedef void (*AW_cb_struct_guard)();
114
115class AW_cb : virtual Noncopyable {
116    WindowCallback cb;
117
118    AW_cb *next;
119
120    static AW_cb_struct_guard guard_before;
121    static AW_cb_struct_guard guard_after;
122    static AW_postcb_cb       postcb; // called after each cb triggered via interface
123
124public:
125    // private (read-only):
126    AW_window  *aw;
127    const char *help_text;
128    char       *id;
129
130    // real public section:
131    AW_cb(AW_window  *awi,
132          AW_CB       g,
133          AW_CL       cd1i       = 0,
134          AW_CL       cd2i       = 0,
135          const char *help_texti = 0,
136          AW_cb      *next       = 0);
137
138    AW_cb(AW_window             *awi,
139          const WindowCallback&  wcb,
140          const char            *help_texti = 0,
141          AW_cb                 *next       = 0);
142
143    ~AW_cb() {
144        delete next; next = NULL;
145        free(id);
146    }
147
148    void run_callbacks();                           // runs the whole list
149    bool contains(AW_CB g);                         // test if contained in list
150    bool is_equal(const AW_cb& other) const;
151
152    int compare(const AW_cb& other) const { return cb<other.cb ? -1 : (other.cb<cb ? 1 : 0); }
153
154#if defined(ASSERTION_USED)
155    AW_CL get_cd1() const { return cb.inspect_CD1(); }
156    AW_CL get_cd2() const { return cb.inspect_CD2(); }
157#endif // DEBUG
158
159    static void set_AW_cb_guards(AW_cb_struct_guard before, AW_cb_struct_guard after) {
160        guard_before = before;
161        guard_after  = after;
162    }
163    static void set_AW_postcb_cb(AW_postcb_cb postcb_cb) {
164        postcb = postcb_cb;
165    }
166
167    static void useraction_init() {
168        if (guard_before) guard_before();
169    }
170    static void useraction_done(AW_window *aw) {
171        if (guard_after) guard_after();
172        if (postcb) postcb(aw);
173    }
174};
175
176
177enum {
178    AWM_DISABLED = 0,           // disabled items (used for dynamically dis-/enabled items)
179    AWM_BASIC    = 1,
180    AWM_EXP      = 2,
181    AWM_ALL      = AWM_BASIC|AWM_EXP
182};
183
184enum {
185    AWM_MASK_UNKNOWN = AWM_DISABLED,
186    AWM_MASK_DEFAULT = AWM_BASIC,
187    AWM_MASK_EXPERT  = AWM_ALL
188};
189
190typedef char *AW_pixmap;
191
192class  AW_window_Motif;
193class  AW_selection_list_entry;
194class  AW_selection_list;
195struct AW_option_menu_struct;
196struct aw_toggle_data;
197
198enum AW_at_storage_type {
199    AW_AT_SIZE_AND_ATTACH,
200    AW_AT_AUTO,
201    AW_AT_MAXSIZE,
202};
203struct AW_at_storage {
204    //! store/restore some properties from/to AW_at
205    virtual ~AW_at_storage() {}
206
207    // will be called via AW_window
208    virtual void store(const AW_at& at)   = 0;
209    virtual void restore(AW_at& at) const = 0;
210
211    static AW_at_storage *make(AW_window *aww, AW_at_storage_type type); // factory
212};
213
214enum AW_SizeRecalc {
215    AW_KEEP_SIZE      = 0,                          // do not resize
216    AW_RESIZE_DEFAULT = 1,                          // do resize to default size
217    AW_RESIZE_USER    = 2,                          // do resize to user size (or default size if that is bigger)
218    AW_RESIZE_ANY     = 3                           // keep AW_RESIZE_USER or set AW_RESIZE_DEFAULT
219};
220
221enum AW_PosRecalc {
222    AW_KEEP_POS            = 0,                     // do not change position on show
223    AW_REPOS_TO_CENTER     = 1,                     // center the window on show (unused atm)
224    AW_REPOS_TO_MOUSE      = 2,                     // move the window under the current mouse position
225    AW_REPOS_TO_MOUSE_ONCE = 3,                     // like AW_REPOS_TO_MOUSE, but only done once!
226};
227
228class AW_window : virtual Noncopyable {
229    AW_SizeRecalc recalc_size_at_show;
230    AW_PosRecalc  recalc_pos_at_show;
231
232    AW_CB0 hide_cb;
233    bool expose_callback_added;
234
235    AW_cb *focus_cb;
236
237    AW_xfig *xfig_data;
238    AW_at   *_at; /** < Defines the next position at which something will be inserted into the window.  */
239
240    int left_indent_of_horizontal_scrollbar;
241    int top_indent_of_vertical_scrollbar;
242
243    void all_menus_created() const;
244    void create_toggle(const char *var_name, aw_toggle_data *tdata);
245
246#if defined(ARB_MOTIF)
247    int calculate_string_width(int columns) const;
248    int calculate_string_height(int columns, int offset) const;
249    char *align_string(const char *string, int columns);
250    void calculate_label_size(int *width, int *height, bool in_pixel, const char *non_at_label);
251#endif
252
253protected:
254    AW_root *root;
255
256    void create_devices();
257    void set_background(const char *colorname, Widget w);
258
259    void wm_activate();                                // un-minimize window and give it the focus (use show_and_activate())
260
261public:
262
263#if defined(ARB_MOTIF)
264    // ---------------------------------------- [start read-only section] @@@ should go private
265
266    AW_event         event;
267    unsigned long    click_time;
268    long             color_table_size;
269    AW_rgb          *color_table;
270    int              number_of_timed_title_changes;
271    AW_window_Motif *p_w;
272    AW_cb           *_callback;
273    AW_cb           *_d_callback;
274
275    // ---------------------------------------- [end read-only section]
276#endif
277
278#if defined(ARB_MOTIF)
279#if defined(IN_ARB_WINDOW)
280    // only used internal and in motif (alternative would be to move a bunch of code into AW_window)
281    const AW_at& get_at() const { return *_at; }
282    AW_at& get_at() { return *_at; }
283#endif
284#endif
285
286    AW_window();
287    virtual ~AW_window();
288
289    const char    *window_local_awarname(const char *localname, bool tmp = true);
290    class AW_awar *window_local_awar(const char *localname, bool tmp = true);
291    void           create_window_variables();
292
293    void         recalc_pos_atShow(AW_PosRecalc pr);
294    void         recalc_size_atShow(enum AW_SizeRecalc sr);
295    AW_PosRecalc get_recalc_pos_atShow() const;
296
297    void allow_delete_window(bool allow_close);
298    void on_hide(AW_CB0 call_on_hide);
299
300
301#if defined(ARB_MOTIF)
302    void run_focus_callback();
303    void show_modal();
304    void set_window_title_intern(char *title);
305#endif
306
307    void update_label(Widget widget, const char *var_value);
308    void update_toggle(Widget widget, const char *var_value, AW_CL cd);
309    void update_input_field(Widget widget, const char *var_value);
310    void update_text_field(Widget widget, const char *var_value);
311
312    void  create_invisible(int columns);
313    void *_create_option_entry(AW_VARIABLE_TYPE type, const char *name, const char *mnemonic, const char *name_of_color);
314    void  refresh_toggle_field(int toggle_field_number); 
315    void  _set_activate_callback(void *widget);
316    void  increment_at_commands(int width, int height);
317
318
319    AW_color_idx alloc_named_data_color(int colnum, char *colorname);
320
321    // special for EDIT4
322    void _get_area_size(AW_area area, AW_screen_area *square);
323   
324    int label_widget(void *wgt, AW_label str, char *mnemonic=0, int width = 0, int alignment = 0);
325
326    // ------------------------------
327    //      The read only section
328
329    char *window_name;          //! window title
330    char *window_defaults_name; //! window id
331    bool  window_is_shown;
332
333    int slider_pos_vertical;
334    int slider_pos_horizontal;
335    int main_drag_gc;
336
337    AW_screen_area *picture;      // the result of tell scrolled picture size
338
339    // --------------------------------
340    //      The real public section
341
342    AW_root *get_root() { return root; }
343    // ******************* Global layout functions **********************
344
345    void show(); // show newly created window or unhide hidden window (aka closed window)
346    void hide(); // hide (don't destroy) a window (<->show)
347
348    void activate() { show(); wm_activate(); }      // make_visible, pop window to front and give it the focus
349
350    bool is_shown() const;  // is window visible (== true) or hidden (== false). ?
351
352    void hide_or_notify(const char *error);
353
354    void    message(char *title, int ms);   // Set for ms milliseconds the title of the window
355    void    set_window_title(const char *title);   // Set the window title forever
356
357    const char *get_window_title() const;       // Get the window's title
358    const char *get_window_id() const { return window_defaults_name; } // Get the window's internal name
359
360    const char *local_id(const char *id) const;
361
362    void set_info_area_height(int height);
363    void set_bottom_area_height(int height);
364
365    // ******************* Input and Motion Events **********************
366
367    void set_popup_callback(const WindowCallback& wcb);
368    void set_focus_callback(const WindowCallback& wcb);
369    bool is_focus_callback(void (*f)(AW_window*, AW_CL, AW_CL));
370
371    void set_expose_callback(AW_area area, const WindowCallback& wcb);
372    void set_resize_callback(AW_area area, const WindowCallback& wcb);
373
374private:
375    // motif relicts:
376    void set_expose_callback(AW_area area, AW_CB0 cb) { set_expose_callback(area, makeWindowCallback(cb)); }
377    void set_resize_callback(AW_area area, AW_CB0 cb) { set_resize_callback(area, makeWindowCallback(cb)); }
378public:
379
380    void set_input_callback(AW_area area, const WindowCallback& wcb);
381    void set_motion_callback(AW_area area, const WindowCallback& wcb);
382
383    void set_double_click_callback(AW_area area, const WindowCallback& wcb);
384
385    bool is_expose_callback(AW_area area, void (*f)(AW_window*, AW_CL, AW_CL));
386    bool is_resize_callback(AW_area area, void (*f)(AW_window*, AW_CL, AW_CL));
387    bool is_input_callback(AW_area area, void (*f)(AW_window*, AW_CL, AW_CL));
388    bool is_motion_callback(AW_area area, void (*f)(AW_window*, AW_CL, AW_CL));
389    bool is_double_click_callback(AW_area area, void (*f)(AW_window*, AW_CL, AW_CL));
390
391    void get_event(AW_event *eventi) const;       // In an event callback get the events info
392
393    void force_expose(); // forces the window to expose instantly
394
395    // ******************* Get the devices **********************
396    AW_device *get_device(AW_area area);
397    AW_device_click *get_click_device(AW_area area, int mousex, int mousey, int max_distance);
398    AW_device_size *get_size_device(AW_area area);
399    AW_device_print *get_print_device(AW_area area);
400
401    // ************** Create the menu buttons *********
402    void create_menu(AW_label name, const char *mnemonic, AW_active mask = AWM_ALL);
403    void insert_sub_menu(AW_label name, const char *mnemonic, AW_active mask = AWM_ALL);
404
405    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback& cb);
406
407    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const CreateWindowCallback& cwcb) { insert_menu_topic(id, name, mnemonic, help_text_, mask, makeWindowPopper(cwcb)); }
408    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, WindowCallbackSimple cb)          { insert_menu_topic(id, name, mnemonic, help_text_, mask, makeWindowCallback(cb)); }
409    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, CreateWindowCallbackSimple cb)    { insert_menu_topic(id, name, mnemonic, help_text_, mask, makeCreateWindowCallback(cb)); }
410
411    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, AW_CB cb, AW_CL cd1, AW_CL cd2) __ATTR__DEPRECATED_TODO("pass WindowCallback") { insert_menu_topic(id, name, mnemonic, help_text_, mask, makeWindowCallback(cb, cd1, cd2)); }
412    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, AW_CB1 cb, AW_CL cd1) __ATTR__DEPRECATED_TODO("pass WindowCallback") { insert_menu_topic(id, name, mnemonic, help_text_, mask, makeWindowCallback(cb, cd1)); }
413
414    void sep______________();
415    void close_sub_menu();
416
417    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, const WindowCallback& cb);
418    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, AW_CB0 cb) { insert_help_topic(labeli, mnemonic, helpText, mask, makeWindowCallback(cb)); }
419    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, void (*f)(AW_window*, AW_CL, AW_CL), AW_CL cd1, AW_CL cd2) __ATTR__DEPRECATED_TODO("pass WindowCallback") {
420        insert_help_topic(labeli, mnemonic, helpText, mask, makeWindowCallback(f, cd1, cd2));
421    }
422
423    // ************** Create modes on the left side ******************
424    int create_mode(const char *pixmap, const char *help_text_, AW_active mask, const WindowCallback& cb);
425    void select_mode(int mode);
426
427    // ************** Control the size of the main drawing area + scrollbars  *********
428    void tell_scrolled_picture_size(AW_screen_area rectangle);
429    void tell_scrolled_picture_size(AW_world rectangle);
430    AW_pos get_scrolled_picture_width() const;
431    AW_pos get_scrolled_picture_height() const;
432    void reset_scrolled_picture_size();
433
434    void get_scrollarea_size(AW_screen_area *square);
435
436    void calculate_scrollbars();
437    void set_vertical_scrollbar_position(int position);
438    void set_horizontal_scrollbar_position(int position);
439
440    void set_vertical_change_callback(const WindowCallback& wcb);
441    void set_horizontal_change_callback(const WindowCallback& wcb);
442    void set_vertical_scrollbar_top_indent(int indent);
443    void set_horizontal_scrollbar_left_indent(int indent);
444
445
446    void update_scrollbar_settings_from_awars(AW_orientation orientation);
447
448    void create_user_geometry_awars(int posx, int posy, int width, int height);
449   
450    // ************** Control window size  *********
451#if defined(IN_ARB_WINDOW)
452    void set_window_size(int width, int height);
453#endif
454    void get_window_size(int& width, int& height);
455    void window_fit();                              // Recalculate the size of a window with buttons
456
457#if defined(IN_ARB_WINDOW)
458    void store_size_in_awars(int width, int height);
459    void get_size_from_awars(int& width, int& height);
460
461    // ************** Control window position  *********
462    void set_window_frame_pos(int xpos, int ypos);
463    void get_window_content_pos(int& xpos, int& ypos);
464
465    void store_pos_in_awars(int xpos, int ypos);
466    void get_pos_from_awars(int& xpos, int& ypos);
467
468    // *****************
469    void get_screen_size(int& width, int& height);
470    bool get_mouse_pos(int& x, int& y);
471    void set_focus_policy(bool follow_mouse);
472#endif
473   
474    // ************** ********************************************************************  *********
475    // ************** Create buttons: First set modify flags and finally create the button  *********
476    // ************** ********************************************************************  *********
477
478    // *** global modifier: ****
479    void load_xfig(const char *file, bool resize=true); // Loads the background graphic
480    void draw_line(int x1, int y1, int x2, int y2, int width, bool resize); // draws a line on the background
481
482    void label_length(int length);   // Justifies all following labels
483    void button_length(int length);   // Sets the width of all following buttons (in chars)
484#if defined(ARB_MOTIF)
485    void button_height(int height);   // Sets the height of all following buttons (in lines)
486#endif
487    int  get_button_length() const; // returns the current width of buttons
488    void highlight();           // Creates a frame around the button
489    void auto_increment(int dx, int dy);   // enable automatic placement of buttons
490    // dx is the horizontal distance between the left
491    // borders of two buttons
492    void auto_space(int xspace, int yspace);   // enable automatic placement of buttons
493    // xspace is the horizontal space between 2 buttons
494
495    void shadow_width (int shadow_thickness); // set the shadow_thickness of buttons
496
497#if defined(ARB_MOTIF)
498    void TuneBackground(Widget w, int modStrength);
499    void TuneOrSetBackground(Widget w, const char *color, int modStrength);
500#endif
501
502    // *** local modifiers: ********
503    void at(int x, int y);      // abs pos of a button (>10,10)
504    void at_x(int x);           // abs x pos
505    void at_y(int y);           // abs y pos
506    void at_shift(int x, int y);   // rel pos of a button
507    void at_newline();          // in auto_space mode only: newline
508
509    void at(const char *id);                        /* place the button at the position set in the .fig
510                                                     * file (loaded with load_xfig) by the string $id */
511    bool at_ifdef(const  char *id);                 // check whether 'id' is an element if the .fig file
512
513    void label(const char *label);   // Create a label before the button
514
515    void get_at_position(int *x, int *y) const;
516    int get_at_xposition() const;
517    int get_at_yposition() const;
518
519    void dump_at_position(const char *debug_label) const; // for debugging (uses printf)
520
521    void at_set_to(bool attach_x, bool attach_y, int xoff, int yoff); // set "to:XY:id" manually
522    void at_unset_to();                                               // unset "to:id" manually
523    void unset_at_commands();
524
525    void store_at_to(AW_at_storage& storage) { storage.store(*_at); }
526    void restore_at_from(const AW_at_storage& stored) { stored.restore(*_at); }
527
528    void sens_mask(AW_active mask);   // Set the sensitivity mask used for following widgets (Note: reset by next at()-command)
529    void help_text(const char *id);   // Set the help text of a button
530
531private:
532    static void popper(AW_window *, CreateWindowCallback *windowMaker);
533    static void replacer(AW_window *aww, CreateWindowCallback *windowMaker);
534    static void destroyCreateWindowCallback(CreateWindowCallback *windowMaker);
535public:
536    static WindowCallback makeWindowPopper(const CreateWindowCallback& cwcb) {
537        return makeWindowCallback(popper, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
538    }
539    static WindowCallback makeWindowReplacer(const CreateWindowCallback& cwcb) {
540        return makeWindowCallback(replacer, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
541    }
542
543    // normal callbacks
544    void callback(const WindowCallback& cb);
545
546    void callback(const CreateWindowCallback& cwcb) { callback(makeWindowPopper(cwcb)); }
547    void callback(CreateWindowCallbackSimple cb)    { callback(makeCreateWindowCallback(cb)); }
548    void callback(WindowCallbackSimple cb)          { callback(makeWindowCallback(cb)); }
549
550    void callback(void (*f)(AW_window*, AW_CL), AW_CL cd1) __ATTR__DEPRECATED_TODO("pass WindowCallback") { callback(makeWindowCallback(f, cd1)); }
551    void callback(void (*f)(AW_window*, AW_CL, AW_CL), AW_CL cd1, AW_CL cd2) __ATTR__DEPRECATED_TODO("pass WindowCallback") { callback(makeWindowCallback(f, cd1, cd2)); }
552
553    void d_callback(const WindowCallback& cb); // secondary callback (called for 'double click into selection list' and 'text field hit ENTER')
554
555    // *** create the buttons ********
556    void   create_button(const char *macro_name, AW_label label, const char *mnemonic = 0, const char *color = 0); // simple button; shadow only when callback
557    void   create_autosize_button(const char *macro_name, AW_label label, const char *mnemonic = 0, unsigned xtraSpace = 1); // as above, but ignores button_length
558    Widget get_last_widget() const;
559
560    void create_toggle(const char *awar_name);  // int 0/1  string yes/no   float undef
561    void create_inverse_toggle(const char *awar_name);  // like create_toggle, but displays inverted toggle value
562
563    void create_toggle(const char *awar_name, const char *nobitmap, const char *yesbitmap, int buttonWidth = 0);
564    void create_text_toggle(const char *var_name, const char *noText, const char *yesText, int buttonWidth = 0);
565
566    void create_input_field(const char *awar_name, int columns = 0);   // One line textfield
567    void create_text_field(const char *awar_name, int columns = 20, int rows = 4);   // Multi line textfield
568    // with scrollbars
569
570
571    // ***** option_menu is a menu where only one selection is visible at a time
572    AW_option_menu_struct *create_option_menu(const char *awar_name, bool fallback2default);
573    void clear_option_menu(AW_option_menu_struct *oms);  // used to redefine available options
574
575private:
576    void insert_option_internal(AW_label choice_label, const char *mnemonic, const char *var_value,  const char *name_of_color, bool default_option);
577    void insert_option_internal(AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color, bool default_option);
578    void insert_option_internal(AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color, bool default_option);
579
580    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, const char *var_value, bool default_toggle);
581    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, int var_value,          bool default_toggle);
582    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, float var_value,        bool default_toggle);
583public:
584
585    // for string
586    void insert_option         (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = 0);  // for string
587    void insert_default_option (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = 0);
588    // for int
589    void insert_option         (AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color = 0);  // for int
590    void insert_default_option (AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color = 0);
591    // for float
592    void insert_option         (AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color = 0);  // for float
593    void insert_default_option (AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color = 0);
594
595    void update_option_menu();
596    void refresh_option_menu(AW_option_menu_struct *);  // don't use this
597
598
599    // ***** toggle_field is a static menu (all items are visible and only one is selected)
600    void create_toggle_field(const char *awar_name, AW_label label, const char *mnemonic);
601    void create_toggle_field(const char *awar_name, int orientation = 0);  // 1 = horizontal
602    // for string
603    void insert_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
604    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
605    // for int
606    void insert_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
607    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
608    // for float
609    void insert_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
610    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
611    void update_toggle_field();
612
613    // ***** selection list is a redefinable scrolled list of items
614
615    AW_selection_list *create_selection_list(const char *awar_name, int columns, int rows, bool fallback2default);
616    AW_selection_list *create_selection_list(const char *awar_name, bool fallback2default) { return create_selection_list(awar_name, 4, 4, fallback2default); }
617};
618
619
620class AW_window_menu_modes : public AW_window { // derived from a Noncopyable
621    void *AW_window_menu_modes_private;       // Do not use !!!
622   
623public:
624    AW_window_menu_modes();
625    ~AW_window_menu_modes();
626    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
627};
628
629class AW_window_menu : public AW_window {
630private:
631public:
632    AW_window_menu();
633    ~AW_window_menu();
634    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
635};
636
637class AW_window_simple_menu : public AW_window {
638private:
639public:
640    AW_window_simple_menu();
641    ~AW_window_simple_menu();
642    void init(AW_root *root, const char *wid, const char *windowname);
643};
644
645
646class AW_window_simple : public AW_window {
647private:
648public:
649    AW_window_simple();
650    ~AW_window_simple();
651    void init(AW_root *root, const char *wid, const char *windowname);
652};
653
654
655class AW_window_message : public AW_window {
656private:
657public:
658    AW_window_message();
659    ~AW_window_message();
660    void init(AW_root *root, const char *windowname, bool allow_close);
661};
662
663typedef struct aw_gc_manager *AW_gc_manager;
664
665
666#else
667#error aw_window.hxx included twice
668#endif
Note: See TracBrowser for help on using the repository browser.