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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIListHeaderSegment_h_
00027 #define _CEGUIListHeaderSegment_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIListHeaderSegmentProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00047 class CEGUIEXPORT ListHeaderSegment : public Window
00048 {
00049 public:
00050         static const String EventNamespace;                             
00051 
00052 
00053         /*************************************************************************
00054                 Constants
00055         *************************************************************************/
00056         // Event names
00057         static const String EventSegmentClicked;                                
00058         static const String EventSplitterDoubleClicked;         
00059         static const String EventSizingSettingChanged;          
00060         static const String EventSortDirectionChanged;          
00061         static const String EventMovableSettingChanged;         
00062         static const String EventSegmentDragStart;                      
00063         static const String EventSegmentDragStop;                               
00064         static const String EventSegmentDragPositionChanged;    
00065         static const String EventSegmentSized;                          
00066         static const String EventClickableSettingChanged;               
00067 
00068         // Defaults
00069         static const float      DefaultSizingArea;              
00070         static const float      SegmentMoveThreshold;   
00071 
00072 
00073         /*************************************************************************
00074                 Enumerated types
00075         *************************************************************************/
00080         enum SortDirection
00081         {
00082                 None,           
00083                 Ascending,      
00084                 Descending      
00085         };
00086 
00087 
00088         /*************************************************************************
00089                 Accessor Methods
00090         *************************************************************************/
00098         bool    isSizingEnabled(void) const                     {return d_sizingEnabled;}
00099 
00100 
00113         SortDirection   getSortDirection(void) const    {return d_sortDir;}
00114 
00115 
00123         bool    isDragMovingEnabled(void) const         {return d_movingEnabled;}
00124 
00125 
00133         const Point&    getDragMoveOffset(void) const   {return d_dragPosition;}
00134 
00135 
00143         bool    isClickable(void) const         {return d_allowClicks;}
00144 
00145 
00146         /*************************************************************************
00147                 Manipulator Methods
00148         *************************************************************************/
00159         void    setSizingEnabled(bool setting);
00160 
00161 
00177         void    setSortDirection(SortDirection sort_dir);
00178 
00179 
00190         void    setDragMovingEnabled(bool setting);
00191 
00192 
00203         void setClickable(bool setting);
00204 
00205 
00206         /*************************************************************************
00207                 Construction & Destruction
00208         *************************************************************************/
00213         ListHeaderSegment(const String& type, const String& name);
00214 
00215 
00220         virtual ~ListHeaderSegment(void);
00221 
00222 
00223 protected:
00224         /*************************************************************************
00225                 Implementation Methods
00226         *************************************************************************/
00231         void    addHeaderSegmentEvents(void);
00232 
00233 
00244         void    doDragSizing(const Point& local_mouse);
00245 
00246 
00257         void    doDragMoving(const Point& local_mouse);
00258 
00259 
00264         void    initDragMoving(void);
00265 
00266 
00271         void    initSizingHoverState(void);
00272 
00273 
00278         void    initSegmentHoverState(void);
00279 
00280 
00293         bool    isDragMoveThresholdExceeded(const Point& local_mouse);
00294 
00295 
00306         virtual bool    testClassName_impl(const String& class_name) const
00307         {
00308                 if (class_name==(const utf8*)"ListHeaderSegment")       return true;
00309                 return Window::testClassName_impl(class_name);
00310         }
00311 
00312 
00313         /*************************************************************************
00314                 New Event Handlers
00315         *************************************************************************/
00320         virtual void    onSegmentClicked(WindowEventArgs& e);
00321 
00322 
00327         virtual void    onSplitterDoubleClicked(WindowEventArgs& e);
00328 
00329 
00334         virtual void    onSizingSettingChanged(WindowEventArgs& e);
00335 
00336 
00341         virtual void    onSortDirectionChanged(WindowEventArgs& e);
00342 
00343 
00348         virtual void    onMovableSettingChanged(WindowEventArgs& e);
00349 
00350 
00355         virtual void    onSegmentDragStart(WindowEventArgs& e);
00356 
00357 
00362         virtual void    onSegmentDragStop(WindowEventArgs& e);
00363 
00364 
00369         virtual void    onSegmentDragPositionChanged(WindowEventArgs& e);
00370 
00371 
00376         virtual void    onSegmentSized(WindowEventArgs& e);
00377 
00378 
00383         virtual void    onClickableSettingChanged(WindowEventArgs& e);
00384 
00385 
00386         /*************************************************************************
00387                 Overridden Event Handlers
00388         *************************************************************************/
00389         virtual void    onMouseMove(MouseEventArgs& e);
00390         virtual void    onMouseButtonDown(MouseEventArgs& e);
00391         virtual void    onMouseButtonUp(MouseEventArgs& e);
00392         virtual void    onMouseDoubleClicked(MouseEventArgs& e);
00393         virtual void    onMouseLeaves(MouseEventArgs& e);
00394         virtual void    onCaptureLost(WindowEventArgs& e);
00395 
00396 
00397         /*************************************************************************
00398                 Implementation Data
00399         *************************************************************************/
00400         const Image*    d_sizingMouseCursor;    
00401         const Image*    d_movingMouseCursor;    
00402 
00403         float   d_splitterSize;         
00404         bool    d_splitterHover;        
00405 
00406         bool    d_dragSizing;           
00407         Point   d_dragPoint;            
00408 
00409         SortDirection   d_sortDir;      
00410 
00411         bool    d_segmentHover;         
00412         bool    d_segmentPushed;        
00413         bool    d_sizingEnabled;        
00414         bool    d_movingEnabled;        
00415         bool    d_dragMoving;           
00416         Point   d_dragPosition;         
00417         bool    d_allowClicks;          
00418 
00419 
00420 private:
00421         /*************************************************************************
00422                 Static Properties for this class
00423         *************************************************************************/
00424         static ListHeaderSegmentProperties::Clickable           d_clickableProperty;
00425         static ListHeaderSegmentProperties::Dragable            d_dragableProperty;
00426         static ListHeaderSegmentProperties::Sizable                     d_sizableProperty;
00427         static ListHeaderSegmentProperties::SortDirection       d_sortDirectionProperty;
00428 
00429 
00430         /*************************************************************************
00431                 Private methods
00432         *************************************************************************/
00433         void    addHeaderSegmentProperties(void);
00434 };
00435 
00436 } // End of  CEGUI namespace section
00437 
00438 #if defined(_MSC_VER)
00439 #       pragma warning(pop)
00440 #endif
00441 
00442 #endif  // end of guard _CEGUIListHeaderSegment_h_

Generated on Sat Nov 26 09:34:48 2005 for Crazy Eddies GUI System by  doxygen 1.4.5