Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SimpleWindow Class Reference

#include <SimpleWindow.h>

Inheritance diagram for SimpleWindow:

Drawing::Canvas Drawing::ToolWindow List of all members.

Public Methods

 SimpleWindow (const string &WindowTitle, float Width=DefaultWidth, float Height=DefaultHeight, const Position &WindowPosition=LogicalOrigin)
 Initializes the member variables.

 SimpleWindow (const char *WindowTitle="Untitled", float Width=DefaultWidth, float Height=DefaultHeight, const Position &WindowPosition=LogicalOrigin)
 SimpleWindow (const SimpleWindow &CopyWindow)
 Displays an alert box and terminates the program.

virtual ~SimpleWindow ()
 Closes the window.

SimpleWindow operator= (const SimpleWindow &NewWindow)
 Displays an alert box and terminates the program.

WindowStatus Open ()
 Creates the graphical window and displays it.

WindowStatus Close ()
 Stops the timer if it is active, destroys the window, and removes it from the display.

WindowStatus GetStatus () const
 Returns the status of the window.

void DrawBitMap (const Pixmap &PixelMap, const Position &UpperLeft, const Position &Size)
 Draws a bitmap in the window.

void Erase (const Position &UpperLeft, float Width, float Height)
 Draws a rectangle to cover up something in the window.

void RenderRectangle (const Position &UpperLeft, const Position &LowerRight, const color &FillColor, const bool Border=false)
 Draws a rectangle with a black border.

void RenderLine (const Position &Base, const Position &Endpoint, const color &Color, const float LineWidth)
 Draws a line.

void RenderEllipse (const Position &UpperLeft, const Position &LowerRight, const color &FillColor, const bool Border=false)
 Draws an ellipse with a black border.

void RenderPolygon (const Position PolyPoints[], int NbrPoints, const color &FillColor, const bool Border=false)
 Draws a polygon with a black border - Parameters: -# The first parameter specifies an array of logical locations that make up the vertices of the polygon.

void RenderPolygon (const vector< Position > &PolyPoints, int NPoints, const color &Color, const bool Border=false)
 Draws a polygon with a black border.

void RenderText (const Position LabelCenter, const string &Message=DefaultMessage, const color &TextColor=Black, const color &BackgroundColor=DefaultColor)
 Draws text.

void RenderText (const Position LabelCenter, const char *Message=DefaultMessage.c_str(), const color &TextColor=Black, const color &BackgroundColor=DefaultColor)
void RenderText (const Position &UpperLeft, const Position &LowerRight, const string &Message=DefaultMessage, const color &TextColor=Black, const color &BackgroundColor=DefaultColor)
 Draws text.

void RenderText (const Position &UpperLeft, const Position &LowerRight, const char *Message=DefaultMessage.c_str(), const color &TextColor=Black, const color &BackgroundColor=DefaultColor)
void Message (const string &Message=DefaultMessage)
 Generates an alert box with the message passed as a parameter.

float GetWidth () const
 Returns the logical width of the window.

float GetHeight () const
 Returns the logical height of the window.

float GetXPosition () const
 Returns the logical x coordinate of the upper left corner of the window.

float GetYPosition () const
 Returns the logical y coordinate of the upper left corner of the window.

Position GetCenter () const
 Returns the logical position of the center of the window.

Position GetPosition () const
 Returns the logical position of the upper left corner of the window.

bool StartTimer (int Interval)
 Starts the interval timer associated with this window.

void StopTimer ()
 Stops the interval timer associated with this window.

void SetQuitCallback (const QuitCallbackFunction &Callback)
 Sets the function that will be called when the window is closed.

void SetTimerCallback (const TimerTickCallbackFunction &Callback)
 Sets the function that will be called when the timer expires.

void SetRefreshCallback (const RefreshCallbackFunction &Callback)
 Sets the function that will be called when the window is damaged.

void SetMouseClickCallback (const MouseClickCallbackFunction &Callback)
 Sets the function that will be called when a mouse click occurs.


Protected Methods

virtual Bool QuitEvent ()
 Calls the function associated with the window closing.

virtual Bool RefreshEvent ()
 Calls the function assoicated with the window being exposed.

virtual Bool TimerEvent ()
 Calls the function associated with the timer expiring.

virtual Bool MouseClickEvent (const Position &MousePosn)
 Calls the function associated with mouse clicks.


Private Methods

void CheckTimer ()
void ConfigureEvent (const XEvent &Report)

Private Attributes

Window window
Pixmap ScreenBuffer
string Title
WindowStatus WinStatus
RefreshCallbackFunction RefreshCallback
QuitCallbackFunction QuitCallback
TimerTickCallbackFunction TimerCallback
MouseClickCallbackFunction MouseClickCallback
Bool TimerActive
unsigned long int AlarmTime
long OldTime
int WinX
int WinY
int WinWidth
int WinHeight
float LogX
float LogY
float LogWidth
float LogHeight

Friends

class WindowManager

Constructor & Destructor Documentation

