From: Robin Dunn <robin@alldunn.com>
Date: Wed, 1 Jun 2005 00:16:41 +0000 (+0000)
Subject: Merge the cell size attribute the same way that other attributes are
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3100c3dbf3d8aeae4d2d68de91c14a0de399bd32

Merge the cell size attribute the same way that other attributes are
merged, e.g., if it is already set to a non-default value in the
current wxGridCellAttr object then don't merge from the other.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h
index e9b5dbb0c2..7c4de9a29f 100644
--- a/include/wx/generic/grid.h
+++ b/include/wx/generic/grid.h
@@ -696,6 +696,7 @@ public:
     bool HasEditor() const { return m_editor != NULL; }
     bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
     bool HasOverflowMode() const { return m_overflow != UnsetOverflow; }
+    bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; }
 
     const wxColour& GetTextColour() const;
     const wxColour& GetBackgroundColour() const;
diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp
index 55049525f7..395e94ac5d 100644
--- a/src/generic/grid.cpp
+++ b/src/generic/grid.cpp
@@ -2142,8 +2142,8 @@ void wxGridCellAttr::MergeWith(wxGridCellAttr *mergefrom)
         mergefrom->GetAlignment( &hAlign, &vAlign);
         SetAlignment(hAlign, vAlign);
     }
-
-    mergefrom->GetSize( &m_sizeRows, &m_sizeCols );
+    if ( !HasSize() && mergefrom->HasSize() )
+        mergefrom->GetSize( &m_sizeRows, &m_sizeCols );
 
     // Directly access member functions as GetRender/Editor don't just return
     // m_renderer/m_editor
@@ -2914,6 +2914,7 @@ wxGridCellAttr *wxGridTableBase::GetAttr(int row, int col, wxGridCellAttr::wxAtt
         return (wxGridCellAttr *)NULL;
 }
 
+
 void wxGridTableBase::SetAttr(wxGridCellAttr* attr, int row, int col)
 {
     if ( m_attrProvider )