HQWidget.h
00001 //
00002 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Id: e3a89f57262141399f8b01158fa8a8d161735373 $
00013 //
00014 
00015 
00016 #ifndef HQWIDGET_H
00017 #define HQWIDGET_H
00018 
00019 
00020 #if defined(IS_OSX) && defined(USE_MDI)
00021 #include <QGLWidget>
00022 #else
00023 #include <QWidget>
00024 #endif
00025 
00026 #if  defined(PARASOLID)
00027 #include "HSolidModel.h"
00028 #include "HSolidView.h"
00029 #else
00030 #include "HBaseModel.h"
00031 #include "HBaseView.h"
00032 #endif
00033 
00034 
00048 #if defined(IS_OSX) && defined(USE_MDI)
00049 class HQWidget: public QGLWidget
00050 #else
00051 class HQWidget: public QWidget
00052 #endif
00053 {
00054     Q_OBJECT
00055 public:
00056     HQWidget( QWidget* parent=0, QString const & name = "", Qt::WFlags f=0, int aa=0);
00057     ~HQWidget();
00058 
00060     HBaseView* GetHoopsView() { return (HBaseView*) m_pHView; }
00061 
00063     HBaseModel* GetHoopsModel() { return (HBaseModel*) m_pHBaseModel; }
00064 
00065     static bool GetKeyState(unsigned int key, int &flags);
00066 
00067     static const char * ChooseDriver();
00068 
00069 protected:
00070 
00072     void * GetColorMap();
00073 
00075     void * GetWindowId();
00076 
00077 #if defined(IS_OSX) && defined(USE_MDI)
00078 
00079     void * GetQGLContext();
00080 #endif
00081 
00083     void * GetClipOverride();
00084 
00086     virtual void Init();    
00087 
00089     virtual QPaintEngine* paintEngine() const;
00090 
00095     virtual void OnLeftButtonDown(QMouseEvent * e = 0);
00096 
00101     virtual void OnLeftButtonUp(QMouseEvent * e = 0);
00102 
00107     virtual void OnLeftButtonDblClk(QMouseEvent * e = 0);
00108 
00113     virtual void OnMidButtonDown(QMouseEvent * e = 0);
00114 
00119     virtual void OnMidButtonUp(QMouseEvent * e = 0);
00120 
00125     virtual void OnMidButtonDblClk(QMouseEvent * e = 0);
00126 
00131     virtual void OnRightButtonDown(QMouseEvent * e = 0);
00132 
00137     virtual void OnRightButtonUp(QMouseEvent * e = 0);
00138 
00143     virtual void OnRightButtonDblClk(QMouseEvent * e = 0);
00144 
00149     virtual void wheelEvent(QWheelEvent * e = 0);
00150 
00154     virtual void paintEvent( QPaintEvent* e);
00155 
00159     virtual void resizeEvent( QResizeEvent* e);
00160 
00161     virtual void focusInEvent(QFocusEvent* e);
00162 
00163     virtual void focusOutEvent(QFocusEvent* e);
00164 
00165 
00170     virtual void keyPressEvent ( QKeyEvent * e );
00171 
00176     virtual void keyReleaseEvent ( QKeyEvent * e );
00177 
00181     virtual void mousePressEvent( QMouseEvent * mev);
00182 
00186     virtual void mouseDoubleClickEvent( QMouseEvent * mev);
00187 
00191     virtual void mouseReleaseEvent( QMouseEvent * mev);
00192 
00193 
00198     virtual void mouseMoveEvent( QMouseEvent * mev);
00199 
00201     void AdjustAxisWindow();
00202 
00206     bool eventFilter(QObject *obj, QEvent *ev);
00207 
00208 #ifdef PARASOLID
00209 
00211     HSolidView * m_pHView;
00212 
00214     HSolidModel * m_pHBaseModel;
00215 #else
00216 
00217     HBaseView * m_pHView;
00218 
00220     HBaseModel * m_pHBaseModel;
00221 #endif
00222 
00223     bool ignore_update;
00224 
00225 private:
00226 
00227     bool initDone;
00228 
00229     void setupWindow();
00230     void setupWindow(bool use_gl);
00231 
00232     unsigned long MapFlags(unsigned long state);
00233 
00234     void * my_colormap; 
00235     void * my_windowid;
00236     void * my_clip_override;
00237     bool my_have_gl_visual;
00238     int  my_aa;
00239 
00240 #if IS_OSX
00241     int use_clip_override[8];
00242 #if USE_MDI
00243     void * my_qgl_context;
00244 #endif
00245 #endif
00246 
00247 };
00248 
00249 
00250 #endif 
00251