]> git.saurik.com Git - wxWidgets.git/blame - src/motif/mdi/doc/mdi.html
Added wxUSE_NUMBERDLG to setup.h; added some files to VC++ project files;
[wxWidgets.git] / src / motif / mdi / doc / mdi.html
CommitLineData
8704bf74
JS
1<HTML>
2
3<HEAD>
4<TITLE>Motif Multi-Document Interface (MDI)</TITLE>
0d57be45 5<LINK REV="made" HREF="mailto:ssadler@cisco.com">
8704bf74
JS
6</HEAD>
7
8<CENTER>
9<IMG SRC="pics/mdi.gif" ALT="[Class Structure]">
10<P><H2>
11<B>
12The Motif Multi-Document Interface
13</B>
14</H2>
15</CENTER>
16
17<P>
18The Motif Multi-Document Interface (MDI) is a collection of C++ classes
19that emulates the behavior of the Multi-Document Interface in Microsoft
20Windows. The MDI framework allows a user to view multiple documents (windows)
21constrained to a single parent window.
22
23<P>
24<HR SIZE = 4>
25
26<P>
27<B>
28C<FONT SIZE=-1>LASS</FONT>
29S<FONT SIZE=-1>TRUCTURE:</FONT>
30</B>
31
32<P>
33<IMG SRC="pics/classes.gif" ALT="[Class Structure]">
34
35<BR>
36Figure 1. Inheritance Graph for MDI classes
37
38<P>
39The <I>XsMDICanvas</I> is a self-contained component used to display and manage
40any number of child document windows. All documents windows are derived from
41the abstract base-class <I>XsMDIWindow</I>. To get the Motif-like functionality,
42document windows should be derived from the <I>XsMotifWindow</I> class.
43
44<P>
45<HR SIZE = 4>
46
47<P>
48<B>
49E<FONT SIZE=-1>XAMPLE:</FONT>
50</B>
51
52<P>
53The process of building and displaying a Multi-Document Interface using MDI
54consists of the following steps:
55
56<OL>
57<LI>Creating the application document(s)</LI>
58<LI>Creating the MDI canvas</LI>
59<LI>Adding the document(s) to the canvas</LI>
60</OL>
61
62<PRE>
63
64#include "XsMDICanvas.h"
65#include "XsMotifWindow.h"
66
67// Application document (derived from XsMotifWindow)
68
69class MyDocument : public XsMotifWindow {
70 public:
71 MyDocument (const char *name);
72 virtual ~MyDocument ( );
73 protected:
74 virtual void _buildClientArea (Widget parent);
75};
76
77void createCanvas (Widget parent) {
78
79// Create documents
80
81 MyDocument *doc1 = new MyDocument ("doc1");
82 MyDocument *doc2 = new MyDocument ("doc2");
83
84// Create the canvas
85
86 XsMDICanvas *canvas = new XsMDICanvas ("canvas", parent);
87
88// Add documents to canvas
89
90 canvas->add (doc1);
91 canvas->add (doc2);
92
93// Show the canvas
94
95 canvas->show ( );
96}
97
98</PRE>
99
100<P>
101In this example, the application document <I>MyDocument</I> is derived
102from <I>XsMotifWindow</I>. This provides a Motif-like window suitable for
103use with the <I>XsMDICanvas</I>.
104
105<P>
106Next, two <I>MyDocument</I> objects are created along with the <I>XsMDICanvas</I>.
107The two documents are then added to the canvas using the <I>add</I>
108member-function of the canvas. Lastly, the canvas is shown (managed)
109using the <I>show</I> member-function.
110
111<P>
112Creating the document <I>MyDocument</I> does not automatically create any
113widgets. Rather, it only initializes internal variables. The widgets are
114not created until the document is added to the canvas. The <I>XsMDICanvas</I>
115is responsible for calling <I>XsMotifWindow::_buildClientArea()</I> at an
116appropriate time. In this member-function, the application can create the
117actual contents of the document.
118
119<P>
120The member-function <I>_buildClientArea</I> is passed a widget to be used as
121the parent of the document contents. This parent widget is an unmanaged
122<I>XmForm</I> widget. The application is free to create whatever contents
123it needs as a child of the <I>XmForm</I> parent.
124
125<P>
126<HR SIZE = 4>
127
128<P>
129<B>
130C<FONT SIZE=-1>LASS</FONT>
131R<FONT SIZE=-1>EFERENCES:</FONT>
132</B>
133
134<P>
135Of the classes in the MDI package, only the following should be of
136interest to MDI library users:
137
138<UL>
139<LI> <A HREF="canvas.html"> XsMDICanvas </A> </LI>
140<LI> <A HREF="mwindow.html"> XsMotifWindow </A> </LI>
141</UL>
142
143<P>
144<HR SIZE = 4>
145
146<P>
147<B>
148E<FONT SIZE=-1>XPLORING</FONT>
149R<FONT SIZE=-1>ESOURCES:</FONT>
150</B>
151
152<P>
153The MDI classes support a number of different X-resources (please refer
154the the class manual pages for complete details). In order to get a feel
155for the customization capabilities of the MDI library, try running the
156test program (<I>MDItest</I>) with the following command-line options:
157
158<DL>
159<DD>MDItest -xrm "*showBorder:false"</DD>
160<DD>MDItest -xrm "*showTitle:false" -xrm "*showResize:false"</DD>
161<DD>MDItest -xrm "*showMenu:false" -xrm "*showMaximize:false"</DD>
162<DD>MDItest -xrm "*borderSize:4" -xrm "*buttonSize:14"</DD>
163<DD>MDItest -xrm "*lowerOnIconify:true" -xrm "*title:Hello World"</DD>
164</DL>
165
166<P>
167<HR SIZE = 4>
168
169<P>
170<B>
171A<FONT SIZE=-1>DDITIONAL</FONT>
172I<FONT SIZE=-1>INFORMATION:</FONT>
173</B>
174
175<P>
176The test program <I>MDItest.C</I> gives a complete example of an MDI
177application. It should serve as a good reference/example of the MDI library.
178
179</BODY>
180</HTML>
181
182