| 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 | // -*- C++ -*- |
| 38 | |
| 39 | /* |
| 40 | * Copyright (C) 1990,91 Silicon Graphics, Inc. |
| 41 | * |
| 42 | _______________________________________________________________________ |
| 43 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 44 | | |
| 45 | | $Revision: 1.1.1.1 $ |
| 46 | | |
| 47 | | Description: |
| 48 | | This class provides an easy to use interface to get X resource |
| 49 | | values for a widget. Special care is taken for SoComponents. |
| 50 | | |
| 51 | | Author(s): David Mott |
| 52 | | |
| 53 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 54 | _______________________________________________________________________ |
| 55 | */ |
| 56 | |
| 57 | #ifndef _SO_XTRESOURCE_ |
| 58 | #define _SO_XTRESOURCE_cxx . . $ `libSoXt/include/Inventor/Xt/SoXtResource.h:58:9`! |
| 59 | |
| 60 | #include <X11/Intrinsic.h> |
| 61 | #include <X11/Xresource.h> |
| 62 | #include <Inventor/SbBasic.h>cxx . . $ `<file>/lib/database/include/Inventor/SbBasic.h`/ |
| 63 | #include <Inventor/SbColor.h>cxx . . $ `<file>/lib/database/include/Inventor/SbColor.h`/ |
| 64 | |
| 65 | class SoXtResourcecxx . . $ SoXtResource# { |
| 66 | public: |
| 67 | // pass in the widget for which X resource values are desired |
| 68 | SoXtResourcecxx . . $ SoXtResource#SoXtResource(cfa999c5a14729dd).(Widgetcxx . . $ Widget# w); |
| 69 | ~cxx . . $ SoXtResource#`~SoXtResource`(49f6e7a06ebc5aa8).SoXtResourcecxx . . $ SoXtResource#(); |
| 70 | |
| 71 | // |
| 72 | // These methods look up X resource values by calling XrmQGetResource. |
| 73 | // They return TRUE if successfully located the resource. |
| 74 | // |
| 75 | // NOTE: you do not have to specify the complete widget hierarchy. |
| 76 | // This is automatically performed by this class. Simply name the |
| 77 | // specific resource that should be searched for. The most efficient |
| 78 | // use of this class is to construct an instance for a widget, then |
| 79 | // call getResource repeatedly with different resource strings which |
| 80 | // are valid for the widget. |
| 81 | // |
| 82 | // For example: |
| 83 | // SoXtResource xr(colorEditor->getWidget()); |
| 84 | // xr.getResource("wysiwyg", "Wysiwyg", onOrOff); |
| 85 | // xr.getResource("colorSliders", "ColorSliders", rgbOrHsv); |
| 86 | // xr.getResource("updateFrequency", "UpdateFrequency", freq); |
| 87 | |
| 88 | // C-api: name=getCol |
| 89 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(b7e68862e8d98070).(char *resName, char *resClass, SbColorcxx . . $ SbColor# &c); |
| 90 | // C-api: name=getInt |
| 91 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(424496a1f3537c6c).(char *resName, char *resClass, short &i); |
| 92 | // C-api: name=getUShort |
| 93 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(8850e116f5de45dc).(char *resName, char *resClass, unsigned short &u); |
| 94 | // C-api: name=getStr |
| 95 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(982bcb294f844ec2).(char *resName, char *resClass, char *&s); |
| 96 | // C-api: name=getBool |
| 97 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(4970352a9cfeb17f).(char *resName, char *resClass, SbBoolcxx . . $ SbBool# &b); |
| 98 | // C-api: name=getFloat |
| 99 | SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(dc688b00e43c73cf).(char *resName, char *resClass, float &f); |
| 100 | |
| 101 | private: |
| 102 | XrmQuarkList nameListcxx . . $ SoXtResource#nameList.; |
| 103 | XrmQuarkList classListcxx . . $ SoXtResource#classList.; |
| 104 | int listSizecxx . . $ SoXtResource#listSize.; |
| 105 | Displaycxx . . $ Display# *displaycxx . . $ SoXtResource#display.; |
| 106 | |
| 107 | // These methods look up X resource values by calling XrmGetResource. |
| 108 | // e.g. getResource("*backgroundColor", "*BackgroundColor", c); |
| 109 | // They return TRUE if successfully located the resource. |
| 110 | |
| 111 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(e3697647de7b20d4).(Displaycxx . . $ Display# *, char *sName, char *sClass, SbColorcxx . . $ SbColor# &c); |
| 112 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(9cb8688f6acdee51).(Displaycxx . . $ Display# *, char *sName, char *sClass, short &i); |
| 113 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(84f36a01281db60c).(Displaycxx . . $ Display# *, char *sName, char *sClass, unsigned short &u); |
| 114 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(e96d1728f4dc2a33).(Displaycxx . . $ Display# *, char *sName, char *sClass, char *&s); |
| 115 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(8d734a54f6579e27).(Displaycxx . . $ Display# *, char *sName, char *sClass, SbBoolcxx . . $ SbBool# &b); |
| 116 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(f51577a1a51c1dd2).(Displaycxx . . $ Display# *, char *sName, char *sClass, float &f); |
| 117 | |
| 118 | |
| 119 | // These methods look up X resource values by calling XrmQGetResource. |
| 120 | // That is, they use XrmQuarks instead of strings. (A quark is an Xrm |
| 121 | // notion - it is simply a key into a hash table of strings.) |
| 122 | // They are used by SoXtResource for SoComponents. |
| 123 | // They return TRUE if successfully located the resource. |
| 124 | |
| 125 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(8b2d274a9a47558f).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, SbColorcxx . . $ SbColor# &c); |
| 126 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(601f2b9cbabe4767).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, short &i); |
| 127 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(a7f27340535452ad).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, unsigned short &u); |
| 128 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(c93aca91e8aebc6d).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, char *&s); |
| 129 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(29524767580e1157).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, SbBoolcxx . . $ SbBool# &b); |
| 130 | static SbBoolcxx . . $ SbBool# getResourcecxx . . $ SoXtResource#getResource(7b155d7b44068ba).(Displaycxx . . $ Display# *, XrmQuarkList qName, XrmQuarkList qClass, float &f); |
| 131 | }; |
| 132 | |
| 133 | #endif /* _SO_XTRESOURCE_ */ |