Crazy Eddie's GUI System  0.8.4
CEGUI::ListHeader Class Reference

Base class for the multi column list header widget. More...

+ Inheritance diagram for CEGUI::ListHeader:
+ Collaboration diagram for CEGUI::ListHeader:

List of all members.

Public Member Functions

uint getColumnCount (void) const
 Return the number of columns or segments attached to the header.
ListHeaderSegmentgetSegmentFromColumn (uint column) const
 Return the ListHeaderSegment object for the specified column.
ListHeaderSegmentgetSegmentFromID (uint id) const
 Return the ListHeaderSegment object with the specified ID.
ListHeaderSegmentgetSortSegment (void) const
 Return the ListHeaderSegment that is marked as being the 'sort key' segment. There must be at least one segment to successfully call this method.
uint getSortSegmentID (void) const
 Return the ListHeaderSegment ID that is marked as being the 'sort key' segment. There must be at least one segment to successfully call this method.
uint getColumnFromSegment (const ListHeaderSegment &segment) const
 Return the zero based column index of the specified segment.
uint getColumnFromID (uint id) const
 Return the zero based column index of the segment with the specified ID.
uint getSortColumn (void) const
 Return the zero based index of the current sort column. There must be at least one segment/column to successfully call this method.
uint getColumnWithText (const String &text) const
 Return the zero based column index of the segment with the specified text.
float getPixelOffsetToSegment (const ListHeaderSegment &segment) const
 Return the pixel offset to the given ListHeaderSegment.
float getPixelOffsetToColumn (uint column) const
 Return the pixel offset to the ListHeaderSegment at the given zero based column index.
float getTotalSegmentsPixelExtent (void) const
 Return the total pixel width of all attached segments.
UDim getColumnWidth (uint column) const
 Return the width of the specified column.
ListHeaderSegment::SortDirection getSortDirection (void) const
 Return the currently set sort direction.
bool isSortingEnabled (void) const
 Return whether user manipulation of the sort column & direction are enabled.
bool isColumnSizingEnabled (void) const
 Return whether the user may size column segments.
bool isColumnDraggingEnabled (void) const
 Return whether the user may modify the order of the segments.
float getSegmentOffset (void) const
 Return the current segment offset value. This value is used to implement scrolling of the header segments within the ListHeader area.
void setSortingEnabled (bool setting)
 Set whether user manipulation of the sort column and direction is enabled.
void setSortDirection (ListHeaderSegment::SortDirection direction)
 Set the current sort direction.
void setSortSegment (const ListHeaderSegment &segment)
 Set the column segment to be used as the sort column.
void setSortColumn (uint column)
 Set the column to be used as the sort column.
void setSortColumnFromID (uint id)
 Set the column to to be used for sorting via its ID code.
void setColumnSizingEnabled (bool setting)
 Set whether columns may be sized by the user.
void setColumnDraggingEnabled (bool setting)
 Set whether columns may be reordered by the user via drag and drop.
void addColumn (const String &text, uint id, const UDim &width)
 Add a new column segment to the end of the header.
void insertColumn (const String &text, uint id, const UDim &width, uint position)
 Insert a new column segment at the specified position.
void insertColumn (const String &text, uint id, const UDim &width, const ListHeaderSegment &position)
 Insert a new column segment at the specified position.
void removeColumn (uint column)
 Removes a column segment from the ListHeader.
void removeSegment (const ListHeaderSegment &segment)
 Remove the specified segment from the ListHeader.
void moveColumn (uint column, uint position)
 Moves a column segment into a new position.
void moveColumn (uint column, const ListHeaderSegment &position)
 Move a column segment to a new position.
void moveSegment (const ListHeaderSegment &segment, uint position)
 Moves a segment into a new position.
void moveSegment (const ListHeaderSegment &segment, const ListHeaderSegment &position)
 Move a segment to a new position.
void setSegmentOffset (float offset)
 Set the current base segment offset. (This implements scrolling of the header segments within the header area).
void setColumnWidth (uint column, const UDim &width)
 Set the width of the specified column.
 ListHeader (const String &type, const String &name)
 Constructor for the list header base class.
virtual ~ListHeader (void)
 Destructor for the list header base class.

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
static const String WidgetTypeName
 Window factory name.
