Make it easier to switch between native and generic sample for testing purposes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44131 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -42,6 +42,7 @@ | |||||||
| #include "wx/timer.h"           // for wxStopWatch | #include "wx/timer.h"           // for wxStopWatch | ||||||
| #include "wx/colordlg.h"        // for wxGetColourFromUser | #include "wx/colordlg.h"        // for wxGetColourFromUser | ||||||
| #include "wx/settings.h" | #include "wx/settings.h" | ||||||
|  | #include "wx/sysopt.h" | ||||||
|  |  | ||||||
| #include "listtest.h" | #include "listtest.h" | ||||||
|  |  | ||||||
| @@ -91,6 +92,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |||||||
|     EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze) |     EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze) | ||||||
|     EVT_MENU(LIST_THAW, MyFrame::OnThaw) |     EVT_MENU(LIST_THAW, MyFrame::OnThaw) | ||||||
|     EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines) |     EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines) | ||||||
|  |     EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric) | ||||||
|  |  | ||||||
|     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo) |     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo) | ||||||
|     EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel) |     EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel) | ||||||
| @@ -222,6 +224,9 @@ MyFrame::MyFrame(const wxChar *title) | |||||||
|     menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, _T("Small icon &view with text\tF6")); |     menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, _T("Small icon &view with text\tF6")); | ||||||
|     menuView->Append(LIST_VIRTUAL_VIEW, _T("&Virtual view\tF7")); |     menuView->Append(LIST_VIRTUAL_VIEW, _T("&Virtual view\tF7")); | ||||||
|     menuView->Append(LIST_SMALL_VIRTUAL_VIEW, _T("Small virtual vie&w\tF8")); |     menuView->Append(LIST_SMALL_VIRTUAL_VIEW, _T("Small virtual vie&w\tF8")); | ||||||
|  | #ifdef __WXMAC__ | ||||||
|  |     menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, _T("Mac: Use Generic Control")); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|     wxMenu *menuList = new wxMenu; |     wxMenu *menuList = new wxMenu; | ||||||
|     menuList->Append(LIST_FOCUS_LAST, _T("&Make last item current\tCtrl-L")); |     menuList->Append(LIST_FOCUS_LAST, _T("&Make last item current\tCtrl-L")); | ||||||
| @@ -340,6 +345,11 @@ void MyFrame::OnToggleLines(wxCommandEvent& event) | |||||||
|     m_listCtrl->SetSingleStyle(wxLC_HRULES | wxLC_VRULES, event.IsChecked()); |     m_listCtrl->SetSingleStyle(wxLC_HRULES | wxLC_VRULES, event.IsChecked()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void MyFrame::OnToggleMacUseGeneric(wxCommandEvent& event) | ||||||
|  | { | ||||||
|  |     wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), event.IsChecked()); | ||||||
|  | } | ||||||
|  |  | ||||||
| void MyFrame::OnFocusLast(wxCommandEvent& WXUNUSED(event)) | void MyFrame::OnFocusLast(wxCommandEvent& WXUNUSED(event)) | ||||||
| { | { | ||||||
|     long index = m_listCtrl->GetItemCount() - 1; |     long index = m_listCtrl->GetItemCount() - 1; | ||||||
|   | |||||||
| @@ -136,6 +136,7 @@ protected: | |||||||
|     void OnFreeze(wxCommandEvent& event); |     void OnFreeze(wxCommandEvent& event); | ||||||
|     void OnThaw(wxCommandEvent& event); |     void OnThaw(wxCommandEvent& event); | ||||||
|     void OnToggleLines(wxCommandEvent& event); |     void OnToggleLines(wxCommandEvent& event); | ||||||
|  |     void OnToggleMacUseGeneric(wxCommandEvent& event); | ||||||
|  |  | ||||||
|     void OnUpdateShowColInfo(wxUpdateUIEvent& event); |     void OnUpdateShowColInfo(wxUpdateUIEvent& event); | ||||||
|     void OnUpdateToggleMultiSel(wxUpdateUIEvent& event); |     void OnUpdateToggleMultiSel(wxUpdateUIEvent& event); | ||||||
| @@ -203,6 +204,7 @@ enum | |||||||
|     LIST_FREEZE, |     LIST_FREEZE, | ||||||
|     LIST_THAW, |     LIST_THAW, | ||||||
|     LIST_TOGGLE_LINES, |     LIST_TOGGLE_LINES, | ||||||
|  |     LIST_MAC_USE_GENERIC, | ||||||
|  |  | ||||||
|     LIST_CTRL                   = 1000 |     LIST_CTRL                   = 1000 | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user