Coin Logo http://www.sim.no
http://www.coin3d.org

SoXtComponent Class Reference

#include <Inventor/Xt/SoXtComponent.h>

Inheritance diagram for SoXtComponent:

SoXtObject SoXtGLWidget SoXtRenderArea SoXtViewer SoXtFullViewer SoXtConstrainedViewer SoXtExaminerViewer SoXtPlaneViewer SoXtFlyViewer List of all members.

Detailed Description

The SoXtComponent class is the base class for all GUI components.

Components in the SoXt component library all inherit this abstract base class. It provides basic methods for setting and querying about the relationship between the component object and its underlying Xt object(s).

Application programmers should not need to interface any code against this class, unless they want to extend the SoXt library in entirely new directions. For making new viewer components, for instance, other classes further down the inheritance hierarchy would be better suited for subclassing.

Note that the relationship between all SoXtComponent derived classes and Xt widgets is one of "has-A", not "is-A" -- i.e. SoXtComponent contains a Widget, it doesn't derive from or subclass it.


Public Member Functions

virtual ~SoXtComponent ()
virtual void show (void)
virtual void hide (void)
virtual void setComponentCursor (const SoXtCursor &cursor)
SbBool isFullScreen (void) const
SbBool setFullScreen (const SbBool onoff)
SbBool isVisible (void)
SbBool isTopLevelShell (void) const
Widget getWidget (void) const
Widget getBaseWidget (void) const
Widget getShellWidget (void) const
Widget getParentWidget (void) const
void setSize (const SbVec2s size)
SbVec2s getSize (void) const
void setTitle (const char *const title)
const char * getTitle (void) const
void setIconTitle (const char *const title)
const char * getIconTitle (void) const
const char * getWidgetName (void) const
const char * getClassName (void) const
void setWindowCloseCallback (SoXtComponentCB *const func, void *const user=NULL)
Display * getDisplay (void)
void fitSize (const SbVec2s size)
void addWindowCloseCallback (SoXtComponentCB *callback, void *closure=NULL)
void removeWindowCloseCallback (SoXtComponentCB *callback, void *closure=NULL)

Static Public Member Functions

static void setWidgetCursor (Widget w, const SoXtCursor &cursor)
static SoXtComponentgetComponent (Widget widget)
static void initClasses (void)

Protected Member Functions

 SoXtComponent (Widget const parent=NULL, const char *const name=NULL, const SbBool embed=TRUE)
virtual void afterRealizeHook (void)
void setClassName (const char *const name)
void setBaseWidget (Widget widget)
void registerWidget (Widget widget)
void unregisterWidget (Widget widget)
virtual const char * getDefaultWidgetName (void) const
virtual const char * getDefaultTitle (void) const
virtual const char * getDefaultIconTitle (void) const
virtual void sizeChanged (const SbVec2s &size)
void addVisibilityChangeCallback (SoXtComponentVisibilityCB *const func, void *const user=NULL)
void removeVisibilityChangeCallback (SoXtComponentVisibilityCB *const func, void *const user=NULL)
void invokeVisibilityChangeCallbacks (const SbBool enable) const
void invokeWindowCloseCallbacks (void) const
virtual void windowCloseAction (void)

Protected Attributes

SbBool firstRealize

Friends

class SoGuiComponentP
class SoXtComponentP


Constructor & Destructor Documentation

SoXtComponent::~SoXtComponent (  )  [virtual]

Destructor.

SoXtComponent::SoXtComponent ( Widget const   parent = NULL,
const char *const   name = NULL,
const SbBool  embed = TRUE 
) [protected]

This is a protected constructor, used only by derived classes.

The parent argument is the parent widget of the component. If you don't supply a parent, the main window (the one given to or returned from SoXt::init()) is used (and the embed argument is considered to be FALSE).

The name argument is the name of the component. If you don't supply one, the name will default to something, depending on the inheritance hierarchy.

The embed argument tells wether the component should be embedded in the parent widget or should create its own shell. This flag is only checked if the parent widget argument is specified (not NULL).

If you create a non-embedded component, the component will create its own shell, which will be a toplevelshell type. If you embed the component, the component will create a formwidget type widget inside the parent widget, which you can get the handle of by calling SoXtComponent::getBaseWidget().


Member Function Documentation

void SoXtComponent::show ( void   )  [virtual]

This will show the widget, de-iconifiying and raising it if necessary.

See also:
hide(), isVisible()

void SoXtComponent::hide ( void   )  [virtual]

This will hide the widget.

See also:
show(), isVisible()

void SoXtComponent::setComponentCursor ( const SoXtCursor cursor  )  [virtual]

Sets the cursor for this component.

Reimplemented in SoXtFullViewer.

void SoXtComponent::setWidgetCursor ( Widget  w,
const SoXtCursor cursor 
) [static]

