]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/mac/carbon/listctrl.h
Fix a couple of small errors.
[wxWidgets.git] / include / wx / mac / carbon / listctrl.h
index eb10af00658927c87bedeae9a1ef3e232e6f000c..9dbab2222362a84a8f29d3e75fb8f013f1db982e 100644 (file)
 #define _WX_LISTCTRL_H_
 
 #include "wx/generic/listctrl.h"
-#include <Carbon/Carbon.h>
 
 class wxMacDataBrowserListCtrlControl;
 class wxMacListControl;
+class wxListCtrlTextCtrlWrapper;
+class wxListCtrlRenameTimer;
+
+WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList);
 
 class WXDLLEXPORT wxListCtrl: public wxControl
 {
@@ -310,18 +313,57 @@ class WXDLLEXPORT wxListCtrl: public wxControl
   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();
+  }
+  
+  // 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;
-  EventHandlerRef   m_macListCtrlEventHandler;
+  void*  m_macListCtrlEventHandler;
+  void*  m_cgContext;
   wxListCtrlCompare m_compareFunc;
   long m_compareFuncData;
   
@@ -330,6 +372,10 @@ protected:
   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,
@@ -342,6 +388,9 @@ protected:
                                   // keep track of inserted/deleted columns
 
   int               m_count; // for virtual lists, store item count
+  
+private: 
+  DECLARE_EVENT_TABLE()
 };
 
 #endif