# wxHeaderCtrlSimple Class Reference
[Controls]

`#include <wx/headerctrl.h>`

Inheritance diagram for wxHeaderCtrlSimple:
[legend]

## Detailed Description

wxHeaderCtrlSimple is a concrete header control which can be used directly, without inheriting from it as you need to do when using wxHeaderCtrl itself.

When using it, you need to use simple AppendColumn(), InsertColumn() and DeleteColumn() methods instead of setting the number of columns with SetColumnCount() and returning the information about them from the overridden GetColumn().

##

Library: wxCore

Category: Controls

See also:
  wxHeaderCtrl

## Public Member Functions
| wxHeaderCtrlSimple ()
| Default constructor not creating the underlying window.
| wxHeaderCtrlSimple (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHD_DEFAULT_STYLE, const wxString &name=wxHeaderCtrlNameStr)
| Constructor creating the window.
void | InsertColumn (const wxHeaderColumnSimple &col, unsigned int idx)
| Insert the column at the given position.
void | AppendColumn (const wxHeaderColumnSimple &col)
| Append the column to the end of the control.
void | DeleteColumn (unsigned int idx)
| Delete the column at the given position.
void | ShowColumn (unsigned int idx, bool show=true)
| Show or hide the column.
void | HideColumn (unsigned int idx)
| Hide the column with the given index.
void | ShowSortIndicator (unsigned int idx, bool sortOrder=true)
| Update the column sort indicator.
void | RemoveSortIndicator ()
| Remove the sort indicator from the column being used as sort key.
## Protected Member Functions
virtual int | GetBestFittingWidth (unsigned int idx) const
| This function can be overridden in the classes deriving from this control instead of overriding UpdateColumnWidthToFit().

List of all members.

## Constructor & Destructor Documentation

wxHeaderCtrlSimple::wxHeaderCtrlSimple | ( |  | ) |

Default constructor not creating the underlying window.

You must use Create() after creating the object using this constructor.

wxHeaderCtrlSimple::wxHeaderCtrlSimple | ( | wxWindow * | parent,
|  | wxWindowID | winid = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `wxHD_DEFAULT_STYLE`,
|  | const wxString & | name = `wxHeaderCtrlNameStr` |
| ) |  |  |

Constructor creating the window.

Please see the base class wxHeaderCtrl::Create() method for the parameters description.

## Member Function Documentation

void wxHeaderCtrlSimple::AppendColumn | ( | const wxHeaderColumnSimple & | col | ) |

Append the column to the end of the control.

See also:
  InsertColumn()

void wxHeaderCtrlSimple::DeleteColumn | ( | unsigned int | idx | ) |

Delete the column at the given position.

See also:
  InsertColumn(), AppendColumn()

virtual int wxHeaderCtrlSimple::GetBestFittingWidth | ( | unsigned int | idx | ) | const`[protected, virtual]`

This function can be overridden in the classes deriving from this control instead of overriding UpdateColumnWidthToFit().

To implement automatic column resizing to fit its contents width when the column divider is double clicked, you need to simply return the fitting width for the given column idx from this method, the control will automatically use the biggest value between the one returned from here and the one needed for the display of the column title itself.

The base class version returns -1 indicating that this function is not implemented.

void wxHeaderCtrlSimple::HideColumn | ( | unsigned int | idx | ) |

Hide the column with the given index.

This is the same as calling

     ShowColumn(idx, false)

.

Parameters:

  | idx | The index of the column to show or hide, from 0 to GetColumnCount().

void wxHeaderCtrlSimple::InsertColumn | ( | const wxHeaderColumnSimple & | col,
|  | unsigned int | idx |
| ) |  |  |

Insert the column at the given position.

Parameters:

  | col | The column to insert. Notice that because of the existence of implicit conversion from wxString to wxHeaderColumn a string can be passed directly here.
  | idx | The position of the new column, from 0 to GetColumnCount(). Using GetColumnCount() means to append the column to the end.

See also:
  AppendColumn()

void wxHeaderCtrlSimple::RemoveSortIndicator | ( |  | ) |

Remove the sort indicator from the column being used as sort key.

See also:
  ShowSortIndicator

void wxHeaderCtrlSimple::ShowColumn | ( | unsigned int | idx,
|  | bool | show = `true` |
| ) |  |  |

Show or hide the column.

Initially the column is shown by default or hidden if it was added with wxCOL_HIDDEN flag set.

When a column is hidden, it doesn't appear at all on the screen but its index is still taken into account when working with other columns. E.g. if there are three columns 0, 1 and 2 and the column 1 is hidden you still need to use index 2 to refer to the last visible column.

Parameters:

  | idx | The index of the column to show or hide, from 0 to GetColumnCount().
  | show | Indicates whether the column should be shown (default) or hidden.

void wxHeaderCtrlSimple::ShowSortIndicator | ( | unsigned int | idx,
|  | bool | sortOrder = `true` |
| ) |  |  |

Update the column sort indicator.

The sort indicator, if shown, is typically an arrow pointing upwards or downwards depending on whether the control contents is sorted in ascending or descending order.

Parameters:

  | idx | The column to set the sort indicator for. If `-1` is given, then the currently shown sort indicator will be removed.
  | sortOrder | If true or false show the sort indicator corresponding to ascending or descending sort order respectively.

|  | [ top ]