static const String EventSortColumnChanged
static const String EventSortDirectionChanged
static const String EventSegmentSized
static const String EventSegmentClicked
static const String EventSplitterDoubleClicked
static const String EventSegmentSequenceChanged
static const String EventSegmentAdded
static const String EventSegmentRemoved
static const String EventSortSettingChanged
static const String EventDragMoveSettingChanged
static const String EventDragSizeSettingChanged
static const String EventSegmentRenderOffsetChanged
static const float ScrollSpeed
 Speed to scroll at when dragging outside header.
static const float MinimumSegmentPixelWidth
 Miniumum width of a segment in pixels.
static const String SegmentNameSuffix
 Widget name suffix for header segments.

Protected Types

typedef std::vector
< ListHeaderSegment
*CEGUI_VECTOR_ALLOC(ListHeaderSegment *) 
SegmentList )

Protected Member Functions

ListHeaderSegmentcreateInitialisedSegment (const String &text, uint id, const UDim &width)
 Create and return a pointer to a new ListHeaderSegment based object.
void layoutSegments (void)
 Layout the attached segments.
ListHeaderSegmentcreateNewSegment (const String &name) const
 Create and return a pointer to a new ListHeaderSegment based object.
void destroyListSegment (ListHeaderSegment *segment) const
 Cleanup and destroy the given ListHeaderSegment that was created via the createNewSegment method.
virtual bool validateWindowRenderer (const WindowRenderer *renderer) const
 Function used in checking if a WindowRenderer is valid for this window.
virtual void onSortColumnChanged (WindowEventArgs &e)
 Handler called when the sort column is changed.
virtual void onSortDirectionChanged (WindowEventArgs &e)
 Handler called when the sort direction is changed.
virtual void onSegmentSized (WindowEventArgs &e)
 Handler called when a segment is sized by the user. e.window points to the segment.
virtual void onSegmentClicked (WindowEventArgs &e)
 Handler called when a segment is clicked by the user. e.window points to the segment.
virtual void onSplitterDoubleClicked (WindowEventArgs &e)
 Handler called when a segment splitter / sizer is double-clicked. e.window points to the segment.
virtual void onSegmentSequenceChanged (WindowEventArgs &e)
 Handler called when the segment / column order changes.
virtual void onSegmentAdded (WindowEventArgs &e)
 Handler called when a new segment is added to the header.
virtual void onSegmentRemoved (WindowEventArgs &e)
 Handler called when a segment is removed from the header.
virtual void onSortSettingChanged (WindowEventArgs &e)
 Handler called then setting that controls the users ability to modify the search column & direction changes.
virtual void onDragMoveSettingChanged (WindowEventArgs &e)
 Handler called when the setting that controls the users ability to drag and drop segments changes.
virtual void onDragSizeSettingChanged (WindowEventArgs &e)
 Handler called when the setting that controls the users ability to size segments changes.
virtual void onSegmentOffsetChanged (WindowEventArgs &e)
 Handler called when the base rendering offset for the segments (scroll position) changes.
bool segmentSizedHandler (const EventArgs &e)
bool segmentMovedHandler (const EventArgs &e)
bool segmentClickedHandler (const EventArgs &e)
bool segmentDoubleClickHandler (const EventArgs &e)
bool segmentDragHandler (const EventArgs &e)

Protected Attributes

SegmentList d_segments
 Attached segment windows in header order.
ListHeaderSegmentd_sortSegment
 Pointer to the segment that is currently set as the sork-key,.
bool d_sizingEnabled
 true if segments can be sized by the user.
bool d_sortingEnabled
 true if the sort criteria modifications by user are enabled (no sorting is actuall done)
bool d_movingEnabled
 true if drag & drop moving of columns / segments is enabled.
uint d_uniqueIDNumber
 field used to create unique names.
float d_segmentOffset
 Base offset used to layout the segments (allows scrolling within the window area)
ListHeaderSegment::SortDirection d_sortDir
 Brief copy of the current sort direction.

Detailed Description

Base class for the multi column list header widget.


Member Function Documentation

void CEGUI::ListHeader::addColumn ( const String text,
uint  id,
const UDim width 
)

Add a new column segment to the end of the header.

