writing a wxwidgets application: a rough guideto set a wxwidgets application going, you will need to derive a wxapp class and override wxapp::oninit. an application must have a top-level wxframe or wxdialog window. each frame may contain one or more instances of classes such as wxpanel, wxsplitterwindow or other windows and controls. a frame can have a wxmenubar, a wxtoolbar, a status line, and a wxicon for when the frame is iconized. a wxpanel is used to place controls (classes derived from wxcontrol) which are used for user interaction. examples of controls are wxbutton, wxcheckbox, wxchoice, wxlistbox, wxradiobox, wxslider. instances of wxdialog can also be used for controls and they have the advantage of not requiring a separate frame. instead of creating a dialog box and populating it with items, it is possible to choose one of the convenient common dialog classes, such as wxmessagedialog and wxfiledialog. you never draw directly onto a window - you use a device context (dc). wxdc is the base for wxclientdc, wxpaintdc, wxmemorydc, wxpostscriptdc, wxmemorydc, wxmetafiledc and wxprinterdc. if your drawing functions have wxdc as a parameter, you can pass any of these dcs to the function, and thus use the same code to draw to several different devices. you can draw using the member functions of wxdc, such as wxdc::drawline and wxdc::drawtext. control colour on a window (wxcolour) with brushes (wxbrush) and pens (wxpen). to intercept events, you add a declare_event_table macro to the window class declaration, and put a begin_event_table ... end_event_table block in the implementation file. between these macros, you add event macros which map the event (such as a mouse click) to a member function. these might override predefined event handlers such as for wxkeyevent and wxmouseevent. most modern applications will have an on-line, hypertext help system; for this, you need wxhelp and the wxhelpcontroller class to control wxhelp. gui applications aren't all graphical wizardry. list and hash table needs are catered for by wxlist and wxhashmap. you will undoubtedly need some platform-independent file functions, and you may find it handy to maintain and search a list of paths using wxpathlist. there's a miscellany of operating system and other functions. see also classes by category for a list of classes.
|