libcvd
Classes | Public Types | Public Member Functions | List of all members
CVD::GLWindow Class Reference

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...
 
struct  State
 
struct  State
 

Public Types

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.
 
enum  EventType { EVENT_CLOSE, EVENT_EXPOSE }
 Symbols for window events.
 

Public Member Functions

 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. More...
 
 GLWindow (const ImageRef &size, const std::string &title, int bpp=24, const std::string &display="")
 
ImageRef size () const
 Get the size.
 
void set_size (const ImageRef &)
 Set the size.
 
ImageRef position () const
 Get the position.
 
void set_position (const ImageRef &)
 Set the position.
 
void set_cursor_position (const ImageRef &where)
 Set the mouse cursor position.
 
ImageRef cursor_position () const
 Get the mouse cursor position.
 
void show_cursor (bool show=true)
 Show (or hide) the cursor.
 
void hide_cursor ()
 Hide the cursor.
 
std::string title () const
 Get the title.
 
void set_title (const std::string &title)
 Set the title.
 
void swap_buffers ()
 Swap the front and back buffers.
 
void handle_events (EventHandler &handler)
 Handle events in the event queue by calling back to the specified handler.
 
void get_events (std::vector< Event > &events)
 Store all events in the event queue into Event objects.
 
void get_events (EventSummary &summary)
 Make a summary of the events in the queue.
 
bool has_events () const
 
void activate ()
 Make this GL context active.
 
void make_current ()
 Make this GL context active.
 

Detailed Description

An object that creates a window and a GL context attached to that window, and manages its events.

Constructor & Destructor Documentation

◆ GLWindow() [1/2]

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.

Parameters
sizeWindow size
bppColour depth
titleWindow title
displayX11 display string, passed to XOpenDisplay. "" Is used to indicate NULL. This is ignored for non X11 platforms.

◆ GLWindow() [2/2]

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.

Member Function Documentation

◆ has_events()

bool CVD::GLWindow::has_events ( ) const
Returns
true if events are pending

The documentation for this class was generated from the following files: