SoGtk  0.1.0
Coin3D GUI toolkit binding
All Classes Functions Variables Typedefs Enumerations Enumerator Modules Pages
SoGtkObject Class Referenceabstract

The SoGtkObject class is the common superclass for all SoGtk component classes. More...

#include <Inventor/Gtk/SoGtkObject.h>

Inheritance diagram for SoGtkObject:
SoGtkComponent SoGtkDevice SoGtkGLWidget SoGtkKeyboard SoGtkMouse SoGtkRenderArea SoGtkViewer SoGtkFullViewer SoGtkConstrainedViewer SoGtkExaminerViewer SoGtkPlaneViewer SoGtkFlyViewer

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 SoGtkObject class is the common superclass for all SoGtk component classes.

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

You can place the macro SOGTK_OBJECT_HEADER(classname,parentname) within a class definition header for SoGtk 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 SoGtkExaminerViewer {
SOGTK_OBJECT_HEADER(MySpecialViewer, SoGtkExaminerViewer);
// [rest of class definition follows]
};
#endif // !MYSPECIALVIEWER_H
The SoGtkExaminerViewer class is a 3D-model examination viewer.
Definition SoGtkExaminerViewer.h:50

Then put the SOGTK_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 SoGtkObject::getClassTypeId ( void )
static

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

◆ getTypeId()

SoType SoGtkObject::getTypeId ( void ) const
pure virtual

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

Usage example:

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

◆ init()

void SoGtkObject::init ( void )
static

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

◆ initClass()

void SoGtkObject::initClass ( void )
static

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

◆ isOfType()

SbBool SoGtkObject::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: