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 "elements/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
00062         static const String EventSegmentClicked;                                
00063         static const String EventSplitterDoubleClicked;         
00064         static const String EventSizingSettingChanged;          
00065         static const String EventSortDirectionChanged;          
00066         static const String EventMovableSettingChanged;         
00067         static const String EventSegmentDragStart;                      
00068         static const String EventSegmentDragStop;                               
00069         static const String EventSegmentDragPositionChanged;    
00070         static const String EventSegmentSized;                          
00071         static const String EventClickableSettingChanged;               
00072 
00073         // Defaults
00074         static const float      DefaultSizingArea;              
00075         static const float      SegmentMoveThreshold;   
00076 
00077 
00078         /*************************************************************************
00079                 Enumerated types
00080         *************************************************************************/
00085         enum SortDirection
00086         {
00087                 None,           
00088                 Ascending,      
00089                 Descending      
00090         };
00091 
00092 
00093         /*************************************************************************
00094                 Accessor Methods
00095         *************************************************************************/
00103         bool    isSizingEnabled(void) const                     {return d_sizingEnabled;}
00104 
00105 
00118         SortDirection   getSortDirection(void) const    {return d_sortDir;}
00119 
00120 
00128         bool    isDragMovingEnabled(void) const         {return d_movingEnabled;}
00129 
00130 
00138         const Point&    getDragMoveOffset(void) const   {return d_dragPosition;}
00139 
00140 
00148         bool    isClickable(void) const         {return d_allowClicks;}
00149 
00150 
00155     bool    isSegmentHovering(void) const  {return d_segmentHover;}
00156 
00157 
00162     bool    isSegmentPushed(void) const  {return d_segmentPushed;}
00163 
00164 
00169     bool    isSplitterHovering(void) const  {return d_splitterHover;}
00170 
00171 
00176     bool    isBeingDragMoved(void) const  {return d_dragMoving;}
00177 
00178 
00183     bool    isBeingDragSized(void) const  {return d_dragSizing;}
00184 
00185 
00186     const Image* getSizingCursorImage() const;
00187     const Image* getMovingCursorImage() const;
00188 
00189 
00190         /*************************************************************************
00191                 Manipulator Methods
00192         *************************************************************************/
00203         void    setSizingEnabled(bool setting);
00204 
00205 
00221         void    setSortDirection(SortDirection sort_dir);
00222 
00223 
00234         void    setDragMovingEnabled(bool setting);
00235 
00236 
00247         void setClickable(bool setting);
00248 
00249 
00250     void setSizingCursorImage(const Image* image);
00251     void setSizingCursorImage(const String& imageset, const String& image);
00252     void setMovingCursorImage(const Image* image);
00253     void setMovingCursorImage(const String& imageset, const String& image);
00254 
00255 
00256         /*************************************************************************
00257                 Construction & Destruction
00258         *************************************************************************/
00263         ListHeaderSegment(const String& type, const String& name);
00264 
00265 
00270         virtual ~ListHeaderSegment(void);
00271 
00272 
00273 protected:
00274         /*************************************************************************
00275                 Implementation Methods
00276         *************************************************************************/
00287         void    doDragSizing(const Point& local_mouse);
00288 
00289 
00300         void    doDragMoving(const Point& local_mouse);
00301 
00302 
00307         void    initDragMoving(void);
00308 
00309 
00314         void    initSizingHoverState(void);
00315 
00316 
00321         void    initSegmentHoverState(void);
00322 
00323 
00336         bool    isDragMoveThresholdExceeded(const Point& local_mouse);
00337 
00338 
00349         virtual bool    testClassName_impl(const String& class_name) const
00350         {
00351                 if (class_name=="ListHeaderSegment")    return true;
00352                 return Window::testClassName_impl(class_name);
00353         }
00354 
00355 
00356         /*************************************************************************
00357                 New Event Handlers
00358         *************************************************************************/
00363         virtual void    onSegmentClicked(WindowEventArgs& e);
00364 
00365 
00370         virtual void    onSplitterDoubleClicked(WindowEventArgs& e);
00371 
00372 
00377         virtual void    onSizingSettingChanged(WindowEventArgs& e);
00378 
00379 
00384         virtual void    onSortDirectionChanged(WindowEventArgs& e);
00385 
00386 
00391         virtual void    onMovableSettingChanged(WindowEventArgs& e);
00392 
00393 
00398         virtual void    onSegmentDragStart(WindowEventArgs& e);
00399 
00400 
00405         virtual void    onSegmentDragStop(WindowEventArgs& e);
00406 
00407 
00412         virtual void    onSegmentDragPositionChanged(WindowEventArgs& e);
00413 
00414 
00419         virtual void    onSegmentSized(WindowEventArgs& e);
00420 
00421 
00426         virtual void    onClickableSettingChanged(WindowEventArgs& e);
00427 
00428 
00429         /*************************************************************************
00430                 Overridden Event Handlers
00431         *************************************************************************/
00432         virtual void    onMouseMove(MouseEventArgs& e);
00433         virtual void    onMouseButtonDown(MouseEventArgs& e);
00434         virtual void    onMouseButtonUp(MouseEventArgs& e);
00435         virtual void    onMouseDoubleClicked(MouseEventArgs& e);
00436         virtual void    onMouseLeaves(MouseEventArgs& e);
00437         virtual void    onCaptureLost(WindowEventArgs& e);
00438 
00439 
00440         /*************************************************************************
00441                 Implementation Data
00442         *************************************************************************/
00443         const Image*    d_sizingMouseCursor;    
00444         const Image*    d_movingMouseCursor;    
00445 
00446         float   d_splitterSize;         
00447         bool    d_splitterHover;        
00448 
00449         bool    d_dragSizing;           
00450         Point   d_dragPoint;            
00451 
00452         SortDirection   d_sortDir;      
00453 
00454         bool    d_segmentHover;         
00455         bool    d_segmentPushed;        
00456         bool    d_sizingEnabled;        
00457         bool    d_movingEnabled;        
00458         bool    d_dragMoving;           
00459         Point   d_dragPosition;         
00460         bool    d_allowClicks;          
00461 
00462 private:
00463         /*************************************************************************
00464                 Static Properties for this class
00465         *************************************************************************/
00466         static ListHeaderSegmentProperties::Clickable           d_clickableProperty;
00467         static ListHeaderSegmentProperties::Dragable            d_dragableProperty;
00468         static ListHeaderSegmentProperties::Sizable                     d_sizableProperty;
00469         static ListHeaderSegmentProperties::SortDirection       d_sortDirectionProperty;
00470     static ListHeaderSegmentProperties::SizingCursorImage   d_sizingCursorProperty;
00471     static ListHeaderSegmentProperties::MovingCursorImage   d_movingCursorProperty;
00472 
00473 
00474         /*************************************************************************
00475                 Private methods
00476         *************************************************************************/
00477         void    addHeaderSegmentProperties(void);
00478 };
00479 
00480 } // End of  CEGUI namespace section
00481 
00482 #if defined(_MSC_VER)
00483 #       pragma warning(pop)
00484 #endif
00485 
00486 #endif  // end of guard _CEGUIListHeaderSegment_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4