• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

CEGUIListHeaderSegment.h

00001 /***********************************************************************
00002         filename:       CEGUIListHeaderSegment.h
00003         created:        15/6/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to list header segment class.
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIListHeaderSegment_h_
00031 #define _CEGUIListHeaderSegment_h_
00032 
00033 #include "../CEGUIBase.h"
00034 #include "../CEGUIWindow.h"
00035 #include "CEGUIListHeaderSegmentProperties.h"
00036 
00037 
00038 #if defined(_MSC_VER)
00039 #       pragma warning(push)
00040 #       pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT ListHeaderSegment : public Window
00052 {
00053 public:
00054         static const String EventNamespace;                             
00055     static const String WidgetTypeName;             
00056 
00057 
00058         /*************************************************************************
00059                 Constants
00060         *************************************************************************/
00061         // Event names
00066         static const String EventSegmentClicked;
00072         static const String EventSplitterDoubleClicked;
00078         static const String EventSizingSettingChanged;
00084         static const String EventSortDirectionChanged;
00090         static const String EventMovableSettingChanged;
00096         static const String EventSegmentDragStart;
00102         static const String EventSegmentDragStop;
00108         static const String EventSegmentDragPositionChanged;
00114         static const String EventSegmentSized;
00120         static const String EventClickableSettingChanged;
00121 
00122         // Defaults
00123         static const float      DefaultSizingArea;              
00124         static const float      SegmentMoveThreshold;   
00125 
00126 
00127         /*************************************************************************
00128                 Enumerated types
00129         *************************************************************************/
00134         enum SortDirection
00135         {
00136                 None,           
00137                 Ascending,      
00138                 Descending      
00139         };
00140 
00141 
00142         /*************************************************************************
00143                 Accessor Methods
00144         *************************************************************************/
00152         bool    isSizingEnabled(void) const                     {return d_sizingEnabled;}
00153 
00154 
00167         SortDirection   getSortDirection(void) const    {return d_sortDir;}
00168 
00169 
00177         bool    isDragMovingEnabled(void) const         {return d_movingEnabled;}
00178 
00179 
00187         const Point&    getDragMoveOffset(void) const   {return d_dragPosition;}
00188 
00189 
00197         bool    isClickable(void) const         {return d_allowClicks;}
00198 
00199 
00204     bool    isSegmentHovering(void) const  {return d_segmentHover;}
00205 
00206 
00211     bool    isSegmentPushed(void) const  {return d_segmentPushed;}
00212 
00213 
00218     bool    isSplitterHovering(void) const  {return d_splitterHover;}
00219 
00220 
00225     bool    isBeingDragMoved(void) const  {return d_dragMoving;}
00226 
00227 
00232     bool    isBeingDragSized(void) const  {return d_dragSizing;}
00233 
00234 
00235     const Image* getSizingCursorImage() const;
00236     const Image* getMovingCursorImage() const;
00237 
00238 
00239         /*************************************************************************
00240                 Manipulator Methods
00241         *************************************************************************/
00252         void    setSizingEnabled(bool setting);
00253 
00254 
00270         void    setSortDirection(SortDirection sort_dir);
00271 
00272 
00283         void    setDragMovingEnabled(bool setting);
00284 
00285 
00296         void setClickable(bool setting);
00297 
00298 
00299     void setSizingCursorImage(const Image* image);
00300     void setSizingCursorImage(const String& imageset, const String& image);
00301     void setMovingCursorImage(const Image* image);
00302     void setMovingCursorImage(const String& imageset, const String& image);
00303 
00304 
00305         /*************************************************************************
00306                 Construction & Destruction
00307         *************************************************************************/
00312         ListHeaderSegment(const String& type, const String& name);
00313 
00314 
00319         virtual ~ListHeaderSegment(void);
00320 
00321 
00322 protected:
00323         /*************************************************************************
00324                 Implementation Methods
00325         *************************************************************************/
00336         void    doDragSizing(const Point& local_mouse);
00337 
00338 
00349         void    doDragMoving(const Point& local_mouse);
00350 
00351 
00356         void    initDragMoving(void);
00357 
00358 
00363         void    initSizingHoverState(void);
00364 
00365 
00370         void    initSegmentHoverState(void);
00371 
00372 
00385         bool    isDragMoveThresholdExceeded(const Point& local_mouse);
00386 
00387 
00398         virtual bool    testClassName_impl(const String& class_name) const
00399         {
00400                 if (class_name=="ListHeaderSegment")    return true;
00401                 return Window::testClassName_impl(class_name);
00402         }
00403 
00404 
00405         /*************************************************************************
00406                 New Event Handlers
00407         *************************************************************************/
00412         virtual void    onSegmentClicked(WindowEventArgs& e);
00413 
00414 
00419         virtual void    onSplitterDoubleClicked(WindowEventArgs& e);
00420 
00421 
00426         virtual void    onSizingSettingChanged(WindowEventArgs& e);
00427 
00428 
00433         virtual void    onSortDirectionChanged(WindowEventArgs& e);
00434 
00435 
00440         virtual void    onMovableSettingChanged(WindowEventArgs& e);
00441 
00442 
00447         virtual void    onSegmentDragStart(WindowEventArgs& e);
00448 
00449 
00454         virtual void    onSegmentDragStop(WindowEventArgs& e);
00455 
00456 
00461         virtual void    onSegmentDragPositionChanged(WindowEventArgs& e);
00462 
00463 
00468         virtual void    onSegmentSized(WindowEventArgs& e);
00469 
00470 
00475         virtual void    onClickableSettingChanged(WindowEventArgs& e);
00476 
00477 
00478         /*************************************************************************
00479                 Overridden Event Handlers
00480         *************************************************************************/
00481         virtual void    onMouseMove(MouseEventArgs& e);
00482         virtual void    onMouseButtonDown(MouseEventArgs& e);
00483         virtual void    onMouseButtonUp(MouseEventArgs& e);
00484         virtual void    onMouseDoubleClicked(MouseEventArgs& e);
00485         virtual void    onMouseLeaves(MouseEventArgs& e);
00486         virtual void    onCaptureLost(WindowEventArgs& e);
00487 
00488 
00489         /*************************************************************************
00490                 Implementation Data
00491         *************************************************************************/
00492         const Image*    d_sizingMouseCursor;    
00493         const Image*    d_movingMouseCursor;    
00494 
00495         float   d_splitterSize;         
00496         bool    d_splitterHover;        
00497 
00498         bool    d_dragSizing;           
00499         Point   d_dragPoint;            
00500 
00501         SortDirection   d_sortDir;      
00502 
00503         bool    d_segmentHover;         
00504         bool    d_segmentPushed;        
00505         bool    d_sizingEnabled;        
00506         bool    d_movingEnabled;        
00507         bool    d_dragMoving;           
00508         Point   d_dragPosition;         
00509         bool    d_allowClicks;          
00510 
00511 private:
00512         /*************************************************************************
00513                 Static Properties for this class
00514         *************************************************************************/
00515         static ListHeaderSegmentProperties::Clickable           d_clickableProperty;
00516         static ListHeaderSegmentProperties::Dragable            d_dragableProperty;
00517         static ListHeaderSegmentProperties::Sizable                     d_sizableProperty;
00518         static ListHeaderSegmentProperties::SortDirection       d_sortDirectionProperty;
00519     static ListHeaderSegmentProperties::SizingCursorImage   d_sizingCursorProperty;
00520     static ListHeaderSegmentProperties::MovingCursorImage   d_movingCursorProperty;
00521 
00522 
00523         /*************************************************************************
00524                 Private methods
00525         *************************************************************************/
00526         void    addHeaderSegmentProperties(void);
00527 };
00528 
00529 } // End of  CEGUI namespace section
00530 
00531 #if defined(_MSC_VER)
00532 #       pragma warning(pop)
00533 #endif
00534 
00535 #endif  // end of guard _CEGUIListHeaderSegment_h_

Generated on Sat Sep 25 2010 02:10:34 for Crazy Eddies GUI System by  doxygen 1.7.1