Draggable Class Reference

#include <Draggable.h>

Inherits Graphic, and MouseListener.

Collaboration diagram for Draggable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Draggable ()
 Draggable (int normalType, int hoverType, int clickType, int dragType, Point startLocation, Point size)
 Creates a new draggable button with the images at the start location and with the size given.
 Draggable (int normalType, int hoverType, int clickType, int dragType, Point startLocation, Point size, PriorityEnum priority)
virtual ~Draggable ()
 Deletes the button and the clickListenrs attached to it.
void draw (BITMAP *canvas, Point offset)
 Draws the button.
void mouseClick (MouseEvent *)
 Changes the image on mouse click.
void mouseDrag (MouseEvent *)
 Moves the image when dragged.
void mouseRelease (MouseEvent *)
 Notifies the clickListeners when the mouse is released on top of the button.
void mouseHover (MouseEvent *)
 Changes the image when the mouse is hovered over.
void mouseExit (MouseEvent *)
 Returns the image to normal when the mouse leaves the area of the button.
void addClickListener (ClickListener *l)
 Adds a clickListener to the button.
void setImage (int type)
 Changes the image to the new type given.
Point getOffset ()
 Returns the offset between the cursor position and the draggable position.
void setCenterDrag (bool center)
 Sets center-dragging.
bool containsPoint (Point p)
PriorityEnum priority ()

Protected Attributes

int normalType
int hoverType
int clickType
int dragType
 The images for the button.
PriorityEnum draggablePriority
Point size
Point curLocation
 Location and size of the button.
BITMAP * currentImage
 The current image of the button.
int currentType
bool dragging
std::list< ClickListener * > * clickListeners
Point dragOffset
bool centerDrag
 Whether the image should be centered around the cursor.


Constructor & Destructor Documentation

Draggable::Draggable (  ) 

Draggable::Draggable ( int  normalType,
int  hoverType,
int  clickType,
int  dragType,
Point  startLocation,
Point  size 
)

Creates a new draggable button with the images at the start location and with the size given.

Initializes the button, setting the image types and the location and size of the buttons

Draggable::Draggable ( int  normalType,
int  hoverType,
int  clickType,
int  dragType,
Point  startLocation,
Point  size,
PriorityEnum  priority 
)

Draggable::~Draggable (  )  [virtual]

Deletes the button and the clickListenrs attached to it.


Member Function Documentation

void Draggable::addClickListener ( ClickListener l  ) 

Adds a clickListener to the button.

bool Draggable::containsPoint ( Point  p  )  [virtual]

Reimplemented from MouseListener.

void Draggable::draw ( BITMAP *  canvas,
Point  offset 
) [virtual]

Draws the button.

Implements Graphic.

Point Draggable::getOffset (  ) 

Returns the offset between the cursor position and the draggable position.

void Draggable::mouseClick ( MouseEvent e  )  [virtual]

Changes the image on mouse click.

Reimplemented from MouseListener.

void Draggable::mouseDrag ( MouseEvent e  )  [virtual]

Moves the image when dragged.

Reimplemented from MouseListener.

void Draggable::mouseExit ( MouseEvent  )  [virtual]

Returns the image to normal when the mouse leaves the area of the button.

Reimplemented from MouseListener.

void Draggable::mouseHover ( MouseEvent  )  [virtual]

Changes the image when the mouse is hovered over.

Reimplemented from MouseListener.

void Draggable::mouseRelease ( MouseEvent e  )  [virtual]

Notifies the clickListeners when the mouse is released on top of the button.

Reimplemented from MouseListener.

PriorityEnum Draggable::priority (  )  [virtual]

Reimplemented from MouseListener.

void Draggable::setCenterDrag ( bool  center  ) 

Sets center-dragging.

void Draggable::setImage ( int  type  ) 

Changes the image to the new type given.


Member Data Documentation

bool Draggable::centerDrag [protected]

Whether the image should be centered around the cursor.

std::list<ClickListener*>* Draggable::clickListeners [protected]

int Draggable::clickType [protected]

Location and size of the button.

BITMAP* Draggable::currentImage [protected]

The current image of the button.

int Draggable::currentType [protected]

bool Draggable::dragging [protected]

int Draggable::dragType [protected]

The images for the button.

int Draggable::hoverType [protected]

int Draggable::normalType [protected]

Point Draggable::size [protected]


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

Generated on Mon Mar 16 14:33:08 2009 for LearningGaming by  doxygen 1.5.7.1