source: branches/species/WINDOW/aw_window.hxx

Last change on this file was 19705, checked in by westram, 4 days ago
  • add alias_remote_command
  • use to change a macro id in selection admin, while providing backward compatibility.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.6 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
23class AW_window;
24class AW_xfig;
25class AW_device;
26struct AW_screen_area;
27struct GB_HASH;
28class AW_device_click;
29class AW_device_print;
30class AW_device_size;
31class AW_common;
32
33// --------------------------------------------------------------------------------
34
35#define AW_MESSAGE_TIME 2000
36#define AW_HEADER_MAIN  extern "C" { int XtAppInitialize(); } void aw_never_called_main() { XtAppInitialize(); }
37
38// ======= Used in Tune background function =================================
39#define TUNE_BUTTON    8
40#define TUNE_INPUT     (-TUNE_BUTTON)
41#define TUNE_SUBMENU   0
42#define TUNE_MENUTOPIC (-12)
43#define TUNE_BRIGHT    (256+30)
44#define TUNE_DARK      (-TUNE_BRIGHT)
45// ==========================================================================
46
47#ifndef AW_AT_HXX
48class AW_at;
49#endif
50
51enum AW_orientation { AW_HORIZONTAL, AW_VERTICAL };
52
53typedef const char *AW_label;       // label for buttons menus etc
54// "fsdf" simple label  // no '/' symbol !!!
55// "awarname/asdf"  // awar name (any '/' in string)
56// "#file.xpm"   // pixmap in $ARBHOME/lib/pixmaps/file.xpm
57
58const char *AW_get_pixmapPath(const char *pixmapName);
59
60void AW_POPDOWN(AW_window *);
61
62enum AW_event_type {
63    AW_Keyboard_Press   = 1,
64    AW_Keyboard_Release = 2,
65    AW_Mouse_Press      = 3,
66    AW_Mouse_Release    = 4,
67    AW_Mouse_Drag       = 5
68};
69
70enum AW_MouseButton {
71    AW_BUTTON_NONE   = 0,
72    AW_BUTTON_LEFT   = 1,
73    AW_BUTTON_MIDDLE = 2,
74    AW_BUTTON_RIGHT  = 3,
75    AW_WHEEL_UP      = 4,
76    AW_WHEEL_DOWN    = 5,
77};
78
79struct AW_event {
80    // fields always valid
81    AW_event_type type;             // AW_Keyboard or AW_Mouse
82    unsigned long time;             // time in msec, when event occurred
83    AW_key_mod    keymodifier;      // control, alt/meta (shift only for type == AW_Mouse)
84
85    // fields valid for type == AW_Mouse
86    AW_MouseButton button;
87    int            x, y;            // pointer x,y coordinates in the event window
88
89    // fields valid for type == AW_Keyboard
90    AW_key_code keycode;            // which key type was pressed
91    char        character;          // the c character
92
93    AW_event()
94        : type(AW_event_type(0)),
95          time(0),
96          keymodifier(AW_KEYMODE_NONE),
97          button(AW_BUTTON_NONE),
98          x(0),
99          y(0),
100          keycode(AW_KEY_NONE),
101          character(0)
102    {}
103};
104
105void AW_help_popup(UNFIXED, const char *help_file);
106inline WindowCallback makeHelpCallback(const char *helpfile) { return makeWindowCallback(AW_help_popup, helpfile); }
107
108void AW_help_entry_pressed(AW_window *);
109void AW_clock_cursor(AW_root *);
110void AW_normal_cursor(AW_root *);
111
112void AW_openURL(AW_root *aw_root, const char *url);
113
114// when using NEVER_RECORDED_ID as part of a button- or menu-ID or
115// as part of an awar-name, actions related to these IDs will
116// silently not get macro-recorded:
117#define NEVER_RECORDED_ID "___NEVER_MACRO_RECORDED___"
118
119typedef void (*AW_cb_struct_guard)();
120typedef WindowCallbackSimple AnyWinCB; // used to check whether function is contained in callback-list (does not check parameters!)
121
122class AW_cb : virtual Noncopyable {
123    WindowCallback cb;
124
125    AW_cb *next;
126
127    static AW_cb_struct_guard guard_before;
128    static AW_cb_struct_guard guard_after;
129    static AW_postcb_cb       postcb; // called after each cb triggered via interface
130
131public:
132    // private (read-only):
133    AW_window  *aw;
134    const char *help_text;
135    char       *id;
136
137    // real public section:
138    AW_cb(AW_window             *awi,
139          const WindowCallback&  wcb,
140          const char            *help_texti = NULp,
141          AW_cb                 *next       = NULp);
142
143    ~AW_cb() {
144        delete next; next = NULp;
145        free(id);
146    }
147
148    void run_callbacks();                           // runs the whole list
149    bool contains(AnyWinCB 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
228enum AW_ScalerType {
229    AW_SCALER_LINEAR,
230    AW_SCALER_EXP_LOWER,  // fine-tuned at lower border, big steps at upper border
231    AW_SCALER_EXP_UPPER,  // fine-tuned at upper border, big steps at lower border
232    AW_SCALER_EXP_CENTER, // fine-tuned at center, big steps at borders
233    AW_SCALER_EXP_BORDER, // fine-tuned at borders, big steps at center
234};
235
236class AW_ScalerTransformer {
237    AW_ScalerType type;
238public:
239    AW_ScalerTransformer(AW_ScalerType type_) : type(type_) {}
240
241    float scaler2awar(float scaler, AW_awar *awar); // [0..1] -> awar-range
242    float awar2scaler(AW_awar *awar); // returns [0..1]
243};
244
245class AW_window : virtual Noncopyable {
246    AW_SizeRecalc recalc_size_at_show;
247    AW_PosRecalc  recalc_pos_at_show;
248
249    WindowCallback *hide_cb;
250    bool            expose_callback_added;
251
252    AW_cb *focus_cb;
253
254    AW_xfig *xfig_data;
255    AW_at   *_at; /** < Defines the next position at which something will be inserted into the window.  */
256
257    int left_indent_of_horizontal_scrollbar;
258    int top_indent_of_vertical_scrollbar;
259
260    const char *layout_reset_wanted;
261
262    char *window_title;
263    char *window_id; //! used to localize macro IDs. has to be unique.
264
265    void all_menus_created() const;
266    void create_toggle(const char *var_name, aw_toggle_data *tdata);
267
268    int calculate_string_width(int columns) const;
269    int calculate_string_height(int columns, int offset) const;
270    char *align_string(const char *label_text, int columns);
271
272    void calculate_label_size(int *width, int *height, bool in_pixel);
273
274protected:
275    AW_root *root;
276
277    void create_devices();
278    void set_background(const char *colorname, Widget w);
279    void set_title_and_id(const char *title, const char *id);
280
281    void wm_activate();                                // un-minimize window and give it the focus (use show_and_activate())
282
283public:
284
285    // ---------------------------------------- [start read-only section] @@@ should go private
286
287    AW_event         event;
288    unsigned long    click_time;
289    long             color_table_size;
290    AW_rgb          *color_table;
291    AW_window_Motif *p_w;
292    AW_cb           *_callback;
293    AW_cb           *_d_callback;
294
295    // ---------------------------------------- [end read-only section]
296
297#if defined(IN_ARB_WINDOW)
298    // only used internal and in motif (alternative would be to move a bunch of code into AW_window)
299    const AW_at& get_at() const { return *_at; }
300    AW_at& get_at() { return *_at; }
301#endif
302
303    AW_window();
304    virtual ~AW_window();
305
306    const char    *local_awarname(const char *common_name, bool tmp = true);
307    class AW_awar *local_awar(const char *common_name, bool tmp = true);
308
309    const char *local_id(const char *id) const;
310    char *local_id_copy(const char *id) const;
311
312    void create_window_variables();
313
314    void recalc_pos_atShow(AW_PosRecalc pr);
315    void recalc_size_atShow(enum AW_SizeRecalc sr);
316    AW_PosRecalc get_recalc_pos_atShow() const;
317
318    void reset_layout(const char *YYYYMMDD);
319
320    void allow_delete_window(bool allow_close);
321    void on_hide(const WindowCallback& call_on_hide);
322    void on_hide(WindowCallbackSimple call_on_hide) { on_hide(makeWindowCallback(call_on_hide)); }
323
324
325    void run_focus_callback();
326    void run_popup_callbacks();
327    void show_modal();
328
329    void update_label(Widget widget, const char *var_value);
330    void update_toggle(Widget widget, const char *var_value, AW_CL cd);
331    void update_input_field(Widget widget, const char *var_value);
332    void update_text_field(Widget widget, const char *var_value);
333    void update_scaler(Widget widget, AW_awar *awar, AW_ScalerType scalerType);
334
335    void  create_invisible(int columns);
336    void *_create_option_entry(AW_VARIABLE_TYPE type, const char *name, const char *mnemonic, const char *name_of_color);
337    void  refresh_toggle_field(int toggle_field_number);
338    void  _set_activate_callback(void *widget);
339    void  increment_at_commands(int width, int height);
340
341
342    AW_color_idx alloc_named_data_color(int colnum, const char *colorname);
343
344    // special for EDIT4
345    void _get_area_size(AW_area area, AW_screen_area *square);
346
347    int label_widget(void *wgt, AW_label str, char *mnemonic = NULp, int width = 0, int alignment = 0);
348
349    // ------------------------------
350    //      The read only section
351
352    int slider_pos_vertical;   //! current position of the vertical slider
353    int slider_pos_horizontal; //! current position of the horizontal slider
354
355    bool window_is_shown;
356
357    AW_screen_area *picture;      // the result of tell scrolled picture size
358
359    // --------------------------------
360    //      The real public section
361
362    AW_root *get_root() { return root; }
363    // ******************* Global layout functions **********************
364
365    void show(); // show newly created window or unhide hidden window (aka closed window)
366    void hide(); // hide (don't destroy) a window (<->show)
367
368    void activate() { show(); wm_activate(); }      // make_visible, pop window to front and give it the focus
369
370    bool is_shown() const;  // is window visible (== true) or hidden (== false). ?
371
372    void hide_or_notify(const char *error);
373
374    void set_window_title(const char *title); // Set the window title
375
376    const char *get_window_title() const;       // Get the window's title
377    const char *get_window_id() const { return window_id; } // Get the window's unique ID
378
379    void set_info_area_height(int height);
380    void set_bottom_area_height(int height);
381
382    // ******************* Input and Motion Events **********************
383
384    void set_popup_callback(const WindowCallback& wcb);
385    void set_focus_callback(const WindowCallback& wcb);
386    bool is_focus_callback(AnyWinCB f);
387
388    void set_expose_callback(AW_area area, const WindowCallback& wcb);
389    void set_resize_callback(AW_area area, const WindowCallback& wcb);
390
391private:
392    // motif relicts:
393    void set_expose_callback(AW_area area, WindowCallbackSimple cb) { set_expose_callback(area, makeWindowCallback(cb)); }
394    void set_resize_callback(AW_area area, WindowCallbackSimple cb) { set_resize_callback(area, makeWindowCallback(cb)); }
395public:
396
397    void set_input_callback(AW_area area, const WindowCallback& wcb);
398    void set_motion_callback(AW_area area, const WindowCallback& wcb);
399
400    void set_double_click_callback(AW_area area, const WindowCallback& wcb);
401
402    bool is_expose_callback(AW_area area, AnyWinCB f);
403    bool is_resize_callback(AW_area area, AnyWinCB f);
404
405    void get_event(AW_event *eventi) const;       // In an event callback get the events info
406
407    void force_expose(); // forces the window to expose instantly
408
409    // ******************* Get the devices **********************
410    AW_device *get_device(AW_area area);
411    AW_device_click *get_click_device(AW_area area, int mousex, int mousey, int max_distance);
412    AW_device_size *get_size_device(AW_area area);
413    AW_device_print *get_print_device(AW_area area);
414
415    AW_common *get_common(AW_area area);
416
417    // ************** Create the menu buttons *********
418
419    /**
420     * Creates a new top level menu.
421     * @param name     Name of the menu.
422     * @param mnemonic Shortcut (optional)
423     * @param mask     Experts only?
424     */
425    void create_menu(const char *name, const char *mnemonic, AW_active mask = AWM_ALL);
426
427    /**
428     * Insert a sub menu into the last created menu.
429     * @param name     Name of the sub menu.
430     * @param mnemonic Shortcut (optional)
431     * @param mask     Experts only?
432     */
433    void insert_sub_menu(const char *name, const char *mnemonic, AW_active mask = AWM_ALL);
434
435    /**
436     * Insert a menu item into the last created menu or sub menu.
437     * @param id           Unique id (for macros)
438     * @param name         Name of the item.
439     * @param mnemonic     Shortcut (optional)
440     * @param help_text_   Name of helpfile (optional)
441     * @param mask         Experts only?
442     * @param wcb Callback that should be called when the item is activated.
443     */
444    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback& wcb);
445
446    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)); }
447    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)); }
448    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)); }
449
450    void sep______________();
451    void close_sub_menu();
452
453    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, const WindowCallback& cb);
454    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, WindowCallbackSimple cb) { insert_help_topic(labeli, mnemonic, helpText, mask, makeWindowCallback(cb)); }
455
456    // ************** Create modes on the left side ******************
457    int create_mode(const char *pixmap, const char *help_text_, AW_active mask, const WindowCallback& cb);
458    void select_mode(int mode);
459
460    // ************** Control the size of the main drawing area + scrollbars  *********
461    void tell_scrolled_picture_size(AW_screen_area rectangle);
462    void tell_scrolled_picture_size(AW_world rectangle);
463    AW_pos get_scrolled_picture_width() const;
464    AW_pos get_scrolled_picture_height() const;
465    void reset_scrolled_picture_size();
466
467    void get_scrollarea_size(AW_screen_area *square);
468
469    void calculate_scrollbars();
470    void set_vertical_scrollbar_position(int position);
471    void set_horizontal_scrollbar_position(int position);
472
473    void set_vertical_change_callback(const WindowCallback& wcb);
474    void set_horizontal_change_callback(const WindowCallback& wcb);
475    void set_vertical_scrollbar_top_indent(int indent);
476    void set_horizontal_scrollbar_left_indent(int indent);
477
478
479    void update_scrollbar_settings_from_awars(AW_orientation orientation);
480
481    void create_user_geometry_awars(int posx, int posy, int width, int height);
482
483    // ************** Control window size  *********
484#if defined(IN_ARB_WINDOW)
485    void set_window_size(int width, int height);
486#endif
487    void get_window_size(int& width, int& height);
488    void window_fit();                              // Recalculate the size of a window with buttons
489
490#if defined(IN_ARB_WINDOW)
491    void store_size_in_awars(int width, int height);
492    void get_size_from_awars(int& width, int& height);
493
494    // ************** Control window position  *********
495    void set_window_frame_pos(int xpos, int ypos);
496    void get_window_content_pos(int& xpos, int& ypos);
497
498    void store_pos_in_awars(int xpos, int ypos);
499    void get_pos_from_awars(int& xpos, int& ypos);
500
501    void reset_geometry_awars();
502
503    // *****************
504    void get_screen_size(int& width, int& height);
505    bool get_mouse_pos(int& x, int& y);
506    void set_focus_policy(bool follow_mouse);
507    void get_font_size(int& w, int& h);
508#endif
509
510    // ************** ********************************************************************  *********
511    // ************** Create buttons: First set modify flags and finally create the button  *********
512    // ************** ********************************************************************  *********
513
514    // *** global modifier: ****
515    void load_xfig(const char *file, bool resize=true); // Loads the background graphic
516    void draw_line(int x1, int y1, int x2, int y2, int width, bool resize); // draws a line on the background
517
518    void label_length(int length);   // Justifies all following labels
519    void button_length(int length);   // Sets the width of all following buttons (in chars)
520    void button_height(int height);   // Sets the height of all following buttons (in lines)
521    int  get_button_length() const; // returns the current width of buttons
522    void highlight();           // Creates a frame around the button
523    void auto_increment(int dx, int dy);   // enable automatic placement of buttons
524    // dx is the horizontal distance between the left
525    // borders of two buttons
526    void auto_space(int xspace, int yspace);   // enable automatic placement of buttons
527    // xspace is the horizontal space between 2 buttons
528
529    void shadow_width (int shadow_thickness); // set the shadow_thickness of buttons
530
531    void TuneBackground(Widget w, int modStrength);
532    void TuneOrSetBackground(Widget w, const char *color, int modStrength);
533
534    // *** local modifiers: ********
535    void at(int x, int y);      // abs pos of a button (>10,10)
536    void at_x(int x);           // abs x pos
537    void at_y(int y);           // abs y pos
538    void at_shift(int x, int y);   // rel pos of a button
539    void at_newline();          // in auto_space mode only: newline
540
541    void at(const char *id);                        /* place the button at the position set in the .fig
542                                                     * file (loaded with load_xfig) by the string $id */
543    bool at_ifdef(const  char *id);                 // check whether 'id' is an element if the .fig file
544
545    void label(const char *label);   // Create a label before the button
546
547    void get_at_position(int *x, int *y) const;
548    int get_at_xposition() const;
549    int get_at_yposition() const;
550
551    void dump_at_position(const char *debug_label) const; // for debugging (uses printf)
552
553    void at_attach(int x, int y);                                        // set "XY:noid" manually (use negative rel. position to attach)
554    void at_attach_to(bool attach_x, bool attach_y, int xoff, int yoff); // set "to:XY:noid" manually
555    void at_unattach();                                                  // unset effects of at_attach() and/or at_attach_to()
556
557    void unset_at_commands();
558
559    void store_at_to(AW_at_storage& storage) { storage.store(*_at); }
560    void restore_at_from(const AW_at_storage& stored) { stored.restore(*_at); }
561
562    void sens_mask(AW_active mask);   // Set the sensitivity mask used for following widgets (Note: reset by next at()-command)
563    void help_text(const char *id);   // Set the help text of a button
564
565private:
566    static void popper(AW_window *, CreateWindowCallback *windowMaker);
567    static void replacer(AW_window *aww, CreateWindowCallback *windowMaker);
568    static void destroyCreateWindowCallback(CreateWindowCallback *windowMaker);
569public:
570    static WindowCallback makeWindowPopper(const CreateWindowCallback& cwcb) {
571        return makeWindowCallback(popper, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
572    }
573    static WindowCallback makeWindowReplacer(const CreateWindowCallback& cwcb) {
574        return makeWindowCallback(replacer, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
575    }
576
577    // normal callbacks
578    void callback(const WindowCallback& cb);
579
580    void callback(const CreateWindowCallback& cwcb) { callback(makeWindowPopper(cwcb)); }
581    void callback(CreateWindowCallbackSimple cb)    { callback(makeCreateWindowCallback(cb)); }
582    void callback(WindowCallbackSimple cb)          { callback(makeWindowCallback(cb)); }
583
584    void d_callback(const WindowCallback& cb); // secondary callback (called for 'double click into selection list' and 'text field hit ENTER')
585
586    void alias_remote_command(const char *action_alias, const char *registered_action);
587
588    // *** create the buttons ********
589    void   create_button(const char *macro_name, AW_label label, const char *mnemonic = NULp, const char *color = NULp); // simple button; shadow only when callback
590    void   create_autosize_button(const char *macro_name, AW_label label, const char *mnemonic = NULp, unsigned xtraSpace = 1); // as above, but ignores button_length
591    Widget get_last_widget() const;
592
593    void create_toggle(const char *awar_name);  // int 0/1  string yes/no   float undef
594    void create_inverse_toggle(const char *awar_name);  // like create_toggle, but displays inverted toggle value
595
596    void create_toggle(const char *awar_name, const char *nobitmap, const char *yesbitmap, int buttonWidth = 0);
597    void create_text_toggle(const char *var_name, const char *noText, const char *yesText, int buttonWidth = 0);
598
599    void create_input_field(const char *awar_name, int columns = 0);                 // One line textfield
600    void create_text_field(const char *awar_name, int columns = 20, int rows = 4);   // Multi line textfield with scrollbars
601    void create_input_field_with_scaler(const char *awar_name, int textcolumns = 4, int scaler_length = 250, AW_ScalerType scalerType = AW_SCALER_LINEAR);
602
603
604    // ***** option_menu is a menu where only one selection is visible at a time
605    AW_option_menu_struct *create_option_menu(const char *awar_name);
606    void clear_option_menu(AW_option_menu_struct *oms);  // used to redefine available options
607
608private:
609    void insert_option_internal(AW_label choice_label, const char *mnemonic, const char *var_value,  const char *name_of_color, bool default_option);
610    void insert_option_internal(AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color, bool default_option);
611    void insert_option_internal(AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color, bool default_option);
612
613    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, const char *var_value, bool default_toggle);
614    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, int var_value,         bool default_toggle);
615    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, float var_value,       bool default_toggle);
616public:
617
618    // for string
619    void insert_option         (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = NULp);  // for string
620    void insert_default_option (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = NULp);
621    // for int
622    void insert_option         (AW_label choice_label, const char *mnemonic, int var_value,         const char *name_of_color = NULp);  // for int
623    void insert_default_option (AW_label choice_label, const char *mnemonic, int var_value,         const char *name_of_color = NULp);
624    // for float
625    void insert_option         (AW_label choice_label, const char *mnemonic, float var_value,       const char *name_of_color = NULp);  // for float
626    void insert_default_option (AW_label choice_label, const char *mnemonic, float var_value,       const char *name_of_color = NULp);
627
628    void update_option_menu();
629    void refresh_option_menu(AW_option_menu_struct *);  // don't use this
630
631
632    // ***** toggle_field is a static menu (all items are visible and only one is selected)
633    void create_toggle_field(const char *awar_name, AW_label label, AW_orientation orientation = AW_VERTICAL);
634    void create_toggle_field(const char *awar_name, AW_orientation orientation = AW_VERTICAL);
635    // for string
636    void insert_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
637    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
638    // for int
639    void insert_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
640    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
641    // for float
642    void insert_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
643    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
644
645    void update_toggle_field();
646
647    // ***** selection list is a redefinable scrolled list of items
648
649    AW_selection_list *create_selection_list(const char *awar_name, int columns, int rows);
650    AW_selection_list *create_selection_list(const char *awar_name) { return create_selection_list(awar_name, 4, 4); }
651};
652
653
654class AW_window_menu_modes : public AW_window { // derived from a Noncopyable
655    void *AW_window_menu_modes_private;       // Do not use !!!
656
657public:
658    AW_window_menu_modes();
659    ~AW_window_menu_modes();
660    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
661    PREPARE_MARK_NONFINAL_CLASS(AW_window_menu_modes);
662};
663MARK_NONFINAL_CLASS(AW_window_menu_modes);
664
665class AW_window_menu : public AW_window {
666private:
667public:
668    AW_window_menu();
669    ~AW_window_menu();
670    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
671};
672
673class AW_window_simple_menu : public AW_window {
674private:
675public:
676    AW_window_simple_menu();
677    ~AW_window_simple_menu();
678    void init(AW_root *root, const char *wid, const char *windowname);
679};
680
681
682class AW_window_simple FINAL_TYPE : public AW_window {
683private:
684public:
685    AW_window_simple();
686    ~AW_window_simple();
687    void init(AW_root *root, const char *wid, const char *windowname);
688};
689
690
691class AW_window_message : public AW_window {
692private:
693public:
694    AW_window_message();
695    ~AW_window_message();
696    void init(AW_root *root_in, const char *wid, const char *windowname, bool allow_close);
697    void init(AW_root *root_in, const char *windowname, bool allow_close); // auto-generates window id from title
698};
699
700class AW_gc_manager;
701
702#else
703#error aw_window.hxx included twice
704#endif
Note: See TracBrowser for help on using the repository browser.