source: tags/ms_r16q3/WINDOW/aw_window.hxx

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