]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/mdi/lib/XsMDIWindow.C
Add some version checks to help compiling on OSX.
[wxWidgets.git] / src / motif / mdi / lib / XsMDIWindow.C
... / ...
CommitLineData
1/*
2 Copyright (C) 1996 Scott W. Sadler
3 All rights reserved.
4*/
5
6/*
7 XsMDIWindow.C
8
9 History
10 03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
11 Created
12*/
13
14// Includes
15
16#include <assert.h>
17#include <Xm/Xm.h>
18#include "XsMDIWindow.h"
19
20// Constructor
21
22XsMDIWindow::XsMDIWindow (const char *name) : XsComponent (name)
23{
24
25// Initialize
26
27 _clientArea = 0;
28 _parent = 0;
29
30// Initial size and placement
31
32 _initX = (Position)-1;
33 _initY = (Position)-1;
34 _initH = (Dimension)-1;
35 _initW = (Dimension)-1;
36 _placed = False;
37}
38
39// Destructor
40
41XsMDIWindow::~XsMDIWindow ( )
42{
43 // Empty
44}
45
46// raise
47
48void XsMDIWindow::raise ( )
49{
50 assert (_base != 0);
51 XRaiseWindow (XtDisplay (_base), XtWindow (_base));
52}
53
54// lower
55
56void XsMDIWindow::lower ( )
57{
58 assert (_base != 0);
59 XLowerWindow (XtDisplay (_base), XtWindow (_base));
60}
61
62// show
63
64void XsMDIWindow::show ( )
65{
66
67// Create the window (if necessary)
68
69 if (_base == 0)
70 {
71 assert (_parent != 0);
72 _createWindow (_parent);
73 }
74
75// Manage the client area
76
77 XtManageChild (_clientArea);
78
79// Configure the window position and size
80
81 if (_placed == False)
82 {
83 const int nargs = 4;
84 Arg args[nargs];
85 int n = 0;
86
87 if (_initX != (Position)-1)
88 {
89 XtSetArg (args[n], XmNx, _initX); n++;
90 }
91 if (_initY != (Position)-1)
92 {
93 XtSetArg (args[n], XmNy, _initY); n++;
94 }
95 if (_initW != (Dimension)-1)
96 {
97 XtSetArg (args[n], XmNwidth, _initW); n++;
98 }
99 if (_initH != (Dimension)-1)
100 {
101 XtSetArg (args[n], XmNheight, _initH); n++;
102 }
103
104 assert (n <= nargs);
105 XtSetValues (_base, args, n);
106
107 _placed = True;
108 }
109
110// Call the base class
111
112 XsComponent::show ( );
113}
114
115// setPosition
116
117void XsMDIWindow::setPosition (Position x, Position y)
118{
119 if (_base != 0)
120 XtVaSetValues (_base, XmNx, x, XmNy, y, NULL);
121 else
122 {
123 _initX = x;
124 _initY = y;
125 }
126}
127
128// setSize
129
130void XsMDIWindow::setSize (Dimension w, Dimension h)
131{
132 if (_base != 0)
133 XtVaSetValues (_base, XmNwidth, w, XmNheight, h, NULL);
134 else
135 {
136 _initW = w;
137 _initH = h;
138 }
139}
140
141// className
142
143const char* XsMDIWindow::className ( ) const
144{
145 return ("XsMDIWindow");
146}
147
148// _setWindowParent
149
150void XsMDIWindow::_setWindowParent (Widget p)
151{
152
153// This is called by the canvas to tell us who our parent is
154
155 _parent = p;
156}