Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoXtResource.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : David Mott (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef _WIN32
51# include <Inventor/Win/SoWinResource.h>
52#else // _WIN32
53
54#ifndef _SO_XTRESOURCE_
55#define _SO_XTRESOURCE_
56
57#include <X11/Intrinsic.h>
58#include <X11/Xresource.h>
59#include <Inventor/SbBasic.h>
60#include <Inventor/SbColor.h>
61#include <Inventor/Xt/SoXtDef.h>
62
102 public:
107 SoXtResource(SoWidget w);
112
113 //
114 // These methods look up X resource values by calling XrmQGetResource.
115 // They return TRUE if successfully located the resource.
116 //
117 // NOTE: you do not have to specify the complete widget hierarchy.
118 // This is automatically performed by this class. Simply name the
119 // specific resource that should be searched for. The most efficient
120 // use of this class is to construct an instance for a widget, then
121 // call getResource repeatedly with different resource strings which
122 // are valid for the widget.
123 //
124 // For example:
125 // SoXtResource xr(colorEditor->getWidget());
126 // xr.getResource("wysiwyg", "Wysiwyg", onOrOff);
127 // xr.getResource("colorSliders", "ColorSliders", rgbOrHsv);
128 // xr.getResource("updateFrequency", "UpdateFrequency", freq);
129
135 SbBool getResource(char *resName, char *resClass, SbColor &c);
141 SbBool getResource(char *resName, char *resClass, short &i);
147 SbBool getResource(char *resName, char *resClass, unsigned short &u);
153 SbBool getResource(char *resName, char *resClass, char *&s);
159 SbBool getResource(char *resName, char *resClass, SbBool &b);
165 SbBool getResource(char *resName, char *resClass, float &f);
166
167 private:
168 XrmQuarkList nameList;
169 XrmQuarkList classList;
170 int listSize;
171 Display *display;
172
173 // These methods look up X resource values by calling XrmGetResource.
174 // e.g. getResource("*backgroundColor", "*BackgroundColor", c);
175 // They return TRUE if successfully located the resource.
176
177 static SbBool getResource(Display *, char *sName, char *sClass, SbColor &c);
178 static SbBool getResource(Display *, char *sName, char *sClass, short &i);
179 static SbBool getResource(Display *, char *sName, char *sClass, unsigned short &u);
180 static SbBool getResource(Display *, char *sName, char *sClass, char *&s);
181 static SbBool getResource(Display *, char *sName, char *sClass, SbBool &b);
182 static SbBool getResource(Display *, char *sName, char *sClass, float &f);
183
184
185 // These methods look up X resource values by calling XrmQGetResource.
186 // That is, they use XrmQuarks instead of strings. (A quark is an Xrm
187 // notion - it is simply a key into a hash table of strings.)
188 // They are used by SoXtResource for SoComponents.
189 // They return TRUE if successfully located the resource.
190
191 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, SbColor &c);
192 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, short &i);
193 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, unsigned short &u);
194 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, char *&s);
195 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, SbBool &b);
196 static SbBool getResource(Display *, XrmQuarkList qName, XrmQuarkList qClass, float &f);
197
198};
199
200#endif /* _SO_XTRESOURCE_ */
201
202#endif // _WIN32
203
204
Color vector class.
Definition SbColor.h:82
Used to retrieve X resources for SoXt components and widgets .
~SoXtResource()
Destructor.
SbBool getResource(char *resName, char *resClass, SbBool &b)
Returns the X resource value for the specified resource name and class.
SbBool getResource(char *resName, char *resClass, unsigned short &u)
Returns the X resource value for the specified resource name and class.
SbBool getResource(char *resName, char *resClass, char *&s)
Returns the X resource value for the specified resource name and class.
SbBool getResource(char *resName, char *resClass, SbColor &c)
Returns the X resource value for the specified resource name and class.
SbBool getResource(char *resName, char *resClass, short &i)
Returns the X resource value for the specified resource name and class.
SbBool getResource(char *resName, char *resClass, float &f)
Returns the X resource value for the specified resource name and class.
SoXtResource(SoWidget w)
Constructor.
int SbBool
Boolean type.
Definition SbBase.h:87