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

CEGUIListHeader.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIListHeader.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for ListHeader widget
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 _CEGUIListHeader_h_
00027 #define _CEGUIListHeader_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIListHeaderSegment.h"
00032 #include "elements/CEGUIListHeaderProperties.h"
00033 
00034 
00035 #if defined(_MSC_VER)
00036 #       pragma warning(push)
00037 #       pragma warning(disable : 4251)
00038 #endif
00039 
00040 
00041 // Start of CEGUI namespace section
00042 namespace CEGUI
00043 {
00048 class CEGUIBASE_API HeaderSequenceEventArgs : public WindowEventArgs
00049 {
00050 public:
00051         HeaderSequenceEventArgs(Window* wnd, uint old_idx, uint new_idx) : WindowEventArgs(wnd), d_oldIdx(old_idx), d_newIdx(new_idx) {};
00052 
00053         uint d_oldIdx;          
00054         uint d_newIdx;          
00055 };
00056 
00057 
00062 class CEGUIBASE_API ListHeader : public Window
00063 {
00064 public:
00065         static const String EventNamespace;                             
00066 
00067 
00068         /*************************************************************************
00069                 Constants
00070         *************************************************************************/
00071         // Event names
00072         static const String EventSortColumnChanged;                     
00073         static const String EventSortDirectionChanged;          
00074         static const String EventSegmentSized;                          
00075         static const String EventSegmentClicked;                                
00076         static const String EventSplitterDoubleClicked;         
00077         static const String EventSegmentSequenceChanged;                
00078         static const String EventSegmentAdded;                          
00079         static const String EventSegmentRemoved;                                
00080         static const String EventSortSettingChanged;                    
00081         static const String EventDragMoveSettingChanged;                
00082         static const String EventDragSizeSettingChanged;                
00083         static const String EventSegmentRenderOffsetChanged;    
00084 
00085         // values
00086         static const float      ScrollSpeed;                            
00087         static const float      MinimumSegmentPixelWidth;       
00088 
00089 
00090         /*************************************************************************
00091                 Accessor Methods
00092         *************************************************************************/
00100         uint    getColumnCount(void) const;
00101 
00102         
00115         ListHeaderSegment&      getSegmentFromColumn(uint column) const;
00116 
00117 
00131         ListHeaderSegment&      getSegmentFromID(uint id) const;
00132 
00133 
00144         ListHeaderSegment&      getSortSegment(void) const;
00145 
00146 
00159         uint    getColumnFromSegment(const ListHeaderSegment& segment) const;
00160 
00161 
00174         uint    getColumnFromID(uint id) const;
00175 
00176 
00187         uint    getSortColumn(void) const;
00188 
00189 
00202         uint    getColumnWithText(const String& text) const;
00203 
00204 
00217         float   getPixelOffsetToSegment(const ListHeaderSegment& segment) const;
00218 
00219 
00233         float   getPixelOffsetToColumn(uint column) const;
00234 
00235 
00243         float   getTotalSegmentsPixelExtent(void) const;
00244 
00245 
00258         float   getColumnPixelWidth(uint column) const;
00259 
00260 
00268         ListHeaderSegment::SortDirection        getSortDirection(void) const;
00269 
00270 
00279         bool    isSortingEnabled(void) const;
00280 
00281 
00289         bool    isColumnSizingEnabled(void) const;
00290 
00291 
00299         bool    isColumnDraggingEnabled(void) const;
00300 
00301 
00310         float   getSegmentOffset(void) const    {return d_segmentOffset;}
00311 
00312 
00313         /*************************************************************************
00314                 Manipulator Methods
00315         *************************************************************************/
00327         void    setSortingEnabled(bool setting);
00328 
00329 
00340         void    setSortDirection(ListHeaderSegment::SortDirection direction);
00341 
00342 
00355         void    setSortSegment(const ListHeaderSegment& segment);
00356 
00357 
00370         void    setSortColumn(uint column);
00371 
00372 
00385         void    setSortColumnFromID(uint id);
00386 
00387 
00399         void    setColumnSizingEnabled(bool setting);
00400 
00401 
00413         void    setColumnDraggingEnabled(bool setting);
00414 
00415 
00432         void    addColumn(const String& text, uint id, float width);
00433 
00434 
00455         void    insertColumn(const String& text, uint id, float width, uint position);
00456 
00457 
00480         void    insertColumn(const String& text, uint id, float width, const ListHeaderSegment& position);
00481 
00482 
00495         void    removeColumn(uint column);
00496 
00497 
00510         void    removeSegment(const ListHeaderSegment& segment);
00511 
00512 
00529         void    moveColumn(uint column, uint position);
00530 
00531 
00550         void    moveColumn(uint column, const ListHeaderSegment& position);
00551 
00552 
00569         void    moveSegment(const ListHeaderSegment& segment, uint position);
00570 
00571 
00589         void    moveSegment(const ListHeaderSegment& segment, const ListHeaderSegment& position);
00590 
00591 
00604         void    setSegmentOffset(float offset);
00605 
00606 
00623         void    setColumnPixelWidth(uint column, float width);
00624 
00625 
00626         /*************************************************************************
00627                 Construction and Destruction
00628         *************************************************************************/
00633         ListHeader(const String& type, const String& name);
00634 
00635 
00640         virtual ~ListHeader(void);
00641 
00642 
00643 protected:
00644         /*************************************************************************
00645                 Abstract Implementation Methods
00646         *************************************************************************/
00658         virtual ListHeaderSegment*      createNewSegment(const String& name) const      = 0;
00659 
00660 
00672         virtual void    destroyListSegment(ListHeaderSegment* segment) const = 0;
00673 
00674 
00675         /*************************************************************************
00676                 Implementation Methods
00677         *************************************************************************/
00682         ListHeaderSegment*      createInitialisedSegment(const String& text, uint id, float width);
00683 
00684 
00689         void    layoutSegments(void);
00690 
00691 
00696         void    addListHeaderEvents(void);
00697 
00698 
00699         /*************************************************************************
00700                 New List header event handlers
00701         *************************************************************************/
00706         virtual void    onSortColumnChanged(WindowEventArgs& e);
00707 
00708 
00713         virtual void    onSortDirectionChanged(WindowEventArgs& e);
00714 
00715 
00720         virtual void    onSegmentSized(WindowEventArgs& e);
00721 
00722 
00727         virtual void    onSegmentClicked(WindowEventArgs& e);
00728 
00729 
00734         virtual void    onSplitterDoubleClicked(WindowEventArgs& e);
00735 
00736 
00741         virtual void    onSegmentSequenceChanged(WindowEventArgs& e);
00742 
00743 
00748         virtual void    onSegmentAdded(WindowEventArgs& e);
00749 
00750 
00755         virtual void    onSegmentRemoved(WindowEventArgs& e);
00756 
00757 
00762         virtual void    onSortSettingChanged(WindowEventArgs& e);
00763 
00764 
00769         virtual void    onDragMoveSettingChanged(WindowEventArgs& e);
00770 
00771 
00776         virtual void    onDragSizeSettingChanged(WindowEventArgs& e);
00777 
00778 
00783         virtual void    onSegmentOffsetChanged(WindowEventArgs& e);
00784 
00785 
00786         /*************************************************************************
00787                 handlers for events we subscribe to from segments
00788         *************************************************************************/
00789         bool    segmentSizedHandler(const EventArgs& e);
00790         bool    segmentMovedHandler(const EventArgs& e);
00791         bool    segmentClickedHandler(const EventArgs& e);
00792         bool    segmentDoubleClickHandler(const EventArgs& e);
00793         bool    segmentDragHandler(const EventArgs& e);
00794 
00795 
00796         /*************************************************************************
00797                 Implementation Data
00798         *************************************************************************/
00799         typedef std::vector<ListHeaderSegment*>         SegmentList;
00800         SegmentList     d_segments;                     
00801         ListHeaderSegment*      d_sortSegment;  
00802         bool    d_sizingEnabled;                
00803         bool    d_sortingEnabled;               
00804         bool    d_movingEnabled;                
00805         uint    d_uniqueIDNumber;               
00806         float   d_segmentOffset;                
00807         ListHeaderSegment::SortDirection        d_sortDir;              
00808 
00809 
00810 private:
00811         /*************************************************************************
00812                 Static Properties for this class
00813         *************************************************************************/
00814         static ListHeaderProperties::SortSettingEnabled         d_sortSettingProperty;
00815         static ListHeaderProperties::ColumnsSizable                     d_sizableProperty;
00816         static ListHeaderProperties::ColumnsMovable                     d_movableProperty;
00817         static ListHeaderProperties::SortColumnID                       d_sortColumnIDProperty;
00818         static ListHeaderProperties::SortDirection                      d_sortDirectionProperty;
00819 
00820 
00821         /*************************************************************************
00822                 Private methods
00823         *************************************************************************/
00824         void    addHeaderProperties(void);
00825 };
00826 
00827 } // End of  CEGUI namespace section
00828 
00829 
00830 #if defined(_MSC_VER)
00831 #       pragma warning(pop)
00832 #endif
00833 
00834 #endif  // end of guard _CEGUIListHeader_h_

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