GLJQComponentBridge.h

00001 /*
00002  * @(#)GLJQComponentBridge.h  0.2.0 / 2007-08-18
00003  *
00004  * Copyright (c) 2007, ETF and contributors. All rights reserved.
00005  *
00006  * This software is licensed under the LGPL, version 2.1, license.
00007  * A copy of the license is included in the file LICENSE-LGPL.txt.
00008  */
00009 #ifndef GLJQCOMPONENTBRIDGE_H
00010 #define GLJQCOMPONENTBRIDGE_H
00011 
00012 #include "JavaQxOpenGL.h"
00013 
00014 #include "JQComponentBridge.h"
00015 
00016 /*^**************************************************************************^*/
00017 /*- GLJQComponentBridge Class.                                               -*/
00018 /*^**************************************************************************^*/
00019 
00026 class JAVAQX_EXPORT GLJQComponentBridge : public JQComponentBridge
00027 {
00028   Q_OBJECT
00029 protected:
00030   GLJQComponentBridge(JNIEnv *env, jobject obj);
00031 public: // native calls
00032   void updateGL(JNIEnv *env);
00033 public: // native calls
00034   static void initialize(JNIEnv *env, jclass cls);
00035   static jlong newInstance(JNIEnv *env, jobject obj);
00036 public:
00037   inline QGLWidget *qGLWidget() const;
00038 protected:
00039   friend class QGLWidgetAdapter; // uses all protected methods
00040   inline void callInitializeGL();
00041   inline void callResizeGL(int width, int height);
00042   inline void callPaintGL();
00043 private:
00044   static jmethodID sm_createGLMID;
00045   static jmethodID sm_initializeGLMID;
00046   static jmethodID sm_resizeGLMID;
00047   static jmethodID sm_paintGLMID;
00048 };
00049 
00050 /*^**************************************************************************^*/
00051 /*- GLJQComponentBridge :: Protected Inline Member Functions.                -*/
00052 /*^**************************************************************************^*/
00053 
00059 inline QGLWidget *GLJQComponentBridge::qGLWidget() const
00060 {
00061   return static_cast<QGLWidget *>(qObject());
00062 }
00063 
00067 inline void GLJQComponentBridge::callInitializeGL()
00068 {
00069   jniObject()->callVoidMethod(sm_initializeGLMID);
00070 }
00071 
00078 inline void GLJQComponentBridge::callResizeGL(int width, int height)
00079 {
00080   jniObject()->callVoidMethod(sm_resizeGLMID, width, height);
00081 }
00082 
00086 inline void GLJQComponentBridge::callPaintGL()
00087 {
00088   jniObject()->callVoidMethod(sm_paintGLMID);
00089 }
00090 
00091 /*^**************************************************************************^*/
00092 /*- Macro Definition.                                                        -*/
00093 /*^**************************************************************************^*/
00094 
00095 #define glJQComponentBridge (reinterpret_cast<GLJQComponentBridge *>(bridge))
00096 
00097 #endif //GLJQCOMPONENTBRIDGE_H
00098 
00099 /*^*****************************************************************************
00100   File History:
00101 
00102  - 2007-08-18 14:03:49 JavaQx Native Generator
00103    Initial version
00104 
00105 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.