Debian Codegraph @

libSoXt/src/motif/SoXtTfSldrSet.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990-93 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.2 $
44 |
45 | Classes:
46 | Subclass of SoXtSliderSet that acts on transform nodes
47 | SoXtTransformSliderSet
48 |
49 | Author(s) : Paul Isaacs
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55
56 //--------------------------------Include------------------------------
57 #include <inttypes.h>
58 #include "SoXtSliderModules.h"
59 #include <Inventor/Xt/SoXtTransformSliderSet.h>
60 #include <X11/StringDefs.h>
61 #include <Xm/Form.h>
62
63 static XtResource _borderWidthResource[] = {
64 { XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof( unsigned short),
65 0, XtRImmediate, (XtPointer) SLIDER_SET_DEFAULT_BORDER_WIDTH }
66 };
67
68 ////////////////////////////////////////////////////////////////////////
69 //
70 // Public constructor - build the widget right now
71 //
72 SoXtTransformSliderSet::SoXtTransformSliderSet(
73 Widget parent,
74 const char *name,
75 SbBool buildInsideParent,
76 SoNode *newEditNode)
77 : SoXtSliderSet(
78 parent,
79 name,
80 buildInsideParent,
81 newEditNode)
82 //
83 ////////////////////////////////////////////////////////////////////////
84 {
85 // In this case, this component is what the app wants, so buildNow = TRUE
86 constructorCommon(TRUE);
87 }
88
89 SoXtTransformSliderSet::~SoXtTransformSliderSet() {}
90
91 ////////////////////////////////////////////////////////////////////////
92 //
93 // SoEXTENDER constructor - the subclass tells us whether to build or not
94 //
95 SoXtTransformSliderSet::SoXtTransformSliderSet(
96 Widget parent,
97 const char *name,
98 SbBool buildInsideParent,
99 SoNode *newEditNode,
100 SbBool buildNow)
101 : SoXtSliderSet(
102 parent,
103 name,
104 buildInsideParent,
105 newEditNode)
106 //
107 ////////////////////////////////////////////////////////////////////////
108 {
109 // In this case, this component may be what the app wants,
110 // or it may want a subclass of this component. Pass along buildNow
111 // as it was passed to us.
112 constructorCommon(buildNow);
113 }
114
115 ///////////////////////////////////////////////////////////////////////
116 //
117 // Description:
118 // Constructor for the SoXtTransformSliderSet. Creates the 5 slider modules
119 // that make up the editor. The base class constructor will create
120 // the container widget, etc.
121 // This constructor gives a default name.
122 // Use: public
123 void
124 SoXtTransformSliderSet::constructorCommon(SbBool buildNow)
125 //
126 //////////////////////////////////////////////////////////////////////
127 {
128 // Create the five modules used by a Transform editor.
129 _numSubComponents = 5;
130 _subComponentArray = new SoXtSliderSetBase* [ _numSubComponents ];
131
132 _subComponentArray[0] = NULL;
133 _subComponentArray[1] = NULL;
134 _subComponentArray[2] = NULL;
135 _subComponentArray[3] = NULL;
136 _subComponentArray[4] = NULL;
137
138 // Build the widget tree, and let SoXtComponent know about our base widget.
139 if (buildNow) {
140 Widget w = buildWidget(getParentWidget());
141 setBaseWidget(w);
142 }
143 }
144
145 Widget
146 SoXtTransformSliderSet::buildWidget(Widget parent)
147 {
148 Arg wargs[10];
149 Dimension newBorderWidth;
150 Widget theWidget;
151
152 _parentShellWidget = parent;
153
154 widget = XtCreateManagedWidget(getWidgetName(),xmFormWidgetClass, parent,NULL, 0);
155
156 _subComponentArray[0] = new SoXtTransSliderModule(widget);
157 _subComponentArray[1] = new SoXtScaleSliderModule(widget);
158 _subComponentArray[2] = new SoXtRotateSliderModule(widget);
159 _subComponentArray[3] = new SoXtScaleOrientationSliderModule(widget);
160 _subComponentArray[4] = new SoXtCenterSliderModule(widget);
161
162 for (int i = 0; i < _numSubComponents; i++ ) {
163 (( SoXtSliderModule *) _subComponentArray[i])->setEditor( this );
164 theWidget = _subComponentArray[i]->getWidget();
165 XtGetApplicationResources( theWidget, (XtPointer) &newBorderWidth,
166 _borderWidthResource, XtNumber( _borderWidthResource ),NULL, 0); XtSetArg( wargs[0], XmNborderWidth, newBorderWidth );
167 XtSetValues( theWidget, wargs, 1 );
168 }
169
170 updateLayout();
171
172 return widget;
173 }
174
175 //
176 // redefine those generic virtual functions
177 //
178 const char *
179 SoXtTransformSliderSet::getDefaultWidgetName() const
180 { return "SoXtTransformSliderSet"; }
181
182 const char *
183 SoXtTransformSliderSet::getDefaultTitle() const
184 { return "Transform Editor"; }
185
186 const char *
187 SoXtTransformSliderSet::getDefaultIconTitle() const
188 { return "Xf Editor"; }
189