VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GX::Window Class Reference

A window class that is-a GX::Drawable and a GX::EventHandler. More...

#include <gxwindow.h>

+ Inheritance diagram for GX::Window:

Public Member Functions

 Window (GX::Display &, int dx, int dy)
 Constructor. The display reference is kept.
 
 Window (GX::Display &, int dx, int dy, int background, const std::string &title=std::string())
 Constructor for a window with a solid background. More...
 
virtual ~Window ()
 Destructor.
 
void clear ()
 Clears the window.
 
void show ()
 Shows ("maps") the window.
 
::Window x ()
 Returns the X object.
 
int dx () const
 Returns the current width.
 
int dy () const
 Returns the current hieght.
 
virtual ::Drawable xd ()
 From Drawable.
 
void enableEvents (long mask)
 Enables the specified event types.
 
void install (GX::ColourMap &)
 Installs a colourmap.
 
GX::DisplaywindowDisplay ()
 Returns a reference to the display as passed in to the ctor. More...
 
const GX::DisplaywindowDisplay () const
 Const overload.
 
GX::Capturecapture ()
 Starts capturing the mouse. More...
 
virtual void onKeyPress (::XKeyEvent &) override
 An override from EventHandler that calls onKey() doing the translation from opaque keycode to meaningful keysym. More...
 
virtual void onKey (const std::string &key)
 Called from this class's override of EventHandler::onKeyPress(). More...
 
virtual void onChar (char c)
 Called from this class's override of EventHandler::onKeyPress() in the case of simple character keys. More...
 
void sendUserEvent ()
 Posts a message back to itself so that onUser() gets called.
 
std::string key () const
 Returns the last onKey() string.
 
void invalidate ()
 Invalidates the window by posting an expose event (see GX::EventHandler::onExpose()). More...
 
- Public Member Functions inherited from GX::Drawable
 Drawable (Display &)
 Constructor. The display reference is kept.
 
virtual ~Drawable ()
 Destructor.
 
void drawPoint (Context &, int x, int y)
 Draws a point.
 
void drawLine (Context &, int x1, int y1, int x2, int y2)
 Draws a line.
 
void drawRectangle (Context &, int x, int y, int dx, int dy)
 Draws a rectangle.
 
void drawArc (Context &, int x, int y, unsigned int width, unsigned int height, int angle1, int angle2)
 Draws an arc.
 
- Public Member Functions inherited from GX::EventHandler
virtual ~EventHandler ()
 Destructor.
 
virtual bool onIdle ()
 Called by GX::Application::run() once the event queue is empty. More...
 
virtual void onLeftMouseButtonDown (int x, int y, bool shift, bool control)
 Called for a left-mouse-button-down event.
 
virtual void onLeftMouseButtonUp (int x, int y, bool shift, bool control)
 Called for a left-mouse-button-up event.
 
virtual void onMouseMove (int x, int y)
 Called for a mouse-move event.
 
virtual void onExposure (int x, int y, int dx, int dy)
 Called first for a window-expose event.
 
virtual void onPaint ()
 Called second for a window-expose event.
 
virtual void onExpose (::XExposeEvent &)
 Called third for a window-expose event.
 
virtual bool onCreate ()
 Called first for a window-map event. More...
 
virtual void onShow ()
 Called second for a window-map event.
 
virtual void onMap (::XMapEvent &)
 Called third for a window-map event.
 
virtual void onKeyRelease (::XKeyEvent &)
 Called for a key-release event.
 
virtual void onUser ()
 Called for a client-message event.
 

Static Public Member Functions

static long events (bool with_mouse_moves)
 Returns a default event mask for enableEvents().
 

Detailed Description

A window class that is-a GX::Drawable and a GX::EventHandler.

The window is empty and inherently drawable, and this class does not create any sub-windows or embedded drawables. However, if a separate drawable is used then it is typically blitted into this window in response to this window's expose events.

Definition at line 47 of file gxwindow.h.

Constructor & Destructor Documentation

GX::Window::Window ( GX::Display display,
int  dx,
int  dy,
int  background,
const std::string &  title = std::string() 
)

Constructor for a window with a solid background.

The display reference is kept.

Definition at line 46 of file gxwindow.cpp.

Member Function Documentation

GX::Capture * GX::Window::capture ( )

Starts capturing the mouse.

Returns a new-ed Capture pointer that should be put into a unique_ptr.

Definition at line 224 of file gxwindow.cpp.

void GX::Window::invalidate ( )

Invalidates the window by posting an expose event (see GX::EventHandler::onExpose()).

This is not normally needed because the X server will generate all the necessary expose events without the help of user code.

Definition at line 209 of file gxwindow.cpp.

void GX::Window::onChar ( char  c)
virtual

Called from this class's override of EventHandler::onKeyPress() in the case of simple character keys.

Definition at line 113 of file gxwindow.cpp.

void GX::Window::onKey ( const std::string &  key)
virtual

Called from this class's override of EventHandler::onKeyPress().

The parameter is something like "a", "X", "F1", "END", "^C", etc.

Definition at line 109 of file gxwindow.cpp.

void GX::Window::onKeyPress ( ::XKeyEvent &  )
overridevirtual

An override from EventHandler that calls onKey() doing the translation from opaque keycode to meaningful keysym.

Reimplemented from GX::EventHandler.

Definition at line 88 of file gxwindow.cpp.

GX::Display & GX::Window::windowDisplay ( )

Returns a reference to the display as passed in to the ctor.

Definition at line 122 of file gxwindow.cpp.


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