Also merge the m_overflow attribute

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-05-07 17:50:08 +00:00
parent dd38c87578
commit ef5df12bdf
2 changed files with 38 additions and 24 deletions

View File

@@ -605,6 +605,13 @@ public:
Merged Merged
}; };
enum wxAttrOverflowMode
{
Unset = -1,
Overflow,
SingleCell
};
// ctors // ctors
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL) wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
{ {
@@ -647,7 +654,8 @@ public:
m_vAlign = vAlign; m_vAlign = vAlign;
} }
void SetSize(int num_rows, int num_cols); void SetSize(int num_rows, int num_cols);
void SetOverflow( bool allow ) { m_overflow = allow; } void SetOverflow(bool allow = TRUE)
{ m_overflow = allow ? Overflow : SingleCell; }
void SetReadOnly(bool isReadOnly = TRUE) void SetReadOnly(bool isReadOnly = TRUE)
{ m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; } { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; }
@@ -667,13 +675,15 @@ public:
bool HasRenderer() const { return m_renderer != NULL; } bool HasRenderer() const { return m_renderer != NULL; }
bool HasEditor() const { return m_editor != NULL; } bool HasEditor() const { return m_editor != NULL; }
bool HasReadWriteMode() const { return m_isReadOnly != Unset; } bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
bool HasOverflowMode() const { return m_overflow != Unset; }
const wxColour& GetTextColour() const; const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const; const wxColour& GetBackgroundColour() const;
const wxFont& GetFont() const; const wxFont& GetFont() const;
void GetAlignment(int *hAlign, int *vAlign) const; void GetAlignment(int *hAlign, int *vAlign) const;
void GetSize(int *num_rows, int *num_cols) const; void GetSize(int *num_rows, int *num_cols) const;
bool GetOverflow() const { return m_overflow; } bool GetOverflow() const
{ return m_overflow != wxGridCellAttr::SingleCell; }
wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
@@ -711,7 +721,8 @@ private:
m_vAlign; m_vAlign;
int m_sizeRows, int m_sizeRows,
m_sizeCols; m_sizeCols;
bool m_overflow;
wxAttrOverflowMode m_overflow;
wxGridCellRenderer* m_renderer; wxGridCellRenderer* m_renderer;
wxGridCellEditor* m_editor; wxGridCellEditor* m_editor;

View File

@@ -2133,6 +2133,9 @@ void wxGridCellAttr::MergeWith(wxGridCellAttr *mergefrom)
if ( !HasReadWriteMode() && mergefrom->HasReadWriteMode() ) if ( !HasReadWriteMode() && mergefrom->HasReadWriteMode() )
SetReadOnly(mergefrom->IsReadOnly()); SetReadOnly(mergefrom->IsReadOnly());
if (!HasOverflowMode() && mergefrom->HasOverflowMode() )
SetReadOnly(mergefrom->GetOverflow());
SetDefAttr(mergefrom->m_defGridAttr); SetDefAttr(mergefrom->m_defGridAttr);
} }