//
// data access methods
//
- NSTableColumn* GetNativeColumnPtr(void) const
+ NSTableColumn* GetNativeColumnPtr() const
{
- return this->m_NativeColumnPtr;
+ return m_NativeColumnPtr;
}
void SetNativeColumnPtr(NSTableColumn* newNativeColumnPtr)
{
- this->m_NativeColumnPtr = newNativeColumnPtr;
+ m_NativeColumnPtr = newNativeColumnPtr;
}
protected:
//
wxDataViewRendererNativeData(void) : m_Object(NULL), m_ColumnCell(NULL)
{
+ Init();
}
wxDataViewRendererNativeData(NSCell* initColumnCell) : m_Object(NULL), m_ColumnCell([initColumnCell retain])
{
+ Init();
}
wxDataViewRendererNativeData(NSCell* initColumnCell, id initObject) : m_Object([initObject retain]), m_ColumnCell([initColumnCell retain])
{
+ Init();
}
- ~wxDataViewRendererNativeData(void)
+
+ ~wxDataViewRendererNativeData()
{
- [this->m_ColumnCell release];
- [this->m_Object release];
+ [m_ColumnCell release];
+ [m_Object release];
+
+ [m_origFont release];
+ [m_origTextColour release];
}
//
// data access methods
//
- NSCell* GetColumnCell(void) const
+ NSCell* GetColumnCell() const
{
- return this->m_ColumnCell;
+ return m_ColumnCell;
}
- NSTableColumn* GetColumnPtr(void) const
+ NSTableColumn* GetColumnPtr() const
{
- return this->m_TableColumnPtr;
+ return m_TableColumnPtr;
}
- id GetItem(void) const
+ id GetItem() const
{
- return this->m_Item;
+ return m_Item;
}
- NSCell* GetItemCell(void) const
+ NSCell* GetItemCell() const
{
- return this->m_ItemCell;
+ return m_ItemCell;
}
- id GetObject(void) const
+ id GetObject() const
{
- return this->m_Object;
+ return m_Object;
}
void SetColumnCell(NSCell* newCell)
{
[newCell retain];
- [this->m_ColumnCell release];
- this->m_ColumnCell = newCell;
+ [m_ColumnCell release];
+ m_ColumnCell = newCell;
}
void SetColumnPtr(NSTableColumn* newColumnPtr)
{
- this->m_TableColumnPtr = newColumnPtr;
+ m_TableColumnPtr = newColumnPtr;
}
void SetItem(id newItem)
{
- this->m_Item = newItem;
+ m_Item = newItem;
}
void SetItemCell(NSCell* newCell)
{
- this->m_ItemCell = newCell;
+ m_ItemCell = newCell;
}
void SetObject(id newObject)
{
[newObject retain];
- [this->m_Object release];
- this->m_Object = newObject;
+ [m_Object release];
+ m_Object = newObject;
}
-protected:
+ // The original cell font and text colour stored here are NULL by default and
+ // are only initialized to the values retrieved from the cell when we change
+ // them from wxCocoaOutlineView:willDisplayCell:forTableColumn:item: which
+ // calls our SaveOriginalXXX() methods before changing the cell attributes.
+ //
+ // This allows us to avoid doing anything for the columns without any
+ // attributes but still be able to restore the correct attributes for the
+ // ones that do.
+ NSFont *GetOriginalFont() const { return m_origFont; }
+ NSColor *GetOriginalTextColour() const { return m_origTextColour; }
+
+ void SaveOriginalFont(NSFont *font)
+ {
+ m_origFont = [font retain];
+ }
+
+ void SaveOriginalTextColour(NSColor *textColour)
+ {
+ m_origTextColour = [textColour retain];
+ }
+
+ // The ellipsization mode which we need to set for each cell being rendered.
+ void SetEllipsizeMode(wxEllipsizeMode mode) { m_ellipsizeMode = mode; }
+ wxEllipsizeMode GetEllipsizeMode() const { return m_ellipsizeMode; }
+
+ // Set the line break mode for the given cell using our m_ellipsizeMode
+ void ApplyLineBreakMode(NSCell *cell);
+
private:
-//
-// variables
-//
+ // common part of all ctors
+ void Init();
+
id m_Item; // item NOT owned by renderer
id m_Object; // object that can be used by renderer for storing special data (owned by renderer)
NSCell* m_ItemCell; // item's cell is NOT owned by renderer
NSTableColumn* m_TableColumnPtr; // column NOT owned by renderer
+
+ // we own those if they're non-NULL
+ NSFont *m_origFont;
+ NSColor *m_origTextColour;
+
+ wxEllipsizeMode m_ellipsizeMode;
};
// ============================================================================
// constructors / destructor
//
wxCocoaDataViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style);
- ~wxCocoaDataViewControl(void);
+ ~wxCocoaDataViewControl();
//
// column related methods (inherited from wxDataViewWidgetImpl)
//
- virtual bool ClearColumns (void);
+ virtual bool ClearColumns ();
virtual bool DeleteColumn (wxDataViewColumn* columnPtr);
virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr);
virtual wxDataViewColumn* GetColumn (unsigned int pos) const;
virtual void Collapse (wxDataViewItem const& item);
virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr);
virtual void Expand (wxDataViewItem const& item);
- virtual unsigned int GetCount (void) const;
+ virtual unsigned int GetCount () const;
virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr);
virtual bool IsExpanded (wxDataViewItem const& item) const;
- virtual bool Reload (void);
+ virtual bool Reload ();
virtual bool Remove (wxDataViewItem const& parent, wxDataViewItem const& item);
virtual bool Remove (wxDataViewItem const& parent, wxDataViewItemArray const& item);
virtual bool Update (wxDataViewColumn const* columnPtr);
virtual int GetSelections(wxDataViewItemArray& sel) const;
virtual bool IsSelected (wxDataViewItem const& item) const;
virtual void Select (wxDataViewItem const& item);
- virtual void SelectAll (void);
+ virtual void SelectAll ();
virtual void Unselect (wxDataViewItem const& item);
- virtual void UnselectAll (void);
+ virtual void UnselectAll ();
//
// sorting related methods
//
- virtual wxDataViewColumn* GetSortingColumn (void) const;
- virtual void Resort (void);
+ virtual wxDataViewColumn* GetSortingColumn () const;
+ virtual void Resort ();
//
// other methods (inherited from wxDataViewWidgetImpl)
virtual void DoSetIndent (int indent);
virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const;
virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height);
- virtual void OnSize (void);
+ virtual void OnSize ();
//
// other methods
//
- wxDataViewCtrl* GetDataViewCtrl(void) const
+ wxDataViewCtrl* GetDataViewCtrl() const
{
- return dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
+ return dynamic_cast<wxDataViewCtrl*>(GetWXPeer());
}
//