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"
28 #include "wx/renderer.h"
30 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 // a list of all catchable events:
35 static EventTypeSpec
const eventList
[] =
37 {kEventClassControl
, kEventControlDraw
},
38 {kEventClassControl
, kEventControlHit
}
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 static pascal OSStatus
wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
, EventRef EventReference
, void* Data
)
47 wxDataViewCtrl
* DataViewCtrlPtr((wxDataViewCtrl
*) Data
); // the 'Data' variable always contains a pointer to the data view control that installed the handler
49 wxMacCarbonEvent
CarbonEvent(EventReference
) ;
52 switch (GetEventKind(EventReference
))
54 case kEventControlDraw
:
58 DataViewCtrlPtr
->MacSetDrawingContext(CarbonEvent
.GetParameter
<CGContextRef
>(kEventParamCGContextRef
,typeCGContextRef
));
59 status
= ::CallNextEventHandler(handler
,EventReference
);
60 DataViewCtrlPtr
->MacSetDrawingContext(NULL
);
63 case kEventControlHit
:
64 if (CarbonEvent
.GetParameter
<ControlPartCode
>(kEventParamControlPart
,typeControlPartCode
) == kControlButtonPart
) // we only care about the header
66 ControlRef controlReference
;
67 DataBrowserPropertyID columnPropertyID
;
68 unsigned long columnIndex
;
70 wxDataViewEvent
DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
,DataViewCtrlPtr
->GetId());
72 CarbonEvent
.GetParameter(kEventParamDirectObject
,&controlReference
);
73 // determine the column that triggered the event (this is the column that is responsible for sorting the data view):
74 status
= ::GetDataBrowserSortProperty(controlReference
,&columnPropertyID
);
75 wxCHECK(status
== noErr
,status
);
76 status
= ::GetDataBrowserTableViewColumnPosition(controlReference
,columnPropertyID
,&columnIndex
);
77 if (status
== errDataBrowserPropertyNotFound
) // user clicked into part of the header that does not have a property
78 return ::CallNextEventHandler(handler
,EventReference
);
79 wxCHECK(status
== noErr
,status
);
80 // initialize wxWidget event handler:
81 DataViewEvent
.SetEventObject(DataViewCtrlPtr
);
82 DataViewEvent
.SetColumn(columnIndex
);
83 DataViewEvent
.SetDataViewColumn(DataViewCtrlPtr
->GetColumn(columnIndex
));
84 // finally sent the equivalent wxWidget event:
85 DataViewCtrlPtr
->GetEventHandler()->ProcessEvent(DataViewEvent
);
86 return ::CallNextEventHandler(handler
,EventReference
);
89 return eventNotHandledErr
;
92 return eventNotHandledErr
;
93 } /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
95 //-----------------------------------------------------------------------------
96 // local function pointers
97 //-----------------------------------------------------------------------------
99 DEFINE_ONE_SHOT_HANDLER_GETTER(wxMacDataViewCtrlEventHandler
)
101 // ---------------------------------------------------------
102 // wxMacDataViewModelNotifier
103 // ---------------------------------------------------------
105 class wxMacDataViewModelNotifier
: public wxDataViewModelNotifier
108 wxMacDataViewModelNotifier(wxMacDataViewDataBrowserListViewControl
* initDataViewControlPtr
) : m_dataViewControlPtr(initDataViewControlPtr
)
112 virtual bool ItemAdded(const wxDataViewItem
&parent
, const wxDataViewItem
&item
)
114 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
117 wxCHECK_MSG(item
.IsOk(),false,_("Added item is invalid."));
118 return (!(parent
.IsOk()) && (this->m_dataViewControlPtr
->AddItem(kDataBrowserNoItem
,&itemID
) == noErr
) ||
119 parent
.IsOk() && (this->m_dataViewControlPtr
->AddItem(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),&itemID
) == noErr
));
120 } /* ItemAdded(wxDataViewItem const&, wxDataViewItem const&) */
122 virtual bool ItemChanged(wxDataViewItem
const& item
)
124 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
127 wxCHECK_MSG(item
.IsOk(), false,_("Changed item is invalid."));
128 wxCHECK_MSG(this->GetOwner() != NULL
,false,_("Owner not initialized."));
129 if (this->m_dataViewControlPtr
->UpdateItems(&itemID
) == noErr
)
131 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
133 // sent the equivalent wxWidget event:
134 wxDataViewEvent
dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED
,dataViewCtrlPtr
->GetId()); // variable defintion
136 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
137 dataViewEvent
.SetItem(item
);
138 // sent the equivalent wxWidget event:
139 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
145 } /* ItemChanged(wxDataViewItem const&) */
147 virtual bool ItemDeleted(wxDataViewItem
const& parent
, wxDataViewItem
const& item
)
151 // variable definition and initialization:
152 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
153 OSStatus errorStatus
;
154 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
156 // 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
157 // not to be identical because the being edited item might be below the passed item in the hierarchy); therefore, the control is informed that currently a deleting process
158 // is started and that variables can currently not be updated even when requested by the system:
159 dataViewCtrlPtr
->SetDeleting(true);
160 errorStatus
= this->m_dataViewControlPtr
->RemoveItem(reinterpret_cast<DataBrowserItemID
>(parent
.GetID()),&itemID
);
161 dataViewCtrlPtr
->SetDeleting(false);
162 return (errorStatus
== noErr
);
166 } /* ItemDeleted(wxDataViewItem const&, wxDataViewItem const&) */
168 virtual bool ValueChanged(wxDataViewItem
const& item
, unsigned int col
)
170 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
171 DataBrowserItemID parentID
;
173 DataBrowserPropertyID propertyID
;
175 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
178 wxCHECK_MSG(item
.IsOk(), false,_("Passed item is invalid."));
179 wxCHECK_MSG(this->GetOwner() != NULL
,false,_("Owner not initialized."));
180 wxCHECK_MSG(dataViewCtrlPtr
!= NULL
, false,_("Control is wrongly initialized."));
181 parentID
= reinterpret_cast<DataBrowserItemID
>(this->GetOwner()->GetParent(item
).GetID());
182 if ((this->m_dataViewControlPtr
->GetPropertyID(col
,&propertyID
) == noErr
) &&
183 (this->m_dataViewControlPtr
->UpdateItems(parentID
,1,&itemID
,dataViewCtrlPtr
->GetColumn(col
)->GetPropertyID(),propertyID
) == noErr
))
185 // variable definition and initialization:
186 wxDataViewEvent
dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED
,dataViewCtrlPtr
->GetId());
188 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
189 dataViewEvent
.SetColumn(col
);
190 dataViewEvent
.SetItem(item
);
191 // send the equivalent wxWidget event:
192 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
198 } /* ValueChanged(wxDataViewItem const&, unsigned int) */
200 virtual bool Cleared(void)
202 if (this->m_dataViewControlPtr
->RemoveItems() == noErr
)
204 // variable definitions and initializations:
205 wxDataViewCtrl
* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl
*>(this->m_dataViewControlPtr
->GetPeer()));
206 wxDataViewEvent
dataViewEvent (wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED
,dataViewCtrlPtr
->GetId());
208 dataViewEvent
.SetEventObject(dataViewCtrlPtr
);
209 // send the equivalent wxWidget event:
210 dataViewCtrlPtr
->GetEventHandler()->ProcessEvent(dataViewEvent
);
216 } /* Cleared(void) */
218 virtual void Resort(void)
220 this->m_dataViewControlPtr
->Resort();
228 wxMacDataViewDataBrowserListViewControl
* m_dataViewControlPtr
;
231 // ---------------------------------------------------------
232 // wxDataViewRenderer
233 // ---------------------------------------------------------
235 wxDataViewRenderer::wxDataViewRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
236 :wxDataViewRendererBase(varianttype
,mode
,align
), m_alignment(align
), m_mode(mode
)
238 } /* wxDataViewRenderer::wxDataViewRenderer(wxString const&, wxDataViewCellMode) */
240 void wxDataViewRenderer::SetMode(wxDataViewCellMode mode
)
242 wxDataViewColumn
* dataViewColumnPtr
;
246 dataViewColumnPtr
= this->GetOwner();
247 if (dataViewColumnPtr
!= NULL
)
249 // variable definition and initialization:
250 wxDataViewCtrl
* dataViewCtrlPtr(dataViewColumnPtr
->GetOwner());
252 if (dataViewCtrlPtr
!= NULL
)
254 // variable definition and initialization:
255 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
257 if (macDataViewListCtrlPtr
!= NULL
)
259 // variable definition and initialization:
260 DataBrowserPropertyFlags flags
;
262 verify_noerr(macDataViewListCtrlPtr
->GetPropertyFlags(dataViewColumnPtr
->GetPropertyID(),&flags
));
263 if (mode
== wxDATAVIEW_CELL_EDITABLE
)
264 flags
|= kDataBrowserPropertyIsEditable
;
266 flags
&= ~kDataBrowserPropertyIsEditable
;
267 verify_noerr(macDataViewListCtrlPtr
->SetPropertyFlags(dataViewColumnPtr
->GetPropertyID(),flags
));
271 } /* wxDataViewRenderer::SetMode(wxDataViewCellMode) */
273 IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer
,wxDataViewRendererBase
)
275 // ---------------------------------------------------------
276 // wxDataViewCustomRenderer
277 // ---------------------------------------------------------
279 wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
280 :wxDataViewRenderer(varianttype
,mode
,align
), m_editorCtrlPtr(NULL
)
282 } /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
284 wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void)
286 if (this->m_DCPtr
!= NULL
)
287 delete this->m_DCPtr
;
288 } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */
290 wxDC
* wxDataViewCustomRenderer::GetDC(void)
292 if (this->m_DCPtr
== NULL
)
294 if ((GetOwner() == NULL
) || (GetOwner()->GetOwner() == NULL
))
296 this->m_DCPtr
= new wxClientDC(this->GetOwner()->GetOwner());
298 return this->m_DCPtr
;
299 } /* wxDataViewCustomRenderer::GetDC(void) */
301 bool wxDataViewCustomRenderer::Render(void)
304 } /* wxDataViewCustomRenderer::Render(void) */
306 void wxDataViewCustomRenderer::SetDC(wxDC
* newDCPtr
)
308 delete this->m_DCPtr
;
309 this->m_DCPtr
= newDCPtr
;
310 } /* wxDataViewCustomRenderer::SetDC(wxDC*) */
313 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer
, wxDataViewRenderer
)
315 // ---------------------------------------------------------
316 // wxDataViewTextRenderer
317 // ---------------------------------------------------------
319 wxDataViewTextRenderer::wxDataViewTextRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
320 :wxDataViewRenderer(varianttype
,mode
,align
)
322 } /* wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const&, wxDataViewCellMode, int) */
324 bool wxDataViewTextRenderer::Render(void)
326 if (this->GetValue().GetType() == this->GetVariantType())
328 // variable definition:
329 wxMacCFStringHolder
cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
331 return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString
) == noErr
);
335 } /* wxDataViewTextRenderer::Render(void) */
337 IMPLEMENT_CLASS(wxDataViewTextRenderer
,wxDataViewRenderer
)
339 // ---------------------------------------------------------
340 // wxDataViewBitmapRenderer
341 // ---------------------------------------------------------
343 wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
344 :wxDataViewRenderer(varianttype
,mode
,align
)
348 bool wxDataViewBitmapRenderer::Render(void)
350 if (this->GetValue().GetType() == this->GetVariantType())
354 bitmap
<< this->GetValue();
356 return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap
.GetBitmapData()->GetIconRef()) == noErr
);
362 } /* wxDataViewBitmapRenderer::Render(void) */
364 IMPLEMENT_CLASS(wxDataViewBitmapRenderer
,wxDataViewRenderer
)
366 // ---------------------------------------------------------
367 // wxDataViewToggleRenderer
368 // ---------------------------------------------------------
370 wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
371 :wxDataViewRenderer(varianttype
,mode
)
375 bool wxDataViewToggleRenderer::Render(void)
377 if (this->GetValue().GetType() == this->GetVariantType())
378 return (::SetDataBrowserItemDataButtonValue(this->GetDataReference(),this->GetValue().GetBool()) == noErr
);
381 } /* wxDataViewToggleRenderer::Render(void) */
383 IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer
,wxDataViewRenderer
)
385 // ---------------------------------------------------------
386 // wxDataViewProgressRenderer
387 // ---------------------------------------------------------
389 wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString
const& label
, wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
390 :wxDataViewRenderer(varianttype
,mode
,align
)
394 bool wxDataViewProgressRenderer::Render(void)
396 if (this->GetValue().GetType() == this->GetVariantType())
397 return ((::SetDataBrowserItemDataMinimum(this->GetDataReference(), 0) == noErr
) &&
398 (::SetDataBrowserItemDataMaximum(this->GetDataReference(),100) == noErr
) &&
399 (::SetDataBrowserItemDataValue (this->GetDataReference(),this->GetValue().GetLong()) == noErr
));
402 } /* wxDataViewProgressRenderer::Render(void) */
404 IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer
,wxDataViewRenderer
)
406 // ---------------------------------------------------------
407 // wxDataViewDateRenderer
408 // ---------------------------------------------------------
410 wxDataViewDateRenderer::wxDataViewDateRenderer(wxString
const& varianttype
, wxDataViewCellMode mode
, int align
)
411 :wxDataViewRenderer(varianttype
,mode
,align
)
415 bool wxDataViewDateRenderer::Render(void)
417 if (this->GetValue().GetType() == this->GetVariantType())
418 return (::SetDataBrowserItemDataDateTime(this->GetDataReference(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan
,1904)).GetSeconds().GetLo()) == noErr
);
421 } /* wxDataViewDateRenderer::Render(void) */
423 IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer
,wxDataViewRenderer
)
425 // ---------------------------------------------------------
427 // ---------------------------------------------------------
429 wxDataViewColumn::wxDataViewColumn(wxString
const &title
, wxDataViewRenderer
*cell
, unsigned int model_column
, int width
, wxAlignment align
, int flags
)
430 :wxDataViewColumnBase(title
,cell
,model_column
,width
,wxALIGN_CENTER
,flags
), m_ascending(true),
431 m_flags(flags
& ~(wxDATAVIEW_COL_HIDDEN
| wxDATAVIEW_COL_RESIZABLE
)), m_maxWidth(std::numeric_limits
<int>::max()), m_minWidth(0), m_width(width
),
432 m_alignment(align
), m_title(title
)
434 } /* wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
436 wxDataViewColumn::wxDataViewColumn(wxBitmap
const& bitmap
, wxDataViewRenderer
*cell
, unsigned int model_column
, int width
, wxAlignment align
, int flags
)
437 :wxDataViewColumnBase(bitmap
,cell
,model_column
,width
,wxALIGN_CENTER
,flags
), m_ascending(true),
438 m_flags(flags
& (wxDATAVIEW_COL_HIDDEN
| wxDATAVIEW_COL_RESIZABLE
)), m_maxWidth(std::numeric_limits
<int>::max()), m_minWidth(0), m_width(width
),
441 } /* wxDataViewColumn::wxDataViewColumn(wxBitmap const&, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
443 void wxDataViewColumn::SetAlignment(wxAlignment align
)
445 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
448 this->m_alignment
= align
;
449 if (dataViewCtrlPtr
!= NULL
)
451 // variable definition and initialization:
452 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
454 if (macDataViewListCtrlPtr
!= NULL
)
456 // variable definition and initialization:
457 DataBrowserListViewHeaderDesc headerDescription
;
459 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
463 case wxALIGN_CENTER_HORIZONTAL
:
464 headerDescription
.btnFontStyle
.just
= teCenter
;
467 headerDescription
.btnFontStyle
.just
= teFlushLeft
;
470 headerDescription
.btnFontStyle
.just
= teFlushRight
;
473 headerDescription
.btnFontStyle
.just
= teFlushDefault
;
475 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set alignment."));
478 } /* wxDataViewColumn::SetAlignment(wxAlignment) */
480 void wxDataViewColumn::SetBitmap(wxBitmap
const& bitmap
)
482 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
485 wxDataViewColumnBase::SetBitmap(bitmap
);
486 if (dataViewCtrlPtr
!= NULL
)
488 // variable definition and initialization:
489 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
491 if (macDataViewListCtrlPtr
!= NULL
)
493 // variable definition and initialization:
494 DataBrowserListViewHeaderDesc headerDescription
;
496 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
497 if (this->GetBitmap().Ok())
498 headerDescription
.btnContentInfo
.u
.iconRef
= this->GetBitmap().GetBitmapData()->GetIconRef();
500 headerDescription
.btnContentInfo
.u
.iconRef
= NULL
;
501 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set icon."));
504 } /* wxDataViewColumn::SetBitmap(wxBitmap const&) */
506 void wxDataViewColumn::SetFlags(int flags
)
508 this->SetHidden ((flags
& wxDATAVIEW_COL_HIDDEN
) != 0);
509 this->SetResizeable((flags
& wxDATAVIEW_COL_RESIZABLE
) != 0);
510 this->SetSortable ((flags
& wxDATAVIEW_COL_SORTABLE
) != 0);
511 } /* wxDataViewColumn::SetFlags(int) */
513 void wxDataViewColumn::SetMaxWidth(int maxWidth
)
515 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
518 this->m_maxWidth
= maxWidth
;
519 if (dataViewCtrlPtr
!= NULL
)
521 // variable definition and initialization:
522 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
524 if (macDataViewListCtrlPtr
!= NULL
)
526 // variable definition and initialization:
527 DataBrowserListViewHeaderDesc headerDescription
;
529 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
530 headerDescription
.maximumWidth
= static_cast<UInt16
>(maxWidth
);
531 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set maximum width."));
534 } /* wxDataViewColumn::SetMaxWidth(int) */
536 void wxDataViewColumn::SetMinWidth(int minWidth
)
538 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
541 this->m_minWidth
= minWidth
;
542 if (dataViewCtrlPtr
!= NULL
)
544 // variable definition and initialization:
545 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
547 if (macDataViewListCtrlPtr
!= NULL
)
549 // variable definition and initialization:
550 DataBrowserListViewHeaderDesc headerDescription
;
552 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
553 headerDescription
.minimumWidth
= static_cast<UInt16
>(minWidth
);
554 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set minimum width."));
557 } /* wxDataViewColumn::SetMaxWidth(int) */
559 void wxDataViewColumn::SetResizeable(bool WXUNUSED(resizeable
))
561 } /* wxDataViewColumn::SetResizeable(bool) */
563 void wxDataViewColumn::SetSortable(bool sortable
)
565 // variable definition and initialization:
566 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
568 if (dataViewCtrlPtr
!= NULL
)
570 // variable definition and initialization:
571 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
573 if (macDataViewListCtrlPtr
!= NULL
)
575 // variable definition and initialization:
576 DataBrowserPropertyFlags flags
;
578 wxCHECK_RET(macDataViewListCtrlPtr
->GetPropertyFlags(this->GetPropertyID(),&flags
) == noErr
,_("Could not get property flags."));
581 this->m_flags
|= wxDATAVIEW_COL_SORTABLE
;
582 flags
|= kDataBrowserListViewSortableColumn
;
586 this->m_flags
&= ~wxDATAVIEW_COL_SORTABLE
;
587 flags
&= ~kDataBrowserPropertyIsEditable
;
589 wxCHECK_RET(macDataViewListCtrlPtr
->SetPropertyFlags(this->GetPropertyID(),flags
) == noErr
,_("Could not set property flags."));
592 } /* wxDataViewColumn::SetSortable(bool) */
594 void wxDataViewColumn::SetSortOrder(bool ascending
)
596 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
599 this->m_ascending
= ascending
;
600 if (dataViewCtrlPtr
!= NULL
)
602 // variable definition and initialization:
603 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
605 if (macDataViewListCtrlPtr
!= NULL
)
607 // variable definition and initialization:
608 DataBrowserListViewHeaderDesc headerDescription
;
610 verify_noerr(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
));
612 headerDescription
.initialOrder
= kDataBrowserOrderIncreasing
;
614 headerDescription
.initialOrder
= kDataBrowserOrderDecreasing
;
615 verify_noerr(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
));
618 } /* wxDataViewColumn::SetSortOrder(bool) */
620 void wxDataViewColumn::SetTitle(wxString
const& title
)
622 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
625 this->m_title
= title
;
626 if (dataViewCtrlPtr
!= NULL
)
628 // variable definition and initialization:
629 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
631 if (macDataViewListCtrlPtr
!= NULL
)
633 // variable definition and initialization:
634 DataBrowserListViewHeaderDesc headerDescription
;
635 wxMacCFStringHolder
cfTitle(title
,(dataViewCtrlPtr
->GetFont().Ok() ? dataViewCtrlPtr
->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
637 wxCHECK_RET(macDataViewListCtrlPtr
->GetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not get header description."));
638 headerDescription
.titleString
= cfTitle
;
639 wxCHECK_RET(macDataViewListCtrlPtr
->SetHeaderDesc(this->GetPropertyID(),&headerDescription
) == noErr
,_("Could not set header description."));
642 } /* wxDataViewColumn::SetTitle(wxString const&) */
644 void wxDataViewColumn::SetWidth(int width
)
646 wxDataViewCtrl
* dataViewCtrlPtr(this->GetOwner());
649 if ((width
>= this->m_minWidth
) && (width
<= this->m_maxWidth
))
651 this->m_width
= width
;
652 if (dataViewCtrlPtr
!= NULL
)
654 // variable definition and initialization:
655 wxMacDataViewDataBrowserListViewControlPointer
macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(dataViewCtrlPtr
->GetPeer()));
657 if (macDataViewListCtrlPtr
!= NULL
)
658 wxCHECK_RET(macDataViewListCtrlPtr
->SetColumnWidth(this->GetPropertyID(),static_cast<UInt16
>(width
)) == noErr
,_("Could not set column width."));
661 } /* wxDataViewColumn::SetWidth(int) */
663 IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn
,wxDataViewColumnBase
)
665 //-----------------------------------------------------------------------------
667 //-----------------------------------------------------------------------------
669 void wxDataViewCtrl::Init(void)
671 this->m_Deleting
= false;
672 this->m_macIsUserPane
= false;
673 this->m_NotifierPtr
= NULL
;
674 this->m_cgContext
= NULL
;
675 } /* wxDataViewCtrl::Init(void) */
677 bool wxDataViewCtrl::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
, const wxValidator
& validator
)
679 if (!(this->wxControl::Create(parent
,id
,pos
,size
,(style
| wxSUNKEN_BORDER
) & ~(wxHSCROLL
| wxVSCROLL
),validator
)))
683 MacSetClipChildren(true) ;
686 this->m_peer
= new wxMacDataViewDataBrowserListViewControl(this,pos
,size
,style
);
687 this->MacPostControlCreate(pos
,size
);
688 ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(this->m_peer
->GetControlRef()),true);
690 InstallControlEventHandler(this->m_peer
->GetControlRef(),GetwxMacDataViewCtrlEventHandlerUPP(),GetEventTypeCount(eventList
),eventList
,this,NULL
);
693 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
695 bool wxDataViewCtrl::AppendColumn(wxDataViewColumn
* dataViewColumnPtr
)
697 // first, some error checking:
698 wxCHECK_MSG(dataViewColumnPtr
!= NULL
, false,_("Column pointer must not be NULL."));
699 wxCHECK_MSG(dataViewColumnPtr
->GetRenderer() != NULL
, false,_("Column does not have a renderer."));
700 wxCHECK_MSG(this->GetModel() != NULL
, false,_("No model associated with control."));
701 wxCHECK_MSG((dataViewColumnPtr
->GetModelColumn() >= 0) &&
702 (dataViewColumnPtr
->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
703 if (this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr
))
705 // variable definitions:
706 DataBrowserPropertyID NewPropertyID
;
707 DataBrowserListViewColumnDesc columnDescription
;
708 wxMacCFStringHolder
cfTitle(dataViewColumnPtr
->GetTitle(),(this->m_font
.Ok() ? this->m_font
.GetEncoding() : wxLocale::GetSystemEncoding()));
709 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
711 // initialize column description:
712 wxCHECK_MSG(MacDataViewListCtrlPtr
!= NULL
, false,_("m_peer is not or incorrectly initialized"));
713 wxCHECK_MSG(MacDataViewListCtrlPtr
->GetFreePropertyID(&NewPropertyID
) == noErr
,false,_("Maximum number of columns reached."));
714 dataViewColumnPtr
->SetPropertyID(NewPropertyID
);
715 if (dataViewColumnPtr
->GetWidth() <= 0)
716 dataViewColumnPtr
->SetWidth(wxDVC_DEFAULT_WIDTH
);
717 columnDescription
.propertyDesc
.propertyID
= NewPropertyID
;
718 columnDescription
.propertyDesc
.propertyType
= dataViewColumnPtr
->GetRenderer()->GetPropertyType();
719 columnDescription
.propertyDesc
.propertyFlags
= kDataBrowserListViewSelectionColumn
; // make the column selectable
720 if (dataViewColumnPtr
->IsSortable())
721 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewSortableColumn
;
723 if (dataViewColumnPtr
->IsMovable())
724 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewMovableColumn
;
726 if (dataViewColumnPtr
->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE
)
727 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserPropertyIsEditable
;
728 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
729 if ((columnDescription
.propertyDesc
.propertyType
== kDataBrowserTextType
) ||
730 (columnDescription
.propertyDesc
.propertyType
== kDataBrowserIconAndTextType
) ||
731 (columnDescription
.propertyDesc
.propertyType
== kDataBrowserDateTimeType
))
732 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewTypeSelectColumn
;
734 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
735 columnDescription
.propertyDesc
.propertyFlags
|= kDataBrowserListViewNoGapForIconInHeaderButton
;
737 columnDescription
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
738 if (dataViewColumnPtr
->IsResizable())
740 columnDescription
.headerBtnDesc
.minimumWidth
= 0;
741 columnDescription
.headerBtnDesc
.maximumWidth
= 30000;
745 columnDescription
.headerBtnDesc
.minimumWidth
= dataViewColumnPtr
->GetWidth();
746 columnDescription
.headerBtnDesc
.maximumWidth
= dataViewColumnPtr
->GetWidth();
748 columnDescription
.headerBtnDesc
.titleOffset
= 0;
749 columnDescription
.headerBtnDesc
.titleString
= cfTitle
; // we cannot directly use the wxMacCFStringHolder constructor call because then the CFStringRef is released
750 // having called 'AddColumn' where the title (CFStringRef) is going to be used
751 columnDescription
.headerBtnDesc
.initialOrder
= kDataBrowserOrderIncreasing
;
752 columnDescription
.headerBtnDesc
.btnFontStyle
.flags
= kControlUseFontMask
| kControlUseJustMask
;
753 switch (dataViewColumnPtr
->GetAlignment())
756 case wxALIGN_CENTER_HORIZONTAL
:
757 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teCenter
;
760 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushLeft
;
763 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushRight
;
766 columnDescription
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
768 columnDescription
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
769 columnDescription
.headerBtnDesc
.btnFontStyle
.style
= normal
;
770 columnDescription
.headerBtnDesc
.btnContentInfo
.contentType
= kControlContentIconRef
;
771 if (dataViewColumnPtr
->GetBitmap().Ok())
772 columnDescription
.headerBtnDesc
.btnContentInfo
.u
.iconRef
= dataViewColumnPtr
->GetBitmap().GetBitmapData()->GetIconRef();
774 wxCHECK_MSG(MacDataViewListCtrlPtr
->AddColumn(&columnDescription
,kDataBrowserListViewAppendColumn
) == noErr
,false,_("Column could not be added."));
776 // final adjustments for the layout:
777 wxCHECK_MSG(MacDataViewListCtrlPtr
->SetColumnWidth(NewPropertyID
,dataViewColumnPtr
->GetWidth()) == noErr
,false,_("Column width could not be set."));
779 if (dataViewColumnPtr
->IsSortable()) // if the current column is marked sortable this column will become the active sortable column, otherwise don't do anything
780 MacDataViewListCtrlPtr
->SetSortProperty(NewPropertyID
);
782 if (dataViewColumnPtr
== this->GetExpanderColumn()) // if the current column is marked expandable this column will become the active expandable column
783 MacDataViewListCtrlPtr
->SetDisclosureColumn(NewPropertyID
,true);
785 // make sure that the data is up-to-date...
786 // if the newly appended column is the first column add the initial data to the control otherwise ask the control to 'update' the data in the newly appended column:
787 if (this->GetColumnCount() == 1)
788 this->AddChildrenLevel(wxDataViewItem());
790 MacDataViewListCtrlPtr
->UpdateItems(kDataBrowserNoItem
,0,NULL
,kDataBrowserItemNoProperty
,NewPropertyID
);
796 } /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
798 bool wxDataViewCtrl::AssociateModel(wxDataViewModel
* model
)
800 if (!wxDataViewCtrlBase::AssociateModel(model
))
803 this->m_NotifierPtr
= new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl
*>(this->m_peer
));
804 model
->AddNotifier(this->m_NotifierPtr
);
807 } /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
809 void wxDataViewCtrl::EnsureVisible(wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
)
813 // variable definition and initialization:
814 DataBrowserPropertyID propertyID
;
815 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
817 if (columnPtr
!= NULL
)
818 propertyID
= columnPtr
->GetPropertyID();
820 propertyID
= kDataBrowserNoItem
;
821 MacDataViewListCtrlPtr
->RevealItem(reinterpret_cast<DataBrowserItemID
>(item
.GetID()),propertyID
,kDataBrowserRevealOnly
);
823 } /* wxDataViewCtrl::EnsureVisible(wxDataViewItem const&, wxDataViewColumn const*) */
825 wxRect
wxDataViewCtrl::GetItemRect(wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
) const
827 if (item
.IsOk() && (columnPtr
!= NULL
))
829 // variable definition:
831 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
833 if (MacDataViewListCtrlPtr
->GetPartBounds(reinterpret_cast<DataBrowserItemID
>(item
.GetID()),columnPtr
->GetPropertyID(),kDataBrowserPropertyContentPart
,&MacRectangle
) == noErr
)
835 // variable definition:
838 ::wxMacNativeToRect(&MacRectangle
,&rectangle
);
846 } /* wxDataViewCtrl::GetItemRect(wxDataViewItem const&, unsigned int) const */
848 wxDataViewItem
wxDataViewCtrl::GetSelection(void) const
850 wxArrayDataBrowserItemID itemIDs
;
852 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
855 if (MacDataViewListCtrlPtr
->GetSelectedItemIDs(itemIDs
) > 0)
856 return wxDataViewItem(reinterpret_cast<void*>(itemIDs
[0]));
858 return wxDataViewItem();
859 } /* wxDataViewCtrl::GetSelection(void) const */
861 int wxDataViewCtrl::GetSelections(wxDataViewItemArray
& sel
) const
863 size_t NoOfSelectedItems
;
865 wxArrayDataBrowserItemID itemIDs
;
867 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
870 NoOfSelectedItems
= MacDataViewListCtrlPtr
->GetSelectedItemIDs(itemIDs
);
872 sel
.SetCount(NoOfSelectedItems
);
873 for (size_t i
=0; i
<NoOfSelectedItems
; ++i
)
874 sel
[i
] = wxDataViewItem(reinterpret_cast<void*>(itemIDs
[i
]));
875 return static_cast<int>(NoOfSelectedItems
);
876 } /* wxDataViewCtrl::GetSelections(wxDataViewItemArray&) const */
878 void wxDataViewCtrl::HitTest(wxPoint
const& point
, wxDataViewItem
& item
, wxDataViewColumn
*& columnPtr
) const
880 item
= wxDataViewItem();
882 } /* wxDataViewCtrl::HitTest(wxPoint const&, wxDataViewItem&, wxDataViewColumn*&) const */
884 bool wxDataViewCtrl::IsSelected(wxDataViewItem
const& item
) const
886 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
889 return MacDataViewListCtrlPtr
->IsItemSelected(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
890 } /* wxDataViewCtrl::IsSelected(wxDataViewItem const&) const */
892 void wxDataViewCtrl::SelectAll(void)
894 DataBrowserItemID
* itemIDPtr
;
896 Handle
handle(::NewHandle(0));
900 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
903 wxCHECK_RET(MacDataViewListCtrlPtr
->GetItems(kDataBrowserNoItem
,true,kDataBrowserItemAnyState
,handle
) == noErr
,_("Could not get items."));
904 NoOfItems
= static_cast<size_t>(::GetHandleSize(handle
)/sizeof(DataBrowserItemID
));
906 itemIDPtr
= (DataBrowserItemID
*) (*handle
);
907 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfItems
,itemIDPtr
,kDataBrowserItemsAssign
);
909 DisposeHandle(handle
);
910 } /* wxDataViewCtrl::SelectAll(void) */
912 void wxDataViewCtrl::Select(wxDataViewItem
const& item
)
916 // variable definition and initialization:
917 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
918 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
920 MacDataViewListCtrlPtr
->SetSelectedItems(1,&itemID
,kDataBrowserItemsAdd
);
922 } /* wxDataViewCtrl::Select(wxDataViewItem const&) */
924 void wxDataViewCtrl::SetSelections(wxDataViewItemArray
const& sel
)
926 size_t const NoOfSelections
= sel
.GetCount();
928 DataBrowserItemID
* itemIDs
;
930 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
933 itemIDs
= new DataBrowserItemID
[NoOfSelections
];
934 for (size_t i
=0; i
<NoOfSelections
; ++i
)
935 itemIDs
[i
] = reinterpret_cast<DataBrowserItemID
>(sel
[i
].GetID());
936 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfSelections
,itemIDs
,kDataBrowserItemsAssign
);
938 } /* wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) */
940 void wxDataViewCtrl::Unselect(wxDataViewItem
const& item
)
944 // variable definition and initialization:
945 DataBrowserItemID
itemID(reinterpret_cast<DataBrowserItemID
>(item
.GetID()));
946 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
948 MacDataViewListCtrlPtr
->SetSelectedItems(1,&itemID
,kDataBrowserItemsRemove
);
950 } /* wxDataViewCtrl::Unselect(wxDataViewItem const&) */
952 void wxDataViewCtrl::UnselectAll(void)
954 DataBrowserItemID
* itemIDPtr
;
956 Handle
handle(::NewHandle(0));
960 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
963 wxCHECK_RET(MacDataViewListCtrlPtr
->GetItems(kDataBrowserNoItem
,true,kDataBrowserItemAnyState
,handle
) == noErr
,_("Could not get items."));
964 NoOfItems
= static_cast<size_t>(::GetHandleSize(handle
)/sizeof(DataBrowserItemID
));
966 itemIDPtr
= (DataBrowserItemID
*) (*handle
);
967 MacDataViewListCtrlPtr
->SetSelectedItems(NoOfItems
,itemIDPtr
,kDataBrowserItemsRemove
);
969 DisposeHandle(handle
);
970 } /* wxDataViewCtrl::UnselectAll(void) */
973 void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem
const& parentItem
)
978 wxCHECK_RET(this->GetModel() != NULL
,_("Model pointer not initialized."));
979 item
= this->GetModel()->GetFirstChild(parentItem
);
982 (void) this->GetModel()->ItemAdded(parentItem
,item
);
983 item
= this->GetModel()->GetNextSibling(item
);
985 } /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
987 // inherited methods from wxDataViewCtrlBase
988 void wxDataViewCtrl::DoSetExpanderColumn(void)
990 if (this->GetExpanderColumn() < this->GetColumnCount())
992 // variable definition and initialization:
993 DataBrowserPropertyID propertyID
;
994 wxMacDataViewDataBrowserListViewControlPointer
MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer
>(this->m_peer
));
996 if (MacDataViewListCtrlPtr
->GetPropertyID(this->GetExpanderColumn(),&propertyID
) == noErr
)
997 (void) MacDataViewListCtrlPtr
->SetDisclosureColumn(propertyID
);
999 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
1001 void wxDataViewCtrl::DoSetIndent(void)
1003 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
1006 void wxDataViewCtrl::OnSize(wxSizeEvent
& event
)
1008 unsigned int const NoOfColumns
= this->GetColumnCount();
1011 for (unsigned int i
=0; i
<NoOfColumns
; ++i
)
1013 // variable definition and initialization:
1014 wxDataViewColumn
* dataViewColumnPtr(this->GetColumn(i
));
1016 if (dataViewColumnPtr
!= NULL
)
1018 // variable definition and initialization:
1019 wxDataViewCustomRenderer
* dataViewCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer
*>(dataViewColumnPtr
->GetRenderer()));
1021 if (dataViewCustomRendererPtr
!= NULL
)
1022 dataViewCustomRendererPtr
->SetDC(NULL
); // reset DC because DC has changed
1026 } /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
1028 IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl
,wxDataViewCtrlBase
)
1030 BEGIN_EVENT_TABLE(wxDataViewCtrl
,wxDataViewCtrlBase
)
1031 EVT_SIZE(wxDataViewCtrl::OnSize
)
1035 // !wxUSE_GENERICDATAVIEWCTRL
1038 // wxUSE_DATAVIEWCTRL