NEURON
apwindow.h
Go to the documentation of this file.
1 #ifndef dismiswin_h
2 #define dismiswin_h
3 
4 #include <InterViews/window.h>
5 
6 #include <InterViews/action.h>
7 #include <InterViews/handler.h>
8 #include <InterViews/observe.h>
9 #include <OS/string.h>
10 #include <ivstream.h>
11 
12 class Menu;
13 class MenuItem;
14 class OcGlyph;
15 class DismissableWindow;
16 class TopLevelWindow;
17 class OcGlyphContainer;
18 class PolyGlyph;
19 
20 // action for dismissing
21 class WinDismiss : public Handler { //dismiss a Window
22 public:
24  virtual ~WinDismiss();
25  virtual void execute(); //this can be replaced
26  virtual bool event(Event&);
27  static void dismiss_defer();
28 protected:
30 private:
33 };
34 
35 // Can be dismissed by window manager without quitting.
36 // The style determines dynamically if this is transient or toplevel
38 public:
39  DismissableWindow(Glyph*, bool force_menubar = false);
40  virtual ~DismissableWindow();
41  virtual void dismiss();
42  virtual const char* name() const;
43  virtual void name(const char*);
44  virtual void replace_dismiss_action(WinDismiss*);
45  virtual Glyph* glyph() const {return glyph_;}
46  virtual void configure();
47  virtual void set_attributes();
48  MenuItem* append_menubar(const char*); // return NULL if no dismiss menubar
49 
50  static bool is_transient() { return is_transient_; }
51 private:
55  static bool is_transient_;
57 };
58 
59 
60 // If you want to place a screen window onto a piece of paper
61 class PrintableWindow : public DismissableWindow , public Observable {
62 public:
64  virtual ~PrintableWindow();
65  virtual void map();
66  virtual void unmap();
67  virtual void hide();
68  virtual bool receive(const Event&);
69  virtual void reconfigured();
70  // The glyph the user actually wants printed
71  virtual Glyph* print_glyph();
72  // for size of what actually gets printed
73  virtual Coord left_pw() const;
74  virtual Coord bottom_pw() const;
75  virtual Coord width_pw() const;
76  virtual Coord height_pw() const;
77  void type(const char*);
78  const char* type() const;
79  static OcGlyphContainer* intercept(OcGlyphContainer*); // instead of window put in a box
80  virtual void map_notify();
81  virtual void unmap_notify() {};
82  virtual Coord save_left() const; // offset by window decoration
83  virtual Coord save_bottom() const; // see nrn.defaults
84  int xleft() const;
85  int xtop() const;
86  void xplace(int left, int top); // in x display pixel coords
87  void xmove(int left, int top);
88  void request_on_resize(bool);
89  static PrintableWindow* leader() { return leader_; }
90  static void leader(PrintableWindow* w) { leader_ = w; }
91 protected:
92  virtual void default_geometry();
93 private:
96  bool mappable_;
97  bool xplace_;
98  int xleft_;
99  int xtop_;
101 };
102 
103 // canvas with hbox and menubar at top and left and right vboxes
104 // the main glyph area resizes according to the window size.
106 public:
108  Glyph* main, Glyph* info=NULL, Menu* m=NULL, Glyph* l=NULL, Glyph* r=NULL
109  );
110  virtual ~StandardWindow();
111  Menu* menubar();
112  Glyph* canvas_glyph();
113  Glyph* info();
114  Glyph* lbox();
115  Glyph* rbox();
116 private:
119  Glyph* info_, *l_, *r_;
120 };
121 
122 class PWMImpl;
123 class JavaWindow;
124 
126 public:
128  virtual ~PrintableWindowManager();
129  void psfilter(const char* filename);
130  void xplace(int, int, bool map = true);
132 
133  void append(PrintableWindow*);
134  void remove(PrintableWindow*);
135  void reconfigured(PrintableWindow*);
136  void append(JavaWindow*);
137  void remove(JavaWindow*);
138  void reconfigured(JavaWindow*);
139  void doprint();
140 
141  virtual void update(Observable*);
142  virtual void disconnect(Observable*);
143 public:
144  PWMImpl* pwmi_;
145 private:
147 };
148 
149 #endif
static void dismiss_defer()
short type
Definition: cabvars.h:10
Glyph * glyph_
Definition: apwindow.h:52
virtual void execute()
virtual bool event(Event &)
#define Glyph
Definition: _defines.h:132
#define Coord
Definition: _defines.h:19
static bool is_transient_
Definition: apwindow.h:55
static void update(NrnThread *)
Definition: fadvance.cpp:570
static DismissableWindow * win_defer_
Definition: apwindow.h:31
#define Handler
Definition: _defines.h:146
CopyString type_
Definition: apwindow.h:94
bool mappable_
Definition: apwindow.h:96
virtual Glyph * glyph() const
Definition: apwindow.h:45
#define PolyGlyph
Definition: _defines.h:207
static List * info
static double map(void *v)
Definition: mlinedit.cpp:46
void append(Item *ql, Item *q)
Definition: list.cpp:348
#define Menu
Definition: _defines.h:176
virtual void unmap_notify()
Definition: apwindow.h:81
int main()
Definition: macmain.cpp:5
static double intercept(void *v)
Definition: ocbox.cpp:162
static void leader(PrintableWindow *w)
Definition: apwindow.h:90
static PrintableWindow * leader_
Definition: apwindow.h:100
Glyph * can_
Definition: apwindow.h:118
Action * dbutton_
Definition: apwindow.h:54
char * name
Definition: init.cpp:16
WinDismiss * wd_
Definition: apwindow.h:53
static DismissableWindow * win_defer_longer_
Definition: apwindow.h:32
#define left
Definition: rbtqueue.cpp:45
#define Event
Definition: _defines.h:107
static OcGlyphContainer * intercept_
Definition: apwindow.h:95
static bool is_transient()
Definition: apwindow.h:50
static List * current
Definition: nrnunit.cpp:12
#define TransientWindow
Definition: _defines.h:318
static double unmap(void *v)
Definition: ocbox.cpp:241
#define TopLevelWindow
Definition: _defines.h:313
DismissableWindow * win_
Definition: apwindow.h:29
#define Action
Definition: _defines.h:27
static PrintableWindow * leader()
Definition: apwindow.h:89
Glyph * r_
Definition: apwindow.h:119
#define MenuItem
Definition: _defines.h:179
static PrintableWindowManager * current_
Definition: apwindow.h:146
Menu * menubar_
Definition: apwindow.h:56
void disconnect(void)
Definition: cabcode.cpp:562
WinDismiss(DismissableWindow *)
return NULL
Definition: cabcode.cpp:461
virtual ~WinDismiss()