Coin Logo http://www.coin3d.org/
http://www.kongsberg.com/kogt/

SoQtComponent.h

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  * Copyright (c) Kongsberg Oil & Gas Technologies AS
00008  * All rights reserved.
00009  * 
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions are
00012  * met:
00013  * 
00014  * Redistributions of source code must retain the above copyright notice,
00015  * this list of conditions and the following disclaimer.
00016  * 
00017  * Redistributions in binary form must reproduce the above copyright
00018  * notice, this list of conditions and the following disclaimer in the
00019  * documentation and/or other materials provided with the distribution.
00020  * 
00021  * Neither the name of the copyright holder nor the names of its
00022  * contributors may be used to endorse or promote products derived from
00023  * this software without specific prior written permission.
00024  * 
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00026  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00027  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00028  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00029  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00030  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00031  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00032  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00033  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00034  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00035  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 \**************************************************************************/
00037 
00038 #include <Inventor/SbLinear.h>
00039 #include <Inventor/Qt/SoQtObject.h>
00040 
00041 #ifdef __COIN_SOQT__
00042 class QWidget;
00043 #endif // __COIN_SOQT__
00044 #ifdef __COIN_SOXT__
00045 #include <X11/Intrinsic.h>
00046 #endif // __COIN_SOXT__
00047 #ifdef __COIN_SOGTK__
00048 #include <gtk/gtk.h>
00049 #endif // __COIN_SOGTK__
00050 #ifdef __COIN_SOWIN__
00051 #include <windows.h>
00052 #endif // __COIN_SOWIN__
00053 
00054 
00055 class SoQtComponent;
00056 class SoQtCursor;
00057 
00058 typedef void SoQtComponentCB(void * user, SoQtComponent * component);
00059 typedef void SoQtComponentVisibilityCB(void * user, SbBool visible);
00060 
00061 // *************************************************************************
00062 
00063 class SOQT_DLL_API SoQtComponent : public SoQtObject {
00064   SOQT_OBJECT_ABSTRACT_HEADER(SoQtComponent, SoQtObject);
00065 
00066 public:
00067   virtual ~SoQtComponent();
00068 
00069   virtual void show(void);
00070   virtual void hide(void);
00071 
00072   virtual void setComponentCursor(const SoQtCursor & cursor);
00073   static void setWidgetCursor(QWidget * w, const SoQtCursor & cursor);
00074 
00075   SbBool isFullScreen(void) const;
00076   SbBool setFullScreen(const SbBool onoff);
00077 
00078   SbBool isVisible(void);
00079   SbBool isTopLevelShell(void) const;
00080 
00081   QWidget * getWidget(void) const;
00082   QWidget * getBaseWidget(void) const;
00083   QWidget * getShellWidget(void) const;
00084   QWidget * getParentWidget(void) const;
00085 
00086   void setSize(const SbVec2s size);
00087   SbVec2s getSize(void) const;
00088 
00089   void setTitle(const char * const title);
00090   const char * getTitle(void) const;
00091   void setIconTitle(const char * const title);
00092   const char * getIconTitle(void) const;
00093 
00094   const char * getWidgetName(void) const;
00095   const char * getClassName(void) const;
00096 
00097   void setWindowCloseCallback(SoQtComponentCB * const func,
00098                               void * const user = NULL);
00099   static SoQtComponent * getComponent(QWidget * widget);
00100 
00101   static void initClasses(void);
00102 
00103 protected:
00104   SoQtComponent(QWidget * const parent = NULL,
00105                    const char * const name = NULL,
00106                    const SbBool embed = TRUE);
00107 
00108   virtual void afterRealizeHook(void);
00109 
00110   // About the wrapping below: this variable was added after SoQt 1.0,
00111   // and before SoXt 1.1. To be able to release SoQt 1.1 from this
00112   // same branch, sizeof(SoQtComponent) needs to be the same as for
00113   // SoQt 1.0, which means we can't add this variable for SoQt.
00114 #ifndef __COIN_SOQT__
00115   SbBool firstRealize;
00116 #endif // __COIN_SOQT__
00117 
00118   void setClassName(const char * const name);
00119   void setBaseWidget(QWidget * widget);
00120 
00121   void registerWidget(QWidget * widget);
00122   void unregisterWidget(QWidget * widget);
00123 
00124   virtual const char * getDefaultWidgetName(void) const;
00125   virtual const char * getDefaultTitle(void) const;
00126   virtual const char * getDefaultIconTitle(void) const;
00127 
00128   virtual void sizeChanged(const SbVec2s & size);
00129 
00130   void addVisibilityChangeCallback(SoQtComponentVisibilityCB * const func,
00131                                    void * const user = NULL);
00132   void removeVisibilityChangeCallback(SoQtComponentVisibilityCB * const func,
00133                                       void * const user = NULL);
00134 
00135 private:
00136   class SoQtComponentP * pimpl;
00137   friend class SoGuiComponentP;
00138   friend class SoQtComponentP;
00139 
00140   // FIXME!: audit and remove as much as possible of the remaining
00141   // toolkit specific parts below. 20020117 mortene.
00142 
00143 #ifdef __COIN_SOXT__
00144 public:
00145   Display * getDisplay(void);
00146   void fitSize(const SbVec2s size);
00147   // FIXME: I guess these should really be part of the common
00148   // API. 20011012 mortene.
00149   void addWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL);
00150   void removeWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL);
00151 
00152 protected:
00153   // FIXME: I guess this should perhaps be part of the common API?
00154   // 20011012 mortene.
00155   void invokeVisibilityChangeCallbacks(const SbBool enable) const;
00156   void invokeWindowCloseCallbacks(void) const;
00157   virtual void windowCloseAction(void);
00158 
00159 private:
00160   // FIXME: get rid of this? 20011012 mortene.
00161   static void event_handler(Widget, XtPointer, XEvent *, Boolean *);
00162 #endif // __COIN_SOXT__
00163 
00164 #ifdef __COIN_SOGTK__
00165 protected:
00166   virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event);
00167 private:
00168   static gint eventHandler(GtkWidget * object, GdkEvent * event, gpointer closure);
00169 #endif // __COIN_SOGTK__
00170 };
00171 
00172 // *************************************************************************
00173 
00174 #endif // ! SOQT_COMPONENT_H

Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Mar 2 2016 19:55:25 for SoQt by Doxygen 1.7.3.