Main Page Class Hierarchy Compound List File List Compound Members File Members Related Pages Examples

# sdlwidgetdnd.h

Go to the documentation of this file.

    00001 /*
    00002     ParaGUI - crossplatform widgetset
    00003     Copyright (C) 2000  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: pipelka $
    00023     Update Date:      $Date: 2001/01/31 17:23:17 $
    00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdlwidgetdnd_h-source.html,v $
    00025     CVS/RCS Revision: $Revision: 1.34 $
    00026     Status:           $State: Exp $
    00027 */
    00028
    00029 #ifndef SDLWIDGETDND_H
    00030 #define SDLWIDGETDND_H
    00031
    00032 #ifdef SWIG
    00033 %include "swigcommon.h"
    00034 %module sdlwidgetdnd
    00035 %{
    00036 #include "sdlwidgetdnd.h"
    00037 %}
    00038 #endif
    00039
    00040 #include "sdlwidget.h"
    00041
    00052 class DECLSPEC SDLWidgetDnD : public SDLWidget  {
    00053 public:
    00054
    00055     SDLWidgetDnD(SDLWidget* parent, int dndID, SDL_Rect& r);
    00056     ~SDLWidgetDnD();
    00057
    00059     bool GetDrop();
    00060
    00062     bool GetDrag();
    00063
    00065     void RemoveObjectDnD(SDLWidgetDnD* obj);
    00066
    00068     void SetDrop(bool drop);
    00069
    00071     void SetDrag(bool drag);
    00072
    00074     void updateDragArea(SDL_Point pt, SDL_Surface* image);
    00075
    00077     void drawDragArea(SDL_Point pt, SDL_Surface* image);
    00078
    00079 protected: // Protected methods
    00080
    00082     SDLWidgetDnD* FindDropTarget(SDL_Point pt);
    00083
    00085     bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
    00086
    00088     bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
    00089
    00091     bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
    00092
    00094     virtual bool AcceptDrop(SDLWidgetDnD* source, int dndID);
    00095
    00097     virtual bool eventDragStart();
    00098
    00100     virtual bool eventDragDrop(SDLWidgetDnD* source, int dndID);
    00101
    00103     virtual bool eventDragCancel();
    00104
    00106     virtual SDL_Surface* eventQueryDragImage();
    00107
    00109     virtual SDL_Surface* eventQueryDropImage(SDL_Surface* dragimage = NULL);
    00110
    00111     SDLWidgetDnD* dnd_next;
    00112     static SDLWidgetDnD* dnd_objectlist;
    00113
    00114 private:
    00115
    00117     void cacheDragArea(SDL_Point p);
    00118
    00120     void restoreDragArea(SDL_Point p);
    00121
    00123     void CheckCursorPos(int& x, int& y);
    00124
    00126     void slideDragImage(SDL_Point start, SDL_Point end, int steps, SDL_Surface* image);
    00127
    00128     bool        CanDrag;
    00129     bool        CanDrop;
    00130     bool        Draging;
    00131     SDL_Point dragPointStart;
    00132     SDL_Point dragPointOld;
    00133     SDL_Point dragPointCurrent;
    00134     SDL_Surface* dragimage;
    00135     SDL_Surface* dragimagecache;
    00136
    00137 private: // disable the copy operators
    00138     SDLWidgetDnD(const SDLWidgetDnD&);
    00139     SDLWidgetDnD& operator=(const SDLWidgetDnD&);
    00140 };
    00141
    00142 #endif // SDLWIDGETDND_H