The Frame Class

team bbl


Let's look at the frame class MyFrame. A frame is a top-level window that contains other windows, and usually has a title bar and menu bar. Here's our simple frame class declaration that we will put after the declaration of MyApp:

 // Declare our main frame class class MyFrame : public wxFrame { public:     // Constructor     MyFrame(const wxString& title);     // Event handlers     void OnQuit(wxCommandEvent& event);     void OnAbout(wxCommandEvent& event); private:     // This class handles events     DECLARE_EVENT_TABLE() }; 

Our frame class has a constructor, two event handlers to link menu commands to C++ code, and a macro to tell wxWidgets that this class handles events.

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net