您的位置:首页 > 产品设计 > UI/UE

August 7th Tuesday (八月 七日 火曜日)

2007-09-10 20:11 423 查看
  How to write an application using documnet/view mode in wxWidgets?  There are the overall steps
involved in creating an application based on the document/view framework:

1. Define your own document and view classes, overriding a minimal set of member functions e.g.
for input/output, drawing and initialization.

2. Define any subwindows (such as a scrolled window) that are needed for the view(s). You may need
to route some events to views or documents, for example OnPaint needs to be routed to wxView::OnDraw.

3. Decide what style of interface you will use: Microsoft's MDI (multiple document child frames
surrounded by an overall frame), SDI (a separate, unconstrained frame for each document), or single-window
(one document open at a time, as in Windows Write).

4. Use the appropriate wxDocParentFrame and wxDocChildFrame classes. Construct an instance of wxDocParentFrame
in your wxApp::OnInit, and a wxDocChildFrame (if not single-window) when you initialize a view. Create
menus using standard menu ids (such as wxID_OPEN, wxID_PRINT).

5. Construct a single wxDocManager instance at the beginning of your wxApp::OnInit, and then as many
wxDocTemplate instances as necessary to define relationships between documents and views. For a simple
application, there will be just one wxDocTemplate.

  If you wish to implement Undo/Redo, you need to derive your own class(es) from wxCommand and use
wxCommandProcessor::Submit instead of directly executing code. The framework will take care of calling
Undo and Do functions as appropriate, so long as the wxID_UNDO and wxID_REDO menu items are defined in
the view menu.
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息