source: tags/ms_r17q3/WINDOW/aw_window.hxx

Last change on this file was 15966, checked in by westram, 7 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.8 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    WindowCallback *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(const WindowCallback& call_on_hide);
321    void on_hide(WindowCallbackSimple call_on_hide) { on_hide(makeWindowCallback(call_on_hide)); }
322
323
324#if defined(ARB_MOTIF)
325    void run_focus_callback();
326    void show_modal();
327    void set_window_title_intern(char *title);
328#endif
329
330    void update_label(Widget widget, const char *var_value);
331    void update_toggle(Widget widget, const char *var_value, AW_CL cd);
332    void update_input_field(Widget widget, const char *var_value);
333    void update_text_field(Widget widget, const char *var_value);
334    void update_scaler(Widget widget, AW_awar *awar, AW_ScalerType scalerType);
335
336    void  create_invisible(int columns);
337    void *_create_option_entry(AW_VARIABLE_TYPE type, const char *name, const char *mnemonic, const char *name_of_color);
338    void  refresh_toggle_field(int toggle_field_number); 
339    void  _set_activate_callback(void *widget);
340    void  increment_at_commands(int width, int height);
341
342
343    AW_color_idx alloc_named_data_color(int colnum, const char *colorname);
344
345    // special for EDIT4
346    void _get_area_size(AW_area area, AW_screen_area *square);
347   
348    int label_widget(void *wgt, AW_label str, char *mnemonic=0, int width = 0, int alignment = 0);
349
350    // ------------------------------
351    //      The read only section
352
353    char *window_name;          //! window title
354    char *window_defaults_name; //! window id
355
356    int slider_pos_vertical;   //! current position of the vertical slider
357    int slider_pos_horizontal; //! current position of the horizontal slider
358
359    bool window_is_shown;
360
361    AW_screen_area *picture;      // the result of tell scrolled picture size
362
363    // --------------------------------
364    //      The real public section
365
366    AW_root *get_root() { return root; }
367    // ******************* Global layout functions **********************
368
369    void show(); // show newly created window or unhide hidden window (aka closed window)
370    void hide(); // hide (don't destroy) a window (<->show)
371
372    void activate() { show(); wm_activate(); }      // make_visible, pop window to front and give it the focus
373
374    bool is_shown() const;  // is window visible (== true) or hidden (== false). ?
375
376    void hide_or_notify(const char *error);
377
378    void    message(char *title, int ms);   // Set for ms milliseconds the title of the window
379    void    set_window_title(const char *title);   // Set the window title forever
380
381    const char *get_window_title() const;       // Get the window's title
382    const char *get_window_id() const { return window_defaults_name; } // Get the window's internal name
383
384    const char *local_id(const char *id) const;
385
386    void set_info_area_height(int height);
387    void set_bottom_area_height(int height);
388
389    // ******************* Input and Motion Events **********************
390
391    void set_popup_callback(const WindowCallback& wcb);
392    void set_focus_callback(const WindowCallback& wcb);
393    bool is_focus_callback(AnyWinCB f);
394
395    void set_expose_callback(AW_area area, const WindowCallback& wcb);
396    void set_resize_callback(AW_area area, const WindowCallback& wcb);
397
398private:
399    // motif relicts:
400    void set_expose_callback(AW_area area, WindowCallbackSimple cb) { set_expose_callback(area, makeWindowCallback(cb)); }
401    void set_resize_callback(AW_area area, WindowCallbackSimple cb) { set_resize_callback(area, makeWindowCallback(cb)); }
402public:
403
404    void set_input_callback(AW_area area, const WindowCallback& wcb);
405    void set_motion_callback(AW_area area, const WindowCallback& wcb);
406
407    void set_double_click_callback(AW_area area, const WindowCallback& wcb);
408
409    bool is_expose_callback(AW_area area, AnyWinCB f);
410    bool is_resize_callback(AW_area area, AnyWinCB f);
411
412    void get_event(AW_event *eventi) const;       // In an event callback get the events info
413
414    void force_expose(); // forces the window to expose instantly
415
416    // ******************* Get the devices **********************
417    AW_device *get_device(AW_area area);
418    AW_device_click *get_click_device(AW_area area, int mousex, int mousey, int max_distance);
419    AW_device_size *get_size_device(AW_area area);
420    AW_device_print *get_print_device(AW_area area);
421
422    AW_common *get_common(AW_area area);
423
424    // ************** Create the menu buttons *********
425
426    /**
427     * Creates a new top level menu.
428     * @param name     Name of the menu.
429     * @param mnemonic Shortcut (optional)
430     * @param mask     Experts only?
431     */
432    void create_menu(const char *name, const char *mnemonic, AW_active mask = AWM_ALL);
433
434    /**
435     * Insert a sub menu into the last created menu.
436     * @param name     Name of the sub menu.
437     * @param mnemonic Shortcut (optional)
438     * @param mask     Experts only?
439     */
440    void insert_sub_menu(const char *name, const char *mnemonic, AW_active mask = AWM_ALL);
441
442    /**
443     * Insert a menu item into the last created menu or sub menu.
444     * @param id           Unique id (for macros)
445     * @param name         Name of the item.
446     * @param mnemonic     Shortcut (optional)
447     * @param help_text_   Name of helpfile (optional)
448     * @param mask         Experts only?
449     * @param wcb Callback that should be called when the item is activated.
450     */
451    void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback& wcb);
452
453    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)); }
454    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)); }
455    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)); }
456
457    void sep______________();
458    void close_sub_menu();
459
460    void insert_help_topic(const char *labeli, const char *mnemonic, const char *helpText, AW_active mask, const WindowCallback& cb);
461    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)); }
462
463    // ************** Create modes on the left side ******************
464    int create_mode(const char *pixmap, const char *help_text_, AW_active mask, const WindowCallback& cb);
465    void select_mode(int mode);
466
467    // ************** Control the size of the main drawing area + scrollbars  *********
468    void tell_scrolled_picture_size(AW_screen_area rectangle);
469    void tell_scrolled_picture_size(AW_world rectangle);
470    AW_pos get_scrolled_picture_width() const;
471    AW_pos get_scrolled_picture_height() const;
472    void reset_scrolled_picture_size();
473
474    void get_scrollarea_size(AW_screen_area *square);
475
476    void calculate_scrollbars();
477    void set_vertical_scrollbar_position(int position);
478    void set_horizontal_scrollbar_position(int position);
479
480    void set_vertical_change_callback(const WindowCallback& wcb);
481    void set_horizontal_change_callback(const WindowCallback& wcb);
482    void set_vertical_scrollbar_top_indent(int indent);
483    void set_horizontal_scrollbar_left_indent(int indent);
484
485
486    void update_scrollbar_settings_from_awars(AW_orientation orientation);
487
488    void create_user_geometry_awars(int posx, int posy, int width, int height);
489   
490    // ************** Control window size  *********
491#if defined(IN_ARB_WINDOW)
492    void set_window_size(int width, int height);
493#endif
494    void get_window_size(int& width, int& height);
495    void window_fit();                              // Recalculate the size of a window with buttons
496
497#if defined(IN_ARB_WINDOW)
498    void store_size_in_awars(int width, int height);
499    void get_size_from_awars(int& width, int& height);
500
501    // ************** Control window position  *********
502    void set_window_frame_pos(int xpos, int ypos);
503    void get_window_content_pos(int& xpos, int& ypos);
504
505    void store_pos_in_awars(int xpos, int ypos);
506    void get_pos_from_awars(int& xpos, int& ypos);
507
508#if defined(ARB_MOTIF)
509    void reset_geometry_awars();
510#endif
511
512    // *****************
513    void get_screen_size(int& width, int& height);
514    bool get_mouse_pos(int& x, int& y);
515    void set_focus_policy(bool follow_mouse);
516    void get_font_size(int& w, int& h);
517#endif
518   
519    // ************** ********************************************************************  *********
520    // ************** Create buttons: First set modify flags and finally create the button  *********
521    // ************** ********************************************************************  *********
522
523    // *** global modifier: ****
524    void load_xfig(const char *file, bool resize=true); // Loads the background graphic
525    void draw_line(int x1, int y1, int x2, int y2, int width, bool resize); // draws a line on the background
526
527    void label_length(int length);   // Justifies all following labels
528    void button_length(int length);   // Sets the width of all following buttons (in chars)
529#if defined(ARB_MOTIF)
530    void button_height(int height);   // Sets the height of all following buttons (in lines)
531#endif
532    int  get_button_length() const; // returns the current width of buttons
533    void highlight();           // Creates a frame around the button
534    void auto_increment(int dx, int dy);   // enable automatic placement of buttons
535    // dx is the horizontal distance between the left
536    // borders of two buttons
537    void auto_space(int xspace, int yspace);   // enable automatic placement of buttons
538    // xspace is the horizontal space between 2 buttons
539
540    void shadow_width (int shadow_thickness); // set the shadow_thickness of buttons
541
542#if defined(ARB_MOTIF)
543    void TuneBackground(Widget w, int modStrength);
544    void TuneOrSetBackground(Widget w, const char *color, int modStrength);
545#endif
546
547    // *** local modifiers: ********
548    void at(int x, int y);      // abs pos of a button (>10,10)
549    void at_x(int x);           // abs x pos
550    void at_y(int y);           // abs y pos
551    void at_shift(int x, int y);   // rel pos of a button
552    void at_newline();          // in auto_space mode only: newline
553
554    void at(const char *id);                        /* place the button at the position set in the .fig
555                                                     * file (loaded with load_xfig) by the string $id */
556    bool at_ifdef(const  char *id);                 // check whether 'id' is an element if the .fig file
557
558    void label(const char *label);   // Create a label before the button
559
560    void get_at_position(int *x, int *y) const;
561    int get_at_xposition() const;
562    int get_at_yposition() const;
563
564    void dump_at_position(const char *debug_label) const; // for debugging (uses printf)
565
566    void at_attach(int x, int y);                                        // set "XY:noid" manually (use negative rel. position to attach)
567    void at_attach_to(bool attach_x, bool attach_y, int xoff, int yoff); // set "to:XY:noid" manually
568    void at_unattach();                                                  // unset effects of at_attach() and/or at_attach_to()
569
570    void unset_at_commands();
571
572    void store_at_to(AW_at_storage& storage) { storage.store(*_at); }
573    void restore_at_from(const AW_at_storage& stored) { stored.restore(*_at); }
574
575    void sens_mask(AW_active mask);   // Set the sensitivity mask used for following widgets (Note: reset by next at()-command)
576    void help_text(const char *id);   // Set the help text of a button
577
578private:
579    static void popper(AW_window *, CreateWindowCallback *windowMaker);
580    static void replacer(AW_window *aww, CreateWindowCallback *windowMaker);
581    static void destroyCreateWindowCallback(CreateWindowCallback *windowMaker);
582public:
583    static WindowCallback makeWindowPopper(const CreateWindowCallback& cwcb) {
584        return makeWindowCallback(popper, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
585    }
586    static WindowCallback makeWindowReplacer(const CreateWindowCallback& cwcb) {
587        return makeWindowCallback(replacer, destroyCreateWindowCallback, new CreateWindowCallback(cwcb));
588    }
589
590    // normal callbacks
591    void callback(const WindowCallback& cb);
592
593    void callback(const CreateWindowCallback& cwcb) { callback(makeWindowPopper(cwcb)); }
594    void callback(CreateWindowCallbackSimple cb)    { callback(makeCreateWindowCallback(cb)); }
595    void callback(WindowCallbackSimple cb)          { callback(makeWindowCallback(cb)); }
596
597    void d_callback(const WindowCallback& cb); // secondary callback (called for 'double click into selection list' and 'text field hit ENTER')
598
599    // *** create the buttons ********
600    void   create_button(const char *macro_name, AW_label label, const char *mnemonic = 0, const char *color = 0); // simple button; shadow only when callback
601    void   create_autosize_button(const char *macro_name, AW_label label, const char *mnemonic = 0, unsigned xtraSpace = 1); // as above, but ignores button_length
602    Widget get_last_widget() const;
603
604    void create_toggle(const char *awar_name);  // int 0/1  string yes/no   float undef
605    void create_inverse_toggle(const char *awar_name);  // like create_toggle, but displays inverted toggle value
606
607    void create_toggle(const char *awar_name, const char *nobitmap, const char *yesbitmap, int buttonWidth = 0);
608    void create_text_toggle(const char *var_name, const char *noText, const char *yesText, int buttonWidth = 0);
609
610    void create_input_field(const char *awar_name, int columns = 0);                 // One line textfield
611    void create_text_field(const char *awar_name, int columns = 20, int rows = 4);   // Multi line textfield with scrollbars
612    void create_input_field_with_scaler(const char *awar_name, int textcolumns = 4, int scaler_length = 250, AW_ScalerType scalerType = AW_SCALER_LINEAR);
613
614
615    // ***** option_menu is a menu where only one selection is visible at a time
616    AW_option_menu_struct *create_option_menu(const char *awar_name, bool fallback2default);
617    void clear_option_menu(AW_option_menu_struct *oms);  // used to redefine available options
618
619private:
620    void insert_option_internal(AW_label choice_label, const char *mnemonic, const char *var_value,  const char *name_of_color, bool default_option);
621    void insert_option_internal(AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color, bool default_option);
622    void insert_option_internal(AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color, bool default_option);
623
624    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, const char *var_value, bool default_toggle);
625    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, int var_value,          bool default_toggle);
626    void insert_toggle_internal(AW_label toggle_label, const char *mnemonic, float var_value,        bool default_toggle);
627public:
628
629    // for string
630    void insert_option         (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = 0);  // for string
631    void insert_default_option (AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color = 0);
632    // for int
633    void insert_option         (AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color = 0);  // for int
634    void insert_default_option (AW_label choice_label, const char *mnemonic, int var_value,          const char *name_of_color = 0);
635    // for float
636    void insert_option         (AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color = 0);  // for float
637    void insert_default_option (AW_label choice_label, const char *mnemonic, float var_value,        const char *name_of_color = 0);
638
639    void update_option_menu();
640    void refresh_option_menu(AW_option_menu_struct *);  // don't use this
641
642
643    // ***** toggle_field is a static menu (all items are visible and only one is selected)
644    void create_toggle_field(const char *awar_name, AW_label label, const char *mnemonic);
645    void create_toggle_field(const char *awar_name, int orientation = 0);  // 1 = horizontal
646    // for string
647    void insert_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
648    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value);
649    // for int
650    void insert_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
651    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, int var_value);
652    // for float
653    void insert_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
654    void insert_default_toggle(AW_label toggle_label, const char *mnemonic, float var_value);
655    void update_toggle_field();
656
657    // ***** selection list is a redefinable scrolled list of items
658
659    AW_selection_list *create_selection_list(const char *awar_name, int columns, int rows, bool fallback2default);
660    AW_selection_list *create_selection_list(const char *awar_name, bool fallback2default) { return create_selection_list(awar_name, 4, 4, fallback2default); }
661};
662
663
664class AW_window_menu_modes : public AW_window { // derived from a Noncopyable
665    void *AW_window_menu_modes_private;       // Do not use !!!
666   
667public:
668    AW_window_menu_modes();
669    ~AW_window_menu_modes();
670    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
671};
672MARK_NONFINAL_CLASS(AW_window_menu_modes);
673
674class AW_window_menu : public AW_window {
675private:
676public:
677    AW_window_menu();
678    ~AW_window_menu();
679    void init(AW_root *root, const char *wid, const char *windowname, int width, int height);
680};
681
682class AW_window_simple_menu : public AW_window {
683private:
684public:
685    AW_window_simple_menu();
686    ~AW_window_simple_menu();
687    void init(AW_root *root, const char *wid, const char *windowname);
688};
689
690
691class AW_window_simple FINAL_TYPE : public AW_window {
692private:
693public:
694    AW_window_simple();
695    ~AW_window_simple();
696    void init(AW_root *root, const char *wid, const char *windowname);
697};
698
699
700class AW_window_message : public AW_window {
701private:
702public:
703    AW_window_message();
704    ~AW_window_message();
705    void init(AW_root *root_in, const char *wid, const char *windowname, bool allow_close);
706    void init(AW_root *root_in, const char *windowname, bool allow_close); // auto-generates window id from title
707};
708
709class AW_gc_manager;
710
711#else
712#error aw_window.hxx included twice
713#endif
Note: See TracBrowser for help on using the repository browser.