Set cursor for a native widget in the underlying toolkit.

SbBool SoXtComponent::isFullScreen ( void   )  const

Returns if this widget/component is in full screen mode.

SbBool SoXtComponent::setFullScreen ( const SbBool  onoff  ) 

Toggle full screen mode for this component, if possible.

Returns FALSE if operation failed. This might happen if the toolkit doesn't support attempts at making the component cover the complete screen or if the component is not a toplevel window.

SbBool SoXtComponent::isVisible ( void   ) 

Returns visibility status on the widget. If any parents of this widget or this widget itself is hidden, returns FALSE.

Note that a widget which is just obscured by other windows on the desktop is not hidden in this sense, and TRUE will be returned.

See also:
show(), hide()

SbBool SoXtComponent::isTopLevelShell ( void   )  const

Returns TRUE if this component is a toplevel shell, i.e. it has a window representation on the desktop.

See also:
getShellWidget()

Widget SoXtComponent::getWidget ( void   )  const

Returns a pointer to the component's window system widget.

See also:
getShellWidget(), getParentWidget()

Widget SoXtComponent::getBaseWidget ( void   )  const

An SoXtComponent may be composed of any number of widgets in parent-children relationships in a tree structure with any depth. This method will return the root widget in that tree.

See also:
setBaseWidget()

Widget SoXtComponent::getShellWidget ( void   )  const

This method returns the shell widget of the component, but only if it was created as a toplevel shell. NULL will be returned for embedded components.

(The toplevel shell is the desktop window which contains the component.)

To get the toplevel shell of embedded components, you can use the SoXt::getShellWidget() method.

See also:
isTopLevelShell(), getWidget()

Widget SoXtComponent::getParentWidget ( void   )  const

Returns the widget which is the parent (i.e. contains) this component's base widget.

See also:
getWidget(), baseWidget(), isTopLevelShell()

void SoXtComponent::setSize ( const SbVec2s  size  ) 

Resize the component widget.

The method assumes the caller knows what he is doing.

See also:
getSize()

SbVec2s SoXtComponent::getSize ( void   )  const

Returns the component widget size.

The size that is returned is a cached size value, not a value fetched from the GUI system.

See also:
setSize()

void SoXtComponent::setTitle ( const char *const   title  ) 

Set the window title of this component. The title will appear on the window title bar, if the component manages its own window.

See also:
getTitle(), setIconTitle(), isTopLevelShell()

const char * SoXtComponent::getTitle ( void   )  const

Returns the window title.

If a title has been set, that title will be returned. If no title has been set, the default title is returned.

See also:
setTitle(), isTopLevelShell()

void SoXtComponent::setIconTitle ( const char *const   title  ) 

This method sets the title of the icon representation of the window.

The title will appear on the window icon, if the component manages its own window.

See also:
getIconTitle(), setTitle(), isTopLevelShell()

const char * SoXtComponent::getIconTitle ( void   )  const

Returns the title the window has when iconfied.

If an icon title has been set, that icon title is returned. If no icon title has been set, the default icon title is returned.

See also:
setIconTitle(), isTopLevelShell()

const char * SoXtComponent::getWidgetName ( void   )  const

This method returns the name of the component.

const char * SoXtComponent::getClassName ( void   )  const

This method returns the class name of the component.

void SoXtComponent::setWindowCloseCallback ( SoXtComponentCB *const   func,
void *const   data = NULL 
)

Set up a callback function to use when the component gets closed. A component must be a toplevel shell for this to have any effect.

For toplevel shells with no close callback set, the window will simply be hidden. The typical action to take in the callback would be to delete the component.

See also:
isTopLevelShell()

SoXtComponent * SoXtComponent::getComponent ( Widget  widget  )  [static]

Finds and returns the SoXtComponent corresponding to the given Widget, if any. If the widget does not seem to belong to any SoXtComponent, NULL will be returned.

void SoXtComponent::initClasses ( void   )  [static]

This function initializes the type system for all the component classes. It is called indirectly for you when you call SoXt::init().

See also:
SoXt::init(), SoXtDevice::initClasses()

void SoXtComponent::afterRealizeHook ( void   )  [protected, virtual]

A function "hook" / callback invoked just after the window for the component has been realized.

Override this if you need specific initialization for your own component or viewer class to happen right after it has been made visible, but remember to call upwards in the inheritance hierarchy:

  void
  MyLittleViewer::afterRealizeHook(void)
  {
    <superclass>::afterRealizeHook();
    // [own initialization here]
  }

Reimplemented in SoXtRenderArea, SoXtPlaneViewer, SoXtExaminerViewer, and SoXtFlyViewer.

void SoXtComponent::setClassName ( const char *const   name  )  [protected]

This method sets the class name of the widget.

void SoXtComponent::setBaseWidget ( Widget  widget  )  [protected]

