NEURON
apwindow.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <InterViews/window.h>
6 
7 #include <InterViews/action.h>
8 #include <InterViews/handler.h>
9 #include <InterViews/observe.h>
10 #include <OS/string.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 
29  protected:
31 
32  private:
35 };
36 
37 // Can be dismissed by window manager without quitting.
38 // The style determines dynamically if this is transient or toplevel
40  public:
41  DismissableWindow(Glyph*, bool force_menubar = false);
42  virtual ~DismissableWindow();
43  virtual void dismiss();
44  virtual const char* name() const;
45  virtual void name(const char*);
47  virtual Glyph* glyph() const {
48  return glyph_;
49  }
50  virtual void configure();
51  virtual void set_attributes();
52  MenuItem* append_menubar(const char*); // return NULL if no dismiss menubar
53 
54  static bool is_transient() {
55  return is_transient_;
56  }
57 
58  private:
62  static bool is_transient_;
64 };
65 
66 
67 // If you want to place a screen window onto a piece of paper
69  public:
71  virtual ~PrintableWindow();
72  virtual void map();
73  virtual void unmap();
74  virtual void hide();
75  virtual bool receive(const Event&);
76  virtual void reconfigured();
77  // The glyph the user actually wants printed
78  virtual Glyph* print_glyph();
79  // for size of what actually gets printed
80  virtual Coord left_pw() const;
81  virtual Coord bottom_pw() const;
82  virtual Coord width_pw() const;
83  virtual Coord height_pw() const;
84  void type(const char*);
85  const char* type() const;
86  static OcGlyphContainer* intercept(OcGlyphContainer*); // instead of window put in a box
87  virtual void map_notify();
88  virtual void unmap_notify(){};
89  virtual Coord save_left() const; // offset by window decoration
90  virtual Coord save_bottom() const; // see nrn.defaults
91  int xleft() const;
92  int xtop() const;
93  void xplace(int left, int top); // in x display pixel coords
94  void xmove(int left, int top);
95  void request_on_resize(bool);
96  static PrintableWindow* leader() {
97  return leader_;
98  }
99  static void leader(PrintableWindow* w) {
100  leader_ = w;
101  }
102 
103  protected:
104  virtual void default_geometry();
105 
106  private:
107  std::string type_;
109  bool mappable_;
110  bool xplace_;
111  int xleft_;
112  int xtop_;
114 };
115 
116 // canvas with hbox and menubar at top and left and right vboxes
117 // the main glyph area resizes according to the window size.
119  public:
121  Glyph* info = NULL,
122  Menu* m = NULL,
123  Glyph* l = NULL,
124  Glyph* r = NULL);
125  virtual ~StandardWindow();
131 
132  private:
135  Glyph *info_, *l_, *r_;
136 };
137 
138 class PWMImpl;
139 
141  public:
144  void psfilter(const char* filename);
145  void xplace(int, int, bool map = true);
147 
151  void doprint();
152 
153  virtual void update(Observable*);
154  virtual void disconnect(Observable*);
155 
156  public:
157  PWMImpl* pwmi_;
158 
159  private:
161 };
#define Handler
Definition: _defines.h:144
#define Menu
Definition: _defines.h:174
#define Coord
Definition: _defines.h:17
#define TopLevelWindow
Definition: _defines.h:310
#define MenuItem
Definition: _defines.h:177
#define Event
Definition: _defines.h:105
#define PolyGlyph
Definition: _defines.h:205
#define TransientWindow
Definition: _defines.h:315
#define Action
Definition: _defines.h:25
#define Glyph
Definition: _defines.h:130
virtual Glyph * glyph() const
Definition: apwindow.h:47
Action * dbutton_
Definition: apwindow.h:61
DismissableWindow(Glyph *, bool force_menubar=false)
static bool is_transient_
Definition: apwindow.h:62
virtual const char * name() const
MenuItem * append_menubar(const char *)
virtual void dismiss()
virtual ~DismissableWindow()
virtual void set_attributes()
virtual void configure()
Glyph * glyph_
Definition: apwindow.h:59
static bool is_transient()
Definition: apwindow.h:54
WinDismiss * wd_
Definition: apwindow.h:60
virtual void replace_dismiss_action(WinDismiss *)
virtual void name(const char *)
Menu * menubar_
Definition: apwindow.h:63
virtual Coord width_pw() const
virtual void default_geometry()
static void leader(PrintableWindow *w)
Definition: apwindow.h:99
void type(const char *)
virtual void reconfigured()
void xmove(int left, int top)
static OcGlyphContainer * intercept(OcGlyphContainer *)
static PrintableWindow * leader_
Definition: apwindow.h:113
virtual bool receive(const Event &)
static PrintableWindow * leader()
Definition: apwindow.h:96
virtual Coord save_left() const
static OcGlyphContainer * intercept_
Definition: apwindow.h:108
virtual Coord save_bottom() const
const char * type() const
PrintableWindow(OcGlyph *)
void xplace(int left, int top)
virtual void hide()
virtual void unmap()
virtual void unmap_notify()
Definition: apwindow.h:88
int xleft() const
int xtop() const
void request_on_resize(bool)
virtual Coord height_pw() const
virtual ~PrintableWindow()
std::string type_
Definition: apwindow.h:107
virtual void map_notify()
virtual Coord bottom_pw() const
virtual Glyph * print_glyph()
virtual Coord left_pw() const
virtual void map()
void xplace(int, int, bool map=true)
static PrintableWindowManager * current()
void append(PrintableWindow *)
void psfilter(const char *filename)
static PrintableWindowManager * current_
Definition: apwindow.h:160
virtual ~PrintableWindowManager()
void reconfigured(PrintableWindow *)
virtual void disconnect(Observable *)
void remove(PrintableWindow *)
virtual void update(Observable *)
Glyph * info_
Definition: apwindow.h:135
Glyph * canvas_glyph()
Glyph * r_
Definition: apwindow.h:135
Glyph * info()
Glyph * can_
Definition: apwindow.h:134
Menu * menubar()
Glyph * rbox()
Glyph * lbox()
StandardWindow(Glyph *main, Glyph *info=NULL, Menu *m=NULL, Glyph *l=NULL, Glyph *r=NULL)
Glyph * l_
Definition: apwindow.h:135
virtual ~StandardWindow()
virtual bool event(Event &)
static void dismiss_defer()
static DismissableWindow * win_defer_
Definition: apwindow.h:33
WinDismiss(DismissableWindow *)
DismissableWindow * win_
Definition: apwindow.h:30
virtual ~WinDismiss()
virtual void execute()
static DismissableWindow * win_defer_longer_
Definition: apwindow.h:34
int main(int argc, char **argv)
Definition: coreneuron.cpp:12
static double map(void *v)
Definition: mlinedit.cpp:43
#define NULL
Definition: spdefs.h:105