Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIListHeaderSegment.h

Go to the documentation of this file.
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 CEGUIBASE_API 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 
00296         /*************************************************************************
00297                 New Event Handlers
00298         *************************************************************************/
00303         virtual void    onSegmentClicked(WindowEventArgs& e);
00304 
00305 
00310         virtual void    onSplitterDoubleClicked(WindowEventArgs& e);
00311 
00312 
00317         virtual void    onSizingSettingChanged(WindowEventArgs& e);
00318 
00319 
00324         virtual void    onSortDirectionChanged(WindowEventArgs& e);
00325 
00326 
00331         virtual void    onMovableSettingChanged(WindowEventArgs& e);
00332 
00333 
00338         virtual void    onSegmentDragStart(WindowEventArgs& e);
00339 
00340 
00345         virtual void    onSegmentDragStop(WindowEventArgs& e);
00346 
00347 
00352         virtual void    onSegmentDragPositionChanged(WindowEventArgs& e);
00353 
00354 
00359         virtual void    onSegmentSized(WindowEventArgs& e);
00360 
00361 
00366         virtual void    onClickableSettingChanged(WindowEventArgs& e);
00367 
00368 
00369         /*************************************************************************
00370                 Overridden Event Handlers
00371         *************************************************************************/
00372         virtual void    onMouseMove(MouseEventArgs& e);
00373         virtual void    onMouseButtonDown(MouseEventArgs& e);
00374         virtual void    onMouseButtonUp(MouseEventArgs& e);
00375         virtual void    onMouseDoubleClicked(MouseEventArgs& e);
00376         virtual void    onMouseLeaves(MouseEventArgs& e);
00377         virtual void    onCaptureLost(WindowEventArgs& e);
00378 
00379 
00380         /*************************************************************************
00381                 Implementation Data
00382         *************************************************************************/
00383         const Image*    d_normalMouseCursor;    
00384         const Image*    d_sizingMouseCursor;    
00385         const Image*    d_movingMouseCursor;    
00386 
00387         float   d_splitterSize;         
00388         bool    d_splitterHover;        
00389 
00390         bool    d_dragSizing;           
00391         Point   d_dragPoint;            
00392 
00393         SortDirection   d_sortDir;      
00394 
00395         bool    d_segmentHover;         
00396         bool    d_segmentPushed;        
00397         bool    d_sizingEnabled;        
00398         bool    d_movingEnabled;        
00399         bool    d_dragMoving;           
00400         Point   d_dragPosition;         
00401         bool    d_allowClicks;          
00402 
00403 
00404 private:
00405         /*************************************************************************
00406                 Static Properties for this class
00407         *************************************************************************/
00408         static ListHeaderSegmentProperties::Clickable           d_clickableProperty;
00409         static ListHeaderSegmentProperties::Dragable            d_dragableProperty;
00410         static ListHeaderSegmentProperties::Sizable                     d_sizableProperty;
00411         static ListHeaderSegmentProperties::SortDirection       d_sortDirectionProperty;
00412 
00413 
00414         /*************************************************************************
00415                 Private methods
00416         *************************************************************************/
00417         void    addHeaderSegmentProperties(void);
00418 };
00419 
00420 } // End of  CEGUI namespace section
00421 
00422 #if defined(_MSC_VER)
00423 #       pragma warning(pop)
00424 #endif
00425 
00426 #endif  // end of guard _CEGUIListHeaderSegment_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1