]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dataview.cpp
Explicitly set "C" locale for the tests using decimal point.
[wxWidgets.git] / src / osx / carbon / dataview.cpp
index 38f94678c90de7cc61f7ead5f7abb5203681f6d9..a981920486b4bdb72844bdd6c11785acc5aff6af 100644 (file)
@@ -1095,6 +1095,18 @@ bool wxMacDataViewDataBrowserListViewControl::AssociateModel(wxDataViewModel* WX
 //
 // 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;
@@ -1183,7 +1195,7 @@ wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetSortingColumn() co
 
 void wxMacDataViewDataBrowserListViewControl::Resort()
 {
-  (void) Resort();
+    (void) wxMacDataBrowserListViewControl::Resort();
 }
 
 //
@@ -1318,8 +1330,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
                // 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;
@@ -1329,8 +1340,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
                // 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;
@@ -1357,8 +1367,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
 #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;
@@ -1704,7 +1713,7 @@ wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItem
   {
       // 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
   }
@@ -2095,8 +2104,7 @@ wxDataObjectComposite* wxMacDataViewDataBrowserListViewControl::GetDnDDataObject
                   dataObject->Add(textDataObject);
                 else
                 {
-                  delete textDataObject;
-                  textDataObject = NULL;
+                  wxDELETE(textDataObject);
                 }
               }
             } /* block */
@@ -2127,8 +2135,7 @@ wxDataObjectComposite* wxMacDataViewDataBrowserListViewControl::GetDnDDataObject
                       dataObject->Add(textDataObject);
                     else
                     {
-                      delete textDataObject;
-                      textDataObject = NULL;
+                      wxDELETE(textDataObject);
                     }
                   }
                   else // overwrite data because the 'utxt' flavor has priority over the 'TEXT' flavor
@@ -2286,14 +2293,11 @@ wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const
         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)
@@ -2308,7 +2312,9 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase)
 // 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));
 }
@@ -2462,16 +2468,18 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title, wxDataViewRenderer* re
                  :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()
@@ -2479,6 +2487,13 @@ wxDataViewColumn::~wxDataViewColumn()
   delete m_NativeDataPtr;
 }
 
+int wxDataViewColumn::GetWidth() const
+{
+    // FIXME: This returns the last programatically 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());
@@ -2733,6 +2748,16 @@ void wxDataViewColumn::SetWidth(int width)
 {
   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))
   {
@@ -2747,6 +2772,17 @@ void wxDataViewColumn::SetWidth(int width)
   }
 }
 
+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