Parameters:
textString object holding the initial text for the new segment
idClient specified ID code to be assigned to the new segment.
widthUDim describing the initial width of the new segment.
Returns:
Nothing.
ListHeaderSegment* CEGUI::ListHeader::createInitialisedSegment ( const String text,
uint  id,
const UDim width 
) [protected]

Create and return a pointer to a new ListHeaderSegment based object.

Parameters:
nameString object holding the name that should be given to the new Window.
Returns:
Pointer to an ListHeaderSegment based object of whatever type is appropriate for this ListHeader.

Cleanup and destroy the given ListHeaderSegment that was created via the createNewSegment method.

Parameters:
segmentPointer to a ListHeaderSegment based object to be destroyed.
Returns:
Nothing.

Create initialise and return a ListHeaderSegment object, with all events subscribed and ready to use.

ListHeaderSegment* CEGUI::ListHeader::createNewSegment ( const String name) const [protected]

Create and return a pointer to a new ListHeaderSegment based object.

Parameters:
nameString object holding the name that should be given to the new Window.
Returns:
Pointer to an ListHeaderSegment based object of whatever type is appropriate for this ListHeader.
void CEGUI::ListHeader::destroyListSegment ( ListHeaderSegment segment) const [protected]

Cleanup and destroy the given ListHeaderSegment that was created via the createNewSegment method.

Parameters:
segmentPointer to a ListHeaderSegment based object to be destroyed.
Returns:
Nothing.
uint CEGUI::ListHeader::getColumnCount ( void  ) const

Return the number of columns or segments attached to the header.

Returns:
uint value equal to the number of columns / segments currently in the header.
uint CEGUI::ListHeader::getColumnFromID ( uint  id) const

Return the zero based column index of the segment with the specified ID.

Parameters:
idID code of the segment whos column index is to be returned.
Returns:
Zero based column index of the first ListHeaderSegment whos ID matches id.
Exceptions:
InvalidRequestExceptionthrown if no attached segment has the requested ID.

Return the zero based column index of the specified segment.

Parameters:
segmentListHeaderSegment whos zero based index is to be returned.
Returns:
Zero based column index of the ListHeaderSegment segment.
Exceptions:
InvalidRequestExceptionthrown if segment is not attached to this ListHeader.
UDim CEGUI::ListHeader::getColumnWidth ( uint  column) const

Return the width of the specified column.

Parameters:
columnZero based column index of the segment whose width is to be returned.
Returns:
UDim describing the width of the ListHeaderSegment at the zero based column index specified by column.
Exceptions:
InvalidRequestExceptionthrown if column is out of range.
uint CEGUI::ListHeader::getColumnWithText ( const String text) const

Return the zero based column index of the segment with the specified text.

Parameters:
textString object containing the text to be searched for.
Returns:
Zero based column index of the segment with the specified text.
Exceptions:
InvalidRequestExceptionthrown if no attached segments have the requested text.
float CEGUI::ListHeader::getPixelOffsetToColumn ( uint  column) const

Return the pixel offset to the ListHeaderSegment at the given zero based column index.

Parameters:
columnZero based column index of the ListHeaderSegment whos pixel offset it to be returned.
Returns:
The number of pixels up-to the begining of the ListHeaderSegment located at zero based column index column.
Exceptions:
InvalidRequestExceptionthrown if column is out of range.

Return the pixel offset to the given ListHeaderSegment.

Parameters:
segmentListHeaderSegment object that the offset to is to be returned.
Returns:
The number of pixels up-to the begining of the ListHeaderSegment described by segment.
Exceptions:
InvalidRequestExceptionthrown if segment is not attached to the ListHeader.

Return the ListHeaderSegment object for the specified column.

Parameters:
columnzero based column index of the ListHeaderSegment to be returned.
Returns:
ListHeaderSegment object at the requested index.
Exceptions:
InvalidRequestExceptionthrown if column is out of range.

Return the ListHeaderSegment object with the specified ID.

Parameters:
idid code of the ListHeaderSegment to be returned.
Returns:
ListHeaderSegment object with the ID id. If more than one segment has the same ID, only the first one will ever be returned.
Exceptions:
InvalidRequestExceptionthrown if no segment with the requested ID is attached.
float CEGUI::ListHeader::getSegmentOffset ( void  ) const [inline]

