Methods to change the cell highlight colour

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-05-05 15:00:00 +00:00
parent 10c16e31a6
commit 61471de76f
2 changed files with 20 additions and 1 deletions

View File

@@ -1138,6 +1138,7 @@ public:
wxString GetRowLabelValue( int row );
wxString GetColLabelValue( int col );
wxColour GetGridLineColour() { return m_gridLineColour; }
wxColour GetCellHighlightColour() { return m_cellHighlightColour; }
void SetRowLabelSize( int width );
void SetColLabelSize( int height );
@@ -1149,6 +1150,7 @@ public:
void SetRowLabelValue( int row, const wxString& );
void SetColLabelValue( int col, const wxString& );
void SetGridLineColour( const wxColour& );
void SetCellHighlightColour( const wxColour& );
void EnableDragRowSize( bool enable = TRUE );
void DisableDragRowSize() { EnableDragRowSize( FALSE ); }
@@ -1586,6 +1588,7 @@ protected:
wxColour m_gridLineColour;
bool m_gridLinesEnabled;
wxColour m_cellHighlightColour;
// common part of AutoSizeColumn/Row() and GetBestSize()
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE);

View File

@@ -3284,6 +3284,7 @@ void wxGrid::Init()
m_gridLineColour = wxColour( 128, 128, 255 );
m_gridLinesEnabled = TRUE;
m_cellHighlightColour = m_gridLineColour;
m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
m_winCapture = (wxWindow *)NULL;
@@ -5503,7 +5504,7 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr )
// hmmm... what could we do here to show that the cell is disabled?
// for now, I just draw a thinner border than for the other ones, but
// it doesn't look really good
dc.SetPen(wxPen(m_gridLineColour, attr->IsReadOnly() ? 1 : 3, wxSOLID));
dc.SetPen(wxPen(m_cellHighlightColour, attr->IsReadOnly() ? 1 : 3, wxSOLID));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect);
@@ -6972,6 +6973,21 @@ void wxGrid::SetGridLineColour( const wxColour& colour )
}
}
void wxGrid::SetCellHighlightColour( const wxColour& colour )
{
if ( m_cellHighlightColour != colour )
{
m_cellHighlightColour = colour;
wxClientDC dc( m_gridWin );
PrepareDC( dc );
wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords);
DrawCellHighlight(dc, attr);
attr->DecRef();
}
}
void wxGrid::EnableGridLines( bool enable )
{
if ( enable != m_gridLinesEnabled )