An object that creates a window and a GL context attached to that window, and manages its events. More...
#include <glwindow.h>
Classes | |
struct | Event |
class | EventHandler |
Abstract base class for event handlers. Subclass this and override to implement a handler. More... | |
struct | EventSummary |
A summary of multiple events. More... | |
Public Types | |
enum | EventType { EVENT_CLOSE, EVENT_EXPOSE } |
Symbols for window events. More... | |
enum | MouseButton { BUTTON_LEFT = 1, BUTTON_MIDDLE = 2, BUTTON_RIGHT = 4, BUTTON_MOD_CTRL = 8, BUTTON_MOD_SHIFT = 0x10, BUTTON_WHEEL_UP = 0x20, BUTTON_WHEEL_DOWN = 0x40 } |
Symbols for mouse buttons and modifiers. More... | |
Public Member Functions | |
void | activate () |
Make this GL context active. | |
ImageRef | cursor_position () const |
Get the mouse cursor position. | |
void | get_events (EventSummary &summary) |
Make a summary of the events in the queue. | |
void | get_events (std::vector< Event > &events) |
Store all events in the event queue into Event objects. | |
GLWindow (const ImageRef &size, const std::string &title, int bpp=24, const std::string &display="") | |
GLWindow (const ImageRef &size, int bpp=24, const std::string &title="GLWindow", const std::string &display="") | |
void | handle_events (EventHandler &handler) |
Handle events in the event queue by calling back to the specified handler. | |
bool | has_events () const |
void | hide_cursor () |
Hide the cursor. | |
void | make_current () |
Make this GL context active. | |
ImageRef | position () const |
Get the position. | |
void | set_cursor_position (const ImageRef &where) |
Set the mouse cursor position. | |
void | set_position (const ImageRef &) |
Set the position. | |
void | set_size (const ImageRef &) |
Set the size. | |
void | set_title (const std::string &title) |
Set the title. | |
void | show_cursor (bool show=true) |
Show (or hide) the cursor. | |
ImageRef | size () const |
Get the size. | |
void | swap_buffers () |
Swap the front and back buffers. | |
std::string | title () const |
Get the title. | |
~GLWindow () | |
Private Member Functions | |
void | init (const ImageRef &size, int bpp, const std::string &title, const std::string &display) |
Private Attributes | |
State * | state |
An object that creates a window and a GL context attached to that window, and manages its events.
Definition at line 39 of file glwindow.h.
Symbols for window events.
Definition at line 44 of file glwindow.h.
Symbols for mouse buttons and modifiers.
BUTTON_LEFT | |
BUTTON_MIDDLE | |
BUTTON_RIGHT | |
BUTTON_MOD_CTRL | |
BUTTON_MOD_SHIFT | |
BUTTON_WHEEL_UP | |
BUTTON_WHEEL_DOWN |
Definition at line 42 of file glwindow.h.
CVD::GLWindow::GLWindow | ( | const ImageRef & | size, | |
int | bpp = 24 , |
|||
const std::string & | title = "GLWindow" , |
|||
const std::string & | display = "" | |||
) | [inline] |
Construct a GLWindow of the given size and colour depth, with the given title. A double-buffered GL context is associated with the window.
size | Window size | |
bpp | Colour depth | |
title | Window title | |
display | X11 display string, passed to XOpenDisplay. "" Is used to indicate NULL. This is ignored for non X11 platforms. |
Definition at line 100 of file glwindow.h.
CVD::GLWindow::GLWindow | ( | const ImageRef & | size, | |
const std::string & | title, | |||
int | bpp = 24 , |
|||
const std::string & | display = "" | |||
) | [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 104 of file glwindow.h.
CVD::GLWindow::~GLWindow | ( | ) |
void CVD::GLWindow::activate | ( | ) |
Make this GL context active.
ImageRef CVD::GLWindow::cursor_position | ( | ) | const |
Get the mouse cursor position.
void CVD::GLWindow::get_events | ( | EventSummary & | summary | ) |
Make a summary of the events in the queue.
void CVD::GLWindow::get_events | ( | std::vector< Event > & | events | ) |
Store all events in the event queue into Event objects.
void CVD::GLWindow::handle_events | ( | EventHandler & | handler | ) |
Handle events in the event queue by calling back to the specified handler.
bool CVD::GLWindow::has_events | ( | ) | const |
void CVD::GLWindow::hide_cursor | ( | ) | [inline] |
Hide the cursor.
Definition at line 124 of file glwindow.h.
void CVD::GLWindow::init | ( | const ImageRef & | size, | |
int | bpp, | |||
const std::string & | title, | |||
const std::string & | display | |||
) | [private] |
void CVD::GLWindow::make_current | ( | ) | [inline] |
Make this GL context active.
Definition at line 142 of file glwindow.h.
ImageRef CVD::GLWindow::position | ( | ) | const |
Get the position.
void CVD::GLWindow::set_cursor_position | ( | const ImageRef & | where | ) |
Set the mouse cursor position.
void CVD::GLWindow::set_position | ( | const ImageRef & | ) |
Set the position.
void CVD::GLWindow::set_size | ( | const ImageRef & | ) |
Set the size.
void CVD::GLWindow::set_title | ( | const std::string & | title | ) |
Set the title.
void CVD::GLWindow::show_cursor | ( | bool | show = true |
) |
Show (or hide) the cursor.
ImageRef CVD::GLWindow::size | ( | ) | const |
Get the size.
void CVD::GLWindow::swap_buffers | ( | ) |
Swap the front and back buffers.
std::string CVD::GLWindow::title | ( | ) | const |
Get the title.
State* CVD::GLWindow::state [private] |
Definition at line 144 of file glwindow.h.