NEURON
rect.h
Go to the documentation of this file.
1 #pragma once
2 
3 #undef Rect
4 #define Rect nrn_Rect
5 
6 class Requisition;
7 class Canvas;
8 class Allocation;
9 class Extension;
10 class Hit;
11 class Brush;
12 class Color;
13 
14 class Appear: public Glyph {
15  protected:
16  Appear(const Color* color = NULL, const Brush* brush = NULL);
17 
18  public:
19  virtual ~Appear();
20  const Color* color() const {
21  return color_;
22  }
23  void color(const Color*);
24  const Brush* brush() const {
25  return brush_;
26  }
27  void brush(const Brush*);
28  static const Color* default_color();
29  static const Brush* default_brush();
30 
31  private:
32  const Color* color_;
33  const Brush* brush_;
34  static const Color* dc_;
35  static const Brush* db_;
36 };
37 
38 class Rect: public Appear {
39  public:
41  Coord bottom,
42  Coord width,
43  Coord height,
44  const Color* c = NULL,
45  const Brush* b = NULL);
46  virtual void request(Requisition&) const;
47  virtual void allocate(Canvas*, const Allocation&, Extension&);
48  virtual void draw(Canvas*, const Allocation&) const;
49  virtual void pick(Canvas*, const Allocation&, int depth, Hit&);
50 
51  Coord left() const, right() const, top() const, bottom() const;
52  Coord width() const, height() const;
53  void left(Coord), bottom(Coord);
54  void width(Coord), height(Coord);
55 
56  private:
57  Coord l_, b_, w_, h_;
58 };
59 
60 class Line: public Appear {
61  public:
62  Line(Coord dx, Coord dy, const Color* color = NULL, const Brush* brush = NULL);
63  Line(Coord dx,
64  Coord dy,
65  float x_align,
66  float y_align,
67  const Color* color = NULL,
68  const Brush* brush = NULL);
69  virtual ~Line();
70 
71  virtual void request(Requisition&) const;
72  virtual void allocate(Canvas*, const Allocation&, Extension&);
73  virtual void draw(Canvas*, const Allocation&) const;
74  virtual void pick(Canvas*, const Allocation&, int depth, Hit&);
75 
76  private:
77  Coord dx_, dy_;
78  float x_, y_;
79 };
80 
81 class Circle: public Appear {
82  public:
83  Circle(float radius, bool filled = false, const Color* color = NULL, const Brush* brush = NULL);
84  virtual ~Circle();
85 
86  virtual void request(Requisition&) const;
87  virtual void allocate(Canvas*, const Allocation&, Extension&);
88  virtual void draw(Canvas*, const Allocation&) const;
89 
90  private:
91  float radius_;
92  bool filled_;
93 };
94 
95 class Triangle: public Appear {
96  public:
97  Triangle(float side, bool filled = false, const Color* color = NULL, const Brush* brush = NULL);
98  virtual ~Triangle();
99 
100  virtual void request(Requisition&) const;
101  virtual void allocate(Canvas*, const Allocation&, Extension&);
102  virtual void draw(Canvas*, const Allocation&) const;
103 
104  private:
105  float side_;
106  bool filled_;
107 };
108 
109 class Rectangle: public Appear {
110  public:
112  float width,
113  bool filled = false,
114  const Color* color = NULL,
115  const Brush* brush = NULL);
116  virtual ~Rectangle();
117 
118  virtual void request(Requisition&) const;
119  virtual void allocate(Canvas*, const Allocation&, Extension&);
120  virtual void draw(Canvas*, const Allocation&) const;
121 
122  private:
123  float height_;
124  float width_;
125  bool filled_;
126 };
127 
128 inline Coord Rect::left() const {
129  return l_;
130 }
131 inline Coord Rect::right() const {
132  return l_ + w_;
133 }
134 inline Coord Rect::bottom() const {
135  return b_;
136 }
137 inline Coord Rect::top() const {
138  return b_ + h_;
139 }
140 inline Coord Rect::width() const {
141  return w_;
142 }
143 inline Coord Rect::height() const {
144  return h_;
145 }
146 
147 inline void Rect::left(Coord x) {
148  l_ = x;
149 }
150 inline void Rect::bottom(Coord x) {
151  b_ = x;
152 }
153 inline void Rect::width(Coord x) {
154  w_ = (x > 0) ? x : 1.;
155 }
156 inline void Rect::height(Coord x) {
157  h_ = (x > 0) ? x : 1.;
158 }
#define Color
Definition: _defines.h:72
#define Canvas
Definition: _defines.h:63
#define Coord
Definition: _defines.h:17
#define Brush
Definition: _defines.h:57
#define Hit
Definition: _defines.h:145
#define Glyph
Definition: _defines.h:130
Definition: rect.h:14
const Color * color_
Definition: rect.h:32
virtual ~Appear()
const Color * color() const
Definition: rect.h:20
static const Color * default_color()
void color(const Color *)
void brush(const Brush *)
const Brush * brush_
Definition: rect.h:33
Appear(const Color *color=NULL, const Brush *brush=NULL)
static const Brush * db_
Definition: rect.h:35
static const Color * dc_
Definition: rect.h:34
static const Brush * default_brush()
const Brush * brush() const
Definition: rect.h:24
Definition: rect.h:81
Circle(float radius, bool filled=false, const Color *color=NULL, const Brush *brush=NULL)
virtual void draw(Canvas *, const Allocation &) const
virtual void request(Requisition &) const
virtual void allocate(Canvas *, const Allocation &, Extension &)
float radius_
Definition: rect.h:91
bool filled_
Definition: rect.h:92
virtual ~Circle()
Definition: rect.h:60
virtual void request(Requisition &) const
Line(Coord dx, Coord dy, float x_align, float y_align, const Color *color=NULL, const Brush *brush=NULL)
Coord dx_
Definition: rect.h:77
float x_
Definition: rect.h:78
virtual ~Line()
virtual void allocate(Canvas *, const Allocation &, Extension &)
Line(Coord dx, Coord dy, const Color *color=NULL, const Brush *brush=NULL)
virtual void draw(Canvas *, const Allocation &) const
virtual void pick(Canvas *, const Allocation &, int depth, Hit &)
Definition: rect.h:38
Coord bottom() const
Definition: rect.h:134
Rect(Coord left, Coord bottom, Coord width, Coord height, const Color *c=NULL, const Brush *b=NULL)
Coord right() const
Definition: rect.h:131
Coord l_
Definition: rect.h:57
Coord b_
Definition: rect.h:57
virtual void allocate(Canvas *, const Allocation &, Extension &)
Coord h_
Definition: rect.h:57
virtual void pick(Canvas *, const Allocation &, int depth, Hit &)
virtual void request(Requisition &) const
Coord height() const
Definition: rect.h:143
Coord width() const
Definition: rect.h:140
Coord top() const
Definition: rect.h:137
Coord left() const
Definition: rect.h:128
Coord w_
Definition: rect.h:57
virtual void draw(Canvas *, const Allocation &) const
virtual void request(Requisition &) const
bool filled_
Definition: rect.h:125
float height_
Definition: rect.h:123
virtual void draw(Canvas *, const Allocation &) const
Rectangle(float height, float width, bool filled=false, const Color *color=NULL, const Brush *brush=NULL)
virtual void allocate(Canvas *, const Allocation &, Extension &)
virtual ~Rectangle()
float width_
Definition: rect.h:124
Definition: rect.h:95
virtual ~Triangle()
virtual void allocate(Canvas *, const Allocation &, Extension &)
virtual void request(Requisition &) const
virtual void draw(Canvas *, const Allocation &) const
float side_
Definition: rect.h:105
bool filled_
Definition: rect.h:106
Triangle(float side, bool filled=false, const Color *color=NULL, const Brush *brush=NULL)
#define y_(arg)
Crout matrix decomposition : Forward/Backward substitution.
Definition: crout.hpp:136
static int c
Definition: hoc.cpp:169
#define NULL
Definition: spdefs.h:105