Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
DragContainer.h
1 /***********************************************************************
2  filename: CEGUIDragContainer.h
3  created: 14/2/2005
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIDragContainer_h_
29 #define _CEGUIDragContainer_h_
30 
31 #include "../Window.h"
32 #include "../WindowFactory.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
46  class CEGUIEXPORT DragContainer : public Window
47  {
48  public:
49  /*************************************************************************
50  Constants
51  *************************************************************************/
52  static const String WidgetTypeName;
53  static const String EventNamespace;
54 
59  static const String EventDragStarted;
65  static const String EventDragEnded;
103 
104  /*************************************************************************
105  Object Construction and Destruction
106  *************************************************************************/
111  DragContainer(const String& type, const String& name);
112 
117  virtual ~DragContainer(void);
118 
119  /*************************************************************************
120  Public Interface to DragContainer
121  *************************************************************************/
130  bool isDraggingEnabled(void) const;
131 
143  void setDraggingEnabled(bool setting);
144 
153  bool isBeingDragged(void) const;
154 
166  float getPixelDragThreshold(void) const;
167 
182  void setPixelDragThreshold(float pixels);
183 
192  float getDragAlpha(void) const;
193 
209  void setDragAlpha(float alpha);
210 
219  const Image* getDragCursorImage(void) const;
220 
235  void setDragCursorImage(const Image* image);
236 
253  void setDragCursorImage(const String& name);
254 
266  Window* getCurrentDropTarget(void) const;
267 
276  bool isStickyModeEnabled() const;
277 
286  void setStickyModeEnabled(bool setting);
287 
304  bool pickUp(const bool force_sticky = false);
305 
319  void setFixedDragOffset(const UVector2& offset);
320 
334  const UVector2& getFixedDragOffset() const;
335 
346  void setUsingFixedDragOffset(const bool enable);
347 
358  bool isUsingFixedDragOffset() const;
359 
360  // Window class overrides.
361  void getRenderingContext_impl(RenderingContext& ctx) const;
362 
363  protected:
364  /*************************************************************************
365  Protected Implementation Methods
366  *************************************************************************/
379  bool isDraggingThresholdExceeded(const Vector2f& local_mouse);
380 
388  void initialiseDragging(void);
389 
400  void doDragging(const Vector2f& local_mouse);
401 
406  void updateActiveMouseCursor(void) const;
407 
408  /*************************************************************************
409  Overrides of methods in Window
410  *************************************************************************/
411 
412  /*************************************************************************
413  Overrides for Event handler methods
414  *************************************************************************/
415  virtual void onMouseButtonDown(MouseEventArgs& e);
416  virtual void onMouseButtonUp(MouseEventArgs& e);
417  virtual void onMouseMove(MouseEventArgs& e);
418  virtual void onCaptureLost(WindowEventArgs& e);
419  virtual void onAlphaChanged(WindowEventArgs& e);
420  virtual void onClippingChanged(WindowEventArgs& e);/*Window::drawSelf(z);*/
421  virtual void onMoved(ElementEventArgs& e);
422 
423  /*************************************************************************
424  New Event handler methods
425  *************************************************************************/
436  virtual void onDragStarted(WindowEventArgs& e);
437 
448  virtual void onDragEnded(WindowEventArgs& e);
449 
460  virtual void onDragPositionChanged(WindowEventArgs& e);
461 
470  virtual void onDragEnabledChanged(WindowEventArgs& e);
471 
480  virtual void onDragAlphaChanged(WindowEventArgs& e);
481 
490  virtual void onDragMouseCursorChanged(WindowEventArgs& e);
491 
500  virtual void onDragThresholdChanged(WindowEventArgs& e);
501 
517  virtual void onDragDropTargetChanged(DragDropEventArgs& e);
518 
519  /*************************************************************************
520  Data
521  *************************************************************************/
524  bool d_dragging;
528  float d_dragAlpha;
533  bool d_dropflag;
534 
542 
543  private:
544  /*************************************************************************
545  Implementation methods
546  *************************************************************************/
554  void addDragContainerProperties(void);
555  };
556 
557 } // End of CEGUI namespace section
558 
559 
560 #if defined(_MSC_VER)
561 # pragma warning(pop)
562 #endif
563 
564 #endif // end of guard _CEGUIDragContainer_h_