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
00061 static const String EventDragStarted;
00067 static const String EventDragEnded;
00073 static const String EventDragPositionChanged;
00079 static const String EventDragEnabledChanged;
00085 static const String EventDragAlphaChanged;
00091 static const String EventDragMouseCursorChanged;
00097 static const String EventDragThresholdChanged;
00104 static const String EventDragDropTargetChanged;
00105
00106
00107
00108
00113 DragContainer(const String& type, const String& name);
00114
00119 virtual ~DragContainer(void);
00120
00121
00122
00123
00132 bool isDraggingEnabled(void) const;
00133
00145 void setDraggingEnabled(bool setting);
00146
00155 bool isBeingDragged(void) const;
00156
00168 float getPixelDragThreshold(void) const;
00169
00184 void setPixelDragThreshold(float pixels);
00185
00194 float getDragAlpha(void) const;
00195
00211 void setDragAlpha(float alpha);
00212
00221 const Image* getDragCursorImage(void) const;
00222
00237 void setDragCursorImage(const Image* image);
00238
00253 void setDragCursorImage(MouseCursorImage image);
00254
00275 void setDragCursorImage(const String& imageset, const String& image);
00276
00288 Window* getCurrentDropTarget(void) const;
00289
00298 bool isStickyModeEnabled() const;
00299
00308 void setStickyModeEnabled(bool setting);
00309
00326 bool pickUp(const bool force_sticky = false);
00327
00341 void setFixedDragOffset(const UVector2& offset);
00342
00356 const UVector2& getFixedDragOffset() const;
00357
00368 void setUsingFixedDragOffset(const bool enable);
00369
00380 bool isUsingFixedDragOffset() const;
00381
00382
00383 void getRenderingContext_impl(RenderingContext& ctx) const;
00384
00385 protected:
00386
00387
00388
00401 bool isDraggingThresholdExceeded(const Point& local_mouse);
00402
00410 void initialiseDragging(void);
00411
00422 void doDragging(const Point& local_mouse);
00423
00428 void updateActiveMouseCursor(void) const;
00429
00430
00441 virtual bool testClassName_impl(const String& class_name) const
00442 {
00443 if (class_name=="DragContainer") return true;
00444 return Window::testClassName_impl(class_name);
00445 }
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455 virtual void onMouseButtonDown(MouseEventArgs& e);
00456 virtual void onMouseButtonUp(MouseEventArgs& e);
00457 virtual void onMouseMove(MouseEventArgs& e);
00458 virtual void onCaptureLost(WindowEventArgs& e);
00459 virtual void onAlphaChanged(WindowEventArgs& e);
00460 virtual void onClippingChanged(WindowEventArgs& e);
00461 virtual void onMoved(WindowEventArgs& e);
00462
00463
00464
00465
00476 virtual void onDragStarted(WindowEventArgs& e);
00477
00488 virtual void onDragEnded(WindowEventArgs& e);
00489
00500 virtual void onDragPositionChanged(WindowEventArgs& e);
00501
00510 virtual void onDragEnabledChanged(WindowEventArgs& e);
00511
00520 virtual void onDragAlphaChanged(WindowEventArgs& e);
00521
00530 virtual void onDragMouseCursorChanged(WindowEventArgs& e);
00531
00540 virtual void onDragThresholdChanged(WindowEventArgs& e);
00541
00557 virtual void onDragDropTargetChanged(DragDropEventArgs& e);
00558
00559
00560
00561
00562 bool d_draggingEnabled;
00563 bool d_leftMouseDown;
00564 bool d_dragging;
00565 UVector2 d_dragPoint;
00566 UVector2 d_startPosition;
00567 float d_dragThreshold;
00568 float d_dragAlpha;
00569 float d_storedAlpha;
00570 bool d_storedClipState;
00571 Window* d_dropTarget;
00572 const Image* d_dragCursorImage;
00573 bool d_dropflag;
00574
00575 bool d_stickyMode;
00577 bool d_pickedUp;
00579 bool d_usingFixedDragOffset;
00581 UVector2 d_fixedDragOffset;
00582
00583 private:
00584
00585
00586
00587 static DragContainerProperties::DragAlpha d_dragAlphaProperty;
00588 static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
00589 static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
00590 static DragContainerProperties::DragThreshold d_dragThresholdProperty;
00591 static DragContainerProperties::StickyMode d_stickyModeProperty;
00592 static DragContainerProperties::FixedDragOffset d_fixedDragOffsetProperty;
00593 static DragContainerProperties::UseFixedDragOffset d_useFixedDragOffsetProperty;
00594
00595
00596
00597
00605 void addDragContainerProperties(void);
00606 };
00607
00608 }
00609
00610
00611 #if defined(_MSC_VER)
00612 # pragma warning(pop)
00613 #endif
00614
00615 #endif // end of guard _CEGUIDragContainer_h_