SoXtComponent(3IV)NAMESoXtComponent (SoXtComp) - abstract base class for all Inventor Xt
components
INHERITS FROMSoXtComponentSYNOPSIS
#include <Inventor_c/Xt/SoXtComponent.h>
typedef void SoXtComponentCB(void *userData, SoXtComponent
*comp)
typedef SoXtComponent SoXtComp
Functions from class SoXtComponent:
void SoXtCompShow(SoXtComp *this)
void SoXtCompHide(SoXtComp *this)
SbBool SoXtCompIsVisible(SoXtComp *this)
Widget SoXtCompGetWidget(const SoXtComp *this)
SbBool SoXtCompIsTopLevelShell(const SoXtComp *this)
Widget SoXtCompGetShellWidget(const SoXtComp *this)
Widget SoXtCompGetParentWidget(const SoXtComp *this)
void SoXtCompSetSize(SoXtComp *this, const SbVec2s *size)
SbVec2s SoXtCompGetSize(SoXtComp *this)
Display * SoXtCompGetDisplay(SoXtComp *this)
void SoXtCompSetTitle(SoXtComp *this, const char
*newTitle)
const char * SoXtCompGetTitle(const SoXtComp *this)
void SoXtCompSetIconTitle(SoXtComp *this, const char
*newIconTitle)
const char * SoXtCompGetIconTitle(const SoXtComp *this)
void SoXtCompSetWinCloseCB(SoXtComp *this, SoXtComponentCB
*func, void *data = NULL)
SoXtComponent * SoXtCompGetComp(Widget w)
const char * SoXtCompGetWidgetName(const SoXtComp *this)
const char * SoXtCompGetClassName(const SoXtComp *this)
DESCRIPTION
Abstract base class from which all Inventor Xt components are derived.
This class provides a basic C protocol for building and displaying Motif
components. Components are used to encapsulate some function or task into
a reusable package in the form of a Motif widget that can be used in any
Inventor Xt program. See the Example section on how to build and use
SoXtComponents.
FUNCTIONS
void SoXtCompShow(SoXtComp *this)
void SoXtCompHide(SoXtComp *this)
This shows and hides the component. If this is a topLevelShell
component, then show() will Realize and Map the window, otherwise it
Page 1SoXtComponent(3IV)
will simply Manage the widget. hide() calls the appropriate unmap or
unmanage routines.
In addition, show() will also pop the component window to the top
and de-iconify if necessary, to make sure the component is visible
by the user.
SbBool SoXtCompIsVisible(SoXtComp *this)
Returns TRUE if this component is mapped onto the screen. For a
component to be visible, it's widget and the shell containing this
widget must be mapped (which is FALSE when the component is
iconified).
Widget SoXtCompGetWidget(const SoXtComp *this)
This returns the base widget for this component. If the component
created its own shell, this returns the topmost widget beneath the
shell. Call getShellWidget() to obtain the shell.
SbBool SoXtCompIsTopLevelShell(const SoXtComp *this)
Widget SoXtCompGetShellWidget(const SoXtComp *this)
Returns TRUE if this component is a top level shell component (has
its own window). Subclasses may use this to decide if they are
allowed to resize themselves. Also method to return the shell widget
(NULL if the shell hasn't been created by this component).
Widget SoXtCompGetParentWidget(const SoXtComp *this)
Return the parent widget, be it a shell or not
void SoXtCompSetSize(SoXtComp *this, const SbVec2s *size)
SbVec2s SoXtCompGetSize(SoXtComp *this)
Convenience routines on the widget - setSize calls XtSetValue
Display * SoXtCompGetDisplay(SoXtComp *this)
Returns the X display associated with this components widget.
void SoXtCompSetTitle(SoXtComp *this, const char
*newTitle)
const char * SoXtCompGetTitle(const SoXtComp *this)
void SoXtCompSetIconTitle(SoXtComp *this, const char
*newIconTitle)
const char * SoXtCompGetIconTitle(const SoXtComp *this)
The window and icon title can be set for topLevelShell components or
components which are directly under a shell widget (i.e. components
which have their own window).
void SoXtCompSetWinCloseCB(SoXtComp *this, SoXtComponentCB
*func, void *data = NULL)
Sets which callback to call when the user closes this component
(double click in the upper left corner) - by default hide() is
called on this component, unless a callback is set to something
Page 2SoXtComponent(3IV)
other than NULL. A pointer to this class will be passed as the
callback data.
Note: this callback is supplied because the user may wish to delete
this component when it is closed.
SoXtComponent * SoXtCompGetComp(Widget w)
This returns the SoXtComponent for this widget. If the widget is not
an Inventor component, then NULL is returned.
const char * SoXtCompGetWidgetName(const SoXtComp *this)
const char * SoXtCompGetClassName(const SoXtComp *this)
Routines which return the widget name and the class name. The widget
name is passed to the build method. The class name is predefined by
each component. These names are used when retrieving X resource
values for the component.
EXAMPLE
This example shows how an Inventor component can be built inside a
program using the Xt widget set. The example uses the SoXtExaminerViewer
widget to view some simple geometry.
#include <Inventor_c/Xt/SoXt.h>
#include <Inventor_c/nodes/SoCone.h>
#include <Inventor_c/Xt/viewers/SoXtExaminerViewer.h>
void main(int argc, char **argv)
{
Widget myWindow;
SoXtExamVwr *myViewer;
/* Initialize Inventor and Xt, which must be done */
/* before any Inventor calls are made. */
myWindow = SoXtInit(argv[0], "Inventor");
/* create the viewer in the toplevel window */
/* and set some scene to display */
myViewer = SoXtExamVwrCreateStd(myWindow, NULL);
SoXtExamVwrSetScene(myViewer, (SoNode *) SoConeCreate();
/* manage and map window on screen */
SoXtExamVwrShow(myViewer);
SoXtShow(myWindow); /* calls XtRealizeWidget() */
/* Loop forever */
SoXtMainLoop();
}
Page 3SoXtComponent(3IV)SEE ALSO
SoXt, SoXtRenderArea, SoXtViewer, SoXtMaterialEditor
Page 4