Small cleanup of wxGenericTreeCtrl-specific parts of the sample

Use HAS_GENERIC_TREECTRL for testing whether we're actually using it or
not instead of checking for USE_GENERIC_TREECTRL and then port names
with a native control, which was done inconsistently, as it included
wxQt in one place, but not the other one.

Also avoid repeating CreateButtonsImageList() declaration twice, as this
resulted in having unbalanced curly braces in this file, which was just
unpleasant.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-11-07 16:36:43 +00:00
parent 725c3d5608
commit 34a730f89c
2 changed files with 12 additions and 4 deletions

View File

@@ -748,7 +748,7 @@ void MyFrame::OnToggleAlternateStates(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnToggleButtons(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnToggleButtons(wxCommandEvent& WXUNUSED(event))
{ {
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #ifdef HAS_GENERIC_TREECTRL
if ( wxGetApp().ShowButtons() ) if ( wxGetApp().ShowButtons() )
{ {
m_treeCtrl->CreateButtonsImageList(-1); m_treeCtrl->CreateButtonsImageList(-1);
@@ -1064,9 +1064,9 @@ void MyTreeCtrl::CreateStateImageList(bool del)
AssignStateImageList(states); AssignStateImageList(states);
} }
#if USE_GENERIC_TREECTRL || (!defined(__WXMSW__) && !defined(__WXQT__))
void MyTreeCtrl::CreateButtonsImageList(int size) void MyTreeCtrl::CreateButtonsImageList(int size)
{ {
#ifdef HAS_GENERIC_TREECTRL
if ( size == -1 ) if ( size == -1 )
{ {
SetButtonsImageList(NULL); SetButtonsImageList(NULL);
@@ -1112,8 +1112,7 @@ void MyTreeCtrl::CreateButtonsImageList(int size)
AssignButtonsImageList(images); AssignButtonsImageList(images);
#else #else
void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size)) wxUnusedVar(size);
{
#endif #endif
} }

View File

@@ -8,6 +8,8 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// This can be defined to 1 to force using wxGenericTreeCtrl even on the
// platforms where the native controls would normally be used (wxMSW and wxQt).
#define USE_GENERIC_TREECTRL 0 #define USE_GENERIC_TREECTRL 0
#if USE_GENERIC_TREECTRL #if USE_GENERIC_TREECTRL
@@ -18,6 +20,13 @@
#endif #endif
#endif #endif
// This one is defined if we're actually using the generic control, either
// because it was explicitly requested above or because there is no other one
// on this platform anyhow.
#if USE_GENERIC_TREECTRL || (!defined(__WXMSW__) && !defined(__WXQT__))
#define HAS_GENERIC_TREECTRL
#endif
// Define a new application type // Define a new application type
class MyApp : public wxApp class MyApp : public wxApp
{ {