Return the current segment offset value. This value is used to implement scrolling of the header segments within the ListHeader area.

Returns:
float value specifying the current segment offset value in whatever metrics system is active for the ListHeader.
uint CEGUI::ListHeader::getSortColumn ( void  ) const

Return the zero based index of the current sort column. There must be at least one segment/column to successfully call this method.

Returns:
Zero based column index that is the current sort column.
Exceptions:
InvalidRequestExceptionthrown if there are no segments / columns in this ListHeader.

Return the currently set sort direction.

Returns:
One of the ListHeaderSegment::SortDirection enumerated values specifying the current sort direction.

Return the ListHeaderSegment that is marked as being the 'sort key' segment. There must be at least one segment to successfully call this method.

Returns:
ListHeaderSegment object which is the sort-key segment.
Exceptions:
InvalidRequestExceptionthrown if no segments are attached to the ListHeader.
uint CEGUI::ListHeader::getSortSegmentID ( void  ) const

Return the ListHeaderSegment ID that is marked as being the 'sort key' segment. There must be at least one segment to successfully call this method.

Returns:
uint which is the sort-key segment ID.
Exceptions:
InvalidRequestExceptionthrown if no segments are attached to the ListHeader.

Return the total pixel width of all attached segments.

Returns:
Sum of the pixel widths of all attached ListHeaderSegment objects.
void CEGUI::ListHeader::insertColumn ( const String text,
uint  id,
const UDim width,
uint  position 
)

Insert a new column segment at the specified position.

Parameters:
textString object holding the initial text for the new segment
idClient specified ID code to be assigned to the new segment.
widthUDim describing the initial width of the new segment.
positionZero based column index indicating the desired position for the new column. If this is greater than the current number of columns, the new segment is added to the end if the header.
Returns:
Nothing.
void CEGUI::ListHeader::insertColumn ( const String text,
uint  id,
const UDim width,
const ListHeaderSegment position 
)

Insert a new column segment at the specified position.

Parameters:
textString object holding the initial text for the new segment
idClient specified ID code to be assigned to the new segment.
widthUDim describing the initial width of the new segment.
positionListHeaderSegment object indicating the insert position for the new segment. The new segment will be inserted before the segment indicated by position.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if ListHeaderSegment position is not attached to the ListHeader.

Return whether the user may modify the order of the segments.

Returns:
true if the user may interactively modify the order of the column segments, false if they may not.

Return whether the user may size column segments.

Returns:
true if the user may interactively modify the width of column segments, false if they may not.
bool CEGUI::ListHeader::isSortingEnabled ( void  ) const

Return whether user manipulation of the sort column & direction are enabled.

Returns:
true if the user may interactively modify the sort column and direction. false if the user may not modify the sort column and direction (these can still be set programmatically).
void CEGUI::ListHeader::moveColumn ( uint  column,
uint  position 
)

Moves a column segment into a new position.

Parameters:
columnZero based column index indicating the column segment to be moved.
positionZero based column index indicating the new position for the segment. If this is greater than the current number of segments, the segment is moved to the end of the header.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if column is out of range for this ListHeader.
void CEGUI::ListHeader::moveColumn ( uint  column,
const ListHeaderSegment position 
)

Move a column segment to a new position.

Parameters:
columnZero based column index indicating the column segment to be moved.
positionListHeaderSegment object indicating the new position for the segment. The segment at column will be moved behind segment position (that is, segment column will appear to the right of segment position).
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if column is out of range for this ListHeader, or if position is not attached to this ListHeader.
void CEGUI::ListHeader::moveSegment ( const ListHeaderSegment segment,
uint  position 
)

Moves a segment into a new position.

Parameters:
segmentListHeaderSegment object that is to be moved.
positionZero based column index indicating the new position for the segment. If this is greater than the current number of segments, the segment is moved to the end of the header.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if segment is not attached to this ListHeader.
void CEGUI::ListHeader::moveSegment ( const ListHeaderSegment segment,
const ListHeaderSegment position 
)

Move a segment to a new position.

Parameters:
segmentListHeaderSegment object that is to be moved.
positionListHeaderSegment object indicating the new position for the segment. The segment segment will be moved behind segment position (that is, segment segment will appear to the right of segment position).
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if either segment or position are not attached to this ListHeader.
void CEGUI::ListHeader::removeColumn ( uint  column)

