mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Fix wxGrid handling of system color change
Fix wxGrid for system color change for colors that were assigned defaults in Init(), and therefore did not update. These colors are now determined as needed during drawing. The grid sample "Colours" menu gets additional commands so you can set all these colors. Closes #26729.
This commit is contained in:
committed by
Vadim Zeitlin
parent
95a47a88a9
commit
58dfc19c96
@@ -340,6 +340,10 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame )
|
||||
|
||||
EVT_MENU( ID_SET_CELL_FG_COLOUR, GridFrame::SetCellFgColour )
|
||||
EVT_MENU( ID_SET_CELL_BG_COLOUR, GridFrame::SetCellBgColour )
|
||||
EVT_MENU( ID_SET_CELL_HL_COLOUR, GridFrame::SetCellHighlightColour)
|
||||
EVT_MENU( ID_SET_SELECTION_FG_COLOUR, GridFrame::SetSelectionFgColour)
|
||||
EVT_MENU( ID_SET_SELECTION_BG_COLOUR, GridFrame::SetSelectionBgColour)
|
||||
EVT_MENU( ID_SET_FROZEN_BORDER, GridFrame::SetFrozenBorderColour)
|
||||
|
||||
EVT_MENU( wxID_ABOUT, GridFrame::OnAbout )
|
||||
EVT_MENU( wxID_CLEAR, GridFrame::OnClear )
|
||||
@@ -531,6 +535,10 @@ GridFrame::GridFrame()
|
||||
colMenu->Append( ID_GRIDLINECOLOUR, "&Grid line colour..." );
|
||||
colMenu->Append( ID_SET_CELL_FG_COLOUR, "Set cell &foreground colour..." );
|
||||
colMenu->Append( ID_SET_CELL_BG_COLOUR, "Set cell &background colour..." );
|
||||
colMenu->Append( ID_SET_CELL_HL_COLOUR, "Set cell &highlight colour..." );
|
||||
colMenu->Append( ID_SET_SELECTION_FG_COLOUR, "Set selection f&oreground colour..." );
|
||||
colMenu->Append( ID_SET_SELECTION_BG_COLOUR, "Set selection b&ackground colour..." );
|
||||
colMenu->Append( ID_SET_FROZEN_BORDER, "Set f&rozen border colour..." );
|
||||
|
||||
wxMenu *editMenu = new wxMenu;
|
||||
editMenu->Append( ID_INSERTROW, "Insert &rows\tCtrl+I" );
|
||||
@@ -1631,6 +1639,46 @@ void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) )
|
||||
}
|
||||
}
|
||||
|
||||
void GridFrame::SetCellHighlightColour(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxColour col = wxGetColourFromUser(this);
|
||||
if ( col.IsOk() )
|
||||
{
|
||||
grid->SetCellHighlightColour(col);
|
||||
grid->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void GridFrame::SetSelectionBgColour(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxColour col = wxGetColourFromUser(this);
|
||||
if ( col.IsOk() )
|
||||
{
|
||||
grid->SetSelectionBackground(col);
|
||||
grid->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void GridFrame::SetSelectionFgColour(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxColour col = wxGetColourFromUser(this);
|
||||
if ( col.IsOk() )
|
||||
{
|
||||
grid->SetSelectionForeground(col);
|
||||
grid->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void GridFrame::SetFrozenBorderColour(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxColour col = wxGetColourFromUser(this);
|
||||
if ( col.IsOk() )
|
||||
{
|
||||
grid->SetGridFrozenBorderColour(col);
|
||||
grid->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void GridFrame::DeselectCell(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
grid->DeselectCell(3, 1);
|
||||
|
||||
@@ -67,6 +67,10 @@ class GridFrame : public wxFrame
|
||||
|
||||
void SetCellFgColour(wxCommandEvent &);
|
||||
void SetCellBgColour(wxCommandEvent &);
|
||||
void SetCellHighlightColour(wxCommandEvent& event);
|
||||
void SetSelectionBgColour(wxCommandEvent& event);
|
||||
void SetSelectionFgColour(wxCommandEvent& event);
|
||||
void SetFrozenBorderColour(wxCommandEvent& event);
|
||||
|
||||
void InsertRow( wxCommandEvent& );
|
||||
void InsertCol( wxCommandEvent& );
|
||||
@@ -210,6 +214,10 @@ public:
|
||||
ID_SELNONE,
|
||||
ID_SET_CELL_FG_COLOUR,
|
||||
ID_SET_CELL_BG_COLOUR,
|
||||
ID_SET_CELL_HL_COLOUR,
|
||||
ID_SET_SELECTION_FG_COLOUR,
|
||||
ID_SET_SELECTION_BG_COLOUR,
|
||||
ID_SET_FROZEN_BORDER,
|
||||
ID_VTABLE,
|
||||
ID_BUGS_TABLE,
|
||||
ID_TABULAR_TABLE,
|
||||
|
||||
Reference in New Issue
Block a user