MCS273 Introduction to C++ Programming (January 2013)

"ccc_win.h" Reference

Note: string color is represented using RGB values. For example, black is "#000000" while white is "#FFFFFF". Check the RGB Color Calculator or Color Scheme Designer as a reference.

class GraphicWindow

Member Function Description
void GraphicWindow::coord(double x1, double y1,
                          double x2, double y2)
Sets the coordinate system for subsequent drawing; (x1, y1) is the top left corner, (x2, y2) is the bottom right corner.
void GraphicWindow::clear()
Clears the window (that is, erase its contents).
string GraphicWindow::get_string(string p)
Displays prompt p and returns the entered string.
int GraphicWindow::get_int(string p)
Displays prompt p and returns the entered integer.
double GraphicWindow::get_double(string p)
Displays prompt p and returns the entered double.
Point GraphicWindow::get_mouse(string p);
Displays prompt p and returns the mouse click point.

class Point

Member Function Description
Point::Point(double x, double y)
Constructs a point at location (x, y).
Point::Point(double x, double y, string color)
Constructs a point of color at location (x, y).
double Point::get_x() const
Returns the x-coordinate of the point.
double Point::get_y() const
Returns the y-coordinate of the point.
string Point::get_color() const
Returns the color of the point.
void Point::move(double dx, double dy)
Move the point by (dx, dy).

class Circle

Member Function Description
Circle::Circle(Point p, double r)
Constructs a circle with center p and radius r.
Circle::Circle(Point p, double r, string color)
Constructs a circle of color with center p and radius r.
Point Circle::get_center() const
Returns the center point of the circle.
double Circle::get_radius() const
Returns the radius of the circle.
string Circle::get_color() const
Returns the color of the circle.
void Circle::move(double dx, double dy)
Moves the circle by (dx, dy).

class Line

Member Function Description
Line::Line(Point p, Point q)
Constructs a line joining the points p and q.
Line::Line(Point p, Point q, string color)
Constructs a line of color joining the points p and q.
Point Line::get_start() const
Returns the starting point of the line.
Point Line::get_end() const
Returns the ending point of the line.
string Line::get_color() const
Returns the color of the line.
void Line::move(double dx, double dy)
Moves the line by (dx, dy).

class Message

Member Function Description
Message::Message(Point p, string s)
Constructs a message with starting point p and text string s.
Message::Message(Point p, string s, string color)
Constructs a message of color with starting point p and text string s.
Message::Message(Point p, double x)
Constructs a message with starting point p and label equal to the number x.
Message::Message(Point p, double x, string color)
Constructs a message of color with starting point p and label equal to the number x.
Point Message::get_start() const
Returns the starting point of the message.
string Message::get_text() const
Returns the text string of the message.
string Message::get_color() const
Returns the color of the message.
void Message::move(double dx, double dy)
Moves the message by (dx, dy).

Augmented from Appendix B on page 730 in Computing Concepts with C++ Essentials, Third Edition by Cay Horstmann.

Includes constructors and accessors for color. (Implemented by Prof. Choong-Soo Lee)