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 "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
00257 bool isStickyModeEnabled() const;
00258
00267 void setStickyModeEnabled(bool setting);
00268
00285 bool pickUp(const bool force_sticky = false);
00286
00300 void setFixedDragOffset(const UVector2& offset);
00301
00315 const UVector2& getFixedDragOffset() const;
00316
00327 void setUsingFixedDragOffset(const bool enable);
00328
00339 bool isUsingFixedDragOffset() const;
00340
00341
00342 void getRenderingContext_impl(RenderingContext& ctx) const;
00343
00344 protected:
00345
00346
00347
00360 bool isDraggingThresholdExceeded(const Point& local_mouse);
00361
00369 void initialiseDragging(void);
00370
00381 void doDragging(const Point& local_mouse);
00382
00387 void updateActiveMouseCursor(void) const;
00388
00389
00400 virtual bool testClassName_impl(const String& class_name) const
00401 {
00402 if (class_name=="DragContainer") return true;
00403 return Window::testClassName_impl(class_name);
00404 }
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414 virtual void onMouseButtonDown(MouseEventArgs& e);
00415 virtual void onMouseButtonUp(MouseEventArgs& e);
00416 virtual void onMouseMove(MouseEventArgs& e);
00417 virtual void onCaptureLost(WindowEventArgs& e);
00418 virtual void onAlphaChanged(WindowEventArgs& e);
00419 virtual void onClippingChanged(WindowEventArgs& e);
00420 virtual void onMoved(WindowEventArgs& e);
00421
00422
00423
00424
00435 virtual void onDragStarted(WindowEventArgs& e);
00436
00447 virtual void onDragEnded(WindowEventArgs& e);
00448
00459 virtual void onDragPositionChanged(WindowEventArgs& e);
00460
00469 virtual void onDragEnabledChanged(WindowEventArgs& e);
00470
00479 virtual void onDragAlphaChanged(WindowEventArgs& e);
00480
00489 virtual void onDragMouseCursorChanged(WindowEventArgs& e);
00490
00499 virtual void onDragThresholdChanged(WindowEventArgs& e);
00500
00516 virtual void onDragDropTargetChanged(DragDropEventArgs& e);
00517
00518
00519
00520
00521 bool d_draggingEnabled;
00522 bool d_leftMouseDown;
00523 bool d_dragging;
00524 UVector2 d_dragPoint;
00525 UVector2 d_startPosition;
00526 float d_dragThreshold;
00527 float d_dragAlpha;
00528 float d_storedAlpha;
00529 bool d_storedClipState;
00530 Window* d_dropTarget;
00531 const Image* d_dragCursorImage;
00532 bool d_dropflag;
00533
00534 bool d_stickyMode;
00536 bool d_pickedUp;
00538 bool d_usingFixedDragOffset;
00540 UVector2 d_fixedDragOffset;
00541
00542 private:
00543
00544
00545
00546 static DragContainerProperties::DragAlpha d_dragAlphaProperty;
00547 static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
00548 static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
00549 static DragContainerProperties::DragThreshold d_dragThresholdProperty;
00550 static DragContainerProperties::StickyMode d_stickyModeProperty;
00551 static DragContainerProperties::FixedDragOffset d_fixedDragOffsetProperty;
00552 static DragContainerProperties::UseFixedDragOffset d_useFixedDragOffsetProperty;
00553
00554
00555
00556
00564 void addDragContainerProperties(void);
00565 };
00566
00567 }
00568
00569
00570 #if defined(_MSC_VER)
00571 # pragma warning(pop)
00572 #endif
00573
00574 #endif // end of guard _CEGUIDragContainer_h_