![]() |
http://www.sim.no http://www.coin3d.org |
00001 #ifndef SOQT_COMPONENT_H 00002 #define SOQT_COMPONENT_H 00003 00004 // src/Inventor/Qt/SoQtComponent.h. Generated from SoGuiComponent.h.in by configure. 00005 00006 /**************************************************************************\ 00007 * 00008 * This file is part of the Coin 3D visualization library. 00009 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU General Public License 00013 * ("GPL") version 2 as published by the Free Software Foundation. 00014 * See the file LICENSE.GPL at the root directory of this source 00015 * distribution for additional information about the GNU GPL. 00016 * 00017 * For using Coin with software that can not be combined with the GNU 00018 * GPL, and for taking advantage of the additional benefits of our 00019 * support services, please contact Kongsberg Oil & Gas Technologies 00020 * about acquiring a Coin Professional Edition License. 00021 * 00022 * See http://www.coin3d.org/ for more information. 00023 * 00024 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00025 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00026 * 00027 \**************************************************************************/ 00028 00029 #include <Inventor/SbLinear.h> 00030 #include <Inventor/Qt/SoQtObject.h> 00031 00032 #ifdef __COIN_SOQT__ 00033 class QWidget; 00034 #endif // __COIN_SOQT__ 00035 #ifdef __COIN_SOXT__ 00036 #include <X11/Intrinsic.h> 00037 #endif // __COIN_SOXT__ 00038 #ifdef __COIN_SOGTK__ 00039 #include <gtk/gtk.h> 00040 #endif // __COIN_SOGTK__ 00041 #ifdef __COIN_SOWIN__ 00042 #include <windows.h> 00043 #endif // __COIN_SOWIN__ 00044 00045 00046 class SoQtComponent; 00047 class SoQtCursor; 00048 00049 typedef void SoQtComponentCB(void * user, SoQtComponent * component); 00050 typedef void SoQtComponentVisibilityCB(void * user, SbBool visible); 00051 00052 // ************************************************************************* 00053 00054 class SOQT_DLL_API SoQtComponent : public SoQtObject { 00055 SOQT_OBJECT_ABSTRACT_HEADER(SoQtComponent, SoQtObject); 00056 00057 public: 00058 virtual ~SoQtComponent(); 00059 00060 virtual void show(void); 00061 virtual void hide(void); 00062 00063 virtual void setComponentCursor(const SoQtCursor & cursor); 00064 static void setWidgetCursor(QWidget * w, const SoQtCursor & cursor); 00065 00066 SbBool isFullScreen(void) const; 00067 SbBool setFullScreen(const SbBool onoff); 00068 00069 SbBool isVisible(void); 00070 SbBool isTopLevelShell(void) const; 00071 00072 QWidget * getWidget(void) const; 00073 QWidget * getBaseWidget(void) const; 00074 QWidget * getShellWidget(void) const; 00075 QWidget * getParentWidget(void) const; 00076 00077 void setSize(const SbVec2s size); 00078 SbVec2s getSize(void) const; 00079 00080 void setTitle(const char * const title); 00081 const char * getTitle(void) const; 00082 void setIconTitle(const char * const title); 00083 const char * getIconTitle(void) const; 00084 00085 const char * getWidgetName(void) const; 00086 const char * getClassName(void) const; 00087 00088 void setWindowCloseCallback(SoQtComponentCB * const func, 00089 void * const user = NULL); 00090 static SoQtComponent * getComponent(QWidget * widget); 00091 00092 static void initClasses(void); 00093 00094 protected: 00095 SoQtComponent(QWidget * const parent = NULL, 00096 const char * const name = NULL, 00097 const SbBool embed = TRUE); 00098 00099 virtual void afterRealizeHook(void); 00100 00101 // About the wrapping below: this variable was added after SoQt 1.0, 00102 // and before SoXt 1.1. To be able to release SoQt 1.1 from this 00103 // same branch, sizeof(SoQtComponent) needs to be the same as for 00104 // SoQt 1.0, which means we can't add this variable for SoQt. 00105 #ifndef __COIN_SOQT__ 00106 SbBool firstRealize; 00107 #endif // __COIN_SOQT__ 00108 00109 void setClassName(const char * const name); 00110 void setBaseWidget(QWidget * widget); 00111 00112 void registerWidget(QWidget * widget); 00113 void unregisterWidget(QWidget * widget); 00114 00115 virtual const char * getDefaultWidgetName(void) const; 00116 virtual const char * getDefaultTitle(void) const; 00117 virtual const char * getDefaultIconTitle(void) const; 00118 00119 virtual void sizeChanged(const SbVec2s & size); 00120 00121 void addVisibilityChangeCallback(SoQtComponentVisibilityCB * const func, 00122 void * const user = NULL); 00123 void removeVisibilityChangeCallback(SoQtComponentVisibilityCB * const func, 00124 void * const user = NULL); 00125 00126 private: 00127 class SoQtComponentP * pimpl; 00128 friend class SoGuiComponentP; 00129 friend class SoQtComponentP; 00130 00131 // FIXME!: audit and remove as much as possible of the remaining 00132 // toolkit specific parts below. 20020117 mortene. 00133 00134 #ifdef __COIN_SOXT__ 00135 public: 00136 Display * getDisplay(void); 00137 void fitSize(const SbVec2s size); 00138 // FIXME: I guess these should really be part of the common 00139 // API. 20011012 mortene. 00140 void addWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL); 00141 void removeWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL); 00142 00143 protected: 00144 // FIXME: I guess this should perhaps be part of the common API? 00145 // 20011012 mortene. 00146 void invokeVisibilityChangeCallbacks(const SbBool enable) const; 00147 void invokeWindowCloseCallbacks(void) const; 00148 virtual void windowCloseAction(void); 00149 00150 private: 00151 // FIXME: get rid of this? 20011012 mortene. 00152 static void event_handler(Widget, XtPointer, XEvent *, Boolean *); 00153 #endif // __COIN_SOXT__ 00154 00155 #ifdef __COIN_SOGTK__ 00156 protected: 00157 virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event); 00158 private: 00159 static gint eventHandler(GtkWidget * object, GdkEvent * event, gpointer closure); 00160 #endif // __COIN_SOGTK__ 00161 }; 00162 00163 // ************************************************************************* 00164 00165 #endif // ! SOQT_COMPONENT_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Sun Mar 11 2012 for SoQt by Doxygen 1.7.5.