void wxMacDataViewDataBrowserListViewControl::DoSetExpanderColumn(wxDataViewColumn const* columnPtr)
{
- SetDisclosureColumn(columnPtr->GetNativeData()->GetPropertyID(),false); // second parameter explicitely passed to ensure that arrow is centered
+ SetDisclosureColumn(columnPtr->GetNativeData()->GetPropertyID(),false); // second parameter explicitly passed to ensure that arrow is centered
}
wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumn(unsigned int pos) const
UInt32 noOfColumns;
- wxCFStringRef title(columnPtr->GetTitle(),m_font.Ok() ? dynamic_cast<wxDataViewCtrl*>(GetWXPeer())->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
+ wxCFStringRef title(columnPtr->GetTitle(),m_font.IsOk() ? dynamic_cast<wxDataViewCtrl*>(GetWXPeer())->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
// try to get new ID for the column:
//
// selection related methods (inherited from wxDataViewWidgetImpl)
//
+wxDataViewItem wxMacDataViewDataBrowserListViewControl::GetCurrentItem() const
+{
+ wxFAIL_MSG( "unimplemented for Carbon" );
+
+ return wxDataViewItem();
+}
+
+void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewItem& WXUNUSED(item))
+{
+ wxFAIL_MSG( "unimplemented for Carbon" );
+}
+
int wxMacDataViewDataBrowserListViewControl::GetSelections(wxDataViewItemArray& sel) const
{
size_t noOfSelectedItems;
void wxMacDataViewDataBrowserListViewControl::Resort()
{
- (void) Resort();
+ (void) wxMacDataBrowserListViewControl::Resort();
}
//
SetHasScrollBars(true,true);
}
+void wxMacDataViewDataBrowserListViewControl::StartEditor( const wxDataViewItem & item, unsigned int column )
+{
+ // implement me
+}
+
//
// callback functions (inherited from wxMacDataBrowserTableViewControl)
//
// variable definition and initialization:
wxVariant modifiedData(true);
- if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
- dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
+ if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;
// variable definition and initialization:
wxVariant modifiedData(false);
- if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
- dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
+ if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;
#endif
wxVariant modifiedData(modifiedString.AsString());
- if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
- dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
+ if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;
{
// make sure that 'Render' can draw only in the allowed area:
dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
- (void) (dataViewCustomRendererPtr->Render( cellrect, dc,
+ (void) (dataViewCustomRendererPtr->WXCallRender( cellrect, dc,
((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0)));
dc->DestroyClippingRegion(); // probably not necessary
}
dataObject->Add(textDataObject);
else
{
- delete textDataObject;
- textDataObject = NULL;
+ wxDELETE(textDataObject);
}
}
} /* block */
dataObject->Add(textDataObject);
else
{
- delete textDataObject;
- textDataObject = NULL;
+ wxDELETE(textDataObject);
}
}
else // overwrite data because the 'utxt' flavor has priority over the 'TEXT' flavor
return wxELLIPSIZE_NONE;
if ( flags & kDataBrowserTruncateTextAtStart )
return wxELLIPSIZE_START;
- if ( flags & kDataBrowserTruncateTextMiddle )
- return wxELLIPSIZE_MIDDLE;
if ( flags & kDataBrowserTruncateTextAtEnd )
return wxELLIPSIZE_END;
- wxFAIL_MSG( "unknown flags" );
-
- return wxELLIPSIZE_NONE;
+ // kDataBrowserTruncateTextMiddle == 0 so there is no need to test for it
+ return wxELLIPSIZE_MIDDLE;
}
void wxDataViewRenderer::SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr)
// wxDataViewCustomRenderer
// ---------------------------------------------------------
wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
- :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL), m_DCPtr(NULL)
+ :wxDataViewCustomRendererBase(varianttype,mode,align),
+ m_editorCtrlPtr(NULL),
+ m_DCPtr(NULL)
{
SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType));
}
{
wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << GetValue().GetType());
- wxCFStringRef cfString(GetValue().GetString(),(GetView()->GetFont().Ok() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+ wxCFStringRef cfString(GetValue().GetString(),(GetView()->GetFont().IsOk() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
return (::SetDataBrowserItemDataText(GetNativeData()->GetItemDataRef(),cfString) == noErr);
}
wxBitmap bitmap;
bitmap << GetValue();
- return (!(bitmap.Ok()) || (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),bitmap.GetIconRef()) == noErr));
+ return (!(bitmap.IsOk()) || (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),bitmap.GetIconRef()) == noErr));
}
IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
iconText << GetValue();
- wxCFStringRef cfString(iconText.GetText(),(GetView()->GetFont().Ok() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+ wxCFStringRef cfString(iconText.GetText(),(GetView()->GetFont().IsOk() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
if (iconText.GetIcon().IsOk())
if (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),MAC_WXHICON(iconText.GetIcon().GetHICON())) != noErr)
:wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title)
{
InitCommon(width, align, flags);
- if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
- renderer->SetAlignment(align);
+ if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
+ (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
+ renderer->SetAlignment(align);
}
wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags)
:wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData())
{
InitCommon(width, align, flags);
- if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
- renderer->SetAlignment(align);
+ if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
+ (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
+ renderer->SetAlignment(align);
}
wxDataViewColumn::~wxDataViewColumn()
delete m_NativeDataPtr;
}
+int wxDataViewColumn::GetWidth() const
+{
+ // FIXME: This returns the last programmatically set width and will not work if
+ // the user changes the column's width by dragging it with the mouse.
+ return m_width;
+}
+
bool wxDataViewColumn::IsSortKey() const
{
wxDataViewCtrl * const dataViewCtrlPtr(GetOwner());
DataBrowserListViewHeaderDesc headerDescription;
wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
- if (GetBitmap().Ok())
+ if (GetBitmap().IsOk())
headerDescription.btnContentInfo.u.iconRef = GetBitmap().GetIconRef();
else
headerDescription.btnContentInfo.u.iconRef = NULL;
}
}
-void wxDataViewColumn::SetResizeable(bool resizeable)
+void wxDataViewColumn::SetResizeable(bool resizable)
{
// first set the internal flag of the column:
- if (resizeable)
+ if (resizable)
m_flags |= wxDATAVIEW_COL_RESIZABLE;
else
m_flags &= ~wxDATAVIEW_COL_RESIZABLE;
DataBrowserListViewHeaderDesc headerDescription;
verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription));
- if (resizeable)
+ if (resizable)
{
if (GetMinWidth() >= GetMaxWidth())
{
if (macDataViewListCtrlPtr != NULL)
{
DataBrowserListViewHeaderDesc headerDescription;
- wxCFStringRef cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+ wxCFStringRef cfTitle(title,(dataViewCtrlPtr->GetFont().IsOk() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
headerDescription.titleString = cfTitle;
{
wxDataViewCtrl* dataViewCtrlPtr(GetOwner());
+ switch ( width )
+ {
+ case wxCOL_WIDTH_AUTOSIZE:
+ // not implemented, fall through
+ case wxCOL_WIDTH_DEFAULT:
+ width = wxDVC_DEFAULT_WIDTH;
+ break;
+ default:
+ break;
+ }
if ((width >= m_minWidth) && (width <= m_maxWidth))
{
}
}
+void wxDataViewColumn::SetHidden(bool WXUNUSED(hidden))
+{
+ // How to do that?
+}
+
+bool wxDataViewColumn::IsHidden() const
+{
+ return true;
+}
+
+
void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort))
{
// see wxGTK native wxDataViewColumn implementation