X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d01c174676f9aaff68142eff49c2128c4473624b..92c0fc34c104c8d7c12d6a3b78ea232690fc23f4:/interface/wx/listctrl.h?ds=sidebyside diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index daba91dc35..d634fe8b14 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -2,7 +2,6 @@ // Name: wx/listctrl.h // Purpose: interface of wxListCtrl // Author: wxWidgets team -// RCS-ID: $Id$ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -203,71 +202,71 @@ enum @beginEventEmissionTable{wxListEvent} @event{EVT_LIST_BEGIN_DRAG(id, func)} Begin dragging with the left mouse button. - Processes a @c wxEVT_COMMAND_LIST_BEGIN_DRAG event type. + Processes a @c wxEVT_LIST_BEGIN_DRAG event type. @event{EVT_LIST_BEGIN_RDRAG(id, func)} Begin dragging with the right mouse button. - Processes a @c wxEVT_COMMAND_LIST_BEGIN_RDRAG event type. + Processes a @c wxEVT_LIST_BEGIN_RDRAG event type. @event{EVT_BEGIN_LABEL_EDIT(id, func)} Begin editing a label. This can be prevented by calling Veto(). - Processes a @c wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT event type. + Processes a @c wxEVT_LIST_BEGIN_LABEL_EDIT event type. @event{EVT_LIST_END_LABEL_EDIT(id, func)} Finish editing a label. This can be prevented by calling Veto(). - Processes a @c wxEVT_COMMAND_LIST_END_LABEL_EDIT event type. + Processes a @c wxEVT_LIST_END_LABEL_EDIT event type. @event{EVT_LIST_DELETE_ITEM(id, func)} An item was deleted. - Processes a @c wxEVT_COMMAND_LIST_DELETE_ITEM event type. + Processes a @c wxEVT_LIST_DELETE_ITEM event type. @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)} All items were deleted. - Processes a @c wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS event type. + Processes a @c wxEVT_LIST_DELETE_ALL_ITEMS event type. @event{EVT_LIST_ITEM_SELECTED(id, func)} The item has been selected. - Processes a @c wxEVT_COMMAND_LIST_ITEM_SELECTED event type. + Processes a @c wxEVT_LIST_ITEM_SELECTED event type. @event{EVT_LIST_ITEM_DESELECTED(id, func)} The item has been deselected. - Processes a @c wxEVT_COMMAND_LIST_ITEM_DESELECTED event type. + Processes a @c wxEVT_LIST_ITEM_DESELECTED event type. @event{EVT_LIST_ITEM_ACTIVATED(id, func)} The item has been activated (ENTER or double click). - Processes a @c wxEVT_COMMAND_LIST_ITEM_ACTIVATED event type. + Processes a @c wxEVT_LIST_ITEM_ACTIVATED event type. @event{EVT_LIST_ITEM_FOCUSED(id, func)} The currently focused item has changed. - Processes a @c wxEVT_COMMAND_LIST_ITEM_FOCUSED event type. + Processes a @c wxEVT_LIST_ITEM_FOCUSED event type. @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)} The middle mouse button has been clicked on an item. This is only supported by the generic control. - Processes a @c wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK event type. + Processes a @c wxEVT_LIST_ITEM_MIDDLE_CLICK event type. @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)} The right mouse button has been clicked on an item. - Processes a @c wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event type. + Processes a @c wxEVT_LIST_ITEM_RIGHT_CLICK event type. @event{EVT_LIST_KEY_DOWN(id, func)} A key has been pressed. - Processes a @c wxEVT_COMMAND_LIST_KEY_DOWN event type. + Processes a @c wxEVT_LIST_KEY_DOWN event type. @event{EVT_LIST_INSERT_ITEM(id, func)} An item has been inserted. - Processes a @c wxEVT_COMMAND_LIST_INSERT_ITEM event type. + Processes a @c wxEVT_LIST_INSERT_ITEM event type. @event{EVT_LIST_COL_CLICK(id, func)} A column (m_col) has been left-clicked. - Processes a @c wxEVT_COMMAND_LIST_COL_CLICK event type. + Processes a @c wxEVT_LIST_COL_CLICK event type. @event{EVT_LIST_COL_RIGHT_CLICK(id, func)} A column (m_col) has been right-clicked. - Processes a @c wxEVT_COMMAND_LIST_COL_RIGHT_CLICK event type. + Processes a @c wxEVT_LIST_COL_RIGHT_CLICK event type. @event{EVT_LIST_COL_BEGIN_DRAG(id, func)} The user started resizing a column - can be vetoed. - Processes a @c wxEVT_COMMAND_LIST_COL_BEGIN_DRAG event type. + Processes a @c wxEVT_LIST_COL_BEGIN_DRAG event type. @event{EVT_LIST_COL_DRAGGING(id, func)} The divider between columns is being dragged. - Processes a @c wxEVT_COMMAND_LIST_COL_DRAGGING event type. + Processes a @c wxEVT_LIST_COL_DRAGGING event type. @event{EVT_LIST_COL_END_DRAG(id, func)} A column has been resized by the user. - Processes a @c wxEVT_COMMAND_LIST_COL_END_DRAG event type. + Processes a @c wxEVT_LIST_COL_END_DRAG event type. @event{EVT_LIST_CACHE_HINT(id, func)} Prepare cache for a virtual list control. - Processes a @c wxEVT_COMMAND_LIST_CACHE_HINT event type. + Processes a @c wxEVT_LIST_CACHE_HINT event type. @endEventTable @library{wxcore} @category{ctrl} - @appearance{listctrl.png} + @appearance{listctrl} @see @ref overview_listctrl, wxListView, wxListBox, wxTreeCtrl, wxImageList, wxListEvent, wxListItem, wxEditableListBox @@ -324,7 +323,7 @@ public: @since 2.9.4 */ long AppendColumn(const wxString& heading, - int format = wxLIST_FORMAT_LEFT, + wxListColumnFormat format = wxLIST_FORMAT_LEFT, int width = -1); /** @@ -350,7 +349,7 @@ public: /** Deletes all items and all columns. - @note This sends an event of type @c wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS + @note This sends an event of type @c wxEVT_LIST_DELETE_ALL_ITEMS under all platforms. */ void ClearAll(); @@ -368,10 +367,10 @@ public: /** Deletes all items in the list control. - This function does @e not send the @c wxEVT_COMMAND_LIST_DELETE_ITEM + This function does @e not send the @c wxEVT_LIST_DELETE_ITEM event because deleting many items from the control would be too slow then (unlike wxListCtrl::DeleteItem) but it does send the special @c - wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS event if the control was not empty. + wxEVT_LIST_DELETE_ALL_ITEMS event if the control was not empty. If it was already empty, nothing is done and no event is sent. @return @true if the items were successfully deleted or if the control @@ -387,7 +386,7 @@ public: /** Deletes the specified item. - This function sends the @c wxEVT_COMMAND_LIST_DELETE_ITEM event for the + This function sends the @c wxEVT_LIST_DELETE_ITEM event for the item being deleted. @see DeleteAllItems() @@ -407,6 +406,27 @@ public: wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + /** + Enable alternating row background colours (also called zebra striping). + + This method can only be called for the control in virtual report mode, + i.e. having ::wxLC_REPORT and ::wxLC_VIRTUAL styles. + + When enabling alternating colours, the appropriate colour for the even + rows is chosen automatically depending on the default foreground and + background colours which are used for the odd rows. + + @param enable + If @true, enable alternating row background colours, i.e. different + colours for the odd and even rows. If @false, disable this feature + and use the same background colour for all rows. + + @since 2.9.5 + + @see SetAlternateRowColour() + */ + void EnableAlternateRowColours(bool enable = true); + /** Enable or disable a beep if there is no match for the currently entered text when searching for the item from keyboard. @@ -750,6 +770,26 @@ public: */ wxRect GetViewRect() const; + /** + Set the alternative row background colour to a specific colour. + + It is recommended to call EnableAlternateRowColours() instead of using + these methods as native implementations of this control might support + alternating row colours but not setting the exact colour to be used for + them. + + As EnableAlternateRowColours(), this method can only be used with + controls having ::wxLC_REPORT and ::wxLC_VIRTUAL styles. + + @param colour + A valid alternative row background colour to enable alternating + rows or invalid colour to disable them and use the same colour for + all rows. + + @since 2.9.5 + */ + void SetAlternateRowColour(const wxColour& colour); + /** Determines which item (if any) is at the specified point, giving details in @a flags. Returns index of the item or @c wxNOT_FOUND if no item is at @@ -1295,7 +1335,7 @@ protected: @endEventTable - @library{wxbase} + @library{wxcore} @category{events} @see wxListCtrl @@ -1385,26 +1425,26 @@ public: }; -wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG; -wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG; -wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT; -wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT; -wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM; -wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; -wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED; -wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED; -wxEventType wxEVT_COMMAND_LIST_KEY_DOWN; -wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM; -wxEventType wxEVT_COMMAND_LIST_COL_CLICK; -wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK; -wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK; -wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED; -wxEventType wxEVT_COMMAND_LIST_CACHE_HINT; -wxEventType wxEVT_COMMAND_LIST_COL_RIGHT_CLICK; -wxEventType wxEVT_COMMAND_LIST_COL_BEGIN_DRAG; -wxEventType wxEVT_COMMAND_LIST_COL_DRAGGING; -wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG; -wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; +wxEventType wxEVT_LIST_BEGIN_DRAG; +wxEventType wxEVT_LIST_BEGIN_RDRAG; +wxEventType wxEVT_LIST_BEGIN_LABEL_EDIT; +wxEventType wxEVT_LIST_END_LABEL_EDIT; +wxEventType wxEVT_LIST_DELETE_ITEM; +wxEventType wxEVT_LIST_DELETE_ALL_ITEMS; +wxEventType wxEVT_LIST_ITEM_SELECTED; +wxEventType wxEVT_LIST_ITEM_DESELECTED; +wxEventType wxEVT_LIST_KEY_DOWN; +wxEventType wxEVT_LIST_INSERT_ITEM; +wxEventType wxEVT_LIST_COL_CLICK; +wxEventType wxEVT_LIST_ITEM_RIGHT_CLICK; +wxEventType wxEVT_LIST_ITEM_MIDDLE_CLICK; +wxEventType wxEVT_LIST_ITEM_ACTIVATED; +wxEventType wxEVT_LIST_CACHE_HINT; +wxEventType wxEVT_LIST_COL_RIGHT_CLICK; +wxEventType wxEVT_LIST_COL_BEGIN_DRAG; +wxEventType wxEVT_LIST_COL_DRAGGING; +wxEventType wxEVT_LIST_COL_END_DRAG; +wxEventType wxEVT_LIST_ITEM_FOCUSED; /** @@ -1412,7 +1452,7 @@ wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem. - @library{wxbase} + @library{wxcore} @category{data} @see @ref overview_listctrl, wxListCtrl, wxListItem @@ -1496,7 +1536,7 @@ public: @library{wxcore} @category{ctrl} - @appearance{listview.png} + @appearance{listview} @see wxListView::SetColumnImage */ @@ -1614,7 +1654,7 @@ public: or SetFont() functions on it passing it the colour/font to use. If the colour/font is not specified, the default list control colour/font is used. - @library{wxbase} + @library{wxcore} @category{data} @see wxListCtrl