Use wxCompositeWindow for generic wxDataViewCtrl implementation

This makes several methods that didn't have any effect before work
correctly, including SetToolTip(), whose effect is now shown in the
sample, but also SetCursor() and SetLayoutDirection().

Some methods would now actually work too well: SetForegroundColour() and
SetBackgroundColour() implementations in wxCompositeWindow apply to all
sub-windows, but in wxDataViewCtrl they are only supposed to affect the
items, but not the header, so we need to override them to prevent the
base class version from being used. It is still preferable to explicitly
disable these two methods and inherit all the other ones (including any
possibly added in the future) from wxCompositeWindow to implementing all
the methods manually in wxDataViewCtrl itself.
This commit is contained in:
Vadim Zeitlin
2021-05-23 14:14:29 +01:00
parent fa00fd24f0
commit 3ed930c736
3 changed files with 51 additions and 10 deletions

View File

@@ -617,9 +617,6 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
wxSizer *firstPanelSz = new wxBoxSizer( wxVERTICAL );
m_ctrl[Page_Music]->SetMinSize(wxSize(-1, 200));
firstPanelSz->Add(m_ctrl[Page_Music], 1, wxGROW|wxALL, 5);
firstPanelSz->Add(
new wxStaticText(firstPanel, wxID_ANY, "Most of the cells above are editable!"),
0, wxGROW|wxALL, 5);
firstPanelSz->Add(button_sizer);
firstPanelSz->Add(sizerCurrent);
firstPanel->SetSizerAndFit(firstPanelSz);
@@ -837,6 +834,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
// select initially the ninth symphony:
m_ctrl[Page_Music]->Select(m_music_model->GetNinthItem());
m_ctrl[Page_Music]->SetToolTip("You may edit most of the cells here!");
}
break;