#include "gobjects.h"

class GOval : public GObject

This graphical object subclass represents an oval inscribed in a rectangular box. For example, the following code displays a filled green oval inscribed in the graphics window:
   int main() {
      GWindow gw;
      cout << "This program draws a green oval filling the window." << endl;
      GOval* oval = new GOval(gw.getWidth(), gw.getHeight());
      oval->setFilled(true);
      oval->setColor("GREEN");
      gw.add(oval);
      return 0;
   }
Constructor
GOval(widthheight)
GOval(xywidthheight) 
Constructs a new oval inscribed in the specified rectangle.
Methods
getFillColor() Returns the color used to display the filled region of this oval.
isFilled() Returns true if the oval is filled.
setBounds(rect)
setBounds(xywidthheight) 
Changes the bounds of the oval to the specified values.
setFillColor(color) Sets the color used to display the filled region of this oval.
setFilled(flag) Sets the fill status for the oval, where false is outlined and true is filled.
setSize(size)
setSize(widthheight) 
Changes the size of the bounding rectangle to the specified width and height.

Constructor detail


GOval(double width, double height);
GOval(double x, double y, double width, double height);
Constructs a new oval inscribed in the specified rectangle. The first form is positioned at the origin; the second at the coordinates given by x and y.

Usage:

GOval* oval = new GOval(width, height);
GOval* oval = new GOval(x, y, width, height);

Method detail


void setSize(const GDimension& size);
void setSize(double width, double height);
Changes the size of the bounding rectangle to the specified width and height.

Usage:

oval->setSize(size);
oval->setSize(width, height);

void setBounds(const GRectangle& size);
void setBounds(double x, double y, double width, double height);
Changes the bounds of the oval to the specified values.

Usage:

oval->setBounds(rect);
oval->setBounds(x, y, width, height);

void setFilled(bool flag);
Sets the fill status for the oval, where false is outlined and true is filled.

Usage:

oval->setFilled(flag);

bool isFilled() const;
Returns true if the oval is filled.

Usage:

if (oval->isFilled()) ...

void setFillColor(string color);
void setFillColor(int rgb);
Sets the color used to display the filled region of this oval.

Usage:

oval->setFillColor(color);

string getFillColor() const;
Returns the color used to display the filled region of this oval. If none has been set, getFillColor returns the empty string.

Usage:

string color = oval->getFillColor();