00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef SOQT_COMPONENT_H
00025
#define SOQT_COMPONENT_H
00026
00027
#include <Inventor/SbLinear.h>
00028
#include <Inventor/Qt/SoQtObject.h>
00029
00030
#ifdef __COIN_SOQT__
00031
class QWidget;
00032
#endif // __COIN_SOQT__
00033
#ifdef __COIN_SOXT__
00034
#include <X11/Intrinsic.h>
00035
#endif // __COIN_SOXT__
00036
#ifdef __COIN_SOGTK__
00037
#include <gtk/gtk.h>
00038
#endif // __COIN_SOGTK__
00039
#ifdef __COIN_SOWIN__
00040
#include <wtypes.h>
00041
#endif // __COIN_SOWIN__
00042
00043
00044
class SoQtComponent;
00045
class SoQtCursor;
00046
00047
typedef void SoQtComponentCB(
void * user,
SoQtComponent * component);
00048
typedef void SoQtComponentVisibilityCB(
void * user, SbBool visible);
00049
00050
00051
00052 class SOQT_DLL_API SoQtComponent :
public SoQtObject {
00053 SOQT_OBJECT_ABSTRACT_HEADER(SoQtComponent,
SoQtObject);
00054
00055
public:
00056
virtual ~SoQtComponent();
00057
00058
virtual void show(
void);
00059
virtual void hide(
void);
00060
00061
virtual void setComponentCursor(
const SoQtCursor & cursor);
00062
static void setWidgetCursor(QWidget * w,
const SoQtCursor & cursor);
00063
00064 SbBool isFullScreen(
void)
const;
00065 SbBool setFullScreen(
const SbBool onoff);
00066
00067 SbBool isVisible(
void);
00068 SbBool isTopLevelShell(
void)
const;
00069
00070 QWidget * getWidget(
void)
const;
00071 QWidget * getBaseWidget(
void)
const;
00072 QWidget * getShellWidget(
void)
const;
00073 QWidget * getParentWidget(
void)
const;
00074
00075
void setSize(
const SbVec2s size);
00076 SbVec2s getSize(
void)
const;
00077
00078
void setTitle(
const char *
const title);
00079
const char * getTitle(
void)
const;
00080
void setIconTitle(
const char *
const title);
00081
const char * getIconTitle(
void)
const;
00082
00083
const char * getWidgetName(
void)
const;
00084
const char * getClassName(
void)
const;
00085
00086
void setWindowCloseCallback(SoQtComponentCB *
const func,
00087
void *
const user = NULL);
00088
static SoQtComponent * getComponent(QWidget * widget);
00089
00090
static void initClasses(
void);
00091
00092
protected:
00093 SoQtComponent(QWidget *
const parent = NULL,
00094
const char *
const name = NULL,
00095
const SbBool embed = TRUE);
00096
00097
virtual void afterRealizeHook(
void);
00098
00099
void setClassName(
const char *
const name);
00100
void setBaseWidget(QWidget * widget);
00101
00102
void registerWidget(QWidget * widget);
00103
void unregisterWidget(QWidget * widget);
00104
00105
virtual const char * getDefaultWidgetName(
void)
const;
00106
virtual const char * getDefaultTitle(
void)
const;
00107
virtual const char * getDefaultIconTitle(
void)
const;
00108
00109
virtual void sizeChanged(
const SbVec2s & size);
00110
00111
void addVisibilityChangeCallback(SoQtComponentVisibilityCB *
const func,
00112
void *
const user = NULL);
00113
void removeVisibilityChangeCallback(SoQtComponentVisibilityCB *
const func,
00114
void *
const user = NULL);
00115
00116
private:
00117
class SoQtComponentP * pimpl;
00118
#ifndef DOXYGEN_SKIP_THIS
00119
friend class SoGuiComponentP;
00120
friend class SoQtComponentP;
00121
#endif // DOXYGEN_SKIP_THIS
00122
00123
00124
00125
#ifdef __COIN_SOWIN__
00126
public:
00127 HWND setFocusProxy(HWND widget);
00128 HWND getFocusProxy(
void);
00129
00130
protected:
00131 HWND buildFormWidget(HWND parent);
00132
virtual void windowCloseAction(
void);
00133
void setResize(SbBool set);
00134 SbBool getResize(
void);
00135
#endif // __COIN_SOWIN__
00136
00137
#ifdef __COIN_SOXT__
00138
public:
00139 Display * getDisplay(
void);
00140
void fitSize(
const SbVec2s size);
00141
00142
00143
void addWindowCloseCallback(SoXtComponentCB * callback,
void * closure = NULL);
00144
void removeWindowCloseCallback(SoXtComponentCB * callback,
void * closure = NULL);
00145
00146
protected:
00147
00148
00149
virtual void windowCloseAction(
void);
00150
void invokeVisibilityChangeCallbacks(
const SbBool enable)
const;
00151
void invokeWindowCloseCallbacks(
void)
const;
00152
00153
00154
static char * getlabel(
unsigned int what);
00155 SbBool firstRealize;
00156
00157
00158
00159
00160
virtual Boolean sysEventHandler(Widget widget, XEvent * event);
00161
00162
private:
00163
00164
static void event_handler(Widget, XtPointer, XEvent *, Boolean *);
00165
#endif // __COIN_SOXT__
00166
00167
#ifdef __COIN_SOGTK__
00168
protected:
00169
virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event);
00170
private:
00171
static gint eventHandler(GtkWidget * object, GdkEvent * event, gpointer closure);
00172
#endif // __COIN_SOGTK__
00173
};
00174
00175
00176
00177
#endif // ! SOQT_COMPONENT_H