NEURON
utility.h
Go to the documentation of this file.
1 #ifndef utility_h
2 #define utility_h
3 
4 #include <InterViews/dialog.h>
5 #include <IV-look/field.h>
6 #include <OS/string.h>
7 #include <InterViews/handler.h>
8 
9 #undef PopupMenu
10 
11 class Window;
12 class FieldEditor;
13 class Menu;
14 class Event;
15 class MenuItem;
16 class PopupWindow;
17 class TelltaleGroup;
18 
19 class FieldDialog: public Dialog {
20  public:
21  static FieldDialog* field_dialog_instance(const char*, Style*, Glyph* extra = NULL);
22  virtual ~FieldDialog();
23  virtual void dismiss(bool accept);
24  const String* text() const {
25  return fe_->text();
26  }
27  virtual void keystroke(const Event& e) {
28  fe_->keystroke(e);
29  }
30  virtual void accept(FieldEditor*);
31  virtual void cancel(FieldEditor*);
32  virtual bool run();
33 
34  private:
38 };
39 
40 /** true if Style 'dialog_spec_position: on' and fills x,y with
41  * dialog_left_position and dialog_bottom_position.
42  **/
44 
45 bool ok_to_write(const String&, Window* w = NULL);
46 bool ok_to_write(const char*, Window* w = NULL);
47 bool ok_to_read(const String&, Window* w = NULL);
48 bool ok_to_read(const char*, Window* w = NULL);
49 bool boolean_dialog(const char* label,
50  const char* accept,
51  const char* cancel,
52  Window* w = NULL,
53  Coord x = 400.,
54  Coord y = 400.);
55 void continue_dialog(const char* label, Window* w = NULL, Coord x = 400., Coord y = 400.);
56 
57 bool str_chooser(const char*, char*, Window* w = NULL, Coord x = 400., Coord y = 400.);
58 bool var_pair_chooser(const char*,
59  float& x,
60  float& y,
61  Window* w = NULL,
62  Coord x1 = 400.,
63  Coord y1 = 400.);
64 
65 class PopupMenu: public Handler {
66  public:
68  virtual ~PopupMenu();
69  virtual bool event(Event&);
71  Menu* menu() {
72  return menu_;
73  }
74 
75  private:
78  bool grabbed_;
79 };
80 
81 // makes sure menuitem width is size of menu width
82 class K {
83  public:
84  static MenuItem* menu_item(const char*);
85  static MenuItem* radio_menu_item(TelltaleGroup*, const char*);
86  static MenuItem* check_menu_item(const char*);
87 };
88 
90 
91 #endif
#define Window
Definition: _defines.h:333
#define Handler
Definition: _defines.h:146
#define Menu
Definition: _defines.h:176
#define PopupWindow
Definition: _defines.h:210
#define Style
Definition: _defines.h:281
#define Coord
Definition: _defines.h:19
#define Dialog
Definition: _defines.h:94
#define MenuItem
Definition: _defines.h:179
#define Event
Definition: _defines.h:107
#define TelltaleGroup
Definition: _defines.h:295
#define FieldEditor
Definition: _defines.h:111
#define Glyph
Definition: _defines.h:132
FieldDialog(Glyph *, Style *)
virtual void cancel(FieldEditor *)
CopyString s_
Definition: utility.h:37
virtual bool run()
virtual void accept(FieldEditor *)
virtual void keystroke(const Event &e)
Definition: utility.h:27
virtual void dismiss(bool accept)
static FieldDialog * field_dialog_instance(const char *, Style *, Glyph *extra=NULL)
const String * text() const
Definition: utility.h:24
virtual ~FieldDialog()
FieldEditor * fe_
Definition: utility.h:36
Definition: utility.h:82
static MenuItem * radio_menu_item(TelltaleGroup *, const char *)
static MenuItem * menu_item(const char *)
static MenuItem * check_menu_item(const char *)
bool grabbed_
Definition: utility.h:78
virtual bool event(Event &)
void append_item(MenuItem *)
Menu * menu()
Definition: utility.h:71
virtual ~PopupMenu()
Menu * menu_
Definition: utility.h:76
PopupWindow * w_
Definition: utility.h:77
Definition: string.h:34
#define e
Definition: passive0.cpp:22
#define NULL
Definition: sptree.h:16
bool var_pair_chooser(const char *, float &x, float &y, Window *w=NULL, Coord x1=400., Coord y1=400.)
bool nrn_spec_dialog_pos(Coord &x, Coord &y)
true if Style 'dialog_spec_position: on' and fills x,y with dialog_left_position and dialog_bottom_po...
bool str_chooser(const char *, char *, Window *w=NULL, Coord x=400., Coord y=400.)
bool ok_to_write(const String &, Window *w=NULL)
void handle_old_focus()
bool ok_to_read(const String &, Window *w=NULL)
bool boolean_dialog(const char *label, const char *accept, const char *cancel, Window *w=NULL, Coord x=400., Coord y=400.)
void continue_dialog(const char *label, Window *w=NULL, Coord x=400., Coord y=400.)