天空是藍色的

          做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe
          數據加載中……
          Minimal wxWidgets sample~~

          /////////////////////////////////////////////////////////////////////////////
          // Name:??????? minimal.cpp
          // Purpose:???? Minimal wxWidgets sample
          // Author:????? Julian Smart
          // Modified by:
          // Created:???? 04/01/98
          // RCS-ID:????? $Id: minimal.cpp,v 1.67 2005/02/20 16:14:03 JS Exp $
          // Copyright:?? (c) Julian Smart
          // Licence:???? wxWindows licence
          /////////////////////////////////////////////////////////////////////////////

          // ============================================================================
          // declarations
          // ============================================================================

          // ----------------------------------------------------------------------------
          // headers
          // ----------------------------------------------------------------------------

          // For compilers that support precompilation, includes "wx/wx.h".
          #include <string>
          #include <iostream>
          #include "wx/wxprec.h"

          #ifdef __BORLANDC__
          ??? #pragma hdrstop
          #endif

          // for all others, include the necessary headers (this file is usually all you
          // need because it includes almost all "standard" wxWidgets headers)
          #ifndef WX_PRECOMP
          ??? #include "wx/wx.h"
          #endif
          // ----------------------------------------------------------------------------
          // resources
          // ----------------------------------------------------------------------------

          // the application icon (under Windows and OS/2 it is in resources and even
          // though we could still include the XPM here it would be unused)
          #if !defined(__WXMSW__) && !defined(__WXPM__)
          ??? #include "sample.xpm"
          #endif

          // ----------------------------------------------------------------------------
          // private classes
          // ----------------------------------------------------------------------------

          // Define a new application type, each program should derive a class from wxApp
          class MyApp : public wxApp
          {
          public:
          ??? // override base class virtuals
          ??? // ----------------------------

          ??? // this one is called on application startup and is a good place for the app
          ??? // initialization (doing it here and not in the ctor allows to have an error
          ??? // return: if OnInit() returns false, the application terminates)
          ??? virtual bool OnInit();
          };

          // Define a new frame type: this is going to be our main frame
          class MyFrame : public wxFrame
          {
          public:
          ??? // ctor(s)
          ??? MyFrame(const wxString& title);
          ?wxButton *WxButton1;
          ??? wxTextCtrl *wxTextCtrl1;
          ??????? wxTextCtrl *wxTextCtrl2;
          ??? // event handlers (these functions should _not_ be virtual)
          ??? void OnQuit(wxCommandEvent& event);
          ??? void OnAbout(wxCommandEvent& event);
          void WxButton1Click(wxCommandEvent& event);
          private:
          ??? // any class wishing to process wxWidgets events must use this macro
          ??? DECLARE_EVENT_TABLE()
          };

          // ----------------------------------------------------------------------------
          // constants
          // ----------------------------------------------------------------------------

          // IDs for the controls and the menu commands
          enum
          {
          ?ID_WXBUTTON1 = 1001,
          ??? // menu items
          ???
          ??? Minimal_Quit = wxID_EXIT,

          ??? // it is important for the id corresponding to the "About" command to have
          ??? // this standard value as otherwise it won't be handled properly under Mac
          ??? // (where it is special and put into the "Apple" menu)
          ??? Minimal_About = wxID_ABOUT

          };

          // ----------------------------------------------------------------------------
          // event tables and other macros for wxWidgets
          // ----------------------------------------------------------------------------

          // the event tables connect the wxWidgets events with the functions (event
          // handlers) which process them. It can be also done at run-time, but for the
          // simple menu events like this the static method is much simpler.
          BEGIN_EVENT_TABLE(MyFrame, wxFrame)
          ??? EVT_MENU(Minimal_Quit,? MyFrame::OnQuit)
          ??? EVT_MENU(Minimal_About, MyFrame::OnAbout)
          ??? EVT_BUTTON(ID_WXBUTTON1,MyFrame::WxButton1Click)
          END_EVENT_TABLE()

          // Create a new application object: this macro will allow wxWidgets to create
          // the application object during program execution (it's better than using a
          // static object for many reasons) and also implements the accessor function
          // wxGetApp() which will return the reference of the right type (i.e. MyApp and
          // not wxApp)
          IMPLEMENT_APP(MyApp)

          // ============================================================================
          // implementation
          // ============================================================================

          // ----------------------------------------------------------------------------
          // the application class
          // ----------------------------------------------------------------------------

          // 'Main program' equivalent: the program execution "starts" here
          bool MyApp::OnInit()
          {
          ??? // create the main application window
          ??? MyFrame *frame = new MyFrame(_T("helloworld-test"));

          ??? // and show it (the frames, unlike simple controls, are not shown when
          ??? // created initially)
          ??? frame->Show(true);

          ??? // success: wxApp::OnRun() will be called which will enter the main message
          ??? // loop and the application will run. If we returned false here, the
          ??? // application would exit immediately.
          ??? return true;
          }

          // ----------------------------------------------------------------------------
          // main frame
          // ----------------------------------------------------------------------------

          // frame constructor
          MyFrame::MyFrame(const wxString& title)
          ?????? : wxFrame(NULL, wxID_ANY, title)
          {

          ??? // set the frame icon
          ??? SetIcon(wxICON(sample));

          #if wxUSE_MENUS
          ??? wxMenu *fileMenu = new wxMenu;
          ??? wxMenu *helpMenu = new wxMenu;
          ??? helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog"));

          ??? fileMenu->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));


          ??? wxMenuBar *menuBar = new wxMenuBar();
          ??? menuBar->Append(fileMenu, _T("&系統"));
          ??? menuBar->Append(helpMenu, _T("&幫助"));

          ??? // ... and attach this menu bar to the frame
          ??? SetMenuBar(menuBar);
          ??
          #endif // wxUSE_MENUS

          #if wxUSE_STATUSBAR
          ??? // create a status bar just for fun (by default with 1 pane only)
          ??? CreateStatusBar(2);
          ??? SetStatusText(_T("helloworld-test"));
          #endif // wxUSE_STATUSBAR
          ?wxPanel* p = new wxPanel(this, -1);
          ? ?wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
          ? ?
          ? ?
          /*? ? topsizer->Add(
          ??? new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_RIGHT).") ),
          ??? wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));


          ? topsizer->Add(
          ??? new wxTextCtrl( p, wxID_ANY, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
          ??? wxSizerFlags(1).Expand().Border(wxALL, 5));


          ? wxBoxSizer *statsizer = new wxStaticBoxSizer(
          ??? new wxStaticBox(p, wxID_ANY, _T("A wxStaticBoxSizer")), wxVERTICAL );
          ? statsizer->Add(
          ??? new wxStaticText(p, wxID_ANY, _T("And some TEXT inside it")),
          ??? wxSizerFlags().Center().Border(wxALL, 30));
          ? topsizer->Add(
          ??? statsizer,
          ??? wxSizerFlags(1).Expand().Border(wxALL, 10));*/
          ? ?
          ? ?
          ??? wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
          ???
          ??? gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Label")),
          ?????????????????? wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
          ?????????????????? wxTextCtrl1 = new wxTextCtrl(p, wxID_ANY, _T(""));
          ??? gridsizer->Add(wxTextCtrl1,
          ?????????????????? wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
          ??? gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Another label")),
          ?????????????????? wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
          ??????????????????
          ?????????????????? wxTextCtrl2 = new wxTextCtrl(p, wxID_ANY, _T(""));
          ??????????????????
          ??? gridsizer->Add(wxTextCtrl2,
          ?????????????????? wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
          ??? gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Final label")),
          ?????????????????? wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
          ??? gridsizer->Add(new wxTextCtrl(p, wxID_ANY, _T("")),
          ?????????????????? wxSizerFlags().Align(wxGROW | wxALIGN_CENTER_VERTICAL));
          ???? topsizer->Add(
          ??????? gridsizer,
          ??????? wxSizerFlags().Proportion(1).Expand().Border(wxALL, 10));
          ???????
          ???? wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
          ? button_box->Add(
          ???? new wxButton( p, wxID_ANY, _T("Two buttons in a box") ),
          ???? wxSizerFlags().Border(wxALL, 7));
          ????
          ?
          ? ?WxButton1 = new wxButton(p, ID_WXBUTTON1, _T("WxButton1"), wxPoint(142,184), wxSize(75,25), 0, wxDefaultValidator, wxT("WxButton1"));
          ?
          ?????? button_box->Add(WxButton1,? wxSizerFlags().Border(wxALL, 7));
          ? button_box->Add(
          ???? new wxButton( p, wxID_ANY, _T("(wxCENTER)") ),
          ???? wxSizerFlags().Border(wxALL, 7));

          ? topsizer->Add(button_box, wxSizerFlags().Center());

          ? p->SetSizer( topsizer );
          ?

          ? ??? topsizer->SetSizeHints( this );
          ???

          }


          // event handlers

          void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
          {
          ??? // true is to force the frame to close
          ??? Close(true);
          }

          void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
          {
          ??? wxString msg;
          ??? msg.Printf( _T("helloworld-test.\n")
          ??????????????? _T("helloworld-test"));
          ???????????????

          ??? wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this);
          }
          void MyFrame::WxButton1Click(wxCommandEvent&? WXUNUSED(event))
          {
          ?


          ?wxString n1 = wxTextCtrl1->GetValue();
          ?wxString n2 = wxTextCtrl1->GetValue();
          ?std::string nx = (std::string)n1;
          ?std::cout << nx <<std::endl;
          ?wxString msg;
          ?msg.Printf( _T(n1));

          ??? wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this);
          }

          posted on 2006-05-15 00:00 bluesky 閱讀(3786) 評論(1)  編輯  收藏 所屬分類: C/C++

          評論

          # re: Minimal wxWidgets sample~~ 2016-06-14 15:10 http://www.sosirradies31.fr

          I was going through a big loss in my online business but since.
            回復  更多評論    
          主站蜘蛛池模板: 通海县| 界首市| 弥勒县| 全南县| 二手房| 晋州市| 屯门区| 惠水县| 加查县| 九龙县| 台中县| 西和县| 聊城市| 宜城市| 四平市| 辉南县| 富宁县| 林芝县| 神农架林区| 乳山市| 安化县| 开封县| 来凤县| 潜山县| 汝南县| 宁都县| 和政县| 平阳县| 霍山县| 介休市| 瓮安县| 海伦市| 个旧市| 新巴尔虎右旗| 宣化县| 靖安县| 安国市| 大冶市| 邵阳县| 安塞县| 会同县|