4 #include <cvd/image_ref.h> 22 using CVD::Exceptions::All::All;
52 BUTTON_MOD_SHIFT = 0x10,
53 BUTTON_WHEEL_UP = 0x20,
54 BUTTON_WHEEL_DOWN = 0x40
106 , cursor_moved(
false)
111 typedef std::map<int, int>::const_iterator key_iterator;
113 std::map<int, std::pair<ImageRef, int>>
mouse_down, mouse_up;
114 typedef std::map<int, std::pair<ImageRef, int>>::const_iterator mouse_iterator;
120 bool should_quit()
const;
133 GLWindow(
const ImageRef& size,
int bpp = 24,
const std::string& title =
"GLWindow",
const std::string& display =
"")
135 init(size, bpp, title, display);
138 GLWindow(
const ImageRef& size,
const std::string& title,
int bpp = 24,
const std::string& display =
"")
140 init(size, bpp, title, display);
153 void set_cursor_position(
const ImageRef& where);
157 void show_cursor(
bool show =
true);
161 std::string title()
const;
163 void set_title(
const std::string& title);
169 void get_events(std::vector<Event>& events);
173 bool has_events()
const;
183 void init(
const ImageRef& size,
int bpp,
const std::string& title,
const std::string& display);
An exception occurred during run-time.
Definition: glwindow.h:34
virtual void on_key_down(GLWindow &, unsigned int)
Called for key press events.
Definition: glwindow.h:69
std::map< int, int > events
Generic window events -> frequency.
Definition: glwindow.h:116
virtual void on_key_up(GLWindow &, unsigned int)
Called for key release events.
Definition: glwindow.h:71
void hide_cursor()
Hide the cursor.
Definition: glwindow.h:159
All classes and functions are within the CVD namespace.
Definition: argb.h:6
void make_current()
Make this GL context active.
Definition: glwindow.h:177
bool cursor_moved
was the cursor moved during the recording of the history
Definition: glwindow.h:124
virtual void on_mouse_move(GLWindow &, ImageRef, unsigned int)
Called for mouse movement events.
Definition: glwindow.h:73
An exception occurred during initialisation.
Definition: glwindow.h:27
An object that creates a window and a GL context attached to that window, and manages its events...
Definition: glwindow.h:42
virtual void on_mouse_up(GLWindow &, ImageRef, unsigned int, unsigned int)
Called for mouse button release events.
Definition: glwindow.h:77
GLWindow(const ImageRef &size, const std::string &title, int bpp=24, const std::string &display="")
Definition: glwindow.h:138
Base class for all CVD::GLWindow exceptions.
Definition: glwindow.h:20
A summary of multiple events.
Definition: glwindow.h:102
Definition: glwindow.cc:20
void clear()
Reset the summary.
Definition: glwindow.h:118
Base class for all CVD exceptions.
Definition: exceptions.h:15
Definition: image_ref.h:29
ImageRef cursor
last seen cursor position from mouse_move
Definition: glwindow.h:122
virtual void on_event(GLWindow &, unsigned int)
Called for general window events (such as EVENT_CLOSE)
Definition: glwindow.h:81
std::map< int, int > key_down
key->frequency mapping for key presses and releases
Definition: glwindow.h:110
GLWindow(const ImageRef &size, int bpp=24, const std::string &title="GLWindow", const std::string &display="")
Construct a GLWindow of the given size and colour depth, with the given title.
Definition: glwindow.h:133
Definition: glwindow.h:84
std::map< int, std::pair< ImageRef, int > > mouse_down
button->frequency mapping for mouse presses and releases
Definition: glwindow.h:113
MouseButton
Symbols for mouse buttons and modifiers.
Definition: glwindow.h:46
virtual void on_mouse_down(GLWindow &, ImageRef, unsigned int, unsigned int)
Called for mouse button press events.
Definition: glwindow.h:75
virtual void on_resize(GLWindow &, ImageRef)
Called for window resize events.
Definition: glwindow.h:79
Abstract base class for event handlers. Subclass this and override to implement a handler...
Definition: glwindow.h:64
EventType
Symbols for window events.
Definition: glwindow.h:57