![]() |
SoGtk
0.1.0
Coin3D GUI toolkit binding
|
The SoGtkComponent class is the base class for all GUI components. More...
#include <Inventor/Gtk/SoGtkComponent.h>
Public Member Functions | |
virtual | ~SoGtkComponent () |
GtkWidget * | getBaseWidget (void) const |
const char * | getClassName (void) const |
const char * | getIconTitle (void) const |
GtkWidget * | getParentWidget (void) const |
GtkWidget * | getShellWidget (void) const |
SbVec2s | getSize (void) const |
const char * | getTitle (void) const |
GtkWidget * | getWidget (void) const |
const char * | getWidgetName (void) const |
virtual void | hide (void) |
SbBool | isFullScreen (void) const |
SbBool | isTopLevelShell (void) const |
SbBool | isVisible (void) |
virtual void | setComponentCursor (const SoGtkCursor &cursor) |
SbBool | setFullScreen (const SbBool onoff) |
void | setIconTitle (const char *const title) |
void | setSize (const SbVec2s size) |
void | setTitle (const char *const title) |
void | setWindowCloseCallback (SoGtkComponentCB *const func, void *const user=NULL) |
virtual void | show (void) |
![]() | |
virtual SoType | getTypeId (void) const =0 |
SbBool | isOfType (SoType type) const |
Static Public Member Functions | |
static SoGtkComponent * | getComponent (GtkWidget *widget) |
static void | initClasses (void) |
static void | setWidgetCursor (GtkWidget *w, const SoGtkCursor &cursor) |
![]() | |
static SoType | getClassTypeId (void) |
static void | init (void) |
static void | initClass (void) |
Protected Member Functions | |
SoGtkComponent (GtkWidget *const parent=NULL, const char *const name=NULL, const SbBool embed=TRUE) | |
void | addVisibilityChangeCallback (SoGtkComponentVisibilityCB *const func, void *const user=NULL) |
virtual void | afterRealizeHook (void) |
virtual SbBool | eventFilter (GtkWidget *object, GdkEvent *event) |
virtual const char * | getDefaultIconTitle (void) const |
virtual const char * | getDefaultTitle (void) const |
virtual const char * | getDefaultWidgetName (void) const |
void | registerWidget (GtkWidget *widget) |
void | removeVisibilityChangeCallback (SoGtkComponentVisibilityCB *const func, void *const user=NULL) |
void | setBaseWidget (GtkWidget *widget) |
void | setClassName (const char *const name) |
virtual void | sizeChanged (const SbVec2s &size) |
void | unregisterWidget (GtkWidget *widget) |
Protected Attributes | |
SbBool | firstRealize |
The SoGtkComponent class is the base class for all GUI components.
Components in the SoGtk 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 Gtk object(s).
Application programmers should not need to interface any code against this class, unless they want to extend the SoGtk 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 SoGtkComponent derived classes and Gtk widgets is one of "has-A", not "is-A" – i.e. SoGtkComponent contains a GtkWidget*, it doesn't derive from or subclass it.
|
virtual |
Destructor.
|
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 SoGtk::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 SoGtkComponent::getBaseWidget().
Constructor.
parent is the widget we'll build this component inside. If parent is NULL, make a new top level window.
name is mostly interesting for debugging purposes.
embed specifies whether or not we should make a new top level window for the component even when we've got a non-NULL parent.
|
protected |
Add a callback which will be called whenever the widget component changes visibility status (because of iconification or deiconification, for instance).
|
protectedvirtual |
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:
Reimplemented in SoGtkRenderArea, SoGtkExaminerViewer, SoGtkFlyViewer, and SoGtkPlaneViewer.
|
protectedvirtual |
Reimplemented in SoGtkGLWidget.
GtkWidget * SoGtkComponent::getBaseWidget | ( | void | ) | const |
An SoGtkComponent 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.
const char * SoGtkComponent::getClassName | ( | void | ) | const |
Returns class name of widget.
|
static |
Finds and returns the SoGtkComponent corresponding to the given GtkWidget*, if any. If the widget does not seem to belong to any SoGtkComponent, NULL
will be returned.
|
protectedvirtual |
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 SoGtkRenderArea, SoGtkExaminerViewer, SoGtkFlyViewer, and SoGtkPlaneViewer.
|
protectedvirtual |
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 SoGtkRenderArea, SoGtkExaminerViewer, SoGtkFlyViewer, and SoGtkPlaneViewer.
|
protectedvirtual |
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 SoGtkRenderArea, SoGtkExaminerViewer, SoGtkFlyViewer, and SoGtkPlaneViewer.
const char * SoGtkComponent::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.
Returns the title the window has when iconified. The component should be a top level shell if you use this method.
GtkWidget * SoGtkComponent::getParentWidget | ( | void | ) | const |
Returns the widget which is the parent of (i.e. contains) this component's base widget.
GtkWidget * SoGtkComponent::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 SoGtk::getShellWidget() method.
SbVec2s SoGtkComponent::getSize | ( | void | ) | const |
const char * SoGtkComponent::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.
Returns the window title. The component should be a top level shell if you call this method.
GtkWidget * SoGtkComponent::getWidget | ( | void | ) | const |
Returns a pointer to the component's window system widget.
const char * SoGtkComponent::getWidgetName | ( | void | ) | const |
Returns name of the widget.
|
virtual |
This will hide the widget.
This will hide the component.
|
static |
This function initializes the type system for all the component classes. It is called indirectly for you when you call SoGtk::init().
SbBool SoGtkComponent::isFullScreen | ( | void | ) | const |
Returns whether this widget/component is in full screen mode or not.
Returns flag indicated whether or not this widget / component is currently in full screen mode.
SbBool SoGtkComponent::isTopLevelShell | ( | void | ) | const |
Returns TRUE
if this component is a top level shell, i.e. it has a window representation on the desktop.
SbBool SoGtkComponent::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.
Returns the visibility status of the component. If any parent widgets of this component 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.
|
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 SoGtkComponent::getComponent() method to fail with those widgets.
|
protected |
Remove one of the callbacks from the list of visibility notification callbacks.
|
protected |
Set the core widget for this SoGtk component. It is important that subclasses get this correct, as the widget set here will be the widget returned from query methods.
|
protected |
Set class name of component.
Set class name of widget.
|
virtual |
Sets the cursor for this component.
Note: not part of the original SGI InventorXt API.
Sets the cursor for this component.
Reimplemented in SoGtkFullViewer.
SbBool SoGtkComponent::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.
void SoGtkComponent::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.
Sets the window's title when it is iconified. The component you use this method on should be a top level shell.
void SoGtkComponent::setSize | ( | const SbVec2s | size | ) |
void SoGtkComponent::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.
Set the window title of this component. This will not work unless the component is a top level shell.
|
static |
Set cursor for a native widget in the underlying toolkit.
Note: not part of the original SGI InventorXt API.
Set cursor for a native widget in the underlying toolkit.
void SoGtkComponent::setWindowCloseCallback | ( | SoGtkComponentCB *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.
Set up a callback function to use when the component is 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.
|
virtual |
This will show the widget, de-iconifying and raising it if necessary.
This will show the widget, deiconifying and raising it if necessary.
|
protectedvirtual |
Called internally from within the SoGtk 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.
Override to detect when the base widget in the component changes its dimensions (an operation which is usually triggered by the user).
Reimplemented in SoGtkGLWidget, SoGtkRenderArea, SoGtkFullViewer, and SoGtkViewer.
|
protected |
Remove a previously registered native toolkit widget from the widget-to-component mappings used by SoGtkComponent::getComponent().