Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
SoWinComponent Class Reference

The SoWinComponent class is the base class for all GUI components. More...

#include <Inventor/Win/SoWinComponent.h>

Inheritance diagram for SoWinComponent:
SoWinObject SoWinGLWidget SoWinRenderArea SoWinViewer SoWinFullViewer SoWinConstrainedViewer SoWinExaminerViewer SoWinPlaneViewer SoWinFlyViewer

Public Member Functions

virtual ~SoWinComponent ()
virtual void show (void)
virtual void hide (void)
virtual void setComponentCursor (const SoWinCursor &cursor)
SbBool isFullScreen (void) const
SbBool setFullScreen (const SbBool onoff)
SbBool isVisible (void)
SbBool isTopLevelShell (void) const
HWND getWidget (void) const
HWND getBaseWidget (void) const
HWND getShellWidget (void) const
HWND 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 (SoWinComponentCB *const func, void *const user=NULL)
- Public Member Functions inherited from SoWinObject
virtual SoType getTypeId (void) const =0
SbBool isOfType (SoType type) const

Static Public Member Functions

static void setWidgetCursor (HWND w, const SoWinCursor &cursor)
static SoWinComponentgetComponent (HWND widget)
static void initClasses (void)
- Static Public Member Functions inherited from SoWinObject
static void initClass (void)
static SoType getClassTypeId (void)
static void init (void)

Protected Member Functions

 SoWinComponent (HWND const parent=NULL, const char *const name=NULL, const SbBool embed=TRUE)
