-
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.
[
Index |
Source |
Summary | Member Functions ]
Class Summary
class Frame
{
public:
- Frame(char *name, Location location, Shape shape);
- Frame(char* name, Location loc);
- Frame(char* name, Shape sh);
- Frame(char* name);
- Frame();
- ~Frame();
- void MoveTo(Location location);
- void Resize(Shape shape);
- void Resize( float factor);
- void DrawText(char* msg, Location location);
- Shape TextSize (char* msg);
- void DrawLine(Location p1, Location p2);
- void DrawCircle(Location center, int radius);
- void Clear();
- void Clear(Location location, Shape shape);
- int IsNamed(char* name);
}; // Frame
Back to the top of Frame
Frame(char *name, Location location, Shape shape);
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.
- location the coordinates 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.
- shape the height and width of the Frame, measured in pixels.
Frame(char *name, Location location, Shape shape);
Back to the top of Frame
Frame(char* name, Location loc);
Construct a Frame object specifying the Frame's name, and its Location.
The Frame is constructed with a default Shape.
- 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.
- location the coordinates 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.
Frame(char* name, Location loc);
Back to the top of Frame
Frame(char* name, Shape sh);
Construct a Frame object specifying the Frame's name, and its Shape.
The Frame is constructed at a default Location.
- 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.
- shape the height and width of the Frame, measured in pixels.
Frame(char* name, Shape sh);
Back to the top of Frame
Frame(char* name);
Construct a Frame object specifying the Frame's name. Both the Location
and the Shape of the Frame are determined by defaults.
- 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 specifying. The Frame's name, its Location, and
its Shape are given default values.
Frame();
Back to the top of Frame
~Frame();
Destructor: frees resources when Frame object is deleted
~Frame();
Back to the top of Frame
void MoveTo(Location location);
Move the Frame's visible window to a specified Location.
- location: the new position of the upper left-hand
corner of the Frame's visible window.
void MoveTo(Location location);
Back to the top of Frame
void Resize(Shape shape);
Change the dimensions of the Frame's visible window to a
specified Shape.
- shape: the new dimensons for the window.
void Resize(Shape shape);
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, Location location);
Draw a text string in the Frames' visible window starting at the
specified location.
- msg: the text string to be drawn.
- location: the upper left-hand corner of where within
the window the first character of the string will be drawn. The
coordinates of the Location are interpreted with respect to the
upper left-hand corner of the window.
void DrawText(char* msg, Location location);
Back to the top of Frame
Shape TextSize (char* msg);
Return the Shape 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)
- msg: the text string whose shape is determined.
Shape TextSize (char* msg);
Back to the top of Frame
void DrawLine(Location p1, Location p2);
Draw a line segment between two points whose Locations are specified.
- p1: one end of the line segment.
- p2: the other end of the line segment.
void DrawLine(Location p1, // draw line from point p1
Location p2); // to point p2
Back to the top of Frame
void DrawCircle(Location center, int radius);
Draw a circle of the specified radius about a specified centerpoint.
- center: the center point of the circle.
- radius: the radius of the circle.
void DrawCircle(Location center, int radius);
Back to the top of Frame
void Clear();
Erase the contents of the Frame's visible window.
void Clear();
Back to the top of Frame
void Clear(Location location, Shape shape);
Erase a specified rectangular region of the Frame's visible window.
Only the specified rectangular region is affected.
- location: the coordinates of the upper left-hand
corner of the rectangular area to be erased.
- shape: the height and width of the rectangular
area to be erased.
void Clear(Location location, Shape shape);
Back to the top of Frame
int IsNamed(char* name);
Reply if the given string is equal to the name of the Frame.
- name: Return 1 if this string matches the name given
to the Frame when the Frame was constructed. Return 0 otherwise.
int IsNamed(char* name);
Back to the top of Frame
Member Functions
- public:
- void MoveTo(Location location);
- void Resize(Shape shape);
- void Resize( float factor);
- void DrawText(char* msg, Location location);
- Shape TextSize (char* msg);
- void DrawLine(Location p1, Location p2);
- void DrawCircle(Location center, int radius);
- void Clear();
- void Clear(Location location, Shape shape);
- int IsNamed(char* name);
Back to the top of Frame
Generated from source by the Cocoon utilities on Thu Apr 02 12:39:40 1998
.
Report problems to jkotula@unimax.com