This method sets the base widget of the component.

void SoXtComponent::registerWidget ( Widget  widget  )  [protected]

This method should be used by subclasses to register the widgets they set up from the underlying native toolkit, so they can be "reverse" mapped to the owner component.

Subclasses failing to register the widgets they use will cause the SoXtComponent::getComponent() method to fail with those widgets.

See also:
unregisterWidget(), getComponent()

void SoXtComponent::unregisterWidget ( Widget  widget  )  [protected]

Remove a previously registered native toolkit widget from the widget-to-component mappings used by SoXtComponent::getComponent().

See also:
registerWidget()

const char * SoXtComponent::getDefaultWidgetName ( void   )  const [protected, virtual]

This method returns the default name of a component widget class.

It should be overridden by derived non-abstract classes for the topmost widget in the component to have a proper name.

Reimplemented in SoXtRenderArea, SoXtPlaneViewer, SoXtExaminerViewer, and SoXtFlyViewer.

const char * SoXtComponent::getDefaultTitle ( void   )  const [protected, virtual]

This method returns the default window caption string of the component.

It should be overridden by derived non-abstract classes so the window and popup menu will get a proper title.

Reimplemented in SoXtRenderArea, SoXtPlaneViewer, SoXtExaminerViewer, and SoXtFlyViewer.

const char * SoXtComponent::getDefaultIconTitle ( void   )  const [protected, virtual]

This method returns the default icon title of the component.

It should be overridden by derived non-abstract classes so icons will get proper titles.

Reimplemented in SoXtRenderArea, SoXtPlaneViewer, SoXtExaminerViewer, and SoXtFlyViewer.

void SoXtComponent::sizeChanged ( const SbVec2s &  size  )  [protected, virtual]

Called internally from within the SoXt library when the widget embedded in a component changes it size, which is usually triggered by end-user interaction.

This method is then invoked to notify the component that the size has changed. It is called from the top and all the way down to the bottom, the size being adjusted to take into account extra decorations having been added at each level in the component class hierarchy.

Reimplemented in SoXtGLWidget, SoXtRenderArea, SoXtViewer, and SoXtFullViewer.

void SoXtComponent::addVisibilityChangeCallback ( SoXtComponentVisibilityCB *const   func,
void *const   user = NULL 
) [protected]

This method adds a callback that will be invoked when the components visibility changes.

Callback invocation is not implemented yet.

See also:
SoXtComponent::removeVisibilityChangeCallback()

void SoXtComponent::removeVisibilityChangeCallback ( SoXtComponentVisibilityCB *const   func,
void *const   data = NULL 
) [protected]

This method removes a callback from the list of callbacks that are to be invoked when the component visibility changes.

See also:
SoXtComponent::addVisibilityChangeCallback()

Display * SoXtComponent::getDisplay ( void   ) 

This method returns the display the component is sent to.

void SoXtComponent::fitSize ( const SbVec2s  size  ) 

This method tries to resize the component window, using size as the minimum requirements.

This method is not part of the Open Inventor SoXt API.

void SoXtComponent::addWindowCloseCallback ( SoXtComponentCB *  callback,
void *  closure = NULL 
)

This method adds a close callback for the component window.

This method is not standard for Open Inventor.

See also:
SoXtComponent::setWindowCloseCallback()

SoXtComponent::removeWindowCloseCallback()

SoXtComponent::invokeWindowCloseCallback()

void SoXtComponent::removeWindowCloseCallback ( SoXtComponentCB *  callback,
void *  closure = NULL 
)

This method removes a close callback for the component window.

This method is not standard for Open Inventor.

See also:
SoXtComponent::addWindowCloseCallback()

SoXtComponent::setWindowCloseCallback()

SoXtComponent::invokeWindowCloseCallback()

void SoXtComponent::invokeVisibilityChangeCallbacks ( const SbBool  enable  )  const [protected]

This method invokes all the visibility-change callbacks.

This method is not part of the Open Inventor API.

See also:
SoXtComponent::addVisibilityChangeCallback()

SoXtComponent::removeVisibilityChangeCallback()

void SoXtComponent::invokeWindowCloseCallbacks ( void   )  const [protected]

This method invokes the close callbacks for the component window.

This method is not standard for Open Inventor.

See also:
SoXtComponent::addWindowCloseCallback()

SoXtComponent::setWindowCloseCallback()

SoXtComponent::removeWindowCloseCallback()

void SoXtComponent::windowCloseAction ( void   )  [protected, virtual]

This method should be hooked up to window close events. If the main window is closed, the program exits. If a sub-window is closed, it is just hidden.


Member Data Documentation

SoXtComponent::firstRealize [protected]

This member is used to detect the first realization of the component.


The documentation for this class was generated from the following files:

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Tue Dec 2 23:15:45 2008 for SoXt by Doxygen. 1.4.7