Drawing Program
Lab 02 Core Exercise HIT3172
 All Classes Functions Variables
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DrawingController Class Reference

#include <DrawingController.h>

Public Member Functions

 DrawingController (Drawing *=NULL)
Drawingget_controlling ()
void set_controlling (Drawing *)
void draw ()
void handle_input ()

Private Member Functions

void add_new_shape (point2d point)
void move_shape (point2d point)
void resize_shape (int rel_width, int rel_height)
void change_color ()
void change_bg_color ()
color rotate_hue (color)

Private Attributes

Drawing_controlling
drawing_element _adding

Detailed Description

The DrawingController contains most of the logic controlling the application, it needs to know what Drawing object it is controlling

Constructor & Destructor Documentation

DrawingController::DrawingController ( Drawing drawing = NULL)

Initialises a new DrawingController

Parameters
drawingthe Drawing object it is controlling

Member Function Documentation

void DrawingController::add_new_shape ( point2d  point)
private

Adds a new shape centered at a point

Parameters
pointthe point to add the shape
void DrawingController::change_bg_color ( )
private

Changes the hue of the colour of the background colour

void DrawingController::change_color ( )
private

Changes the hue of the colour of the selected shape

void DrawingController::draw ( )

Draws all items on the screen needed for the program

Drawing * DrawingController::get_controlling ( )

Gets the Drawing object the controller is controlling

Returns
the Drawing object the controller is controlling
void DrawingController::handle_input ( )

Handles input and changes state of the program and the Drawing / Shapes it controls

void DrawingController::move_shape ( point2d  relative_movement)
private

Moves the selected shape by a relative amount

Parameters
relative_movementthe relative amount to move the shape
void DrawingController::resize_shape ( int  rel_width,
int  rel_height 
)
private

Resizes the selected shape by a relative amount

Parameters
rel_widththe relative change in width
rel_heightthe relative change in height
color DrawingController::rotate_hue ( color  c)
private

Changes the colour by rotating the hue of the colour

Parameters
cthe original colour
Returns
the hue-altered colour
void DrawingController::set_controlling ( Drawing drawing)

Sets the Drawing object the controller is controlling

Parameters
drawingthe Drawing object to control

Member Data Documentation

drawing_element DrawingController::_adding
private

controls which shape subclass will be drawn to the screen

Drawing* DrawingController::_controlling
private

The Drawing object the controller is controlling


The documentation for this class was generated from the following files: