source: tags/ms_r16q2/WINDOW/aw_window.hxx

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