Crazy Eddies GUI System  0.6.0
CEGUIListHeaderSegment.h
1 /***********************************************************************
2  filename: CEGUIListHeaderSegment.h
3  created: 15/6/2004
4  author: Paul D Turner
5 
6  purpose: Interface to list header segment class.
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIListHeaderSegment_h_
31 #define _CEGUIListHeaderSegment_h_
32 
33 #include "CEGUIBase.h"
34 #include "CEGUIWindow.h"
35 #include "elements/CEGUIListHeaderSegmentProperties.h"
36 
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
51 class CEGUIEXPORT ListHeaderSegment : public Window
52 {
53 public:
54  static const String EventNamespace;
55  static const String WidgetTypeName;
56 
57 
58  /*************************************************************************
59  Constants
60  *************************************************************************/
61  // Event names
62  static const String EventSegmentClicked;
70  static const String EventSegmentSized;
72 
73  // Defaults
74  static const float DefaultSizingArea;
75  static const float SegmentMoveThreshold;
76 
77 
78  /*************************************************************************
79  Enumerated types
80  *************************************************************************/
86  {
87  None,
89  Descending
90  };
91 
92 
93  /*************************************************************************
94  Accessor Methods
95  *************************************************************************/
103  bool isSizingEnabled(void) const {return d_sizingEnabled;}
104 
105 
118  SortDirection getSortDirection(void) const {return d_sortDir;}
119 
120 
128  bool isDragMovingEnabled(void) const {return d_movingEnabled;}
129 
130 
138  const Point& getDragMoveOffset(void) const {return d_dragPosition;}
139 
140 
148  bool isClickable(void) const {return d_allowClicks;}
149 
150 
155  bool isSegmentHovering(void) const {return d_segmentHover;}
156 
157 
162  bool isSegmentPushed(void) const {return d_segmentPushed;}
163 
164 
169  bool isSplitterHovering(void) const {return d_splitterHover;}
170 
171 
176  bool isBeingDragMoved(void) const {return d_dragMoving;}
177 
178 
183  bool isBeingDragSized(void) const {return d_dragSizing;}
184 
185 
186  const Image* getSizingCursorImage() const;
187  const Image* getMovingCursorImage() const;
188 
189 
190  /*************************************************************************
191  Manipulator Methods
192  *************************************************************************/
203  void setSizingEnabled(bool setting);
204 
205 
221  void setSortDirection(SortDirection sort_dir);
222 
223 
234  void setDragMovingEnabled(bool setting);
235 
236 
247  void setClickable(bool setting);
248 
249 
250  void setSizingCursorImage(const Image* image);
251  void setSizingCursorImage(const String& imageset, const String& image);
252  void setMovingCursorImage(const Image* image);
253  void setMovingCursorImage(const String& imageset, const String& image);
254 
255 
256  /*************************************************************************
257  Construction & Destruction
258  *************************************************************************/
263  ListHeaderSegment(const String& type, const String& name);
264 
265 
270  virtual ~ListHeaderSegment(void);
271 
272 
273 protected:
274  /*************************************************************************
275  Implementation Methods
276  *************************************************************************/
287  void doDragSizing(const Point& local_mouse);
288 
289 
300  void doDragMoving(const Point& local_mouse);
301 
302 
307  void initDragMoving(void);
308 
309 
314  void initSizingHoverState(void);
315 
316 
321  void initSegmentHoverState(void);
322 
323 
336  bool isDragMoveThresholdExceeded(const Point& local_mouse);
337 
338 
349  virtual bool testClassName_impl(const String& class_name) const
350  {
351  if (class_name=="ListHeaderSegment") return true;
352  return Window::testClassName_impl(class_name);
353  }
354 
355 
356  /*************************************************************************
357  New Event Handlers
358  *************************************************************************/
363  virtual void onSegmentClicked(WindowEventArgs& e);
364 
365 
370  virtual void onSplitterDoubleClicked(WindowEventArgs& e);
371 
372 
377  virtual void onSizingSettingChanged(WindowEventArgs& e);
378 
379 
384  virtual void onSortDirectionChanged(WindowEventArgs& e);
385 
386 
391  virtual void onMovableSettingChanged(WindowEventArgs& e);
392 
393 
398  virtual void onSegmentDragStart(WindowEventArgs& e);
399 
400 
405  virtual void onSegmentDragStop(WindowEventArgs& e);
406 
407 
412  virtual void onSegmentDragPositionChanged(WindowEventArgs& e);
413 
414 
419  virtual void onSegmentSized(WindowEventArgs& e);
420 
421 
426  virtual void onClickableSettingChanged(WindowEventArgs& e);
427 
428 
429  /*************************************************************************
430  Overridden Event Handlers
431  *************************************************************************/
432  virtual void onMouseMove(MouseEventArgs& e);
433  virtual void onMouseButtonDown(MouseEventArgs& e);
434  virtual void onMouseButtonUp(MouseEventArgs& e);
435  virtual void onMouseDoubleClicked(MouseEventArgs& e);
436  virtual void onMouseLeaves(MouseEventArgs& e);
437  virtual void onCaptureLost(WindowEventArgs& e);
438 
439 
440  /*************************************************************************
441  Implementation Data
442  *************************************************************************/
445 
448 
451 
453 
461 
462 private:
463  /*************************************************************************
464  Static Properties for this class
465  *************************************************************************/
466  static ListHeaderSegmentProperties::Clickable d_clickableProperty;
467  static ListHeaderSegmentProperties::Dragable d_dragableProperty;
468  static ListHeaderSegmentProperties::Sizable d_sizableProperty;
469  static ListHeaderSegmentProperties::SortDirection d_sortDirectionProperty;
470  static ListHeaderSegmentProperties::SizingCursorImage d_sizingCursorProperty;
471  static ListHeaderSegmentProperties::MovingCursorImage d_movingCursorProperty;
472 
473 
474  /*************************************************************************
475  Private methods
476  *************************************************************************/
477  void addHeaderSegmentProperties(void);
478 };
479 
480 } // End of CEGUI namespace section
481 
482 #if defined(_MSC_VER)
483 # pragma warning(pop)
484 #endif
485 
486 #endif // end of guard _CEGUIListHeaderSegment_h_