SimpleWindow::SimpleWindow const string &    WindowTitle = NoTitle,
float    Width = DefaultWidth,
float    Height = DefaultHeight,
const Position &    WindowPosition = LogicalOrigin
 

Initializes the member variables.

  • Parameters:
    1. The first parameter specifies the title of the window.
    2. The second parameter specifies the width of the window in centimeters.
    3. The third parameter specifies the height of the window in centimeters.
    4. The fourth parameter specifies the location of the upper left corner of the window in centimeters.

SimpleWindow::SimpleWindow const char *    WindowTitle = "Untitled",
float    Width = DefaultWidth,
float    Height = DefaultHeight,
const Position &    WindowPosition = LogicalOrigin
 

SimpleWindow::SimpleWindow const SimpleWindow &    CopyWindow
 

Displays an alert box and terminates the program.

SimpleWindow objects should not be copied.

  • Parameters:
  1. The parameter specifies the SimpleWindow to copy.

SimpleWindow::~SimpleWindow   [virtual]
 

Closes the window.


Member Function Documentation

void SimpleWindow::CheckTimer   [private]
 

WindowStatus SimpleWindow::Close  
 

Stops the timer if it is active, destroys the window, and removes it from the display.

void SimpleWindow::ConfigureEvent const XEvent &    Report [private]
 

void SimpleWindow::DrawBitMap const Pixmap &    PixelMap,
const Position &    UpperLeft,
const Position &    Size
 

Draws a bitmap in the window.

  • Parameters:
    1. The first parameter specifies the data that constitutes the bitmap.
    2. The second parameter specifies the location of the upper left corner of the bitmap in centimeters.
    3. The third parameter specifies the dimensions of the bitmap in centimeters.

void SimpleWindow::Erase const Position &    UpperLeft,
float    Width,
float    Height
 

Draws a rectangle to cover up something in the window.

  • Parameters:
    1. The first parameter specifies the location in centimeters of the upper left corner of the rectangle to draw.
    2. The second parameter specifies the width in centimeters of the rectangle to draw.
    3. The third parameter specifies the height in centimeters of the rectangle to draw.
    4. The fourth parameter specifies the color of the rectangle to draw.

Position SimpleWindow::GetCenter   const
 

Returns the logical position of the center of the window.

float SimpleWindow::GetHeight   const
 

Returns the logical height of the window.

Position SimpleWindow::GetPosition   const
 

Returns the logical position of the upper left corner of the window.

WindowStatus SimpleWindow::GetStatus   const
 

Returns the status of the window.

A window is either open or closed or an error has occured.

float SimpleWindow::GetWidth   const
 

Returns the logical width of the window.

float SimpleWindow::GetXPosition   const
 

Returns the logical x coordinate of the upper left corner of the window.

float SimpleWindow::GetYPosition   const
 

Returns the logical y coordinate of the upper left corner of the window.

void SimpleWindow::Message const string &    Message = DefaultMessage
 

Generates an alert box with the message passed as a parameter.

  • Parameters:
    1. The parameter specifies the message to put in the alert box.

int SimpleWindow::MouseClickEvent const Position &    MousePosn [protected, virtual]
 

Calls the function associated with mouse clicks.

Reimplemented in Drawing::Canvas, and Drawing::ToolWindow.

WindowStatus SimpleWindow::Open  
 

Creates the graphical window and displays it.

SimpleWindow SimpleWindow::operator= const SimpleWindow &    NewWindow
 

Displays an alert box and terminates the program.

Assignment of SimpleWindow objects not allowed.

  • Parameters:
  1. The parameter specifies the new window.

int SimpleWindow::QuitEvent   [protected, virtual]
 

Calls the function associated with the window closing.

int SimpleWindow::RefreshEvent   [protected, virtual]
 

Calls the function assoicated with the window being exposed.

Reimplemented in Drawing::Canvas, and Drawing::ToolWindow.

void SimpleWindow::RenderEllipse const Position &    UpperLeft,
const Position &    LowerRight,
const color   FillColor = DefaultColor,
const bool    Border = false
 

Draws an ellipse with a black border.

  • Parameters:
    1. The first parameter specifies the location in centimeters of the upper left corner of a bounding box.
    2. The second parameter specifies the location in centimeters of the lower right corner of a bounding box.
    3. The third parameter specifies the fill color of the ellipse.
    4. The fourth parameter specifies whether or not the ellipse will be drawn with a black outline.

void SimpleWindow::RenderLine const Position &    Base,
const Position &    Endpoint,
const color   Color,
const float    LineWidth
 

Draws a line.

  • Parameters:
    1. The first parameter specifies the location in centimeters of one endpoint of the line.
    2. The second parameter specifies the location in centimeters of the other endpoint of the line.
    3. The third parameter specifies the color of the line.
    4. The fourth paramter specifies the line width in centimeters.

void SimpleWindow::RenderPolygon const vector< Position > &    PolyPoints,
int    NbrPoints,
const color   FillColor = DefaultColor,
const bool    Border = false
 

