Coin Logo http://www.sim.no
http://www.coin3d.org

SoQtComponent.h
1 #ifndef SOQT_COMPONENT_H
2 #define SOQT_COMPONENT_H
3 
4 // src/Inventor/Qt/SoQtComponent.h. Generated from SoGuiComponent.h.in by configure.
5 
6 /**************************************************************************\
7  *
8  * This file is part of the Coin 3D visualization library.
9  * Copyright (C) by Kongsberg Oil & Gas Technologies.
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * ("GPL") version 2 as published by the Free Software Foundation.
14  * See the file LICENSE.GPL at the root directory of this source
15  * distribution for additional information about the GNU GPL.
16  *
17  * For using Coin with software that can not be combined with the GNU
18  * GPL, and for taking advantage of the additional benefits of our
19  * support services, please contact Kongsberg Oil & Gas Technologies
20  * about acquiring a Coin Professional Edition License.
21  *
22  * See http://www.coin3d.org/ for more information.
23  *
24  * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
25  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
26  *
27 \**************************************************************************/
28 
29 #include <Inventor/SbLinear.h>
30 #include <Inventor/Qt/SoQtObject.h>
31 
32 #ifdef __COIN_SOQT__
33 class QWidget;
34 #endif // __COIN_SOQT__
35 #ifdef __COIN_SOXT__
36 #include <X11/Intrinsic.h>
37 #endif // __COIN_SOXT__
38 #ifdef __COIN_SOGTK__
39 #include <gtk/gtk.h>
40 #endif // __COIN_SOGTK__
41 #ifdef __COIN_SOWIN__
42 #include <windows.h>
43 #endif // __COIN_SOWIN__
44 
45 
46 class SoQtComponent;
47 class SoQtCursor;
48 
49 typedef void SoQtComponentCB(void * user, SoQtComponent * component);
50 typedef void SoQtComponentVisibilityCB(void * user, SbBool visible);
51 
52 // *************************************************************************
53 
54 class SOQT_DLL_API SoQtComponent : public SoQtObject {
55  SOQT_OBJECT_ABSTRACT_HEADER(SoQtComponent, SoQtObject);
56 
57 public:
58  virtual ~SoQtComponent();
59 
60  virtual void show(void);
61  virtual void hide(void);
62 
63  virtual void setComponentCursor(const SoQtCursor & cursor);
64  static void setWidgetCursor(QWidget * w, const SoQtCursor & cursor);
65 
66  SbBool isFullScreen(void) const;
67  SbBool setFullScreen(const SbBool onoff);
68 
69  SbBool isVisible(void);
70  SbBool isTopLevelShell(void) const;
71 
72  QWidget * getWidget(void) const;
73  QWidget * getBaseWidget(void) const;
74  QWidget * getShellWidget(void) const;
75  QWidget * getParentWidget(void) const;
76 
77  void setSize(const SbVec2s size);
78  SbVec2s getSize(void) const;
79 
80  void setTitle(const char * const title);
81  const char * getTitle(void) const;
82  void setIconTitle(const char * const title);
83  const char * getIconTitle(void) const;
84 
85  const char * getWidgetName(void) const;
86  const char * getClassName(void) const;
87 
88  void setWindowCloseCallback(SoQtComponentCB * const func,
89  void * const user = NULL);
90  static SoQtComponent * getComponent(QWidget * widget);
91 
92  static void initClasses(void);
93 
94 protected:
95  SoQtComponent(QWidget * const parent = NULL,
96  const char * const name = NULL,
97  const SbBool embed = TRUE);
98 
99  virtual void afterRealizeHook(void);
100 
101  // About the wrapping below: this variable was added after SoQt 1.0,
102  // and before SoXt 1.1. To be able to release SoQt 1.1 from this
103  // same branch, sizeof(SoQtComponent) needs to be the same as for
104  // SoQt 1.0, which means we can't add this variable for SoQt.
105 #ifndef __COIN_SOQT__
106  SbBool firstRealize;
107 #endif // __COIN_SOQT__
108 
109  void setClassName(const char * const name);
110  void setBaseWidget(QWidget * widget);
111 
112  void registerWidget(QWidget * widget);
113  void unregisterWidget(QWidget * widget);
114 
115  virtual const char * getDefaultWidgetName(void) const;
116  virtual const char * getDefaultTitle(void) const;
117  virtual const char * getDefaultIconTitle(void) const;
118 
119  virtual void sizeChanged(const SbVec2s & size);
120 
121  void addVisibilityChangeCallback(SoQtComponentVisibilityCB * const func,
122  void * const user = NULL);
123  void removeVisibilityChangeCallback(SoQtComponentVisibilityCB * const func,
124  void * const user = NULL);
125 
126 private:
127  class SoQtComponentP * pimpl;
128  friend class SoGuiComponentP;
129  friend class SoQtComponentP;
130 
131  // FIXME!: audit and remove as much as possible of the remaining
132  // toolkit specific parts below. 20020117 mortene.
133 
134 #ifdef __COIN_SOXT__
135 public:
136  Display * getDisplay(void);
137  void fitSize(const SbVec2s size);
138  // FIXME: I guess these should really be part of the common
139  // API. 20011012 mortene.
140  void addWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL);
141  void removeWindowCloseCallback(SoXtComponentCB * callback, void * closure = NULL);
142 
143 protected:
144  // FIXME: I guess this should perhaps be part of the common API?
145  // 20011012 mortene.
146  void invokeVisibilityChangeCallbacks(const SbBool enable) const;
147  void invokeWindowCloseCallbacks(void) const;
148  virtual void windowCloseAction(void);
149 
150 private:
151  // FIXME: get rid of this? 20011012 mortene.
152  static void event_handler(Widget, XtPointer, XEvent *, Boolean *);
153 #endif // __COIN_SOXT__
154 
155 #ifdef __COIN_SOGTK__
156 protected:
157  virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event);
158 private:
159  static gint eventHandler(GtkWidget * object, GdkEvent * event, gpointer closure);
160 #endif // __COIN_SOGTK__
161 };
162 
163 // *************************************************************************
164 
165 #endif // ! SOQT_COMPONENT_H
The SoQtComponent class is the base class for all GUI components.
Definition: SoQtComponent.h:54
The SoQtObject class is the common superclass for all SoQt component classes.The purpose of making th...
Definition: SoQtObject.h:39
The SoQtCursor class is used to set cursors for GUI components.The class provides both a set of pre-d...
Definition: SoQtCursor.h:32

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

Generated on Fri Mar 30 2018 for SoQt by Doxygen 1.8.8.