]> git.saurik.com Git - wxWidgets.git/commitdiff
Add scrollbars if the columns exceed the horizontal space for the control, also,...
authorKevin Ollivier <kevino@theolliviers.com>
Sun, 12 Nov 2006 04:08:13 +0000 (04:08 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Sun, 12 Nov 2006 04:08:13 +0000 (04:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/listctrl_mac.cpp

index 7fc71fe14d99529a6bc21cf2e8787c4123f632ea..a2c5c20ae3b07213e5301492b456f773b34e1f92 100644 (file)
@@ -728,6 +728,23 @@ void wxListCtrl::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 
     if (m_genericImpl)
         m_genericImpl->SetSize(0, 0, width, height, sizeFlags);
+
+    // determine if we need a horizontal scrollbar, and add it if so
+    if (m_dbImpl)
+    {
+        int totalWidth = 0;
+        for (int column = 0; column < GetColumnCount(); column++)
+        {
+              totalWidth += m_dbImpl->GetColumnWidth( column );
+        }
+
+        Boolean vertScrollBar;
+        GetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), NULL, &vertScrollBar );
+        if (totalWidth > width)
+            SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), true, vertScrollBar );
+        else
+            SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), false, vertScrollBar );
+    }
 }
 
 wxSize wxListCtrl::DoGetBestSize() const
@@ -819,6 +836,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
 
     if (m_dbImpl)
     {
+        long mask = item.GetMask();
         if ( col >= (int)m_colsInfo.GetCount() )
         {
             wxListItem* listItem = new wxListItem(item);
@@ -828,7 +846,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
         {
             wxListItem listItem;
             GetColumn( col, listItem );
-            long mask = item.GetMask();
+
             if (mask & wxLIST_MASK_TEXT)
                 listItem.SetText(item.GetText());
             if (mask & wxLIST_MASK_DATA)
@@ -842,6 +860,9 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
             if (mask & wxLIST_MASK_WIDTH)
                 listItem.SetWidth(item.GetWidth());
         }
+        
+        if (mask & wxLIST_MASK_WIDTH)
+            SetColumnWidth( col, item.GetWidth() )
 
         // change the appearance in the databrowser.
         DataBrowserListViewHeaderDesc columnDesc;
@@ -927,10 +948,22 @@ bool wxListCtrl::SetColumnWidth(int col, int width)
         {
             for (int column = 0; column < GetColumnCount(); column++)
             {
+                wxListItem colInfo;
+                GetColumn(col, colInfo);
+             
+                colInfo.SetWidth(width);
+                SetColumn(col, colInfo);
+            
                 m_dbImpl->SetColumnWidth(col, mywidth);
             }
         }
-        else{
+        else
+        {
+            wxListItem colInfo;
+            GetColumn(col, colInfo);
+         
+            colInfo.SetWidth(width);
+            SetColumn(col, colInfo);
             m_dbImpl->SetColumnWidth(col, mywidth);
         }
         return true;