Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_WidgetDnD Class Reference

Drag and drop handler. More...

#include <pgwidgetdnd.h>

Inheritance diagram for PG_WidgetDnD:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_WidgetDnD (PG_Widget *parent, int dndID, const PG_Rect &r)
 PG_WidgetDnD (PG_Widget *parent, int dndID, const PG_Rect &r, bool bCreateSurface)
 ~PG_WidgetDnD ()
bool GetDrop ()
bool GetDrag ()
void RemoveObjectDnD (PG_WidgetDnD *obj)
void SetDrop (bool drop)
void SetDrag (bool drag)
void updateDragArea (PG_Point pt, SDL_Surface *image)
void drawDragArea (PG_Point pt, SDL_Surface *image)

Protected Member Functions

PG_WidgetDnDFindDropTarget (PG_Point pt)
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
virtual bool AcceptDrop (PG_WidgetDnD *source, int dndID)
virtual bool eventDragStart ()
virtual bool eventDragDrop (PG_WidgetDnD *source, int dndID)
virtual bool eventDragCancel ()
virtual SDL_Surface * eventQueryDragImage ()
virtual SDL_Surface * eventQueryDropImage (SDL_Surface *dragimage=NULL)

Protected Attributes

PG_WidgetDnDdnd_next

Static Protected Attributes

static PG_WidgetDnDdnd_objectlist = NULL

Detailed Description

Drag and drop handler.

Author:
Alexander Pipelka
All classes that would ever require drag and drop functionality (esentially all widgets) derive from this (eventually). Handles both the sending and receiving of all DnD events.

Definition at line 44 of file pgwidgetdnd.h.


Constructor & Destructor Documentation

PG_WidgetDnD::PG_WidgetDnD PG_Widget parent,
int  dndID,
const PG_Rect r
 

Definition at line 36 of file pgwidgetdnd.cpp.

References dnd_next, dnd_objectlist, and PG_Widget::SetID().

PG_WidgetDnD::PG_WidgetDnD PG_Widget parent,
int  dndID,
const PG_Rect r,
bool  bCreateSurface
 

Definition at line 50 of file pgwidgetdnd.cpp.

References dnd_next, dnd_objectlist, and PG_Widget::SetID().

PG_WidgetDnD::~PG_WidgetDnD  ) 
 

Definition at line 64 of file pgwidgetdnd.cpp.

References RemoveObjectDnD().


Member Function Documentation

bool PG_WidgetDnD::AcceptDrop PG_WidgetDnD source,
int  dndID
[protected, virtual]
 

Definition at line 131 of file pgwidgetdnd.cpp.

Referenced by FindDropTarget().

void PG_WidgetDnD::drawDragArea PG_Point  pt,
SDL_Surface *  image
 

Definition at line 376 of file pgwidgetdnd.cpp.

References PG_Draw::BlitSurface(), PG_Application::GetScreen(), PG_Point::x, and PG_Point::y.

Referenced by eventMouseButtonUp(), and eventMouseMotion().

bool PG_WidgetDnD::eventDragCancel  )  [protected, virtual]
 

Definition at line 296 of file pgwidgetdnd.cpp.

Referenced by eventMouseButtonUp().

bool PG_WidgetDnD::eventDragDrop PG_WidgetDnD source,
int  dndID
[protected, virtual]
 

Definition at line 291 of file pgwidgetdnd.cpp.

Referenced by eventMouseButtonUp().

bool PG_WidgetDnD::eventDragStart  )  [protected, virtual]
 

Definition at line 146 of file pgwidgetdnd.cpp.

Referenced by eventMouseButtonDown().

bool PG_WidgetDnD::eventMouseButtonDown const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 151 of file pgwidgetdnd.cpp.

References PG_Draw::CreateRGBSurface(), eventDragStart(), eventQueryDragImage(), PG_Application::GetEventSupplier(), PG_MessageObject::SetCapture(), PG_Point::x, and PG_Point::y.

bool PG_WidgetDnD::eventMouseButtonUp const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 241 of file pgwidgetdnd.cpp.

References drawDragArea(), eventDragCancel(), eventDragDrop(), FindDropTarget(), PG_Application::GetEventSupplier(), PG_Widget::GetID(), PG_MessageObject::ReleaseCapture(), PG_FileArchive::UnloadSurface(), updateDragArea(), PG_Point::x, and PG_Point::y.

bool PG_WidgetDnD::eventMouseMotion const SDL_MouseMotionEvent *  motion  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseMotionEvent message.

This handler is called when mouse movement is detected. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
motion SDL_MouseMotionEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 183 of file pgwidgetdnd.cpp.

References drawDragArea(), PG_MessageObject::eventMouseMotion(), eventQueryDragImage(), eventQueryDropImage(), FindDropTarget(), PG_Application::GetEventSupplier(), updateDragArea(), PG_Point::x, and PG_Point::y.

SDL_Surface * PG_WidgetDnD::eventQueryDragImage  )  [protected, virtual]
 

Definition at line 301 of file pgwidgetdnd.cpp.

Referenced by eventMouseButtonDown(), and eventMouseMotion().

SDL_Surface * PG_WidgetDnD::eventQueryDropImage SDL_Surface *  dragimage = NULL  )  [protected, virtual]
 

Definition at line 372 of file pgwidgetdnd.cpp.

Referenced by eventMouseMotion().

PG_WidgetDnD * PG_WidgetDnD::FindDropTarget PG_Point  pt  )  [protected]
 

Definition at line 104 of file pgwidgetdnd.cpp.

References AcceptDrop(), dnd_next, dnd_objectlist, GetDrop(), PG_Widget::GetID(), PG_Rect::IsInside(), and PG_Widget::IsVisible().

Referenced by eventMouseButtonUp(), and eventMouseMotion().

bool PG_WidgetDnD::GetDrag  ) 
 

Definition at line 69 of file pgwidgetdnd.cpp.

bool PG_WidgetDnD::GetDrop  ) 
 

Definition at line 74 of file pgwidgetdnd.cpp.

Referenced by FindDropTarget().

void PG_WidgetDnD::RemoveObjectDnD PG_WidgetDnD obj  ) 
 

Definition at line 79 of file pgwidgetdnd.cpp.

References dnd_next, and dnd_objectlist.

Referenced by ~PG_WidgetDnD().

void PG_WidgetDnD::SetDrag bool  drag  ) 
 

Definition at line 136 of file pgwidgetdnd.cpp.

void PG_WidgetDnD::SetDrop bool  drop  ) 
 

Definition at line 141 of file pgwidgetdnd.cpp.

void PG_WidgetDnD::updateDragArea PG_Point  pt,
SDL_Surface *  image
 

Definition at line 395 of file pgwidgetdnd.cpp.

References PG_Application::GetScreen(), PG_Application::UpdateRects(), PG_Point::x, and PG_Point::y.

Referenced by eventMouseButtonUp(), and eventMouseMotion().


Member Data Documentation

PG_WidgetDnD* PG_WidgetDnD::dnd_next [protected]
 

Definition at line 112 of file pgwidgetdnd.h.

Referenced by FindDropTarget(), PG_WidgetDnD(), and RemoveObjectDnD().

PG_WidgetDnD * PG_WidgetDnD::dnd_objectlist = NULL [static, protected]
 

Definition at line 34 of file pgwidgetdnd.cpp.

Referenced by FindDropTarget(), PG_WidgetDnD(), and RemoveObjectDnD().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:43 2008 for Advanced Strategic Command by  doxygen 1.4.2