-
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 ]
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.
- name: this string defines the name of the Frame. This string
will
appear on the top border of the window on the user's
display and, when a mouse event occurs in a window, this
name will be passed to the OnMouseEvent method so that the
program will know in which Frame the event occured.
- x the x coordinate of where the Frame's upper left-hand
corner is located on the user's
display relative to the upper left-hand corner of the display.
It is measured in pixels of how far the point is from the
left-hand edge of the display.
- y the y coordinate of where the Frame's upper left-hand
corner is located on the user's
display relative to the upper left-hand corner of the display.
It is measured in pixels of how far the point is from the
top edge of the display.
- width the width of the Frame's window measured in pixels.
- height the height of the Frame's window measured in pixels.
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.
- name: this string defines the name of the Frame. This string
will
appear on the top border of the window on the user's
display and, when a mouse event occurs in a window, this
name will be passed to the OnMouseEvent method so that the
program will know in which Frame the event occured.
- x the x coordinate of where the Frame's upper left-hand
corner is located on the user's
display relative to the upper left-hand corner of the display.
It is measured in pixels of how far the point is from the
left-hand edge of the display.
- y the y coordinate of where the Frame's upper left-hand
corner is located on the user's
display relative to the upper left-hand corner of the display.
It is measured in pixels of how far the point is from the
top edge of the display.
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.
- name: this string defines the name of the Frame. This string
will
appear on the top border of the window on the user's
display and, when a mouse event occurs in a window, this
name will be passed to the OnMouseEvent method so that the
program will know in which Frame the event occured.
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.
- newX the new x coordinate
- newy the new y coordinate
>
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.
- newWidth the width of the window after the method is complete
>
- newHeight the height of the window after the method is complete //
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.
- factor: the amount by which the window's height and
width are multiplied. If factor > 1, the window will increase in
size. If factor < 1, the window will decrease in size.
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.
- msg the characters to appear in the window
- x the x coordinate of where the text will begin
- y the y coordinate of where the text will begin
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.
- msg: the text string whose shape is determined.
- width: the width of the given text string.
- height: the height of the given text string.
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.
- x1 x coordinate of one end
- y1 y coordinate of one end
- x2 x coordinate of the other end
- y2 y coordinate of the other end
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.
- x the x coordinate of the center of the circle
- y the y coordinate of the center of the circle
- radius the radius of the circle in pixels
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.
- name the string whose value is tested against the
name of the Frame.
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