unsigned long columnIndex;
wxDataViewColumn* column;
OSStatus status;
- wxDataViewEvent DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId());
+ wxDataViewEvent DataViewEvent(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId());
CarbonEvent.GetParameter(kEventParamDirectObject,&controlReference);
// determine the column that triggered the event (this is the column that is responsible for sorting the data view):
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();
+}
+
+wxDataViewColumn *wxMacDataViewDataBrowserListViewControl::GetCurrentColumn() const
+{
+ wxFAIL_MSG( "unimplemented for Carbon" );
+ return NULL;
+}
+
+void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewItem& WXUNUSED(item))
+{
+ wxFAIL_MSG( "unimplemented for Carbon" );
+}
+
+int wxMacDataViewDataBrowserListViewControl::GetSelectedItemsCount() const
+{
+ Handle handle(::NewHandle(0));
+
+ if ( GetItems(kDataBrowserNoItem,true,kDataBrowserItemIsSelected,handle) != noErr )
+ {
+ wxFAIL_MSG( "failed to get selected items" );
+ return 0;
+ }
+
+ size_t noOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID));
+ HUnlock(handle);
+ DisposeHandle(handle);
+
+ return noOfItems;
+}
+
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 & WXUNUSED(item), unsigned int WXUNUSED(column) )
+{
+ // implement me
+}
+
//
// callback functions (inherited from wxMacDataBrowserTableViewControl)
//
}
void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection))
- // In this method we do not supply a contextual menu handler at all but only send a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU.
+ // In this method we do not supply a contextual menu handler at all but only send a wxEVT_DATAVIEW_ITEM_CONTEXT_MENU.
{
wxArrayDataBrowserItemID itemIDs;
*helpType = kCMHelpItemNoHelp;
*helpItemString = NULL;
// create information for a context menu event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
// 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;
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
case kDataBrowserItemDoubleClicked:
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
case kDataBrowserSelectionSetChanged:
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
{
columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetColumn(columnIndex);
{
// 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
}
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
- dataViewCustomRendererItem = reinterpret_cast<void*>(itemID);
+ dataViewCustomRendererItem = wxDataViewItem(reinterpret_cast<void*>(itemID));
wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item"));
dataViewColumnPtr = GetColumnPtr(propertyID);
wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing."));
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
- dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event
- // (can be an invalid item ID, this is especially useful if the dataview does not contain any items)
+
+ // this is the item that receives the event (can be an invalid item ID, this is
+ // especially useful if the dataview does not contain any items)
+ dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast<void*>(itemID)) );
+
dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
dataViewEvent.SetDataObject(dataObjects);
dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects));
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
- dataViewItem = reinterpret_cast<void*>(itemID);
+ dataViewItem = wxDataViewItem(reinterpret_cast<void*>(itemID));
wxCHECK_MSG(dataViewItem.IsOk(),false,_("Invalid data view item"));
// send a begin drag event and proceed with dragging unless the event is vetoed:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(dataViewItem);
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
- dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event
- // (can be an invalid item ID, this is especially useful if the dataview does not contain any items)
+
+ // this is the item that receives the event (can be an invalid item ID, this is
+ // especially useful if the dataview does not contain any items)
+ dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast<void*>(itemID)) );
+
dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
dataViewEvent.SetDataObject(dataObjects);
dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects));
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
m_alignment = align;
}
+namespace
+{
+
+// get the browser control or NULL if anything went wrong (it's not supposed to
+// so we assert if it did)
+wxMacDataViewDataBrowserListViewControl *
+GetBrowserFromCol(wxDataViewColumn *col)
+{
+ wxCHECK_MSG( col, NULL, "should have a valid column" );
+
+ wxDataViewCtrl * const dvc = col->GetOwner();
+ wxCHECK_MSG( dvc, NULL, "column must be associated with the control" );
+
+ return static_cast<wxMacDataViewDataBrowserListViewControl *>(dvc->GetPeer());
+}
+
+} // anonymous namespace
+
void wxDataViewRenderer::SetMode(wxDataViewCellMode mode)
{
- wxDataViewColumn* dataViewColumnPtr;
+ wxDataViewColumn * const col = GetOwner();
+ wxMacDataViewDataBrowserListViewControl * const
+ browser = GetBrowserFromCol(col);
+ wxCHECK_RET( browser, "must be fully initialized" );
+ const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID();
- m_mode = mode;
- dataViewColumnPtr = GetOwner();
- if (dataViewColumnPtr != NULL)
- {
- wxDataViewCtrl* dataViewCtrlPtr(dataViewColumnPtr->GetOwner());
+ DataBrowserPropertyFlags flags;
+ verify_noerr( browser->GetPropertyFlags(colID, &flags) );
- if (dataViewCtrlPtr != NULL)
+ if ( (mode == wxDATAVIEW_CELL_EDITABLE) ||
+ (mode == wxDATAVIEW_CELL_ACTIVATABLE) )
+ flags |= kDataBrowserPropertyIsEditable;
+ else
+ flags &= ~kDataBrowserPropertyIsEditable;
+
+ verify_noerr( browser->SetPropertyFlags(colID, flags) );
+}
+
+void wxDataViewRenderer::EnableEllipsize(wxEllipsizeMode mode)
+{
+ wxDataViewColumn * const col = GetOwner();
+
+ wxMacDataViewDataBrowserListViewControl * const
+ browser = GetBrowserFromCol(col);
+ wxCHECK_RET( browser, "must be fully initialized" );
+
+ const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID();
+
+ DataBrowserPropertyFlags flags;
+ browser->GetPropertyFlags(colID, &flags);
+
+ flags &= ~(kDataBrowserDoNotTruncateText |
+ kDataBrowserTruncateTextAtStart |
+ kDataBrowserTruncateTextMiddle |
+ kDataBrowserTruncateTextAtEnd);
+
+ int flagToSet = 0;
+ switch ( mode )
{
- wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+ case wxELLIPSIZE_NONE:
+ flagToSet = kDataBrowserDoNotTruncateText;
+ break;
- if (macDataViewListCtrlPtr != NULL)
- {
- DataBrowserPropertyFlags flags;
-
- verify_noerr(macDataViewListCtrlPtr->GetPropertyFlags(dataViewColumnPtr->GetNativeData()->GetPropertyID(),&flags));
- if ((mode == wxDATAVIEW_CELL_EDITABLE) ||
- (mode == wxDATAVIEW_CELL_ACTIVATABLE))
- flags |= kDataBrowserPropertyIsEditable;
- else
- flags &= ~kDataBrowserPropertyIsEditable;
- verify_noerr(macDataViewListCtrlPtr->SetPropertyFlags(dataViewColumnPtr->GetNativeData()->GetPropertyID(),flags));
- }
+ case wxELLIPSIZE_START:
+ flagToSet = kDataBrowserTruncateTextAtStart;
+ break;
+
+ case wxELLIPSIZE_MIDDLE:
+ flagToSet = kDataBrowserTruncateTextMiddle;
+ break;
+
+ case wxELLIPSIZE_END:
+ flagToSet = kDataBrowserTruncateTextAtEnd;
+ break;
}
- }
+
+ wxCHECK_RET( flagToSet, "unknown wxEllipsizeMode value" );
+
+ flags |= flagToSet;
+ verify_noerr( browser->SetPropertyFlags(colID, flags) );
+}
+
+wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const
+{
+ wxDataViewColumn * const col = GetOwner();
+
+ wxMacDataViewDataBrowserListViewControl * const
+ browser = GetBrowserFromCol(col);
+ wxCHECK_MSG( browser, wxELLIPSIZE_NONE, "must be fully initialized" );
+
+ const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID();
+
+ DataBrowserPropertyFlags flags;
+ browser->GetPropertyFlags(colID, &flags);
+
+ if ( flags & kDataBrowserDoNotTruncateText )
+ return wxELLIPSIZE_NONE;
+ if ( flags & kDataBrowserTruncateTextAtStart )
+ return wxELLIPSIZE_START;
+ if ( flags & kDataBrowserTruncateTextAtEnd )
+ return wxELLIPSIZE_END;
+
+ // 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::SetAsSortKey(bool WXUNUSED(sort))
+void wxDataViewColumn::SetHidden(bool WXUNUSED(hidden))
{
- // see wxGTK native wxDataViewColumn implementation
- wxFAIL_MSG( "not implemented" );
+ // How to do that?
}
+bool wxDataViewColumn::IsHidden() const
+{
+ return true;
+}
+
+
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;