virtual void afterRealizeHook (void)
void setClassName (const char *const name)
void setBaseWidget (HWND widget)
void registerWidget (HWND widget)
void unregisterWidget (HWND 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 (SoWinComponentVisibilityCB *const func, void *const user=NULL)
void removeVisibilityChangeCallback (SoWinComponentVisibilityCB *const func, void *const user=NULL)

Protected Attributes

SbBool firstRealize

Detailed Description

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

Components in the SoWin 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 Win object(s).

Application programmers should not need to interface any code against this class, unless they want to extend the SoWin 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 SoWinComponent derived classes and Win widgets is one of "has-A", not "is-A" – i.e. SoWinComponent contains a HWND, it doesn't derive from or subclass it.

Constructor & Destructor Documentation

◆ ~SoWinComponent()

SoWinComponent::~SoWinComponent ( )


◆ SoWinComponent()

SoWinComponent::SoWinComponent ( HWND const  parent = NULL,
const char *const  name = NULL,
const SbBool  embed = TRUE 

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 SoWin::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 whether 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 top level shell type. If you embed the component, the component will create a form widget type widget inside the parent widget, which you can get the handle of by calling SoWinComponent::getBaseWidget().

Member Function Documentation

◆ show()

void SoWinComponent::show ( void  )

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

See also
hide(), isVisible()

◆ hide()

void SoWinComponent::hide ( void  )

This will hide the widget.

See also
show(), isVisible()

◆ setComponentCursor()

void SoWinComponent::setComponentCursor ( const SoWinCursor cursor)

Sets the cursor for this component.

Note: not part of the original SGI InventorXt API.

Reimplemented in SoWinFullViewer.

◆ setWidgetCursor()

void SoWinComponent::setWidgetCursor ( HWND  w,
const SoWinCursor cursor 

Set cursor for a native widget in the underlying toolkit.

Note: not part of the original SGI InventorXt API.

◆ isFullScreen()

SbBool SoWinComponent::isFullScreen ( void  ) const

Returns whether this widget/component is in full screen mode or not.

◆ setFullScreen()

SbBool SoWinComponent::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 top level window.

◆ isVisible()

SbBool SoWinComponent::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()

◆ isTopLevelShell()

SbBool SoWinComponent::isTopLevelShell ( void  ) const

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

See also

◆ getWidget()

HWND SoWinComponent::getWidget ( void  ) const

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

See also
getShellWidget(), getParentWidget()

◆ getBaseWidget()

HWND SoWinComponent::getBaseWidget ( void  ) const

An SoWinComponent 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

◆ getShellWidget()

HWND SoWinComponent::getShellWidget ( void  ) const

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

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

To get the top level shell of embedded components, you can use the SoWin::getShellWidget() method.

See also
isTopLevelShell(), getWidget()

◆ getParentWidget()

HWND SoWinComponent::getParentWidget ( void  ) const

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

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

◆ setSize()

void SoWinComponent::setSize ( const SbVec2s  size)

Resize the component widget.

The method assumes the caller knows what he is doing.

See also

◆ getSize()

SbVec2s SoWinComponent::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

◆ setTitle()

void SoWinComponent::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()

◆ getTitle()

const char * SoWinComponent::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()

◆ setIconTitle()

void SoWinComponent::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()

◆ getIconTitle()

const char * SoWinComponent::getIconTitle ( void  ) const

Returns the title the window has when iconified.

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

◆ getWidgetName()

const char * SoWinComponent::getWidgetName ( void  ) const

Returns name of the widget.

◆ getClassName()

const char * SoWinComponent::getClassName ( void  ) const

Returns class name of widget.

◆ setWindowCloseCallback()

void SoWinComponent::setWindowCloseCallback ( SoWinComponentCB *const  func,
void *const  data = NULL 

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

For top level 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

◆ getComponent()

SoWinComponent * SoWinComponent::getComponent ( HWND  widget)

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

◆ initClasses()

void SoWinComponent::initClasses ( void  )

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

See also
SoWin::init(), SoWinDevice::initClasses()

◆ afterRealizeHook()

void SoWinComponent::afterRealizeHook ( void  )

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:

// [own initialization here]

Reimplemented in SoWinRenderArea, SoWinExaminerViewer, SoWinPlaneViewer, and SoWinFlyViewer.

◆ setClassName()

void SoWinComponent::setClassName ( const char *const  name)

Set class name of component.

See also
getClassName(), componentClassName()

◆ setBaseWidget()

void SoWinComponent::setBaseWidget ( HWND  widget)

Set the core widget for this SoWin component. It is important that subclasses get this correct, as the widget set here will be the widget returned from query methods.

See also

◆ registerWidget()

void SoWinComponent::registerWidget ( HWND  widget)

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 SoWinComponent::getComponent() method to fail with those widgets.

See also
unregisterWidget(), getComponent()

◆ unregisterWidget()

void SoWinComponent::unregisterWidget ( HWND  widget)

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

See also

◆ getDefaultWidgetName()

const char * SoWinComponent::getDefaultWidgetName ( void  ) const

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 SoWinRenderArea, SoWinExaminerViewer, SoWinFlyViewer, and SoWinPlaneViewer.

◆ getDefaultTitle()

const char * SoWinComponent::getDefaultTitle ( void  ) const

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

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

Reimplemented in SoWinRenderArea, SoWinExaminerViewer, SoWinFlyViewer, and SoWinPlaneViewer.

◆ getDefaultIconTitle()

const char * SoWinComponent::getDefaultIconTitle ( void  ) const

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 SoWinRenderArea, SoWinExaminerViewer, SoWinFlyViewer, and SoWinPlaneViewer.

◆ sizeChanged()

void SoWinComponent::sizeChanged ( const SbVec2s size)

Called internally from within the SoWin library when the widget embedded in a component changes its 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 SoWinViewer, SoWinGLWidget, SoWinRenderArea, and SoWinFullViewer.

◆ addVisibilityChangeCallback()

void SoWinComponent::addVisibilityChangeCallback ( SoWinComponentVisibilityCB *const  func,
void *const  user = NULL 

Add a callback which will be called whenever the widget component changes visibility status (because of iconification or deiconification, for instance).

See also
removeVisibilityChangeCallback(), isVisible()

◆ removeVisibilityChangeCallback()

void SoWinComponent::removeVisibilityChangeCallback ( SoWinComponentVisibilityCB *const  func,
void *const  data = NULL 

Remove one of the callbacks from the list of visibility notification callbacks.

See also
addVisibilityChangeCallback(), isVisible()

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