Draws a polygon with a black border.

  • Parameters:
    1. The first parameter specifies a vector of logical locations that make up the vertices of the polygon.
    2. The second parameter specifies the number of vertices that the polygon has.
    3. The third parameter specifies the fill color of the polygon.
    4. The fourth parameter specifies whether or not the polygon will be drawn with a black outline.

void SimpleWindow::RenderPolygon const Position    PolyPoints[],
int    NbrPoints,
const color   FillColor = DefaultColor,
const bool    Border = false
 

Draws a polygon with a black border - Parameters: -# The first parameter specifies an array of logical locations that make up the vertices of the polygon.

  1. The second parameter specifies the number of vertices that the polygon has.
    1. The third parameter specifies the fill color of the polygon.
    2. The fourth parameter specifies whether or not the polygon will be drawn with a black outline.

void SimpleWindow::RenderRectangle const Position &    UpperLeft,
const Position &    LowerRight,
const color   FillColor = DefaultColor,
const bool    Border = false
 

Draws a rectangle with a black border.

  • Parameters:
    1. The first parameter specifies the location in centimeters of the upper left corner of the rectangle.
    2. The second parameter specifies the location in centimeters of the lower right corner of the rectangle.
    3. The third parameter specifies the fill color of the rectangle.
    4. The fourth parameter specifies whether or not the rectangle will be drawn with a black outline.

void SimpleWindow::RenderText const Position &    UpperLeft,
const Position &    LowerRight,
const char *    Message = DefaultMessage.c_str(),
const color   TextColor = Black,
const color   BackgroundColor = DefaultColor
 

void SimpleWindow::RenderText const Position &    UpperLeft,
const Position &    LowerRight,
const string &    Message = DefaultMessage,
const color   TextColor = Black,
const color   BackgroundColor = DefaultColor
 

Draws text.

  • Parameters:
    1. The first parameter specifies the logical location for the upper left corner of an invisible box used to center the text.
    2. The second parameter specifies the logical location for the lower right corner of an invisible box used to center the text.
    3. The third parameter specifies the message that is the text.
    4. The fourth parameter specifies the color of the text.
    5. The fifth parameter specifies the background color of the text.

void SimpleWindow::RenderText const Position    LabelCenter,
const char *    Message = DefaultMessage.c_str(),
const color   TextColor = Black,
const color   BackgroundColor = DefaultColor
 

void SimpleWindow::RenderText const Position    LabelCenter,
const string &    Message = DefaultMessage,
const color   TextColor = Black,
const color   BackgroundColor = DefaultColor
 

Draws text.

  • Parameters:
    1. The first parameter specifies where to center the text.
    2. The second parameter specifies the message that is the text.
    3. The third parameter specifies the color of the text.
    4. The fourth parameter specifies the background color of the text.

void SimpleWindow::SetMouseClickCallback const MouseClickCallbackFunction   Callback
 

Sets the function that will be called when a mouse click occurs.

void SimpleWindow::SetQuitCallback const QuitCallbackFunction   Callback
 

Sets the function that will be called when the window is closed.

void SimpleWindow::SetRefreshCallback const RefreshCallbackFunction   Callback
 

Sets the function that will be called when the window is damaged.

void SimpleWindow::SetTimerCallback const TimerTickCallbackFunction   Callback
 

Sets the function that will be called when the timer expires.

int SimpleWindow::StartTimer int    Interval
 

Starts the interval timer associated with this window.

Each time the timer expires, the function set by SetTimerCallback get called.

void SimpleWindow::StopTimer  
 

Stops the interval timer associated with this window.

Bool SimpleWindow::TimerEvent   [protected, virtual]
 

Calls the function associated with the timer expiring.

Reimplemented in Drawing::Canvas.


Friends And Related Function Documentation

friend class WindowManager [friend]
 


Member Data Documentation

unsigned long int SimpleWindow::AlarmTime [private]
 

float SimpleWindow::LogHeight [private]
 

float SimpleWindow::LogWidth [private]
 

float SimpleWindow::LogX [private]
 

float SimpleWindow::LogY [private]
 

MouseClickCallbackFunction SimpleWindow::MouseClickCallback [private]
 

long SimpleWindow::OldTime [private]
 

QuitCallbackFunction SimpleWindow::QuitCallback [private]
 

RefreshCallbackFunction SimpleWindow::RefreshCallback [private]
 

Pixmap SimpleWindow::ScreenBuffer [private]
 

Bool SimpleWindow::TimerActive [private]
 

TimerTickCallbackFunction SimpleWindow::TimerCallback [private]
 

string SimpleWindow::Title [private]
 

Window SimpleWindow::window [private]
 

int SimpleWindow::WinHeight [private]
 

WindowStatus SimpleWindow::WinStatus [private]
 

int SimpleWindow::WinWidth [private]
 

int SimpleWindow::WinX [private]
 

int SimpleWindow::WinY [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Nov 8 10:52:32 2002 for Draw by doxygen1.2.17