X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2bc1d69812f8fc3f6ae24508a9d007ad5d00ede..5d0fac27c4b2151b1ff3689cdb602bbaf10a4003:/include/wx/mac/carbon/listctrl.h diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index cd02fd737f..a3949e50d8 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -12,15 +12,17 @@ #ifndef _WX_LISTCTRL_H_ #define _WX_LISTCTRL_H_ -#include "wx/control.h" -#include "wx/event.h" -#include "wx/imaglist.h" +#include "wx/defs.h" #include "wx/generic/listctrl.h" +#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic") + class wxMacDataBrowserListCtrlControl; +class wxMacListControl; +class wxListCtrlTextCtrlWrapper; +class wxListCtrlRenameTimer; -// type of compare function for wxListCtrl sort operation -typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData); +WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); class WXDLLEXPORT wxListCtrl: public wxControl { @@ -106,10 +108,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl // Sets the item text void SetItemText(long item, const wxString& str) ; - + void SetItemTextColour(long item, const wxColour& colour) ; wxColour GetItemTextColour(long item) const; - + void SetItemBackgroundColour(long item, const wxColour& colour) ; wxColour GetItemBackgroundColour(long item) const; @@ -120,7 +122,8 @@ class WXDLLEXPORT wxListCtrl: public wxControl long GetItemData(long item) const ; // Sets the item data - bool SetItemData(long item, long data) ; + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } // Gets the item rectangle bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; @@ -137,11 +140,12 @@ class WXDLLEXPORT wxListCtrl: public wxControl // Gets the number of columns in the list control int GetColumnCount() const; + void SetItemSpacing( int spacing, bool isSmall = false ); wxSize GetItemSpacing() const; // Gets the number of selected items in the list control int GetSelectedItemCount() const; - + wxRect GetViewRect() const; // Gets the text colour of the listview @@ -154,6 +158,9 @@ class WXDLLEXPORT wxListCtrl: public wxControl // list or report view long GetTopItem() const ; + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } // Add or remove a single window style @@ -307,23 +314,84 @@ class WXDLLEXPORT wxListCtrl: public wxControl void Command(wxCommandEvent& event) { ProcessCommand(event); }; + wxListCtrlCompare GetCompareFunc() { return m_compareFunc; }; + long GetCompareFuncData() { return m_compareFuncData; }; + + + // public overrides needed for pimpl approach + virtual bool SetFont(const wxFont& font); + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour); + virtual wxColour GetBackgroundColour(); + + // functions for editing/timer + void OnRenameTimer(); + bool OnRenameAccept(long itemEdit, const wxString& value); + void OnRenameCancelled(long itemEdit); + + void ChangeCurrent(long current); + void ResetCurrent() { ChangeCurrent((long)-1); } + bool HasCurrent() const { return m_current != (long)-1; } + + void OnLeftDown(wxMouseEvent& event); + void OnDblClick(wxMouseEvent& event); + + void FinishEditing(wxTextCtrl *text) + { + delete text; + m_textctrlWrapper = NULL; + SetFocus(); + } + + virtual int GetScrollPos(int orient) const; + + void OnRightDown(wxMouseEvent& event); + void OnMiddleDown(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + virtual void SetFocus(); + void FireMouseEvent(wxEventType eventType, wxPoint position); + + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget* GetDropTarget() const; + + // with CG, we need to get the context from an kEventControlDraw event + // unfortunately, the DataBrowser callbacks don't provide the context + // and we need it, so we need to set/remove it before and after draw + // events so we can access it in the callbacks. + void MacSetDrawingContext(void* context) { m_cgContext = context; } + void* MacGetDrawingContext() { return m_cgContext; } + protected: - // overrides needed for pimpl approach + + // protected overrides needed for pimpl approach virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual wxSize DoGetBestSize() const; + long m_current; + wxListCtrlTextCtrlWrapper *m_textctrlWrapper; + wxListCtrlRenameTimer *m_renameTimer; // common part of all ctors void Init(); - + wxGenericListCtrl* m_genericImpl; // allow use of the generic impl. wxMacDataBrowserListCtrlControl* m_dbImpl; - + void* m_macListCtrlEventHandler; + void* m_cgContext; + wxListCtrlCompare m_compareFunc; + long m_compareFuncData; + wxTextCtrl* m_textCtrl; // The control used for editing a label wxImageList * m_imageListNormal; // The image list for normal icons wxImageList * m_imageListSmall; // The image list for small icons wxImageList * m_imageListState; // The image list state icons (not implemented yet) - + + wxColumnList m_colsInfo; // for storing info about each column + wxColour m_textColor; + wxColour m_bgColor; + // keep track of whether or not we should delete the image list ourselves. bool m_ownsImageListNormal, m_ownsImageListSmall, @@ -336,9 +404,10 @@ protected: // keep track of inserted/deleted columns int m_count; // for virtual lists, store item count -}; -typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); +private: + DECLARE_EVENT_TABLE() +}; #endif // _WX_LISTCTRL_H_