Frame

This class represents the abstraction of a graphical user interface window. The methods of this class allow for simple text and graphics to be displayed in the window. Under program control, the window may be moved on the user's display and its shape may be changed. Each Frame is given a name that is appears on the title bar of the visible window and is used to identify the Frame when mouse events occur in that window. The location of a Frame on the user's display is measured in a coordinate system where the upper left-hand corner of the display is the coordinates (0,0), the x-axis is the top of the display with higher x values to the right, and the y-axis is the left edge of the display with higher values nearer the bottom of the display. The shape of a Frame is given by it width and height, both measures in pixels. The Frame class declares several named constants that are used to identify the nature of mouse events that occur in a window.

[ Index | Source | Summary | Member Functions ]

Quick Index


Class Summary

class Frame
{

public:
Frame(char* name, int x, int y, int width, int height);
Frame(char* name, int x, int y);
Frame(char* name);
Frame();
void MoveTo(int newX, int newY);
void Resize(int newWidth, int newHeight);
void Resize( float factor);
void DrawText(char* msg, int x, int y);
void TextSize (char* msg, int& width, int& height);
void DrawLine(int x1, int y1, int x2, int y2);
void DrawCircle(int x, int y, int radius);
void Clear();
int IsNamed(char* name);
void ~Frame()$">Frame();
}; // Frame

Back to the top of Frame


Frame(char* name, int x, int y, int width, int height);

Construct a Frame object specifying the Frame's name, its location - the x and y coordinates, and its shape - its width and height.

    Frame(char* name, int x, int y, int width, int height);

Back to the top of Frame


Frame(char* name, int x, int y);

Construct a Frame object specifying the Frame's name, and its location - the x and y coordinates. Default values are used for the Frame's height and width.

  Frame(char* name, int x, int y);

Back to the top of Frame


Frame(char* name);

Construct a Frame object specifying the Frame's name. The Frames location (x and y coordinates) and its shape (width and height) are given default values.

  Frame(char* name);

Back to the top of Frame


Frame();

Construct a Frame object with default values used for its name, location, and shape.

  Frame();

Back to the top of Frame


void MoveTo(int newX, int newY);

Change the location of a window on the user's display. The (x,y) coordinates of the upper left-hand corner of the Frame's new position relative to the upper left-hand corner of the user's display are given.

  void  MoveTo(int newX, int newY);           

Back to the top of Frame


void Resize(int newWidth, int newHeight);

Change the shape of a window. Both the new width and the new height of the window must be given.

  void  Resize(int newWidth, int newHeight);        

Back to the top of Frame


void Resize( float factor);

Change the dimensions of the Frame's visible window by multiplying each dimension by a given amount.

   void     Resize( float factor);              

Back to the top of Frame


void DrawText(char* msg, int x, int y);

Draw a text string at a given location in a window. The displayed text is drawn in a rectangular area whose upper left-hand corner is given by the x and y parameters.

   void  DrawText(char* msg, int x,  int  y);

Back to the top of Frame


void TextSize (char* msg, int& width, int& height);

Return the width and height of the rectangular area occupied in the window by the given text string. This method is useful in erasing a given text string (see the Clear method). The width and height arguments are passed by reference so that the two integer values can be returned to the caller.

   void TextSize (char* msg, int& width, int& height);               

Back to the top of Frame


void DrawLine(int x1, int y1, int x2, int y2);

Draw a line between two points. Each point is denoted by an (x,y) coordinate pair.

  void  DrawLine(int x1, int y1, int x2, int y2);          

Back to the top of Frame


void DrawCircle(int x, int y, int radius);

Draw a circle at a given location with a given radius.

    void  DrawCircle(int x, int y, int radius);

Back to the top of Frame


void Clear();

Erase the contents of the window. All text and graphics displayed in the window will be erased. Typically, this method is used before refreshing/redrawing the contents of the window to insure that all text/graphics previously drawn are erased.

    void  Clear();

Back to the top of Frame


int IsNamed(char* name);

Indicate if the Frame has a name equal to that of the string given as the parameter. This method is typically used in the onMouseEvent method to determine in which Frame a given mouse event occurred.

   int   IsNamed(char* name);      

Back to the top of Frame


void ~Frame();

Dispose of all resource associated with this object and its window.

  void ~Frame();

Back to the top of Frame


Member Functions

public:
void MoveTo(int newX, int newY);
void Resize(int newWidth, int newHeight);
void Resize( float factor);
void DrawText(char* msg, int x, int y);
void TextSize (char* msg, int& width, int& height);
void DrawLine(int x1, int y1, int x2, int y2);
void DrawCircle(int x, int y, int radius);
void Clear();
int IsNamed(char* name);

Back to the top of Frame


Generated from source by the Cocoon utilities on Thu Apr 02 12:39:16 1998 .

Report problems to jkotula@unimax.com