|
WXP C++ Library Version 6.74.9
|
This class plots data to the X Windows device. More...
#include "../include/XWindow.h"
Public Member Functions | |
| XWindow () | |
| ~XWindow () | |
| int | init () |
| int | setParam (const char *str) |
| int | open () |
| int | getDevice (String &str) |
| int | resize (float rwidth, float rheight) |
| int | addCallback (const char *event, Listener *list, const void *data) |
| int | doCallback (const char *ev_str, const char *ev_data) |
| void | callback (const char *ev_str, const char *ev_data, const void *data) |
| int | close () |
| int | setFocus () |
| int | unsetFocus () |
| int | update () |
| int | clear () |
| int | clearRect (Rect &rect) |
| int | manage () |
| int | unmanage () |
| int | setTitle (const char *str) |
| const char * | getTitle () |
| int | setIcon (bool val) |
| int | setFixed (bool val) |
| int | setCursor (int type) |
| int | getCursor () |
| int | setInverse (bool val) |
| bool | getInverse () |
| int | setBackground (const char *str) |
| int | setSize (float rwidth, float rheight) |
| int | getSize (float &width, float &height) |
| float | getWidth () |
| float | getHeight () |
| int | setOffset (float rx, float ry) |
| int | getOffset (float &x, float &y) |
| int | getCoords (Rect &rect) |
| Rect | getCoords () |
| int | allocColor (float red, float grn, float blu) |
| int | setColor (int type, int ind) |
| int | setLineWidth (int type, float width) |
| int | setLineStyle (int type, int style) |
| int | setFillStyle (int type, int style) |
| int | drawLine (int type, float x1, float y1, float x2, float y2) |
| int | drawLine (int type, Points &pts) |
| int | drawFill (int type, Points &pts) |
| int | setImageAlign (int h, int v) |
| int | drawImage (Image &image, float x, float y) |
| int | drawImage (Image &image, int bgcolor, float x, float y) |
| int | getImage (Image &image) |
| int | setFont (const char *name) |
| int | setTextAlign (int h, int v) |
| int | drawText (Point &pt, const char *str) |
| Rect | getClip () |
| int | setClip (float x1, float y1, float x2, float y2) |
| int | setClip (Rect rect) |
| Pixmap | getFramePixmap (int ind) |
| int | copyFrame (int dest, int src) |
| int | displayFrame (int ind) |
| int | clearFrame (int ind) |
| int | newFrame (int ind) |
| int | newFrame () |
| bool | isLooping () |
| int | getFrame () |
| int | setFrame (int ind) |
| int | incFrame (int step) |
| int | deleteFrame (int ind) |
| int | deleteFrame () |
| int | getNumFrames () |
| int | loopRate (int dir) |
| int | toggleLoop () |
| int | message (const char *str) |
| int | printGC (int type) |
| int | bell (int len) |
| virtual int | init ()=0 |
| virtual int | setParam (const char *str)=0 |
| virtual int | open ()=0 |
| virtual int | getDevice (String &str)=0 |
| virtual int | resize (float rwidth, float rheight)=0 |
| virtual int | manage ()=0 |
| virtual int | unmanage ()=0 |
| virtual int | addCallback (const char *event, Listener *list, const void *data)=0 |
| virtual int | doCallback (const char *ev_str, const char *ev_data)=0 |
| virtual void | callback (const char *ev_str, const char *ev_data, const void *data)=0 |
| virtual int | close ()=0 |
| virtual int | update ()=0 |
| virtual int | clear ()=0 |
| virtual int | clearRect (Rect &rect)=0 |
| virtual int | setTitle (const char *str)=0 |
| virtual int | setIcon (bool val)=0 |
| virtual int | setFixed (bool val)=0 |
| virtual int | setInverse (bool val)=0 |
| virtual bool | getInverse ()=0 |
| virtual int | setBackground (const char *str)=0 |
| virtual int | setSize (float rwidth, float rheight)=0 |
| virtual int | getSize (float &width, float &height)=0 |
| virtual float | getWidth ()=0 |
| virtual float | getHeight ()=0 |
| virtual int | setOffset (float rx, float ry)=0 |
| virtual int | getOffset (float &x, float &y)=0 |
| virtual int | getCoords (Rect &rect)=0 |
| virtual Rect | getCoords ()=0 |
| virtual int | allocColor (float red, float grn, float blu)=0 |
| virtual int | setColor (int type, int ind)=0 |
| virtual int | setLineWidth (int type, float width)=0 |
| virtual int | setLineStyle (int type, int style)=0 |
| virtual int | setFillStyle (int type, int style)=0 |
| virtual int | drawLine (int type, float x1, float y1, float x2, float y2)=0 |
| virtual int | drawLine (int type, Points &pts)=0 |
| virtual int | drawFill (int type, Points &pts)=0 |
| virtual int | setImageAlign (int h, int v)=0 |
| virtual int | drawImage (Image &image, float x, float y)=0 |
| virtual int | drawImage (Image &image, int bgcolor, float x, float y)=0 |
| virtual int | getImage (Image &image)=0 |
| virtual int | setFont (const char *name)=0 |
| virtual int | setTextAlign (int h, int v)=0 |
| virtual int | drawText (Point &pt, const char *str)=0 |
| virtual Rect | getClip ()=0 |
| virtual int | setClip (float x1, float y1, float x2, float y2)=0 |
| virtual int | setClip (Rect rect)=0 |
| virtual int | setCursor (int type)=0 |
| virtual int | copyFrame (int dest, int src)=0 |
| virtual int | displayFrame (int ind)=0 |
| virtual int | clearFrame (int ind)=0 |
| virtual int | newFrame (int ind)=0 |
| virtual int | newFrame ()=0 |
| virtual bool | isLooping ()=0 |
| virtual int | getFrame ()=0 |
| virtual int | setFrame (int ind)=0 |
| virtual int | incFrame (int step)=0 |
| virtual int | deleteFrame (int ind)=0 |
| virtual int | getNumFrames ()=0 |
| virtual int | message (const char *str)=0 |
| virtual int | bell (int len)=0 |
| virtual void | callback (const char *ev_str, const char *ev_data, const void *data)=0 |
Static Public Member Functions | |
| static int | mainloop () |
| static int | waitEvent () |
| static int | checkEvent () |
| static int | addWindow (Window &win) |
| static int | processEvent (XEvent *event) |
| static int | procCallback (Window win, int type, const char *ev_str, const char *ev_data) |
| static int | newCallback (Window win, int event, Listener *list, const void *data) |
| static int | deleteCallbacks (Window) |
| static int | errorHandler (Display *dpy, XErrorEvent *error) |
| static int | errorIOHandler (Display *dpy) |
Static Public Attributes | |
| static const int | AnyEvent = 0 |
| static const int | Redraw = 50 |
| static const int | WINDOW = 1 |
| static const int | PIXMAP = 2 |
| static const int | CURSOR_X = 0 |
| static const int | CURSOR_PTR = 1 |
| static const int | CURSOR_MOVE = 2 |
| static const int | CURSOR_LOOP = 3 |
| static const int | CURSOR_STOP = 4 |
| static const int | CURSOR_DRAW = 5 |
| static const int | CURSOR_RECT = 6 |
| static const int | CURSOR_PLUS = 6 |
| static const int | CURSOR_TEXT = 7 |
| static const int | CURSOR_WAIT = 8 |
Static Public Attributes inherited from WXP::Device | |
| static const int | BASE = 0 |
| static const int | LINE = 1 |
| static const int | MARK = 2 |
| static const int | FILL = 3 |
| static const int | TEXT = 4 |
| static const int | LAST = -1 |
| static const int | CUR = -2 |
| static const int | WIN = -3 |
| static const int | ALL = -4 |
| static const int | CURSOR_X = 0 |
| static const int | CURSOR_PTR = 1 |
| static const int | CURSOR_MOVE = 2 |
| static const int | CURSOR_LOOP = 3 |
| static const int | CURSOR_STOP = 4 |
| static const int | CURSOR_DRAW = 5 |
| static const int | CURSOR_RECT = 6 |
| static const int | CURSOR_PLUS = 6 |
| static const int | CURSOR_TEXT = 7 |
| static const int | CURSOR_WAIT = 8 |
| static const int | ALIGN_HLEFT = 1 |
| static const int | ALIGN_HCENTER = 2 |
| static const int | ALIGN_HRIGHT = 3 |
| static const int | ALIGN_VBOTTOM = 1 |
| static const int | ALIGN_VCENTER = 2 |
| static const int | ALIGN_VTOP = 3 |
This class plots data to the X Windows device.
| XWindow::XWindow | ( | ) |
Constructor. Initializes class data
References init().
| XWindow::~XWindow | ( | ) |
Destructor. Closes down X Windows
References close().
|
virtual |
Adds a new callback to the callback list
| event | Event on which to invoke callback |
| list | Listener class containing callback method |
| data | User specified data to be sent with callback |
Implements WXP::Device.
References WXP::StrLib::equal(), and newCallback().
|
virtual |
Allocates a color into the device specific color database
| red | Red value (0-1) |
| grn | Green value (0-1) |
| blu | Blue value (0-1) |
Implements WXP::Device.
Referenced by drawImage(), and drawImage().
|
virtual |
|
virtual |
Internal callback for processing events specific to this class
| ev_str | Event description (string) |
| ev_data | Additional data from event |
| data | User specified data |
Implements WXP::Device.
References deleteFrame(), WXP::StrLib::equal(), incFrame(), loopRate(), procCallback(), resize(), toggleLoop(), and update().
|
static |
Checks to see if an event is present in queue and then sends it to process_event
| display | Display to query events |
References processEvent().
Referenced by mainloop().
|
virtual |
Clears the window, painting it with background color
Implements WXP::Device.
Referenced by deleteFrame().
|
virtual |
Clears a frame in loop
| ind | Index in loop to clear |
Implements WXP::Device.
References getFramePixmap().
Referenced by newFrame().
|
virtual |
Implements WXP::Device.
|
virtual |
|
virtual |
Copies a frame
| dest | Destination index in loop |
| src | Source index in loop |
Implements WXP::Device.
References getFramePixmap(), and WXP::Wxp::outDebug().
Referenced by displayFrame().
| int XWindow::deleteFrame | ( | ) |
Deletes all frames in the loop
References deleteFrame().
Referenced by callback(), close(), and deleteFrame().
|
virtual |
Deletes a frame in the loop
| ind | Index of the frame to delete |
Implements WXP::Device.
References clear(), displayFrame(), WXP::Wxp::outDebug(), and update().
|
virtual |
Displays a frame
| ind | Index in loop to display |
Implements WXP::Device.
References copyFrame(), WXP::Wxp::outDebug(), and update().
Referenced by deleteFrame(), and incFrame().
|
virtual |
Implements WXP::Device.
|
virtual |
Draws a filled area
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| num | Number of points |
| pt | Array of points |
Implements WXP::Device.
References WXP::Points::getNum(), WXP::Points::getX1(), and WXP::Points::getY1().
|
virtual |
Draws an image
| image | Image to use |
| x | X location of image |
| y | Y location of image |
Implements WXP::Device.
References allocColor(), WXP::Image::getPixel(), WXP::Image::setColorVal(), and WXP::Image::validData().
|
virtual |
Draws a transparent image
| image | Image to use |
| bgcolor | Color to make transparent in image |
| x | X location of upper right corner of image |
| y | Y location of upper right corner of image |
Implements WXP::Device.
References allocColor(), WXP::Image::getPixel(), WXP::Image::setColorVal(), and WXP::Image::validData().
|
virtual |
Draws a line
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| x1 | First X point |
| y1 | First Y point |
| x2 | Second X point |
| y2 | Second Y point |
Implements WXP::Device.
|
virtual |
Draws a line
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| pts | Array of points |
Implements WXP::Device.
References WXP::Points::getNum(), WXP::Points::getX1(), and WXP::Points::getY1().
|
virtual |
Draws text to window using device fonts
| pt | Location of text |
| str | String to plot |
Implements WXP::Device.
References WXP::Point::x, and WXP::Point::y.
|
static |
|
static |
X IO error handler. Usually called when connection broken to X server. Causes program to exit.
| dpy | X display |
Referenced by open().
|
virtual |
Gets the current device specific clip rectangle
Implements WXP::Device.
|
virtual |
|
virtual |
Gets the window coordinates
| rect | Coordinates |
Implements WXP::Device.
References WXP::Rect::set().
|
virtual |
Returns device specification for direct access to window
| str | Output string with specification |
Implements WXP::Device.
References WXP::String::printf().
|
virtual |
| Pixmap XWindow::getFramePixmap | ( | int | ind | ) |
Gets the Pixmap ID (local)
| ind | Index into loop |
Referenced by clearFrame(), and copyFrame().
|
inlinevirtual |
Implements WXP::Device.
|
virtual |
Gets an image from the drawing window
| image | Image class to put image into |
Implements WXP::Device.
References WXP::Image::allocData(), WXP::Image::init(), and WXP::Image::setPixel().
|
virtual |
|
virtual |
|
virtual |
Gets the window offset
| rx | Upper left X position |
| ry | Upper left Y position |
Implements WXP::Device.
|
virtual |
|
inlinevirtual |
Implements WXP::Device.
|
virtual |
Increments frame in the loop
| step | Step increment (usually 1 or -1) |
Implements WXP::Device.
References displayFrame().
Referenced by callback(), and mainloop().
|
virtual |
|
virtual |
| int XWindow::loopRate | ( | int | dir | ) |
Changes loop rate
| dir | 1 = faster, -1 = slower |
References WXP::Wxp::outDebug().
Referenced by callback().
|
static |
Main loop of program that just waits for events to be processed
References checkEvent(), incFrame(), procCallback(), and setCursor().
Referenced by manage().
|
virtual |
|
virtual |
|
static |
Adds a new callback into callback queue
| win | Window to process data on |
| event | Event type |
| list | Listener class to call when event occurs |
| data | User specific data to send Listener class |
Referenced by addCallback(), and open().
|
virtual |
Creates a new frame at end of loop
Implements WXP::Device.
References newFrame().
Referenced by newFrame().
|
virtual |
Creates a new frame
| ind | Index in loop to insert new frame |
Implements WXP::Device.
References clearFrame().
|
virtual |
Opens a window
Implements WXP::Device.
References WXP::StrLib::clear(), WXP::StrLib::equal(), errorHandler(), errorIOHandler(), newCallback(), WXP::Wxp::outWarning(), WXP::StrLib::replace(), and WXP::StrLib::valid().
| int XWindow::printGC | ( | int | type | ) |
Prints the contents of a X11 Graphics Context
| type | Type of graphics context to print |
|
static |
Passes event information to each of the callbacks
| win | Applicable window |
| type | Event type |
| ev_str | Event name |
| ev_data | Event specific data |
Referenced by callback(), mainloop(), and processEvent().
|
static |
Processes a single event and passes data onto callbacks
| event | X Event structure for the event |
References WXP::Wxp::outDebug(), and procCallback().
Referenced by checkEvent(), and waitEvent().
|
virtual |
Resizes the window
| rwidth | New width |
| rheight | New height |
Implements WXP::Device.
References WXP::Wxp::outDebug().
Referenced by callback().
|
virtual |
Sets the window title in title bar (internal reference only)
| str | Title string |
Implements WXP::Device.
References WXP::StrLib::copy().
|
virtual |
Sets the clipping rectangle
| x1 | Upper left X point |
| y1 | Upper left Y point |
| x2 | Lower right X point |
| y2 | Lower right Y point |
Implements WXP::Device.
Referenced by setClip().
|
virtual |
Sets the clipping rectangle
| rect | Rectangle class with clipping information |
Implements WXP::Device.
References setClip(), WXP::Rect::xmax, WXP::Rect::xmin, WXP::Rect::ymax, and WXP::Rect::ymin.
|
virtual |
Sets the color for each graphics type
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| ind | Device color index (see allocColor) |
Implements WXP::Device.
|
virtual |
Sets the cursor type
| type | Cursor type (CURSOR_PTR, CURSOR_STOP,...) |
Implements WXP::Device.
Referenced by mainloop(), and toggleLoop().
|
virtual |
Sets the fill style
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| width | Style (0=solid, >0=patterned) |
Implements WXP::Device.
|
virtual |
Sets whether window size is fixed (not resizable)
| val | true=not resizable |
Implements WXP::Device.
| int XWindow::setFocus | ( | ) |
Sets the focus on the window
|
virtual |
Sets the text font to use in drawing
| name | Descriptive name of font |
| size | Size of font (for fixed fonts) |
Implements WXP::Device.
References WXP::StrLib::copy(), WXP::StrLib::index(), WXP::Wxp::outDebug(), WXP::Wxp::outWarning(), and WXP::StrLib::splice().
|
virtual |
Sets the drawing frame in loop. All drawing primitives will be done to this frame
| ind | Index in loop to use |
Implements WXP::Device.
|
virtual |
|
virtual |
Sets the image alignment
| h | Horizontal alignment |
| v | Vertical alignment |
Implements WXP::Device.
|
virtual |
|
virtual |
Sets the line style
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| width | Style (1=solid, >1=patterned) |
Implements WXP::Device.
|
virtual |
Sets the line width
| type | Graphics type (LINE,MARK,FILL,TEXT) |
| width | Width (1=normal) |
Implements WXP::Device.
|
virtual |
Sets the offset of the window on the display
| rx | Upper left X coordinate |
| ry | Upper left Y coordinate |
Implements WXP::Device.
|
virtual |
Sets parameters for the X Windows display
| str | String containing parameters |
Implements WXP::Device.
References WXP::StrLib::copy(), WXP::Strings::equal(), WXP::Strings::getChar(), WXP::Strings::getLength(), WXP::Strings::getNum(), WXP::Strings::getString(), WXP::Strings::index(), and WXP::Strings::scanf().
|
virtual |
|
virtual |
Sets the text alignment
| h | Horizontal alignment |
| v | Vertical alignment |
Implements WXP::Device.
|
virtual |
Sets the window title in title bar
| str | Title string |
Implements WXP::Device.
References WXP::StrLib::copy().
| int XWindow::toggleLoop | ( | ) |
|
virtual |
Exits out of event manager
Implements WXP::Device.
| int XWindow::unsetFocus | ( | ) |
Unsets the focus on the window
|
virtual |
Refreshes/updates the display for expose events
Implements WXP::Device.
Referenced by callback(), deleteFrame(), and displayFrame().
|
static |
Waits on the next event and sends it to process_event
| display | Display to query events |
References processEvent().