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

pgwidgetdnd.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgwidgetdnd.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
00027 */
00028 
00029 #ifndef PG_WIDGETDND_H
00030 #define PG_WIDGETDND_H
00031 
00032 #include "pgwidget.h"
00033 
00044 class DECLSPEC PG_WidgetDnD : public PG_Widget  {
00045 public:
00046 
00049         PG_WidgetDnD(PG_Widget* parent, int dndID, const PG_Rect& r);
00050 
00053         PG_WidgetDnD(PG_Widget* parent, int dndID, const PG_Rect& r, bool bCreateSurface);
00054 
00057         ~PG_WidgetDnD();
00058 
00060         bool GetDrop();
00061 
00063         bool GetDrag();
00064 
00066         void RemoveObjectDnD(PG_WidgetDnD* obj);
00067 
00069         void SetDrop(bool drop);
00070 
00072         void SetDrag(bool drag);
00073 
00075         void updateDragArea(PG_Point pt, SDL_Surface* image);
00076 
00078         void drawDragArea(PG_Point pt, SDL_Surface* image);
00079 
00080 protected: // Protected methods
00081 
00083         PG_WidgetDnD* FindDropTarget(PG_Point pt);
00084 
00086         bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00087 
00089         bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00090 
00092         bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00093 
00095         virtual bool AcceptDrop(PG_WidgetDnD* source, int dndID);
00096 
00098         virtual bool eventDragStart();
00099 
00101         virtual bool eventDragDrop(PG_WidgetDnD* source, int dndID);
00102 
00104         virtual bool eventDragCancel();
00105 
00107         virtual SDL_Surface* eventQueryDragImage();
00108 
00110         virtual SDL_Surface* eventQueryDropImage(SDL_Surface* dragimage = NULL);
00111 
00112         PG_WidgetDnD* dnd_next;
00113         static PG_WidgetDnD* dnd_objectlist;
00114 
00115 private:
00116 
00118         DLLLOCAL void cacheDragArea(PG_Point p);
00119 
00121         DLLLOCAL void restoreDragArea(PG_Point p);
00122 
00124         DLLLOCAL void CheckCursorPos(int& x, int& y);
00125 
00127         DLLLOCAL void slideDragImage(PG_Point start, PG_Point end, int steps, SDL_Surface* image);
00128 
00129         bool CanDrag;
00130 
00131         bool CanDrop;
00132 
00133         bool Draging;
00134 
00135         PG_Point dragPointStart;
00136 
00137         PG_Point dragPointOld;
00138 
00139         PG_Point dragPointCurrent;
00140 
00141         SDL_Surface* dragimage;
00142 
00143         SDL_Surface* dragimagecache;
00144 
00145 private: // disable the copy operators
00146 
00147         PG_WidgetDnD(const PG_WidgetDnD&);
00148         PG_WidgetDnD& operator=(const PG_WidgetDnD&);
00149 
00150 };
00151 
00152 #endif // PG_WIDGETDND_H

Generated on Tue Jun 24 01:27:50 2008 for Advanced Strategic Command by  doxygen 1.4.2