SHARE
TWEET

OTCMakerMain.cpp

Snowsz Sep 28th, 2015 9 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /***************************************************************
  2.  * Name:      OTCMakerMain.cpp
  3.  * Purpose:   Code for Application Frame
  4.  * Author:    Snowsz (snowsz10@hotmail.com)
  5.  * Created:   2015-09-28
  6.  * Copyright: Snowsz ()
  7.  * License:
  8.  **************************************************************/
  9.  
  10. #include "OTCMakerMain.h"
  11. #include <wx/msgdlg.h>
  12.  
  13. //(*InternalHeaders(OTCMakerDialog)
  14. #include <wx/settings.h>
  15. #include <wx/font.h>
  16. #include <wx/intl.h>
  17. #include <wx/string.h>
  18. //*)
  19.  
  20. //helper functions
  21. enum wxbuildinfoformat {
  22.     short_f, long_f };
  23.  
  24. wxString wxbuildinfo(wxbuildinfoformat format)
  25. {
  26.     wxString wxbuild(wxVERSION_STRING);
  27.  
  28.     if (format == long_f )
  29.     {
  30. #if defined(__WXMSW__)
  31.         wxbuild << _T("-Windows");
  32. #elif defined(__UNIX__)
  33.         wxbuild << _T("-Linux");
  34. #endif
  35.  
  36. #if wxUSE_UNICODE
  37.         wxbuild << _T("-Unicode build");
  38. #else
  39.         wxbuild << _T("-ANSI build");
  40. #endif // wxUSE_UNICODE
  41.     }
  42.  
  43.     return wxbuild;
  44. }
  45.  
  46. //(*IdInit(OTCMakerDialog)
  47. const long OTCMakerDialog::ID_STATICTEXT1 = wxNewId();
  48. const long OTCMakerDialog::ID_BUTTON1 = wxNewId();
  49. const long OTCMakerDialog::ID_STATICLINE1 = wxNewId();
  50. const long OTCMakerDialog::ID_BUTTON2 = wxNewId();
  51. //*)
  52.  
  53. BEGIN_EVENT_TABLE(OTCMakerDialog,wxDialog)
  54.     //(*EventTable(OTCMakerDialog)
  55.     //*)
  56. END_EVENT_TABLE()
  57.  
  58. OTCMakerDialog::OTCMakerDialog(wxWindow* parent,wxWindowID id)
  59. {
  60.     //(*Initialize(OTCMakerDialog)
  61.     Create(parent, id, _("wxWidgets app"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
  62.     BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
  63.     StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Welcome to\nwxWidgets"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
  64.     wxFont StaticText1Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
  65.     if ( !StaticText1Font.Ok() ) StaticText1Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
  66.     StaticText1Font.SetPointSize(20);
  67.     StaticText1->SetFont(StaticText1Font);
  68.     BoxSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
  69.     BoxSizer2 = new wxBoxSizer(wxVERTICAL);
  70.     Button1 = new wxButton(this, ID_BUTTON1, _("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
  71.     BoxSizer2->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4);
  72.     StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
  73.     BoxSizer2->Add(StaticLine1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4);
  74.     Button2 = new wxButton(this, ID_BUTTON2, _("Quit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
  75.     BoxSizer2->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4);
  76.     BoxSizer1->Add(BoxSizer2, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4);
  77.     SetSizer(BoxSizer1);
  78.     BoxSizer1->Fit(this);
  79.     BoxSizer1->SetSizeHints(this);
  80.  
  81.     Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&OTCMakerDialog::OnAbout);
  82.     Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&OTCMakerDialog::OnQuit);
  83.     //*)
  84. }
  85.  
  86. OTCMakerDialog::~OTCMakerDialog()
  87. {
  88.     //(*Destroy(OTCMakerDialog)
  89.     //*)
  90. }
  91.  
  92. void OTCMakerDialog::OnQuit(wxCommandEvent& event)
  93. {
  94.     Close();
  95. }
  96.  
  97. void OTCMakerDialog::OnAbout(wxCommandEvent& event)
  98. {
  99.     wxString msg = wxbuildinfo(long_f);
  100.     wxMessageBox(msg, _("Welcome to..."));
  101. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top