00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CEGUIDragContainer_h_
00029 #define _CEGUIDragContainer_h_
00030
00031 #include "CEGUIWindow.h"
00032 #include "CEGUIWindowFactory.h"
00033 #include "elements/CEGUIDragContainerProperties.h"
00034
00035
00036 #if defined(_MSC_VER)
00037 # pragma warning(push)
00038 # pragma warning(disable : 4251)
00039 #endif
00040
00041
00042 namespace CEGUI
00043 {
00048 class CEGUIEXPORT DragContainer : public Window
00049 {
00050 public:
00051
00052
00053
00054 static const String WidgetTypeName;
00055 static const String EventNamespace;
00056 static const String EventDragStarted;
00057 static const String EventDragEnded;
00058 static const String EventDragPositionChanged;
00059 static const String EventDragEnabledChanged;
00060 static const String EventDragAlphaChanged;
00061 static const String EventDragMouseCursorChanged;
00062 static const String EventDragThresholdChanged;
00063 static const String EventDragDropTargetChanged;
00064
00065
00066
00067
00072 DragContainer(const String& type, const String& name);
00073
00078 virtual ~DragContainer(void);
00079
00080
00081
00082
00091 bool isDraggingEnabled(void) const;
00092
00104 void setDraggingEnabled(bool setting);
00105
00114 bool isBeingDragged(void) const;
00115
00127 float getPixelDragThreshold(void) const;
00128
00143 void setPixelDragThreshold(float pixels);
00144
00153 float getDragAlpha(void) const;
00154
00170 void setDragAlpha(float alpha);
00171
00180 const Image* getDragCursorImage(void) const;
00181
00196 void setDragCursorImage(const Image* image);
00197
00212 void setDragCursorImage(MouseCursorImage image);
00213
00234 void setDragCursorImage(const String& imageset, const String& image);
00235
00247 Window* getCurrentDropTarget(void) const;
00248
00249 protected:
00250
00251
00252
00265 bool isDraggingThresholdExceeded(const Point& local_mouse);
00266
00274 void initialiseDragging(void);
00275
00286 void doDragging(const Point& local_mouse);
00287
00292 void updateActiveMouseCursor(void) const;
00293
00294
00305 virtual bool testClassName_impl(const String& class_name) const
00306 {
00307 if (class_name=="DragContainer") return true;
00308 return Window::testClassName_impl(class_name);
00309 }
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 virtual void onMouseButtonDown(MouseEventArgs& e);
00320 virtual void onMouseButtonUp(MouseEventArgs& e);
00321 virtual void onMouseMove(MouseEventArgs& e);
00322 virtual void onCaptureLost(WindowEventArgs& e);
00323 virtual void onAlphaChanged(WindowEventArgs& e);
00324 virtual void onClippingChanged(WindowEventArgs& e);
00325 virtual void onMoved(WindowEventArgs& e);
00326
00327
00328
00329
00340 virtual void onDragStarted(WindowEventArgs& e);
00341
00352 virtual void onDragEnded(WindowEventArgs& e);
00353
00364 virtual void onDragPositionChanged(WindowEventArgs& e);
00365
00374 virtual void onDragEnabledChanged(WindowEventArgs& e);
00375
00384 virtual void onDragAlphaChanged(WindowEventArgs& e);
00385
00394 virtual void onDragMouseCursorChanged(WindowEventArgs& e);
00395
00404 virtual void onDragThresholdChanged(WindowEventArgs& e);
00405
00421 virtual void onDragDropTargetChanged(DragDropEventArgs& e);
00422
00423
00424
00425
00426 bool d_draggingEnabled;
00427 bool d_leftMouseDown;
00428 bool d_dragging;
00429 UVector2 d_dragPoint;
00430 UVector2 d_startPosition;
00431 float d_dragThreshold;
00432 float d_dragAlpha;
00433 float d_storedAlpha;
00434 bool d_storedClipState;
00435 Window* d_dropTarget;
00436 const Image* d_dragCursorImage;
00437 bool d_dropflag;
00438
00439 private:
00440
00441
00442
00443 static DragContainerProperties::DragAlpha d_dragAlphaProperty;
00444 static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
00445 static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
00446 static DragContainerProperties::DragThreshold d_dragThresholdProperty;
00447
00448
00449
00450
00458 void addDragContainerProperties(void);
00459 };
00460
00461 }
00462
00463
00464 #if defined(_MSC_VER)
00465 # pragma warning(pop)
00466 #endif
00467
00468 #endif // end of guard _CEGUIDragContainer_h_