Crazy Eddies GUI System  0.7.0
CEGUIDragContainer.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 "../CEGUIWindow.h"
32 #include "../CEGUIWindowFactory.h"
33 #include "CEGUIDragContainerProperties.h"
34 
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
48  class CEGUIEXPORT DragContainer : public Window
49  {
50  public:
51  /*************************************************************************
52  Constants
53  *************************************************************************/
54  static const String WidgetTypeName;
55  static const String EventNamespace;
56  static const String EventDragStarted;
57  static const String EventDragEnded;
64 
65  /*************************************************************************
66  Object Construction and Destruction
67  *************************************************************************/
72  DragContainer(const String& type, const String& name);
73 
78  virtual ~DragContainer(void);
79 
80  /*************************************************************************
81  Public Interface to DragContainer
82  *************************************************************************/
91  bool isDraggingEnabled(void) const;
92 
104  void setDraggingEnabled(bool setting);
105 
114  bool isBeingDragged(void) const;
115 
127  float getPixelDragThreshold(void) const;
128 
143  void setPixelDragThreshold(float pixels);
144 
153  float getDragAlpha(void) const;
154 
170  void setDragAlpha(float alpha);
171 
180  const Image* getDragCursorImage(void) const;
181 
196  void setDragCursorImage(const Image* image);
197 
212  void setDragCursorImage(MouseCursorImage image);
213 
234  void setDragCursorImage(const String& imageset, const String& image);
235 
247  Window* getCurrentDropTarget(void) const;
248 
257  bool isStickyModeEnabled() const;
258 
267  void setStickyModeEnabled(bool setting);
268 
269  // Window class overrides.
270  void getRenderingContext_impl(RenderingContext& ctx) const;
271 
272  protected:
273  /*************************************************************************
274  Protected Implementation Methods
275  *************************************************************************/
288  bool isDraggingThresholdExceeded(const Point& local_mouse);
289 
297  void initialiseDragging(void);
298 
309  void doDragging(const Point& local_mouse);
310 
315  void updateActiveMouseCursor(void) const;
316 
317 
328  virtual bool testClassName_impl(const String& class_name) const
329  {
330  if (class_name=="DragContainer") return true;
331  return Window::testClassName_impl(class_name);
332  }
333 
334 
335  /*************************************************************************
336  Overrides of methods in Window
337  *************************************************************************/
338 
339  /*************************************************************************
340  Overrides for Event handler methods
341  *************************************************************************/
342  virtual void onMouseButtonDown(MouseEventArgs& e);
343  virtual void onMouseButtonUp(MouseEventArgs& e);
344  virtual void onMouseMove(MouseEventArgs& e);
345  virtual void onCaptureLost(WindowEventArgs& e);
346  virtual void onAlphaChanged(WindowEventArgs& e);
347  virtual void onClippingChanged(WindowEventArgs& e);/*Window::drawSelf(z);*/
348  virtual void onMoved(WindowEventArgs& e);
349 
350  /*************************************************************************
351  New Event handler methods
352  *************************************************************************/
363  virtual void onDragStarted(WindowEventArgs& e);
364 
375  virtual void onDragEnded(WindowEventArgs& e);
376 
387  virtual void onDragPositionChanged(WindowEventArgs& e);
388 
397  virtual void onDragEnabledChanged(WindowEventArgs& e);
398 
407  virtual void onDragAlphaChanged(WindowEventArgs& e);
408 
417  virtual void onDragMouseCursorChanged(WindowEventArgs& e);
418 
427  virtual void onDragThresholdChanged(WindowEventArgs& e);
428 
444  virtual void onDragDropTargetChanged(DragDropEventArgs& e);
445 
446  /*************************************************************************
447  Data
448  *************************************************************************/
451  bool d_dragging;
455  float d_dragAlpha;
460  bool d_dropflag;
461 
465 
466  private:
467  /*************************************************************************
468  Static properties for the Spinner widget
469  *************************************************************************/
470  static DragContainerProperties::DragAlpha d_dragAlphaProperty;
471  static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
472  static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
473  static DragContainerProperties::DragThreshold d_dragThresholdProperty;
474  static DragContainerProperties::StickyMode d_stickyModeProperty;
475 
476  /*************************************************************************
477  Implementation methods
478  *************************************************************************/
486  void addDragContainerProperties(void);
487  };
488 
489 } // End of CEGUI namespace section
490 
491 
492 #if defined(_MSC_VER)
493 # pragma warning(pop)
494 #endif
495 
496 #endif // end of guard _CEGUIDragContainer_h_