]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dataview.cpp
applied patch 1908782 wxAuiMDIChildFrame not removed from wxAuiMDIClientWindow
[wxWidgets.git] / src / mac / carbon / dataview.cpp
index e54cc745f71638565192bb6993716d2b27819214..99b593cdb93b90c9857e622f0e8d1fcad327ebb8 100644 (file)
@@ -174,13 +174,23 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
   } /* switch */
   columnDescription.headerBtnDesc.btnFontStyle.font  = kControlFontViewSystemFont;
   columnDescription.headerBtnDesc.btnFontStyle.style = normal;
-  columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
-  if (columnPtr->GetBitmap().Ok())
+  if (columnPtr->GetBitmap().IsOk())
+  {
+    columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
 #if wxCHECK_VERSION(2,9,0)
     columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef();
 #else
     columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetBitmapData()->GetIconRef();
 #endif
+  }
+  else
+  {
+    // not text only as we otherwise could not add a bitmap later
+    // columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly;
+    columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
+    columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = NULL;
+  }
+    
  // done:
   return true;
 } /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
@@ -992,9 +1002,23 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
 
   ::SetDataBrowserTableViewHiliteStyle( this->m_peer->GetControlRef(), kDataBrowserTableViewFillHilite );
 
+  ::SetDataBrowserTableViewGeometry( this->m_peer->GetControlRef(), true, false );
+  
   return true;
 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
 
+/*static*/
+wxVisualAttributes wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+{
+    wxVisualAttributes attr;
+
+    attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
+    attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
+    attr.font.MacCreateFromThemeFont(kThemeViewsFont);
+
+    return attr;
+}
+
 bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
 {
   if (!wxDataViewCtrlBase::AssociateModel(model))
@@ -1014,9 +1038,9 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
   wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
 #if wxCHECK_VERSION(2,9,0)
-  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
 #else
-  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
 #endif
 
 
@@ -1134,9 +1158,9 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
   wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
 #if wxCHECK_VERSION(2,9,0)
-  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
 #else
-  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
 #endif
 
 
@@ -1456,6 +1480,19 @@ void wxDataViewCtrl::OnSize(wxSizeEvent& event)
         dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
     } /* if */
   } /* for */
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  ControlRef ref = MacDataViewListCtrlPtr->GetControlRef();
+  if (NoOfColumns == 1)
+  {
+     ::SetDataBrowserHasScrollBars( ref, false, true );
+     ::AutoSizeDataBrowserListViewColumns( ref );
+  }
+  if (NoOfColumns > 1)
+  {
+     ::SetDataBrowserHasScrollBars( ref, true, true );
+  }
+  
   event.Skip();
 } /* wxDataViewCtrl::OnSize(wxSizeEvent&) */