Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 "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
114  static const String EventSegmentSized;
121 
122  // Defaults
123  static const float DefaultSizingArea;
124  static const float SegmentMoveThreshold;
125 
126 
127  /*************************************************************************
128  Enumerated types
129  *************************************************************************/
135  {
138  Descending
139  };
140 
141 
142  /*************************************************************************
143  Accessor Methods
144  *************************************************************************/
152  bool isSizingEnabled(void) const {return d_sizingEnabled;}
153 
154 
167  SortDirection getSortDirection(void) const {return d_sortDir;}
168 
169 
177  bool isDragMovingEnabled(void) const {return d_movingEnabled;}
178 
179 
187  const Point& getDragMoveOffset(void) const {return d_dragPosition;}
188 
189 
197  bool isClickable(void) const {return d_allowClicks;}
198 
199 
204  bool isSegmentHovering(void) const {return d_segmentHover;}
205 
206 
211  bool isSegmentPushed(void) const {return d_segmentPushed;}
212 
213 
218  bool isSplitterHovering(void) const {return d_splitterHover;}
219 
220 
225  bool isBeingDragMoved(void) const {return d_dragMoving;}
226 
227 
232  bool isBeingDragSized(void) const {return d_dragSizing;}
233 
234 
235  const Image* getSizingCursorImage() const;
236  const Image* getMovingCursorImage() const;
237 
238 
239  /*************************************************************************
240  Manipulator Methods
241  *************************************************************************/
252  void setSizingEnabled(bool setting);
253 
254 
270  void setSortDirection(SortDirection sort_dir);
271 
272 
283  void setDragMovingEnabled(bool setting);
284 
285 
296  void setClickable(bool setting);
297 
298 
299  void setSizingCursorImage(const Image* image);
300  void setSizingCursorImage(const String& imageset, const String& image);
301  void setMovingCursorImage(const Image* image);
302  void setMovingCursorImage(const String& imageset, const String& image);
303 
304 
305  /*************************************************************************
306  Construction & Destruction
307  *************************************************************************/
312  ListHeaderSegment(const String& type, const String& name);
313 
314 
319  virtual ~ListHeaderSegment(void);
320 
321 
322 protected:
323  /*************************************************************************
324  Implementation Methods
325  *************************************************************************/
336  void doDragSizing(const Point& local_mouse);
337 
338 
349  void doDragMoving(const Point& local_mouse);
350 
351 
356  void initDragMoving(void);
357 
358 
363  void initSizingHoverState(void);
364 
365 
370  void initSegmentHoverState(void);
371 
372 
385  bool isDragMoveThresholdExceeded(const Point& local_mouse);
386 
387 
398  virtual bool testClassName_impl(const String& class_name) const
399  {
400  if (class_name=="ListHeaderSegment") return true;
401  return Window::testClassName_impl(class_name);
402  }
403 
404 
405  /*************************************************************************
406  New Event Handlers
407  *************************************************************************/
412  virtual void onSegmentClicked(WindowEventArgs& e);
413 
414 
419  virtual void onSplitterDoubleClicked(WindowEventArgs& e);
420 
421 
426  virtual void onSizingSettingChanged(WindowEventArgs& e);
427 
428 
433  virtual void onSortDirectionChanged(WindowEventArgs& e);
434 
435 
440  virtual void onMovableSettingChanged(WindowEventArgs& e);
441 
442 
447  virtual void onSegmentDragStart(WindowEventArgs& e);
448 
449 
454  virtual void onSegmentDragStop(WindowEventArgs& e);
455 
456 
461  virtual void onSegmentDragPositionChanged(WindowEventArgs& e);
462 
463 
468  virtual void onSegmentSized(WindowEventArgs& e);
469 
470 
475  virtual void onClickableSettingChanged(WindowEventArgs& e);
476 
477 
478  /*************************************************************************
479  Overridden Event Handlers
480  *************************************************************************/
481  virtual void onMouseMove(MouseEventArgs& e);
482  virtual void onMouseButtonDown(MouseEventArgs& e);
483  virtual void onMouseButtonUp(MouseEventArgs& e);
484  virtual void onMouseDoubleClicked(MouseEventArgs& e);
485  virtual void onMouseLeaves(MouseEventArgs& e);
486  virtual void onCaptureLost(WindowEventArgs& e);
487 
488 
489  /*************************************************************************
490  Implementation Data
491  *************************************************************************/
494 
497 
500 
502 
510 
511 private:
512  /*************************************************************************
513  Static Properties for this class
514  *************************************************************************/
515  static ListHeaderSegmentProperties::Clickable d_clickableProperty;
516  static ListHeaderSegmentProperties::Dragable d_dragableProperty;
517  static ListHeaderSegmentProperties::Sizable d_sizableProperty;
518  static ListHeaderSegmentProperties::SortDirection d_sortDirectionProperty;
519  static ListHeaderSegmentProperties::SizingCursorImage d_sizingCursorProperty;
520  static ListHeaderSegmentProperties::MovingCursorImage d_movingCursorProperty;
521 
522 
523  /*************************************************************************
524  Private methods
525  *************************************************************************/
526  void addHeaderSegmentProperties(void);
527 };
528 
529 } // End of CEGUI namespace section
530 
531 #if defined(_MSC_VER)
532 # pragma warning(pop)
533 #endif
534 
535 #endif // end of guard _CEGUIListHeaderSegment_h_