1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/datavgen.cpp
3 // Purpose: wxDataViewCtrl native mac implementation
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
13 #if wxUSE_DATAVIEWCTRL
15 #include "wx/dataview.h"
17 #if !defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0)
21 #include "wx/mac/carbon/databrow.h"
25 #include "wx/settings.h"
26 #include "wx/dcclient.h"
30 #include "wx/renderer.h"
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 // a list of all catchable events:
37 static EventTypeSpec
const eventList
[] =
39 {kEventClassControl
, kEventControlDraw
},
40 {kEventClassControl
, kEventControlHit
}
43 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 static pascal OSStatus
wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
, EventRef EventReference
, void* Data
)
49 wxDataViewCtrl
* DataViewCtrlPtr((wxDataViewCtrl
*) Data
); // the 'Data' variable always contains a pointer to the data view control that installed the handler
51 wxMacCarbonEvent
CarbonEvent(EventReference
) ;
54 switch (GetEventKind(EventReference
))
56 case kEventControlDraw
:
60 DataViewCtrlPtr
->MacSetDrawingContext(CarbonEvent
.GetParameter
<CGContextRef
>(kEventParamCGContextRef
,typeCGContextRef
));
61 status
= ::CallNextEventHandler(handler
,EventReference
);
62 DataViewCtrlPtr
->MacSetDrawingContext(NULL
);
65 case kEventControlHit
:
66 if (CarbonEvent
.GetParameter
<ControlPartCode
>(kEventParamControlPart
,typeControlPartCode
) == kControlButtonPart
) // we only care about the header
68 ControlRef controlReference
;
69 DataBrowserPropertyID columnPropertyID
;
70 unsigned long columnIndex
;
72 wxDataViewEvent
DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
,DataViewCtrlPtr
->GetId());
74 CarbonEvent
.GetParameter(kEventParamDirectObject
,&controlReference
);
75 // determine the column that triggered the event (this is the column that is responsible for sorting the data view):
76 status
= ::GetDataBrowserSortProperty(controlReference
,&columnPropertyID
);
77 wxCHECK(status
== noErr
,status
);
78 status
= ::GetDataBrowserTableViewColumnPosition(controlReference
,columnPropertyID
,&columnIndex
);
79 if (status
== errDataBrowserPropertyNotFound
) // user clicked into part of the header that does not have a property
80 return ::CallNextEventHandler(handler
,EventReference
);
81 wxCHECK(status
== noErr
,status
);
82 // initialize wxWidget event handler:
83 DataViewEvent
.SetEventObject(DataViewCtrlPtr
);
84 DataViewEvent
.SetColumn(columnIndex
);
85 DataViewEvent
.SetDataViewColumn(DataViewCtrlPtr
->GetColumn(columnIndex
));
86 // finally sent the equivalent wxWidget event:
87 #if wxCHECK_VERSION(2,9,0)
88 DataViewCtrlPtr
->HandleWindowEvent(DataViewEvent
);
90 DataViewCtrlPtr
->GetEventHandler()->ProcessEvent(DataViewEvent
);
92 return ::CallNextEventHandler(handler
,EventReference
);
95 return eventNotHandledErr
;
98 return eventNotHandledErr
;
99 } /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
101 static DataBrowserItemID
* CreateDataBrowserItemIDArray(size_t& noOfEntries
, wxDataViewItemArray
const& items
) // returns a newly allocated pointer to valid data browser item IDs
103 size_t const noOfItems
= items
.GetCount();
105 DataBrowserItemID
* itemIDs(new DataBrowserItemID
[noOfItems
]);
108 // convert all valid data view items to data browser items
110 for (size_t i
=0; i
<noOfItems
; ++i
)
113 itemIDs
[noOfEntries
] = reinterpret_cast<DataBrowserItemID
>(items
[i
].GetID());
118 } /* CreateDataBrowserItemIDArray(size_t&, wxDataViewItemArray const&) */
120 #if wxCHECK_VERSION(2,9,0)
121 static bool InitializeColumnDescription(DataBrowserListViewColumnDesc
& columnDescription
, wxDataViewColumn
const* columnPtr
, DataBrowserPropertyID columnPropertyID
, wxCFStringRef
const& title
)
123 static bool InitializeColumnDescription(DataBrowserListViewColumnDesc
& columnDescription
, wxDataViewColumn
const* columnPtr
, DataBrowserPropertyID columnPropertyID
, wxMacCFStringHolder
const& title
)
126 // set properties for the column:
127 columnDescription
.propertyDesc
.propertyID
= columnPropertyID
;
128 columnDescription
.propertyDesc
.propertyType
= columnPtr
->GetRenderer()->GetPropertyType();
129 columnDescription
.propertyDesc
.propertyFlags
= kDataBrowserListViewSelectionColumn
; // make the column selectable
130 if (columnPtr
->IsReorderable())
131 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewMovableColumn
;
132 if (columnPtr
->IsResizeable())
134 columnDescription
.headerBtnDesc
.minimumWidth
= 0;
135 columnDescription
.headerBtnDesc
.maximumWidth
= 30000; // 32767 is the theoretical maximum though but 30000 looks nicer
139 columnDescription
.headerBtnDesc
.minimumWidth
= columnPtr
->GetWidth();
140 columnDescription
.headerBtnDesc
.maximumWidth
= columnPtr
->GetWidth();
142 if (columnPtr
->IsSortable())
143 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewSortableColumn
;
144 if (columnPtr
->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE
)
145 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserPropertyIsEditable
;
146 if ((columnDescription
.propertyDesc
.propertyType
== kDataBrowserCustomType
) ||
147 (columnDescription
.propertyDesc
.propertyType
== kDataBrowserDateTimeType
) ||
148 (columnDescription
.propertyDesc
.propertyType
== kDataBrowserIconAndTextType
) ||
149 (columnDescription
.propertyDesc
.propertyType
== kDataBrowserTextType
))
150 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewTypeSelectColumn
; // enables generally the possibility to have user input for the mentioned types
151 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
152 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewNoGapForIconInHeaderButton
;
154 // set header's properties:
155 columnDescription
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
156 columnDescription
.headerBtnDesc
.titleOffset
= 0;
157 columnDescription
.headerBtnDesc
.titleString
= ::CFStringCreateCopy(kCFAllocatorDefault
,title
);
158 columnDescription
.headerBtnDesc
.initialOrder
= kDataBrowserOrderIncreasing
; // choose one of the orders as "undefined" is not supported anyway (s. ControlDefs.h in the HIToolbox framework)
159 columnDescription
.headerBtnDesc
.btnFontStyle
.flags
= kControlUseFontMask
| kControlUseJustMask
;
160 switch (columnPtr
->GetAlignment())
163 case wxALIGN_CENTER_HORIZONTAL
:
164 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teCenter
;
167 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushLeft
;
170 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushRight
;
173 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
175 columnDescription
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
176 columnDescription
.headerBtnDesc
.btnFontStyle
.style
= normal
;
177 columnDescription
.headerBtnDesc
.btnContentInfo
.contentType
= kControlContentIconRef
;
178 if (columnPtr
->GetBitmap().Ok())
179 #if wxCHECK_VERSION(2,9,0)
180 columnDescription
.headerBtnDesc
.btnContentInfo
.u
.iconRef
= columnPtr
->GetBitmap().GetIconRef();
182 columnDescription
.headerBtnDesc
.btnContentInfo
.u
.iconRef
= columnPtr
->GetBitmap().GetBitmapData()->GetIconRef();
186 } /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
188 //-----------------------------------------------------------------------------
189 // local function pointers
190 //-----------------------------------------------------------------------------
192 DEFINE_ONE_SHOT_HANDLER_GETTER(wxMacDataViewCtrlEventHandler
)
194 // ---------------------------------------------------------
195 // wxMacDataViewModelNotifier
196 // ---------------------------------------------------------
198 class wxMacDataViewModelNotifier
: public wxDataViewModelNotifier
201 wxMacDataViewModelNotifier(wxMacDataViewDataBrowserListViewControl
* initDataViewControlPtr
) : m_dataViewControlPtr(initDataViewControlPtr
)
205 virtual bool ItemAdded(const wxDataViewItem
&parent
, const wxDataViewItem
&item
)
207 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
210 wxCHECK_MSG(item
.IsOk(),false,_("Added item is invalid."));
211 return (!(parent
.IsOk()) && (this->m_dataViewControlPtr
->AddItem(kDataBrowserNoItem
,&itemID
) == noErr
) ||
212 parent
.IsOk() && (this->m_dataViewControlPtr
->AddItem(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),&itemID
) == noErr
));
213 } /* ItemAdded(wxDataViewItem const&, wxDataViewItem const&) */
215 virtual bool ItemsAdded(wxDataViewItem
const& parent
, wxDataViewItemArray
const& items
)
219 DataBrowserItemID
* itemIDs
;
224 // convert all valid data view items to data browser items:
225 itemIDs
= ::CreateDataBrowserItemIDArray(noOfEntries
,items
);
226 // insert all valid items into control:
227 noFailureFlag
= ((noOfEntries
== 0) ||
228 !(parent
.IsOk()) && (this->m_dataViewControlPtr
->AddItems(kDataBrowserNoItem
,noOfEntries
,itemIDs
,kDataBrowserItemNoProperty
) == noErr
) ||
229 parent
.IsOk() && (this->m_dataViewControlPtr
->AddItems(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),noOfEntries
,itemIDs
,kDataBrowserItemNoProperty
) == noErr
));
230 // give allocated array space free again:
233 return noFailureFlag
;
234 } /* ItemsAdded(wxDataViewItem const&, wxDataViewItemArray const&) */
236 virtual bool ItemChanged(wxDataViewItem
const& item
)
238 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
241 wxCHECK_MSG(item
.IsOk(),false,_("Changed item is invalid."));
242 if (this->m_dataViewControlPtr
->UpdateItems(&itemID
) == noErr
)
244 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
246 // sent the equivalent wxWidget event:
247 wxDataViewEvent
dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
,dataViewCtrlPtr
->GetId()); // variable defintion
249 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
250 dataViewEvent
.SetItem(item
);
251 // sent the equivalent wxWidget event:
252 #if wxCHECK_VERSION(2,9,0)
253 dataViewCtrlPtr
->HandleWindowEvent(dataViewEvent
);
255 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
262 } /* ItemChanged(wxDataViewItem const&) */
264 virtual bool ItemsChanged(wxDataViewItemArray
const& items
)
268 DataBrowserItemID
* itemIDs
;
273 // convert all valid data view items to data browser items:
274 itemIDs
= ::CreateDataBrowserItemIDArray(noOfEntries
,items
);
275 // change items (ATTENTION: ONLY ITEMS OF THE ROOT ARE CHANGED BECAUSE THE PARENT PARAMETER IS MISSING):
276 noFailureFlag
= (this->m_dataViewControlPtr
->UpdateItems(kDataBrowserNoItem
,noOfEntries
,itemIDs
,kDataBrowserItemNoProperty
,kDataBrowserItemNoProperty
) == noErr
);
279 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
281 // send for all changed items a wxWidget event:
282 wxDataViewEvent
dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
,dataViewCtrlPtr
->GetId()); // variable defintion
284 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
285 for (size_t i
=0; i
<noOfEntries
; ++i
)
287 dataViewEvent
.SetItem(reinterpret_cast<void*>(itemIDs
[i
]));
288 #if wxCHECK_VERSION(2,9,0)
289 dataViewCtrlPtr
->HandleWindowEvent(dataViewEvent
);
291 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
295 // release allocated array space:
298 return noFailureFlag
;
299 } /* ItemsChanged(wxDataViewItem const&) */
301 virtual bool ItemDeleted(wxDataViewItem
const& parent
, wxDataViewItem
const& item
)
305 // variable definition and initialization:
306 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
307 OSStatus errorStatus
;
308 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
310 // when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have
311 // not to be identical because the being edited item might be below the passed item in the hierarchy);
312 // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
313 // has been started and that variables can currently not be updated even when requested by the system:
314 dataViewCtrlPtr
->SetDeleting(true);
315 errorStatus
= this->m_dataViewControlPtr
->RemoveItem(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),&itemID
);
316 // enable automatic updating again:
317 dataViewCtrlPtr
->SetDeleting(false);
318 return (errorStatus
== noErr
);
322 } /* ItemDeleted(wxDataViewItem const&, wxDataViewItem const&) */
324 virtual bool ItemsDeleted(wxDataViewItem
const& parent
, wxDataViewItemArray
const& items
)
328 DataBrowserItemID
* itemIDs
;
330 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
335 wxCHECK_MSG(dataViewCtrlPtr
!= NULL
,false,_("Data view control is not correctly initialized"));
336 // convert all valid data view items to data browser items:
337 itemIDs
= ::CreateDataBrowserItemIDArray(noOfEntries
,items
);
338 // when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have
339 // not to be identical because the being edited item might be below the passed item in the hierarchy);
340 // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
341 // has been started and that variables can currently not be updated even when requested by the system:
342 dataViewCtrlPtr
->SetDeleting(true);
343 // insert all valid items into control:
344 noFailureFlag
= ((noOfEntries
== 0) ||
345 !(parent
.IsOk()) && (this->m_dataViewControlPtr
->RemoveItems(kDataBrowserNoItem
,noOfEntries
,itemIDs
,kDataBrowserItemNoProperty
) == noErr
) ||
346 parent
.IsOk() && (this->m_dataViewControlPtr
->RemoveItems(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),noOfEntries
,itemIDs
,kDataBrowserItemNoProperty
) == noErr
));
347 // enable automatic updating again:
348 dataViewCtrlPtr
->SetDeleting(false);
349 // give allocated array space free again:
352 return noFailureFlag
;
353 } /* ItemsDeleted(wxDataViewItem const&, wxDataViewItemArray const&) */
355 virtual bool ValueChanged(wxDataViewItem
const& item
, unsigned int col
)
357 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
358 DataBrowserItemID parentID
;
360 DataBrowserPropertyID propertyID
;
362 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
365 wxCHECK_MSG(item
.IsOk(), false,_("Passed item is invalid."));
366 wxCHECK_MSG(this->GetOwner() != NULL
,false,_("Owner not initialized."));
367 wxCHECK_MSG(dataViewCtrlPtr
!= NULL
, false,_("Control is wrongly initialized."));
368 parentID
= reinterpret_cast<DataBrowserItemID
>(this->GetOwner()->GetParent(item
).GetID());
369 if ((this->m_dataViewControlPtr
->GetPropertyID(col
,&propertyID
) == noErr
) &&
370 (this->m_dataViewControlPtr
->UpdateItems(parentID
,1,&itemID
,dataViewCtrlPtr
->GetColumn(col
)->GetPropertyID(),propertyID
) == noErr
))
372 // variable definition and initialization:
373 wxDataViewEvent
dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
,dataViewCtrlPtr
->GetId());
375 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
376 dataViewEvent
.SetColumn(col
);
377 dataViewEvent
.SetItem(item
);
378 // send the equivalent wxWidget event:
379 #if wxCHECK_VERSION(2,9,0)
380 dataViewCtrlPtr
->HandleWindowEvent(dataViewEvent
);
382 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
389 } /* ValueChanged(wxDataViewItem const&, unsigned int) */
391 virtual bool Cleared(void)
393 bool noFailureFlag
= (this->m_dataViewControlPtr
->RemoveItems() == noErr
);
395 wxDataViewItemArray array
;
396 GetOwner()->GetChildren( item
, array
);
397 ItemsAdded( item
, array
);
398 return noFailureFlag
;
399 } /* Cleared(void) */
401 virtual void Resort(void)
403 this->m_dataViewControlPtr
->Resort();
411 wxMacDataViewDataBrowserListViewControl
* m_dataViewControlPtr
;
414 // ---------------------------------------------------------
415 // wxDataViewRenderer
416 // ---------------------------------------------------------
418 wxDataViewRenderer::wxDataViewRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
419 :wxDataViewRendererBase(varianttype
,mode
,align
), m_alignment(align
), m_mode(mode
)
421 } /* wxDataViewRenderer::wxDataViewRenderer(wxString const&, wxDataViewCellMode) */
423 void wxDataViewRenderer::SetMode(wxDataViewCellMode mode
)
425 wxDataViewColumn
* dataViewColumnPtr
;
429 dataViewColumnPtr
= this->GetOwner();
430 if (dataViewColumnPtr
!= NULL
)
432 // variable definition and initialization:
433 wxDataViewCtrl
* dataViewCtrlPtr(dataViewColumnPtr
->GetOwner());
435 if (dataViewCtrlPtr
!= NULL
)
437 // variable definition and initialization:
438 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
440 if (macDataViewListCtrlPtr
!= NULL
)
442 // variable definition and initialization:
443 DataBrowserPropertyFlags flags
;
445 verify_noerr(macDataViewListCtrlPtr
->GetPropertyFlags(dataViewColumnPtr
->GetPropertyID(),&flags
));
446 if (mode
== wxDATAVIEW_CELL_EDITABLE
)
447 flags
|= kDataBrowserPropertyIsEditable
;
449 flags
&= ~kDataBrowserPropertyIsEditable
;
450 verify_noerr(macDataViewListCtrlPtr
->SetPropertyFlags(dataViewColumnPtr
->GetPropertyID(),flags
));
454 } /* wxDataViewRenderer::SetMode(wxDataViewCellMode) */
456 IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer
,wxDataViewRendererBase
)
458 // ---------------------------------------------------------
459 // wxDataViewCustomRenderer
460 // ---------------------------------------------------------
462 wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
463 :wxDataViewRenderer(varianttype
,mode
,align
), m_editorCtrlPtr(NULL
), m_DCPtr(NULL
)
465 } /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
467 wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void)
469 if (this->m_DCPtr
!= NULL
)
470 delete this->m_DCPtr
;
471 } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */
473 void wxDataViewCustomRenderer::RenderText( const wxString
&text
, int xoffset
, wxRect cell
, wxDC
*dc
, int state
)
475 wxDataViewCtrl
*view
= GetOwner()->GetOwner();
476 wxColour col
= (state
& wxDATAVIEW_CELL_SELECTED
) ? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
) : view
->GetForegroundColour();
477 dc
->SetTextForeground(col
);
478 dc
->DrawText( text
, cell
.x
+ xoffset
, cell
.y
+ ((cell
.height
- dc
->GetCharHeight()) / 2));
481 wxDC
* wxDataViewCustomRenderer::GetDC(void)
483 if (this->m_DCPtr
== NULL
)
485 if ((GetOwner() == NULL
) || (GetOwner()->GetOwner() == NULL
))
487 this->m_DCPtr
= new wxWindowDC(this->GetOwner()->GetOwner());
489 return this->m_DCPtr
;
490 } /* wxDataViewCustomRenderer::GetDC(void) */
492 bool wxDataViewCustomRenderer::Render(void)
495 } /* wxDataViewCustomRenderer::Render(void) */
497 void wxDataViewCustomRenderer::SetDC(wxDC
* newDCPtr
)
499 delete this->m_DCPtr
;
500 this->m_DCPtr
= newDCPtr
;
501 } /* wxDataViewCustomRenderer::SetDC(wxDC*) */
503 WXDataBrowserPropertyType
wxDataViewCustomRenderer::GetPropertyType(void) const
505 return kDataBrowserCustomType
;
506 } /* wxDataViewCustomRenderer::GetPropertyType(void) const */
508 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer
, wxDataViewRenderer
)
510 // ---------------------------------------------------------
511 // wxDataViewTextRenderer
512 // ---------------------------------------------------------
514 wxDataViewTextRenderer::wxDataViewTextRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
515 :wxDataViewRenderer(varianttype
,mode
,align
)
517 } /* wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const&, wxDataViewCellMode, int) */
519 bool wxDataViewTextRenderer::Render(void)
521 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << this->GetValue().GetType());
523 // variable definition:
524 #if wxCHECK_VERSION(2,9,0)
525 wxCFStringRef
cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
527 wxMacCFStringHolder
cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
529 return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString
) == noErr
);
530 } /* wxDataViewTextRenderer::Render(void) */
532 WXDataBrowserPropertyType
wxDataViewTextRenderer::GetPropertyType(void) const
534 return kDataBrowserTextType
;
535 } /* wxDataViewTextRenderer::GetPropertyType(void) const */
537 IMPLEMENT_CLASS(wxDataViewTextRenderer
,wxDataViewRenderer
)
539 // ---------------------------------------------------------
540 // wxDataViewTextRendererAttr
541 // ---------------------------------------------------------
543 wxDataViewTextRendererAttr::wxDataViewTextRendererAttr(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
544 :wxDataViewTextRenderer(varianttype
,mode
,align
)
546 } /* wxDataViewTextRendererAttr::wxDataViewTextRendererAttr(wxString const&, wxDataViewCellMode, int) */
548 IMPLEMENT_CLASS(wxDataViewTextRendererAttr
,wxDataViewTextRenderer
)
550 // ---------------------------------------------------------
551 // wxDataViewBitmapRenderer
552 // ---------------------------------------------------------
554 wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
555 :wxDataViewRenderer(varianttype
,mode
,align
)
559 bool wxDataViewBitmapRenderer::Render(void)
560 // This method returns 'true' if
561 // - the passed bitmap is valid and it could be assigned to the native data browser;
562 // - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
563 // In all other cases the method returns 'false'.
565 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Bitmap renderer cannot render value; value type: ")) << this->GetValue().GetType());
567 // variable definition:
570 bitmap
<< this->GetValue();
572 #if wxCHECK_VERSION(2,9,0)
573 return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap
.GetIconRef()) == noErr
);
575 return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap
.GetBitmapData()->GetIconRef()) == noErr
);
579 } /* wxDataViewBitmapRenderer::Render(void) */
581 WXDataBrowserPropertyType
wxDataViewBitmapRenderer::GetPropertyType(void) const
583 return kDataBrowserIconType
;
584 } /* wxDataViewBitmapRenderer::GetPropertyType(void) const */
586 IMPLEMENT_CLASS(wxDataViewBitmapRenderer
,wxDataViewRenderer
)
588 // ---------------------------------------------------------
589 // wxDataViewIconTextRenderer
590 // ---------------------------------------------------------
592 wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
593 :wxDataViewRenderer(varianttype
,mode
)
597 bool wxDataViewIconTextRenderer::Render(void)
599 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << this->GetValue().GetType());
601 // variable definition:
602 wxDataViewIconText iconText
;
604 iconText
<< this->GetValue();
606 // variable definition:
607 #if wxCHECK_VERSION(2,9,0)
608 wxCFStringRef
cfString(iconText
.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
610 wxMacCFStringHolder
cfString(iconText
.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
613 if (iconText
.GetIcon().IsOk())
614 if (::SetDataBrowserItemDataIcon(this->GetDataReference(),MAC_WXHICON(iconText
.GetIcon().GetHICON())) != noErr
)
616 return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString
) == noErr
);
617 } /* wxDataViewIconTextRenderer::Render(void) */
619 WXDataBrowserPropertyType
wxDataViewIconTextRenderer::GetPropertyType(void) const
621 return kDataBrowserIconAndTextType
;
622 } /* wxDataViewIconTextRenderer::GetPropertyType(void) const */
624 IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer
,wxDataViewRenderer
)
627 // ---------------------------------------------------------
628 // wxDataViewToggleRenderer
629 // ---------------------------------------------------------
631 wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
632 :wxDataViewRenderer(varianttype
,mode
)
636 bool wxDataViewToggleRenderer::Render(void)
638 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << this->GetValue().GetType());
639 return (::SetDataBrowserItemDataButtonValue(this->GetDataReference(),this->GetValue().GetBool()) == noErr
);
640 } /* wxDataViewToggleRenderer::Render(void) */
642 WXDataBrowserPropertyType
wxDataViewToggleRenderer::GetPropertyType(void) const
644 return kDataBrowserCheckboxType
;
645 } /* wxDataViewToggleRenderer::GetPropertyType(void) const */
647 IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer
,wxDataViewRenderer
)
649 // ---------------------------------------------------------
650 // wxDataViewProgressRenderer
651 // ---------------------------------------------------------
653 wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString
const& label
, wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
654 :wxDataViewRenderer(varianttype
,mode
,align
)
658 bool wxDataViewProgressRenderer::Render(void)
660 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << this->GetValue().GetType());
661 return ((::SetDataBrowserItemDataMinimum(this->GetDataReference(), 0) == noErr
) &&
662 (::SetDataBrowserItemDataMaximum(this->GetDataReference(),100) == noErr
) &&
663 (::SetDataBrowserItemDataValue (this->GetDataReference(),this->GetValue().GetLong()) == noErr
));
664 } /* wxDataViewProgressRenderer::Render(void) */
666 WXDataBrowserPropertyType
wxDataViewProgressRenderer::GetPropertyType(void) const
668 return kDataBrowserProgressBarType
;
669 } /* wxDataViewProgressRenderer::GetPropertyType(void) const */
671 IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer
,wxDataViewRenderer
)
673 // ---------------------------------------------------------
674 // wxDataViewDateRenderer
675 // ---------------------------------------------------------
677 wxDataViewDateRenderer::wxDataViewDateRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
678 :wxDataViewRenderer(varianttype
,mode
,align
)
682 bool wxDataViewDateRenderer::Render(void)
684 wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << this->GetValue().GetType());
685 return (::SetDataBrowserItemDataDateTime(this->GetDataReference(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan
,1904)).GetSeconds().GetLo()) == noErr
);
686 } /* wxDataViewDateRenderer::Render(void) */
688 WXDataBrowserPropertyType
wxDataViewDateRenderer::GetPropertyType(void) const
690 return kDataBrowserDateTimeType
;
691 } /* wxDataViewDateRenderer::GetPropertyType(void) const */
693 IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer
,wxDataViewRenderer
)
695 // ---------------------------------------------------------
697 // ---------------------------------------------------------
699 wxDataViewColumn::wxDataViewColumn(wxString
const &title
, wxDataViewRenderer
*cell
, unsigned int model_column
, int width
, wxAlignment align
, int flags
)
700 :wxDataViewColumnBase(title
,cell
,model_column
,width
,align
,flags
), m_ascending(true),
701 m_flags(flags
& ~(wxDATAVIEW_COL_HIDDEN
)), m_maxWidth(30000), m_minWidth(0), m_width(width
>= 0 ? width
: wxDVC_DEFAULT_WIDTH
),
702 m_alignment(align
), m_title(title
)
704 } /* wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
706 wxDataViewColumn::wxDataViewColumn(wxBitmap
const& bitmap
, wxDataViewRenderer
*cell
, unsigned int model_column
, int width
, wxAlignment align
, int flags
)
707 :wxDataViewColumnBase(bitmap
,cell
,model_column
,width
,align
,flags
), m_ascending(true),
708 m_flags(flags
& ~(wxDATAVIEW_COL_HIDDEN
)), m_maxWidth(30000), m_minWidth(0), m_width(width
>= 0 ? width
: wxDVC_DEFAULT_WIDTH
),
711 } /* wxDataViewColumn::wxDataViewColumn(wxBitmap const&, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
713 void wxDataViewColumn::SetAlignment(wxAlignment align
)
715 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
718 this->m_alignment
= align
;
719 if (dataViewCtrlPtr
!= NULL
)
721 // variable definition and initialization:
722 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
724 if (macDataViewListCtrlPtr
!= NULL
)
726 // variable definition and initialization:
727 DataBrowserListViewHeaderDesc headerDescription
;
729 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
733 case wxALIGN_CENTER_HORIZONTAL
:
734 headerDescription
.btnFontStyle
.just
= teCenter
;
737 headerDescription
.btnFontStyle
.just
= teFlushLeft
;
740 headerDescription
.btnFontStyle
.just
= teFlushRight
;
743 headerDescription
.btnFontStyle
.just
= teFlushDefault
;
745 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set alignment."));
748 } /* wxDataViewColumn::SetAlignment(wxAlignment) */
750 void wxDataViewColumn::SetBitmap(wxBitmap
const& bitmap
)
752 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
755 wxDataViewColumnBase::SetBitmap(bitmap
);
756 if (dataViewCtrlPtr
!= NULL
)
758 // variable definition and initialization:
759 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
761 if (macDataViewListCtrlPtr
!= NULL
)
763 // variable definition and initialization:
764 DataBrowserListViewHeaderDesc headerDescription
;
766 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
767 if (this->GetBitmap().Ok())
768 #if wxCHECK_VERSION(2,9,0)
769 headerDescription
.btnContentInfo
.u
.iconRef
= this->GetBitmap().GetIconRef();
771 headerDescription
.btnContentInfo
.u
.iconRef
= this->GetBitmap().GetBitmapData()->GetIconRef();
774 headerDescription
.btnContentInfo
.u
.iconRef
= NULL
;
775 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set icon."));
778 } /* wxDataViewColumn::SetBitmap(wxBitmap const&) */
780 void wxDataViewColumn::SetFlags(int flags
)
782 this->SetHidden ((flags
& wxDATAVIEW_COL_HIDDEN
) != 0);
783 this->SetReorderable((flags
& wxDATAVIEW_COL_REORDERABLE
) != 0);
784 this->SetResizeable ((flags
& wxDATAVIEW_COL_RESIZABLE
) != 0);
785 this->SetSortable ((flags
& wxDATAVIEW_COL_SORTABLE
) != 0);
786 } /* wxDataViewColumn::SetFlags(int) */
788 void wxDataViewColumn::SetMaxWidth(int maxWidth
)
790 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
793 this->m_maxWidth
= maxWidth
;
794 if (dataViewCtrlPtr
!= NULL
)
796 // variable definition and initialization:
797 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
799 if (macDataViewListCtrlPtr
!= NULL
)
801 // variable definition and initialization:
802 DataBrowserListViewHeaderDesc headerDescription
;
804 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
805 headerDescription
.maximumWidth
= static_cast<UInt16
>(maxWidth
);
806 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set maximum width."));
809 } /* wxDataViewColumn::SetMaxWidth(int) */
811 void wxDataViewColumn::SetMinWidth(int minWidth
)
813 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
816 this->m_minWidth
= minWidth
;
817 if (dataViewCtrlPtr
!= NULL
)
819 // variable definition and initialization:
820 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
822 if (macDataViewListCtrlPtr
!= NULL
)
824 // variable definition and initialization:
825 DataBrowserListViewHeaderDesc headerDescription
;
827 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
828 headerDescription
.minimumWidth
= static_cast<UInt16
>(minWidth
);
829 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set minimum width."));
832 } /* wxDataViewColumn::SetMaxWidth(int) */
834 void wxDataViewColumn::SetReorderable(bool reorderable
)
836 // first set the internal flag of the column:
838 this->m_flags
|= wxDATAVIEW_COL_REORDERABLE
;
840 this->m_flags
&= ~wxDATAVIEW_COL_REORDERABLE
;
841 // if the column is associated with a control change also immediately the flags of the control:
842 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner()); // variable definition and initialization
844 if (dataViewCtrlPtr
!= NULL
)
846 // variable definition and initialization:
847 DataBrowserPropertyFlags flags
;
848 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
850 wxCHECK_RET(macDataViewListCtrlPtr
!= NULL
, _("Valid pointer to native data view control does not exist"));
851 wxCHECK_RET(macDataViewListCtrlPtr
->GetPropertyFlags(this->GetPropertyID(),&flags
) == noErr
,_("Could not get property flags."));
853 flags
|= kDataBrowserListViewMovableColumn
;
855 flags
&= ~kDataBrowserListViewMovableColumn
;
856 wxCHECK_RET(macDataViewListCtrlPtr
->SetPropertyFlags(this->GetPropertyID(),flags
) == noErr
,_("Could not set property flags."));
858 } /* wxDataViewColumn::SetReorderable(bool) */
860 void wxDataViewColumn::SetResizeable(bool WXUNUSED(resizeable
))
862 } /* wxDataViewColumn::SetResizeable(bool) */
864 void wxDataViewColumn::SetSortable(bool sortable
)
866 // first set the internal flag of the column:
868 this->m_flags
|= wxDATAVIEW_COL_SORTABLE
;
870 this->m_flags
&= ~wxDATAVIEW_COL_SORTABLE
;
871 // if the column is associated with a control change also immediately the flags of the control:
872 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner()); // variable definition and initialization
874 if (dataViewCtrlPtr
!= NULL
)
876 // variable definition and initialization:
877 DataBrowserPropertyFlags flags
;
878 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
880 wxCHECK_RET(macDataViewListCtrlPtr
!= NULL
, _("Valid pointer to native data view control does not exist"));
881 wxCHECK_RET(macDataViewListCtrlPtr
->GetPropertyFlags(this->GetPropertyID(),&flags
) == noErr
,_("Could not get property flags."));
883 flags
|= kDataBrowserListViewSortableColumn
;
885 flags
&= ~kDataBrowserListViewSortableColumn
;
886 wxCHECK_RET(macDataViewListCtrlPtr
->SetPropertyFlags(this->GetPropertyID(),flags
) == noErr
,_("Could not set property flags."));
888 } /* wxDataViewColumn::SetSortable(bool) */
890 void wxDataViewColumn::SetSortOrder(bool ascending
)
892 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
895 this->m_ascending
= ascending
;
896 if (dataViewCtrlPtr
!= NULL
)
898 // variable definition and initialization:
899 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
901 if (macDataViewListCtrlPtr
!= NULL
)
903 // variable definition and initialization:
904 DataBrowserListViewHeaderDesc headerDescription
;
906 verify_noerr(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
));
908 headerDescription
.initialOrder
= kDataBrowserOrderIncreasing
;
910 headerDescription
.initialOrder
= kDataBrowserOrderDecreasing
;
911 verify_noerr(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
));
912 macDataViewListCtrlPtr
->SetSortProperty(this->GetPropertyID());
915 } /* wxDataViewColumn::SetSortOrder(bool) */
917 void wxDataViewColumn::SetTitle(wxString
const& title
)
919 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
922 this->m_title
= title
;
923 if (dataViewCtrlPtr
!= NULL
)
925 // variable definition and initialization:
926 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
928 if (macDataViewListCtrlPtr
!= NULL
)
930 // variable definition and initialization:
931 DataBrowserListViewHeaderDesc headerDescription
;
932 #if wxCHECK_VERSION(2,9,0)
933 wxCFStringRef
cfTitle(title
,(dataViewCtrlPtr
->GetFont().Ok() ? dataViewCtrlPtr
->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
935 wxMacCFStringHolder
cfTitle(title
,(dataViewCtrlPtr
->GetFont().Ok() ? dataViewCtrlPtr
->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
938 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
939 headerDescription
.titleString
= cfTitle
;
940 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set header description."));
943 } /* wxDataViewColumn::SetTitle(wxString const&) */
945 void wxDataViewColumn::SetWidth(int width
)
947 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
950 if ((width
>= this->m_minWidth
) && (width
<= this->m_maxWidth
))
952 this->m_width
= width
;
953 if (dataViewCtrlPtr
!= NULL
)
955 // variable definition and initialization:
956 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
958 if (macDataViewListCtrlPtr
!= NULL
)
959 wxCHECK_RET(macDataViewListCtrlPtr
->SetColumnWidth(this->GetPropertyID(),static_cast<UInt16
>(width
)) == noErr
,_("Could not set column width."));
962 } /* wxDataViewColumn::SetWidth(int) */
964 IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn
,wxDataViewColumnBase
)
966 //-----------------------------------------------------------------------------
968 //-----------------------------------------------------------------------------
970 void wxDataViewCtrl::Init(void)
972 this->m_CustomRendererPtr
= NULL
;
973 this->m_Deleting
= false;
974 this->m_macIsUserPane
= false;
975 this->m_cgContext
= NULL
;
976 } /* wxDataViewCtrl::Init(void) */
978 bool wxDataViewCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
, const wxValidator
& validator
)
980 if (!(this->wxControl::Create(parent
,id
,pos
,size
,(style
| wxSUNKEN_BORDER
) & ~(wxHSCROLL
| wxVSCROLL
),validator
)))
984 MacSetClipChildren(true) ;
987 this->m_peer
= new wxMacDataViewDataBrowserListViewControl(this,pos
,size
,style
);
988 this->MacPostControlCreate(pos
,size
);
989 ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(this->m_peer
->GetControlRef()),true);
991 InstallControlEventHandler(this->m_peer
->GetControlRef(),GetwxMacDataViewCtrlEventHandlerUPP(),GetEventTypeCount(eventList
),eventList
,this,NULL
);
993 ::SetDataBrowserTableViewHiliteStyle( this->m_peer
->GetControlRef(), kDataBrowserTableViewFillHilite
);
995 ::SetDataBrowserTableViewGeometry( this->m_peer
->GetControlRef(), true, false );
998 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
1000 bool wxDataViewCtrl::AssociateModel(wxDataViewModel
* model
)
1002 if (!wxDataViewCtrlBase::AssociateModel(model
))
1005 model
->AddNotifier(new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl
*>(this->m_peer
)));
1008 } /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
1010 bool wxDataViewCtrl::AppendColumn(wxDataViewColumn
* columnPtr
)
1012 DataBrowserListViewColumnDesc columnDescription
;
1014 DataBrowserPropertyID NewPropertyID
;
1016 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1018 #if wxCHECK_VERSION(2,9,0)
1019 wxCFStringRef
title(columnPtr
->GetTitle(),this->m_font
.Ok() ? this->m_font
.GetEncoding() : wxLocale::GetSystemEncoding());
1021 wxMacCFStringHolder
title(columnPtr
->GetTitle(),this->m_font
.Ok() ? this->m_font
.GetEncoding() : wxLocale::GetSystemEncoding());
1025 // first, some error checking:
1026 wxCHECK_MSG(MacDataViewListCtrlPtr
!= NULL
, false,_("m_peer is not or incorrectly initialized"));
1027 wxCHECK_MSG(columnPtr
!= NULL
, false,_("Column pointer must not be NULL."));
1028 wxCHECK_MSG(columnPtr
->GetRenderer() != NULL
, false,_("Column does not have a renderer."));
1029 wxCHECK_MSG(this->GetModel() != NULL
, false,_("No model associated with control."));
1030 wxCHECK_MSG((columnPtr
->GetModelColumn() >= 0) &&
1031 (columnPtr
->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
1033 // try to get new ID for the column:
1034 wxCHECK_MSG(MacDataViewListCtrlPtr
->GetFreePropertyID(&NewPropertyID
) == noErr
,false,_("Cannot create new column's ID. Probably max. number of columns reached."));
1035 // full column variable initialization:
1036 columnPtr
->SetPropertyID(NewPropertyID
);
1037 // add column to wxWidget's internal structure:
1038 wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr
) &&
1039 this->m_ColumnPointers
.insert(ColumnPointerHashMapType::value_type(NewPropertyID
,columnPtr
)).second
,false,_("Could not add column to internal structures."));
1040 // create a column description and add column to the native control:
1041 wxCHECK_MSG(::InitializeColumnDescription(columnDescription
,columnPtr
,NewPropertyID
,title
), false,_("Column description could not be initialized."));
1042 wxCHECK_MSG(MacDataViewListCtrlPtr
->AddColumn(&columnDescription
,kDataBrowserListViewAppendColumn
) == noErr
,false,_("Column could not be added."));
1044 // final adjustments for the layout:
1045 wxCHECK_MSG(MacDataViewListCtrlPtr
->SetColumnWidth(NewPropertyID
,columnPtr
->GetWidth()) == noErr
,false,_("Column width could not be set."));
1047 // make sure that the data is up-to-date...
1048 // if the newly appended column is the first column add the initial data to the control and mark the column as an expander column,
1049 // otherwise ask the control to 'update' the data in the newly appended column:
1050 if (this->GetColumnCount() == 1)
1052 this->SetExpanderColumn(columnPtr
);
1053 this->AddChildrenLevel(wxDataViewItem());
1056 MacDataViewListCtrlPtr
->UpdateItems(kDataBrowserNoItem
,0,NULL
,kDataBrowserItemNoProperty
,NewPropertyID
);
1059 } /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
1061 bool wxDataViewCtrl::ClearColumns(void)
1063 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1066 while (this->m_ColumnPointers
.begin() != this->m_ColumnPointers
.end())
1068 wxCHECK_MSG(MacDataViewListCtrlPtr
->RemoveColumnByProperty(this->m_ColumnPointers
.begin()->first
) == noErr
,false,_("Could not remove column."));
1069 delete this->m_ColumnPointers
.begin()->second
;
1070 this->m_ColumnPointers
.erase(this->m_ColumnPointers
.begin());
1073 } /* wxDataViewCtrl::ClearColumns(void) */
1075 bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn
* columnPtr
)
1077 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1080 if ((MacDataViewListCtrlPtr
->RemoveColumnByProperty(columnPtr
->GetPropertyID()) == noErr
) && (this->m_ColumnPointers
.erase(columnPtr
->GetPropertyID()) > 0))
1087 } /* wxDataViewCtrl::DeleteColumn(wxDataViewColumn*) */
1089 wxDataViewColumn
* wxDataViewCtrl::GetColumn(unsigned int pos
) const
1091 DataBrowserPropertyID propertyID
;
1093 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1096 if (MacDataViewListCtrlPtr
->GetPropertyID(pos
,&propertyID
) == noErr
)
1098 // variable definition:
1099 ColumnPointerHashMapType::const_iterator
Result(this->m_ColumnPointers
.find(propertyID
));
1101 if (Result
!= this->m_ColumnPointers
.end())
1102 return Result
->second
;
1108 } /* wxDataViewCtrl::GetColumn(unsigned int pos) const */
1110 unsigned int wxDataViewCtrl::GetColumnCount(void) const
1112 return this->m_ColumnPointers
.size();
1113 } /* wxDataViewCtrl::GetColumnCount(void) const */
1115 int wxDataViewCtrl::GetColumnPosition(wxDataViewColumn
const* columnPtr
) const
1117 if (columnPtr
!= NULL
)
1119 // variable definition and initialization:
1120 DataBrowserTableViewColumnIndex Position
;
1121 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1123 wxCHECK_MSG(MacDataViewListCtrlPtr
->GetColumnIndex(columnPtr
->GetPropertyID(),&Position
) == noErr
,-1,_("Could not determine column's position"));
1124 return static_cast<int>(Position
);
1128 } /* wxDataViewCtrl::GetColumnPosition(wxDataViewColumn const*) const */
1130 bool wxDataViewCtrl::PrependColumn(wxDataViewColumn
* columnPtr
)
1132 DataBrowserListViewColumnDesc columnDescription
;
1134 DataBrowserPropertyID NewPropertyID
;
1136 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1138 #if wxCHECK_VERSION(2,9,0)
1139 wxCFStringRef
title(columnPtr
->GetTitle(),this->m_font
.Ok() ? this->m_font
.GetEncoding() : wxLocale::GetSystemEncoding());
1141 wxMacCFStringHolder
title(columnPtr
->GetTitle(),this->m_font
.Ok() ? this->m_font
.GetEncoding() : wxLocale::GetSystemEncoding());
1145 // first, some error checking:
1146 wxCHECK_MSG(MacDataViewListCtrlPtr
!= NULL
, false,_("m_peer is not or incorrectly initialized"));
1147 wxCHECK_MSG(columnPtr
!= NULL
, false,_("Column pointer must not be NULL."));
1148 wxCHECK_MSG(columnPtr
->GetRenderer() != NULL
, false,_("Column does not have a renderer."));
1149 wxCHECK_MSG(this->GetModel() != NULL
, false,_("No model associated with control."));
1150 wxCHECK_MSG((columnPtr
->GetModelColumn() >= 0) &&
1151 (columnPtr
->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
1153 // try to get new ID for the column:
1154 wxCHECK_MSG(MacDataViewListCtrlPtr
->GetFreePropertyID(&NewPropertyID
) == noErr
,false,_("Cannot create new column's ID. Probably max. number of columns reached."));
1155 // full column variable initialization:
1156 columnPtr
->SetPropertyID(NewPropertyID
);
1157 // add column to wxWidget's internal structure:
1158 wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr
) &&
1159 this->m_ColumnPointers
.insert(ColumnPointerHashMapType::value_type(NewPropertyID
,columnPtr
)).second
,false,_("Could not add column to internal structures."));
1160 // create a column description and add column to the native control:
1161 wxCHECK_MSG(::InitializeColumnDescription(columnDescription
,columnPtr
,NewPropertyID
,title
),false,_("Column description could not be initialized."));
1162 wxCHECK_MSG(MacDataViewListCtrlPtr
->AddColumn(&columnDescription
,0) == noErr
, false,_("Column could not be added."));
1164 // final adjustments for the layout:
1165 wxCHECK_MSG(MacDataViewListCtrlPtr
->SetColumnWidth(NewPropertyID
,columnPtr
->GetWidth()) == noErr
,false,_("Column width could not be set."));
1167 // make sure that the data is up-to-date...
1168 // if the newly appended column is the first column add the initial data to the control and mark the column as an expander column,
1169 // otherwise ask the control to 'update' the data in the newly appended column:
1170 if (this->GetColumnCount() == 1)
1172 this->SetExpanderColumn(columnPtr
);
1173 this->AddChildrenLevel(wxDataViewItem());
1176 MacDataViewListCtrlPtr
->UpdateItems(kDataBrowserNoItem
,0,NULL
,kDataBrowserItemNoProperty
,NewPropertyID
);
1179 } /* wxDataViewCtrl::PrependColumn(wxDataViewColumn*) */
1181 void wxDataViewCtrl::Collapse(wxDataViewItem
const& item
)
1183 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1186 MacDataViewListCtrlPtr
->CloseContainer(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
1187 } /* wxDataViewCtrl::Collapse(wxDataViewItem const&) */
1189 void wxDataViewCtrl::EnsureVisible(wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
)
1193 // variable definition and initialization:
1194 DataBrowserPropertyID propertyID
;
1195 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1197 if (columnPtr
!= NULL
)
1198 propertyID
= columnPtr
->GetPropertyID();
1200 propertyID
= kDataBrowserNoItem
;
1201 MacDataViewListCtrlPtr
->RevealItem(reinterpret_cast<DataBrowserItemID
>(item
.GetID()),propertyID
,kDataBrowserRevealOnly
);
1203 } /* wxDataViewCtrl::EnsureVisible(wxDataViewItem const&, wxDataViewColumn const*) */
1205 void wxDataViewCtrl::Expand(wxDataViewItem
const& item
)
1207 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1210 MacDataViewListCtrlPtr
->OpenContainer(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
1211 } /* wxDataViewCtrl::Expand(wxDataViewItem const&) */
1213 wxDataViewColumn
* wxDataViewCtrl::GetSortingColumn(void) const
1215 DataBrowserPropertyID propertyID
;
1217 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1220 if (MacDataViewListCtrlPtr
->GetSortProperty(&propertyID
) == noErr
)
1221 return this->GetColumnPtr(propertyID
);
1224 } /* wxDataViewCtrl::GetSortingColumn(void) const */
1226 unsigned int wxDataViewCtrl::GetCount(void) const
1228 ItemCount noOfItems
;
1231 wxCHECK_MSG(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
)->GetItemCount(&noOfItems
) == noErr
,0,_("Could not determine number of items"));
1233 } /* wxDataViewCtrl::GetCount(void) const */
1235 wxRect
wxDataViewCtrl::GetItemRect(wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
) const
1237 if (item
.IsOk() && (columnPtr
!= NULL
))
1239 // variable definition:
1241 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1243 if (MacDataViewListCtrlPtr
->GetPartBounds(reinterpret_cast<DataBrowserItemID
>(item
.GetID()),columnPtr
->GetPropertyID(),kDataBrowserPropertyContentPart
,&MacRectangle
) == noErr
)
1245 // variable definition:
1248 ::wxMacNativeToRect(&MacRectangle
,&rectangle
);
1256 } /* wxDataViewCtrl::GetItemRect(wxDataViewItem const&, unsigned int) const */
1258 wxDataViewItem
wxDataViewCtrl::GetSelection(void) const
1260 wxArrayDataBrowserItemID itemIDs
;
1262 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1265 if (MacDataViewListCtrlPtr
->GetSelectedItemIDs(itemIDs
) > 0)
1266 return wxDataViewItem(reinterpret_cast<void*>(itemIDs
[0]));
1268 return wxDataViewItem();
1269 } /* wxDataViewCtrl::GetSelection(void) const */
1271 int wxDataViewCtrl::GetSelections(wxDataViewItemArray
& sel
) const
1273 size_t NoOfSelectedItems
;
1275 wxArrayDataBrowserItemID itemIDs
;
1277 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1280 NoOfSelectedItems
= MacDataViewListCtrlPtr
->GetSelectedItemIDs(itemIDs
);
1282 sel
.SetCount(NoOfSelectedItems
);
1283 for (size_t i
=0; i
<NoOfSelectedItems
; ++i
)
1284 sel
[i
] = wxDataViewItem(reinterpret_cast<void*>(itemIDs
[i
]));
1285 return static_cast<int>(NoOfSelectedItems
);
1286 } /* wxDataViewCtrl::GetSelections(wxDataViewItemArray&) const */
1288 void wxDataViewCtrl::HitTest(wxPoint
const& point
, wxDataViewItem
& item
, wxDataViewColumn
*& columnPtr
) const
1290 item
= wxDataViewItem();
1292 } /* wxDataViewCtrl::HitTest(wxPoint const&, wxDataViewItem&, wxDataViewColumn*&) const */
1294 bool wxDataViewCtrl::IsSelected(wxDataViewItem
const& item
) const
1296 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1299 return MacDataViewListCtrlPtr
->IsItemSelected(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
1300 } /* wxDataViewCtrl::IsSelected(wxDataViewItem const&) const */
1302 void wxDataViewCtrl::SelectAll(void)
1304 DataBrowserItemID
* itemIDPtr
;
1306 Handle
handle(::NewHandle(0));
1310 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1313 wxCHECK_RET(MacDataViewListCtrlPtr
->GetItems(kDataBrowserNoItem
,true,kDataBrowserItemAnyState
,handle
) == noErr
,_("Could not get items."));
1314 NoOfItems
= static_cast<size_t>(::GetHandleSize(handle
)/sizeof(DataBrowserItemID
));
1316 itemIDPtr
= (DataBrowserItemID
*) (*handle
);
1317 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfItems
,itemIDPtr
,kDataBrowserItemsAssign
);
1319 DisposeHandle(handle
);
1320 } /* wxDataViewCtrl::SelectAll(void) */
1322 void wxDataViewCtrl::Select(wxDataViewItem
const& item
)
1326 // variable definition and initialization:
1327 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
1328 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1330 MacDataViewListCtrlPtr
->SetSelectedItems(1,&itemID
,kDataBrowserItemsAdd
);
1332 } /* wxDataViewCtrl::Select(wxDataViewItem const&) */
1334 void wxDataViewCtrl::SetSelections(wxDataViewItemArray
const& sel
)
1336 size_t const NoOfSelections
= sel
.GetCount();
1338 DataBrowserItemID
* itemIDs
;
1340 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1343 itemIDs
= new DataBrowserItemID
[NoOfSelections
];
1344 for (size_t i
=0; i
<NoOfSelections
; ++i
)
1345 itemIDs
[i
] = reinterpret_cast<DataBrowserItemID
>(sel
[i
].GetID());
1346 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfSelections
,itemIDs
,kDataBrowserItemsAssign
);
1348 } /* wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) */
1350 void wxDataViewCtrl::Unselect(wxDataViewItem
const& item
)
1354 // variable definition and initialization:
1355 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
1356 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1358 MacDataViewListCtrlPtr
->SetSelectedItems(1,&itemID
,kDataBrowserItemsRemove
);
1360 } /* wxDataViewCtrl::Unselect(wxDataViewItem const&) */
1362 void wxDataViewCtrl::UnselectAll(void)
1364 DataBrowserItemID
* itemIDPtr
;
1366 Handle
handle(::NewHandle(0));
1370 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1373 wxCHECK_RET(MacDataViewListCtrlPtr
->GetItems(kDataBrowserNoItem
,true,kDataBrowserItemAnyState
,handle
) == noErr
,_("Could not get items."));
1374 NoOfItems
= static_cast<size_t>(::GetHandleSize(handle
)/sizeof(DataBrowserItemID
));
1376 itemIDPtr
= (DataBrowserItemID
*) (*handle
);
1377 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfItems
,itemIDPtr
,kDataBrowserItemsRemove
);
1379 DisposeHandle(handle
);
1380 } /* wxDataViewCtrl::UnselectAll(void) */
1383 void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem
const& parentItem
)
1387 wxDataViewItemArray items
;
1390 wxCHECK_RET(this->GetModel() != NULL
,_("Model pointer not initialized."));
1391 NoOfChildren
= this->GetModel()->GetChildren(parentItem
,items
);
1393 for (int i
=0; i
<NoOfChildren
; ++i
)
1394 (void) this->GetModel()->ItemAdded(parentItem
,items
[i
]);
1396 (void) this->GetModel()->ItemsAdded(parentItem
,items
);
1398 } /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
1400 void wxDataViewCtrl::FinishCustomItemEditing(void)
1402 if (this->GetCustomRendererItem().IsOk())
1404 this->GetCustomRendererPtr()->FinishEditing();
1405 this->SetCustomRendererItem(wxDataViewItem());
1406 this->SetCustomRendererPtr (NULL
);
1408 } /* wxDataViewCtrl::FinishCustomItemEditing(void) */
1410 wxDataViewColumn
* wxDataViewCtrl::GetColumnPtr(WXDataBrowserPropertyID propertyID
) const
1412 // variable definition:
1413 ColumnPointerHashMapType::const_iterator
Result(this->m_ColumnPointers
.find(propertyID
));
1415 if (Result
!= this->m_ColumnPointers
.end())
1416 return Result
->second
;
1419 } /* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID) const */
1421 // inherited methods from wxDataViewCtrlBase
1422 void wxDataViewCtrl::DoSetExpanderColumn(void)
1424 if (this->GetExpanderColumn() != NULL
)
1426 // variable definition and initialization:
1427 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1429 (void) MacDataViewListCtrlPtr
->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID(),false); // second parameter explicitely passed to ensure that arrow is centered
1431 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
1433 void wxDataViewCtrl::DoSetIndent(void)
1435 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1438 (void) MacDataViewListCtrlPtr
->SetIndent(static_cast<float>(this->GetIndent()));
1439 } /* wxDataViewCtrl::DoSetIndent(void) */
1442 void wxDataViewCtrl::OnSize(wxSizeEvent
& event
)
1444 unsigned int const NoOfColumns
= this->GetColumnCount();
1447 for (unsigned int i
=0; i
<NoOfColumns
; ++i
)
1449 // variable definition and initialization:
1450 wxDataViewColumn
* dataViewColumnPtr(this->GetColumn(i
));
1452 if (dataViewColumnPtr
!= NULL
)
1454 // variable definition and initialization:
1455 wxDataViewCustomRenderer
* dataViewCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer
*>(dataViewColumnPtr
->GetRenderer()));
1457 if (dataViewCustomRendererPtr
!= NULL
)
1458 dataViewCustomRendererPtr
->SetDC(NULL
); // reset DC because DC has changed
1462 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
1463 ControlRef ref
= MacDataViewListCtrlPtr
->GetControlRef();
1464 if (NoOfColumns
== 1)
1466 ::SetDataBrowserHasScrollBars( ref
, false, true );
1467 ::AutoSizeDataBrowserListViewColumns( ref
);
1469 if (NoOfColumns
> 1)
1471 ::SetDataBrowserHasScrollBars( ref
, true, true );
1475 } /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
1477 IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl
,wxDataViewCtrlBase
)
1479 BEGIN_EVENT_TABLE(wxDataViewCtrl
,wxDataViewCtrlBase
)
1480 EVT_SIZE(wxDataViewCtrl::OnSize
)
1484 // !wxUSE_GENERICDATAVIEWCTRL
1487 // wxUSE_DATAVIEWCTRL