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:
@@ -1138,6 +1138,7 @@ public:
|
|||||||
wxString GetRowLabelValue( int row );
|
wxString GetRowLabelValue( int row );
|
||||||
wxString GetColLabelValue( int col );
|
wxString GetColLabelValue( int col );
|
||||||
wxColour GetGridLineColour() { return m_gridLineColour; }
|
wxColour GetGridLineColour() { return m_gridLineColour; }
|
||||||
|
wxColour GetCellHighlightColour() { return m_cellHighlightColour; }
|
||||||
|
|
||||||
void SetRowLabelSize( int width );
|
void SetRowLabelSize( int width );
|
||||||
void SetColLabelSize( int height );
|
void SetColLabelSize( int height );
|
||||||
@@ -1149,6 +1150,7 @@ public:
|
|||||||
void SetRowLabelValue( int row, const wxString& );
|
void SetRowLabelValue( int row, const wxString& );
|
||||||
void SetColLabelValue( int col, const wxString& );
|
void SetColLabelValue( int col, const wxString& );
|
||||||
void SetGridLineColour( const wxColour& );
|
void SetGridLineColour( const wxColour& );
|
||||||
|
void SetCellHighlightColour( const wxColour& );
|
||||||
|
|
||||||
void EnableDragRowSize( bool enable = TRUE );
|
void EnableDragRowSize( bool enable = TRUE );
|
||||||
void DisableDragRowSize() { EnableDragRowSize( FALSE ); }
|
void DisableDragRowSize() { EnableDragRowSize( FALSE ); }
|
||||||
@@ -1586,6 +1588,7 @@ protected:
|
|||||||
|
|
||||||
wxColour m_gridLineColour;
|
wxColour m_gridLineColour;
|
||||||
bool m_gridLinesEnabled;
|
bool m_gridLinesEnabled;
|
||||||
|
wxColour m_cellHighlightColour;
|
||||||
|
|
||||||
// common part of AutoSizeColumn/Row() and GetBestSize()
|
// common part of AutoSizeColumn/Row() and GetBestSize()
|
||||||
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE);
|
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE);
|
||||||
|
@@ -3284,6 +3284,7 @@ void wxGrid::Init()
|
|||||||
|
|
||||||
m_gridLineColour = wxColour( 128, 128, 255 );
|
m_gridLineColour = wxColour( 128, 128, 255 );
|
||||||
m_gridLinesEnabled = TRUE;
|
m_gridLinesEnabled = TRUE;
|
||||||
|
m_cellHighlightColour = m_gridLineColour;
|
||||||
|
|
||||||
m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
|
m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
|
||||||
m_winCapture = (wxWindow *)NULL;
|
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?
|
// 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
|
// for now, I just draw a thinner border than for the other ones, but
|
||||||
// it doesn't look really good
|
// 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.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
|
|
||||||
dc.DrawRectangle(rect);
|
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 )
|
void wxGrid::EnableGridLines( bool enable )
|
||||||
{
|
{
|
||||||
if ( enable != m_gridLinesEnabled )
|
if ( enable != m_gridLinesEnabled )
|
||||||
|
Reference in New Issue
Block a user