SoWin  1.6.2
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoWinObject Class Referenceabstract

The SoWinObject class is the common superclass for all SoWin component classes. More...

#include <Inventor/Win/SoWinObject.h>

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

Public Member Functions

virtual SoType getTypeId (void) const =0
 
SbBool isOfType (SoType type) const
 

Static Public Member Functions

static SoType getClassTypeId (void)
 
static void init (void)
 
static void initClass (void)
 

Detailed Description

The SoWinObject class is the common superclass for all SoWin component classes.

The purpose of making this class the superclass of all SoWin device, component and viewer classes is to be able to do runtime type checking of the SoWin objects.

You can place the macro SOWIN_OBJECT_HEADER(classname,parentname) within a class definition header for SoWin extension components to automatically provide the necessary definitions for setting up a runtime type system for your extension classes:

#ifndef MYSPECIALVIEWER_H
#define MYSPECIALVIEWER_H
class MySpecialViewer : public SoWinExaminerViewer {
SOWIN_OBJECT_HEADER(MySpecialViewer, SoWinExaminerViewer);
// [rest of class definition follows]
};
#endif // !MYSPECIALVIEWER_H
The SoWinExaminerViewer class is a 3D-model examination viewer.
Definition SoWinExaminerViewer.h:50

Then put the SOWIN_OBJECT_SOURCE(classname) macro within the actual implementation source code file to include the necessary code for the runtime type system:

#include <MySpecialViewer.h>
SOQT_OBJECT_SOURCE(MySpecialViewer);
// [rest of class implementation]

See also the documentation of the SoType class in Coin or Inventor.

Member Function Documentation

◆ getClassTypeId()

SoType SoWinObject::getClassTypeId ( void )
static

This static method returns the SoType object associated with objects of this class.

◆ getTypeId()

SoType SoWinObject::getTypeId ( void ) const
pure virtual

Returns the type identification of an object derived from a class inheriting SoWinObject. This is used for runtime type checking and "downward" casting.

Usage example:

void foo(SoWinViewer * comp)
{
// safe downward cast, knows the type
}
else if (comp->getTypeId().isOfType(SoWinFlyViewer::getClassTypeId())) {
// safe downward cast, knows the type
SoWinFlyViewer * flyviewer = (SoWinFlyViewer *)comp;
// then something else
}
}
The SoWinFlyViewer class implements controls for moving the camera in a "flying" motion.
Definition SoWinFlyViewer.h:42
virtual SoType getTypeId(void) const =0
static SoType getClassTypeId(void)
Definition SoWinObject.cpp:152
The SoWinViewer class is the top level base viewer class.
Definition SoWinViewer.h:90

◆ init()

void SoWinObject::init ( void )
static

Initialize the type system of SoWinObject, all SoWin device classes and all SoWin components (including viewers).

◆ initClass()

void SoWinObject::initClass ( void )
static

Sets up initialization for data common to all instances of this class, submitting necessary information to the internal SoWin type system.

◆ isOfType()

SbBool SoWinObject::isOfType ( SoType type) const

Returns TRUE if the type of this object is either of the same type or inherited from type.


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