logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SoXtComponent — abstract base class for all Inventor Xt components

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.

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/Xt/SoXt.h>#include<Inventor/nodes/SoCone.h>#include<Inventor/Xt/viewers/SoXtExaminerViewer.h>voidmain(int,char**argv){//InitializeInventorandXt,whichmustbedone//beforeanyInventorcallsaremade.WidgetmyWindow=SoXt::init(argv[0]);//createtheviewerinthetoplevelwindow//andsetsomescenetodisplaySoXtExaminerViewer*myViewer=newSoXtExaminerViewer(myWindow);myViewer->setSceneGraph(newSoCone());//manageandmapwindowonscreenmyViewer->show();SoXt::show(myWindow);//callsXtRealizeWidget()//LoopforeverSoXt::mainLoop();}

Inherits From

       SoXtComponent

Methods

virtualvoidshow()virtualvoidhide()
          This shows and hides the component. If this is a topLevelShell component, then show() will Realize and
          Map the window, otherwise it 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.

     SbBoolisVisible()
          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).

          Subclasses should call this routine before redrawing anything  and  in  any  sensor  trigger  methods.
          Calling  this  will  check  the  current  visibility (which is really cheap) and invoke the visibility
          changed callbacks if the state changes (see addVisibilityChangeCallback()).

     WidgetgetWidget()const
          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.

     SbBoolisTopLevelShell()constWidgetgetShellWidget()const
          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).

     WidgetgetParentWidget()const
          Return the parent widget, be it a shell or not

     voidsetSize(constSbVec2s&size)SbVec2sgetSize()
          Convenience routines on the widget — setSize calls XtSetValue

     Display*getDisplay()
          Returns the X display associated with this components widget.

     voidsetTitle(constchar*newTitle)constchar*getTitle()constvoidsetIconTitle(constchar*newIconTitle)constchar*getIconTitle()const
          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).

     voidsetWindowCloseCallback(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  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.

     staticSoXtComponent*getComponent(Widgetw)
          This  returns the SoXtComponent for this widget. If the widget is not an Inventor component, then NULL
          is returned.

     constchar*getWidgetName()constconstchar*getClassName()const
          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.

Name

       SoXtComponent — abstract base class for all Inventor Xt components

See Also

SoXt,SoXtRenderArea,SoXtViewer,SoXtMaterialEditorSoXtComponent(3IV)()

Synopsis

#include<Inventor/Xt/SoXtComponent.h>typedefvoidSoXtComponentCB(void*userData,SoXtComponent*comp)

          Methods from class SoXtComponent:

     virtualvoidshow()virtualvoidhide()SbBoolisVisible()WidgetgetWidget()constSbBoolisTopLevelShell()constWidgetgetShellWidget()constWidgetgetParentWidget()constvoidsetSize(constSbVec2s&size)SbVec2sgetSize()Display*getDisplay()voidsetTitle(constchar*newTitle)constchar*getTitle()constvoidsetIconTitle(constchar*newIconTitle)constchar*getIconTitle()constvoidsetWindowCloseCallback(SoXtComponentCB*func,void*data=NULL)staticSoXtComponent*getComponent(Widgetw)constchar*getWidgetName()constconstchar*getClassName()const

See Also