Neo  0.5.0
Developer Documentation
Window.h
Go to the documentation of this file.
1 #ifndef __WINDOW_H
2 #define __WINDOW_H
3 
4 #include <Neo2DEngine.h>
5 #include <Container.h>
6 #include <WindowManager.h>
7 #include <vector>
8 
9 #define TITLE_HEIGHT 30
10 
11 namespace Neo2D
12 {
13 namespace Gui
14 {
15 using namespace Neo;
16 
21 {
26 };
27 
33 class NEO2D_EXPORT Window : public Container
34 {
35 
36  protected:
38 
39  float m_mx;
40  float m_my;
41 
43 
45 
46  public:
47  Window(unsigned int x, unsigned int y, unsigned int width,
48  unsigned int height, const char* label)
49  : Container(x, y, width, height, label),
50  m_labelText(NULL),
51  m_state(WINDOW_SELECTED_STATE),
52  m_wm(NULL)
53 
54  {
55  }
56 
57  ~Window();
58 
59  void setWindowManager(WindowManager* wm) { m_wm = wm; }
60 
61  bool containsPoint(float x, float y)
62  {
63  return (x >= m_x && x <= m_x + m_width && y >= m_y-TITLE_HEIGHT &&
64  y <= m_y + m_height);
65  }
66 
67  void draw();
68  void draw(Vector2 offset) { draw(); }
69  void update();
70 
71  virtual bool isMouseOver();
72 };
73 
74 }
75 }
76 
77 #endif
Definition: Window.h:24
OText * m_labelText
Definition: Window.h:37
Window(unsigned int x, unsigned int y, unsigned int width, unsigned int height, const char *label)
Definition: Window.h:47
float m_my
Definition: Window.h:40
Definition: OText.h:40
WindowManager * m_wm
Definition: Window.h:44
float m_mx
Definition: Window.h:39
This class manages all windows on screen, that means managing order and selection of windows...
Definition: WindowManager.h:23
A Container organizes multiple Widgets into one to provide layout functionality.
Definition: Container.h:20
Definition: Vector2.h:31
Definition: Button.h:42
Definition: Window.h:23
Definition: Window.h:25
WINDOW_STATE m_state
Definition: Window.h:42
void draw(Vector2 offset)
Draws the widget to the canvas it belongs to.
Definition: Window.h:68
bool containsPoint(float x, float y)
Definition: Window.h:61
void setWindowManager(WindowManager *wm)
Definition: Window.h:59
Definition: Color.h:29
WINDOW_STATE
Definition: Window.h:20
This class implements a Window that can be used to display widgets.
Definition: Window.h:33