A window class with active window management. More...
#include <GUI/XWinManaged.H>
Public Member Functions | |
XWinManaged (const Dims &dims, const int x=-1, const int y=-1, const char *title="USC Neuromorphic Vision") | |
Constructor: create, display and map the window, start the event handling. | |
XWinManaged (const Image< PixRGB< byte > > &img, const char *title="USC Neuromorphic Vision") | |
Constructor: create a window as large as img and display img. | |
XWinManaged (const Image< byte > &img, const char *title="USC Neuromorphic Vision") | |
Constructor: create a window as large as img and display img. | |
XWinManaged (const Image< float > &img, const char *title="USC Neuromorphic Vision", bool normalize=true) | |
Constructor: create a window as large as img and display img. | |
virtual | ~XWinManaged () |
Destructor: destroy the window and stop the event handling. | |
bool | pressedCloseButton () |
returns whether the user has clicked the close button. | |
void | setTraceEvents (bool on) |
request that event tracing be turned on or off | |
int | getLastKeyPress () |
returns the key press at the front of the keyboard buffer | |
std::string | getLastKeyString () |
get the decoded string of the last key press | |
KeySym | getLastKeySym (std::string *s=0) |
get the decoded keysym of the last key press | |
bool | getLastKeyEvent (XKeyEvent *ev) |
copy the last key event into ev, and pop that event from the queue | |
Point2D< int > | getLastMouseClick () |
returns the last mouse click at the front of the click buffer | |
bool | getLastButtonEvent (XButtonEvent *ev) |
copy the last button press event into ev, and pop that event from the queue | |
std::string | describeKeyEvent (const XKeyEvent *ev) const |
std::string | describeButtonEvent (const XButtonEvent *ev) const |
std::string | describeEvent (const XEvent *ev) const |
A window class with active window management.
This class is an extension of the XWindow class to allow event handling. In the current implementation, exposure and resize events are handled. Instead of destroying the window, clicking the close button will set a flag that can be accessed by calling pressedCloseButton().
Definition at line 67 of file XWinManaged.H.
XWinManaged::XWinManaged | ( | const Dims & | dims, | |
const int | x = -1 , |
|||
const int | y = -1 , |
|||
const char * | title = "USC Neuromorphic Vision" | |||
) |
Constructor: create, display and map the window, start the event handling.
The call of to the constructor is identical to the parent class XWindow. In addition to creating the window, the event handling is started.
w | Width of usable image area. | |
h | height of usable image area. | |
x | Horizontal position hint for window placement; use -1 for automatic placement. | |
y | Vertical position hint for window placement; use -1 for automatic placement. | |
title | String that will appear in the window title. |
Definition at line 78 of file XWinManaged.C.
XWinManaged::XWinManaged | ( | const Image< PixRGB< byte > > & | img, | |
const char * | title = "USC Neuromorphic Vision" | |||
) |
Constructor: create a window as large as img and display img.
Definition at line 89 of file XWinManaged.C.
References XWindow::drawImage().
XWinManaged::XWinManaged | ( | const Image< byte > & | img, | |
const char * | title = "USC Neuromorphic Vision" | |||
) |
Constructor: create a window as large as img and display img.
Definition at line 101 of file XWinManaged.C.
References XWindow::drawImage().
XWinManaged::XWinManaged | ( | const Image< float > & | img, | |
const char * | title = "USC Neuromorphic Vision" , |
|||
bool | normalize = true | |||
) |
Constructor: create a window as large as img and display img.
Definition at line 111 of file XWinManaged.C.
References XWindow::drawImage().
XWinManaged::~XWinManaged | ( | ) | [virtual] |
Destructor: destroy the window and stop the event handling.
Definition at line 123 of file XWinManaged.C.
References rutz::ix86_atomic_int::atomic_set().
bool XWinManaged::getLastButtonEvent | ( | XButtonEvent * | ev | ) |
copy the last button press event into ev, and pop that event from the queue
Definition at line 294 of file XWinManaged.C.
Referenced by getLastMouseClick(), and PrefsWindow::update().
bool XWinManaged::getLastKeyEvent | ( | XKeyEvent * | ev | ) |
copy the last key event into ev, and pop that event from the queue
Definition at line 272 of file XWinManaged.C.
Referenced by getLastKeyPress(), getLastKeyString(), and getLastKeySym().
int XWinManaged::getLastKeyPress | ( | ) |
returns the key press at the front of the keyboard buffer
returns -1 if no key press has occured since the last call
Definition at line 226 of file XWinManaged.C.
References getLastKeyEvent().
Referenced by BotControl::getUserInput().
std::string XWinManaged::getLastKeyString | ( | ) |
get the decoded string of the last key press
returns an empty string if no key press has occured since the last call
Definition at line 236 of file XWinManaged.C.
References getLastKeyEvent().
KeySym XWinManaged::getLastKeySym | ( | std::string * | s = 0 |
) |
get the decoded keysym of the last key press
Returns NoSymbol if no key press has occured since the last call. Also return the corresponding string through s if s is non-null.
Definition at line 252 of file XWinManaged.C.
References getLastKeyEvent().
Referenced by PrefsWindow::update().
Point2D< int > XWinManaged::getLastMouseClick | ( | ) |
returns the last mouse click at the front of the click buffer
does not distinguish between right and left buttons; returns (-1,-1) if no mouse clicks have occured since the last call
Definition at line 284 of file XWinManaged.C.
References getLastButtonEvent().
Referenced by BotControl::getUserInput().
bool XWinManaged::pressedCloseButton | ( | ) | [inline] |
returns whether the user has clicked the close button.
Definition at line 105 of file XWinManaged.H.
Referenced by main().
void XWinManaged::setTraceEvents | ( | bool | on | ) |
request that event tracing be turned on or off
Definition at line 220 of file XWinManaged.C.
References rutz::ix86_atomic_int::atomic_set().