X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd3f686c274a264e89ea97505350a82c1134f307..ad9bb75ff2c6a1734c24742c5f39ed8be197e16d:/include/wx/msw/listctrl.h diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 0677ecd2be..ef0a992d06 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -69,8 +69,6 @@ - in Win95, you can be called back to supply other information besides text, such as state information. This saves no memory and is probably superfluous to requirements. - - discover why SetWindowLong doesn't properly change the - style, requiring RecreateWindow instead. - testing of whole API, extending current sample. @@ -103,7 +101,7 @@ #define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. #define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. -#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL wxLIST_HITTEST_ONITEMSTATEICON) +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) // Flags for GetNextItem enum { @@ -171,11 +169,11 @@ public: int m_format; // left, right, centre int m_width; // width of column - wxListItem(void); + wxListItem(); }; // type of compare function for wxListCtrl sort operation -typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData); +typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); class WXDLLEXPORT wxListCtrl: public wxControl { @@ -185,7 +183,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl * Public interface */ - wxListCtrl(void); + wxListCtrl(); inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, @@ -193,7 +191,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl { Create(parent, id, pos, size, style, validator, name); } - ~wxListCtrl(void); + ~wxListCtrl(); bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl"); @@ -204,7 +202,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl // Sets the background colour (GetBackgroundColour already implicit in // wxWindow class) - void SetBackgroundColour(const wxColour& col); + bool SetBackgroundColour(const wxColour& col); // Gets information about this column bool GetColumn(int col, wxListItem& item) const; @@ -222,10 +220,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl // visible area of the list control (list or report view) // or the total number of items in the list control (icon // or small icon view) - int GetCountPerPage(void) const; + int GetCountPerPage() const; // Gets the edit control for editing labels. - wxTextCtrl* GetEditControl(void) const; + wxTextCtrl* GetEditControl() const; // Gets information about the item bool GetItem(wxListItem& info) const ; @@ -258,7 +256,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl bool SetItemData(long item, long data) ; // Gets the item rectangle - bool GetItemRect(long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS) const ; + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; // Gets the item position bool GetItemPosition(long item, wxPoint& pos) const ; @@ -267,10 +265,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl bool SetItemPosition(long item, const wxPoint& pos) ; // Gets the number of items in the list control - int GetItemCount(void) const; + int GetItemCount() const; // Gets the number of columns in the list control - int GetColumnCount(void) const; + int GetColumnCount() const { return m_colCount; } // Retrieves the spacing between icons in pixels. // If small is TRUE, gets the spacing for the small icon @@ -278,17 +276,17 @@ class WXDLLEXPORT wxListCtrl: public wxControl int GetItemSpacing(bool isSmall) const; // Gets the number of selected items in the list control - int GetSelectedItemCount(void) const; + int GetSelectedItemCount() const; // Gets the text colour of the listview - wxColour GetTextColour(void) const; + wxColour GetTextColour() const; // Sets the text colour of the listview void SetTextColour(const wxColour& col); // Gets the index of the topmost visible item when in // list or report view - long GetTopItem(void) const ; + long GetTopItem() const ; // Add or remove a single window style void SetSingleStyle(long style, bool add = TRUE) ; @@ -330,16 +328,16 @@ class WXDLLEXPORT wxListCtrl: public wxControl bool DeleteItem(long item); // Deletes all items - bool DeleteAllItems(void) ; + bool DeleteAllItems() ; // Deletes a column bool DeleteColumn(int col); // Deletes all columns - bool DeleteAllColumns(void); + bool DeleteAllColumns(); // Clears items, and columns if there are any. - void ClearAll(void); + void ClearAll(); // Edit the label wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); @@ -407,26 +405,16 @@ class WXDLLEXPORT wxListCtrl: public wxControl // data is arbitrary data to be passed to the sort function. bool SortItems(wxListCtrlCompare fn, long data); -/* Why should we need this function? Leave for now. - * WE NEED IT because item data may have changed, - * but the display needs refreshing (in string callback mode) - // Updates an item. If the list control has the wxLI_AUTO_ARRANGE style, - // the items will be rearranged. - bool Update(long item); -*/ - - void Command(wxCommandEvent& event) { ProcessCommand(event); }; - // IMPLEMENTATION virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - // Recreate window - seems to be necessary when changing a style. - void RecreateWindow(void); + // bring the control in sync with current m_windowStyle value + void UpdateStyle(); // Add to pool: necessary because Windows needs to have a string // still exist across 3 callbacks. - char *AddPool(const wxString& str); + wxChar *AddPool(const wxString& str); protected: wxTextCtrl* m_textCtrl; // The control used for editing a label @@ -440,40 +428,9 @@ protected: int m_colCount; // Windows doesn't have GetColumnCount so must // keep track of inserted/deleted columns +private: + bool DoCreateControl(int x, int y, int w, int h); }; -class WXDLLEXPORT wxListEvent : public wxNotifyEvent -{ -public: - wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); - - int m_code; - long m_itemIndex; - long m_oldItemIndex; - int m_col; - bool m_cancelled; - wxPoint m_pointDrag; - - wxListItem m_item; - - DECLARE_DYNAMIC_CLASS(wxListEvent) -}; - -typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); - -#define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, -#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, - #endif // _WX_LISTCTRL_H_