Removes a column segment from the ListHeader.

Parameters:
columnZero based column index indicating the segment to be removed.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if column is out of range.

Remove the specified segment from the ListHeader.

Parameters:
segmentListHeaderSegment object that is to be removed from the ListHeader.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if segment is not attached to this ListHeader.

Set whether columns may be reordered by the user via drag and drop.

Parameters:
setting
  • true to indicate the user may change the order of the column segments via drag and drop.
  • false to indicate the user may not change the column segment order.
Returns:
Nothing.

Set whether columns may be sized by the user.

Parameters:
setting
  • true to indicate that the user may interactively size segments.
  • false to indicate that the user may not interactively size segments.
Returns:
Nothing.
void CEGUI::ListHeader::setColumnWidth ( uint  column,
const UDim width 
)

Set the width of the specified column.

Parameters:
columnZero based column index of the segment whose width is to be set.
widthUDim value specifying the new width to set for the ListHeaderSegment at the zero based column index specified by column.
Returns:
Nothing
Exceptions:
InvalidRequestExceptionthrown if column is out of range.
void CEGUI::ListHeader::setSegmentOffset ( float  offset)

Set the current base segment offset. (This implements scrolling of the header segments within the header area).

Parameters:
offsetNew base offset for the first segment. The segments will of offset to the left by the amount specified. offset should be specified using the active metrics system for the ListHeader.
Returns:
Nothing.
void CEGUI::ListHeader::setSortColumn ( uint  column)

Set the column to be used as the sort column.

Parameters:
columnZero based column index indicating the column to be sorted.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if column is out of range for this ListHeader.

Set the column to to be used for sorting via its ID code.

Parameters:
idID code of the column segment that is to be used as the sort column.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if no segment with ID id is attached to the ListHeader.

Set the current sort direction.

Parameters:
directionOne of the ListHeaderSegment::SortDirection enumerated values indicating the sort direction to be used.
Returns:
Nothing.
void CEGUI::ListHeader::setSortingEnabled ( bool  setting)

Set whether user manipulation of the sort column and direction is enabled.

Parameters:
setting
  • true to allow interactive user manipulation of the sort column and direction.
  • false to disallow interactive user manipulation of the sort column and direction.
Returns:
Nothing.

Set the column segment to be used as the sort column.

Parameters:
segmentListHeaderSegment object indicating the column to be sorted.
Returns:
Nothing.
Exceptions:
InvalidRequestExceptionthrown if segment is not attached to this ListHeader.
virtual bool CEGUI::ListHeader::validateWindowRenderer ( const WindowRenderer renderer) const [protected, virtual]

Function used in checking if a WindowRenderer is valid for this window.

Parameters:
rendererWindow renderer that will be checked (it can be null!)
Returns:
Returns true if the given WindowRenderer class name is valid for this window. False if not.

Reimplemented from CEGUI::Window.


Member Data Documentation

Event fired when setting that controls user drag & drop of segments is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose drag & drop enabled setting has changed.

Event fired when setting that controls user sizing of segments is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose user sizing setting has changed.

Event fired when a segment is added to the header. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader that has had a new segment added.

Event fired when a segment of the header is clicked by the user. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeaderSegment that was clicked.

Event fired when a segment is removed from the header. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader that has had a segment removed.

Event fired when the rendering offset for the segments changes. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose segment rendering offset has changed.

Event fired when the order of the segments in the header has changed. Handlers are passed a const HeaderSequenceEventArgs reference with WindowEventArgs::window set to the ListHeader whose segments have changed sequence, HeaderSequenceEventArgs::d_oldIdx is the original index of the segment that has moved, and HeaderSequenceEventArgs::d_newIdx is the new index of the segment that has moved.

Event fired when a segment of the header is sized by the user. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeaderSegment that has been sized.

Event fired when the current sort column of the header is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose sort column has been changed.

Event fired when the sort direction of the header is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose sort direction had been changed.

Event fired when setting that controls user modification to sort configuration is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeader whose user sort control setting has been changed.

Event fired when a segment splitter of the header is double-clicked. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ListHeaderSegment whose splitter area was double-clicked.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends