source: tags/arb-6.0/WINDOW/aw_window.hxx

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