Update indentation in native dialog sample

This commit is contained in:
Maarten Bent
2020-10-21 00:57:42 +02:00
parent a942dc8a76
commit c2819c8d38
2 changed files with 35 additions and 35 deletions

View File

@@ -35,45 +35,45 @@ wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
if ( !wxApp::OnInit() ) if ( !wxApp::OnInit() )
return false; return false;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(NULL, wxID_ANY, "wxWidgets Native Dialog Sample", wxDefaultPosition, wxDefaultSize); MyFrame* frame = new MyFrame(NULL, wxID_ANY, "wxWidgets Native Dialog Sample", wxDefaultPosition, wxDefaultSize);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
frame->CreateStatusBar(2); frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu* file_menu = new wxMenu;
file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource"); file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource");
file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program"); file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar* menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File"); menu_bar->Append(file_menu, "&File");
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
// Make a panel // Make a panel
frame->panel = new wxWindow(frame, wxID_ANY); frame->panel = new wxWindow(frame, wxID_ANY);
frame->Show(true); frame->Show(true);
return true; return true;
} }
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1) EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size): MyFrame::MyFrame(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size) :
wxFrame(parent, id, title, pos, size) wxFrame(parent, id, title, pos, size)
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -82,19 +82,19 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
Close(true); Close(true);
} }
void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
{ {
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
MyDialog dialog; MyDialog dialog;
if (dialog.LoadNativeDialog(this, "dialog1")) if ( dialog.LoadNativeDialog(this, "dialog1") )
{ {
dialog.ShowModal(); dialog.ShowModal();
} }
#else #else
wxMessageBox("No native dialog support","Platform limitation"); wxMessageBox("No native dialog support", "Platform limitation");
#endif #endif
} }

View File

@@ -9,31 +9,31 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Define a new application // Define a new application
class MyApp: public wxApp class MyApp : public wxApp
{ {
public: public:
MyApp(void){} MyApp(void) {}
bool OnInit(void) wxOVERRIDE; bool OnInit(void) wxOVERRIDE;
}; };
class MyFrame: public wxFrame class MyFrame : public wxFrame
{ {
public: public:
wxWindow *panel; wxWindow* panel;
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnTest1(wxCommandEvent& event); void OnTest1(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();
}; };
class MyDialog : public wxDialog class MyDialog : public wxDialog
{ {
public: public:
void OnOk(wxCommandEvent& event); void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event); void OnCancel(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();
}; };
#define RESOURCE_QUIT 4 #define RESOURCE_QUIT 4