SOXTRESOURCE(3iv)
π SoXtResource β the manual page, but make it cute
okay bestie, welcome to SoXtResource(3IV) β yes that's the manual name, and yes it's giving "3IV" the whole time, we love a consistent section number π
πΈ NAME πΈ
SoXtResource β the little helper that goes and gets your X resources for SoXtComponents and widgets π
π¦ INHERITS FROM π¦
SoXtResource
β¨ SYNOPSIS β¨
#include <Inventor/Xt/SoXtResource.h>
Methods from class SoXtResource:
SoXtResource(Widget w)
~SoXtResource()
SbBool getResource(char *resName, char *resClass, SbColor &c)
SbBool getResource(char *resName, char *resClass, short &i)
SbBool getResource(char *resName, char *resClass, unsigned
short &u)
SbBool getResource(char *resName, char *resClass, char *&s)
SbBool getResource(char *resName, char *resClass, SbBool &b)
SbBool getResource(char *resName, char *resClass, float &f)
π DESCRIPTION π
so basically this class is your low-effort, high-reward way to grab X resource values for widgets and components. β¨ Instead of doing the whole standard Xt thing where you climb up a widget hierarchy with Xt calls, this class does its own traversal β and it does that on purpose, because it wants to give special care to widgets that are Inventor components. π«Ά
like, real example: the Inventor Material Editor top level widget is a Motif form widget, so its class name is XmForm. But SoXtResource knows the editor is an Inventor component, so it uses the class name that the editor itself provides (in this case "SoXtMaterialEditor") when it goes looking up resource values. no cap, it just knows. π
EXAMPLE:
SoXtResource xr( materialEditor->getWidget() );
xr.getResource("tile1Color", "Tile1Color", color);
xr.getResource("updateFrequency", "UpdateFrequency", freq);
π METHODS π
SoXtResource(Widget w)
~SoXtResource()
Constructor and destructor, the classic duo. π The constructor takes the widget it's gonna retrieve resource values for.
SbBool getResource(char *resName, char *resClass, SbColor &c)
SbBool getResource(char *resName, char *resClass, short &i)
SbBool getResource(char *resName, char *resClass, unsigned
short &u)
SbBool getResource(char *resName, char *resClass, char *&s)
SbBool getResource(char *resName, char *resClass, SbBool &b)
SbBool getResource(char *resName, char *resClass, float &f)
This hands you back the X resource value for the resource name and class you asked for. And the best part?? you do NOT need to specify the widget hierarchy β that gets computed automatically in the constructor. obsessed. πβ¨
π NOTES π
Components will typically look up their own resources during buildWidget(). π§ And here's the important bit, bestie: for a component to have its Inventor class name recognized by SoXtResource, it must call SoXtComponent::registerWidget() in its buildWidget() method. (This is done in every Inventor component.) So don't skip it, fr fr. π
β SEE ALSO β
- X Resources (
Xrm) - X Intrinsics (
Xt) SoXtSoXtComponent
okay that's the whole page, you ate it, go forth and resource your widgets π«Άπ
and that's a wrap on SoXtResource(3IV) β from the SoXtResource(3IV) manual, page footer and all, no date attached, just vibes and version numbers. ππ
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms