JQWindowBridge.h

00001 /*
00002  * @(#)JQWindowBridge.h  0.2.0 / 2007-10-31
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 JQWINDOWBRIDGE_H
00010 #define JQWINDOWBRIDGE_H
00011 
00012 #include "JavaQxQSwing.h"
00013 
00014 #include <QList>
00015 
00016 #include "JQContainerBridge.h"
00017 
00018 /*^**************************************************************************^*/
00019 /*- JQWindowBridge Class.                                                    -*/
00020 /*^**************************************************************************^*/
00021 
00028 class JAVAQX_EXPORT JQWindowBridge : public JQContainerBridge
00029 {
00030   Q_OBJECT
00031 protected:
00032   JQWindowBridge(JNIEnv *env, jobject obj, QWidget *widget);
00033   JQWindowBridge(JNIEnv *env, jobject obj);
00034   virtual ~JQWindowBridge();
00035 public slots: // native calls
00036   void setWindowType(JNIEnv *env, jint windowType);
00037   void setTitle(JNIEnv *env, jstring title);
00038   void setIconImage(JNIEnv *env, jlong imagePointer);
00039   void setIconImage(JNIEnv *env, jbyteArray imageData, jint length);
00040   void setOpacity(JNIEnv *env, jdouble opacity);
00041   void setAcceptClose(JNIEnv *env, jboolean accept);
00042   void setModality(JNIEnv *env, jint modality);
00043   void setState(JNIEnv *env, jint state);
00044   void setAlwaysOnTop(JNIEnv *env, jboolean alwaysOnTop);
00045   void setLocationRelativeTo(JNIEnv *env, jlong windowBridge);
00046   void toFront(JNIEnv *env);
00047   void toBack(JNIEnv *env);
00048   void setBorderDecoration(JNIEnv *env, jint borderDecoration);
00049 public: // native calls
00050   static void initialize(JNIEnv *env, jclass cls);
00051   static jboolean opacitySupported(JNIEnv *env, jclass cls);
00052   static jboolean alwaysOnTopSupported(JNIEnv *env, jclass cls);
00053   static jboolean fullScreenSupported(JNIEnv *env, jclass cls);
00054   static jboolean windowShapeSupported(JNIEnv *env, jclass cls);
00055   static jobjectArray getWindows(JNIEnv *env, jclass cls);
00056   static jobject getActiveWindow(JNIEnv *env, jclass cls);
00057   static void setWindowOwner(JNIEnv *env, jclass cls, jlong windowBridge,
00058                              jlong ownerBridge);
00059   static jlong newInstance(JNIEnv *env, jobject obj);
00060 public: // native callbacks
00061   void windowOpened();
00062   void windowClosing();
00063   void windowClosed();
00064   void windowActivated();
00065   void windowDeactivated();
00066   void windowGainedFocus();
00067   void windowLostFocus();
00068   void windowStateChanged(jint oldState, jint newState);
00069 public:
00070   virtual void showWindow(JNIEnv *env);
00071 protected:
00072   jint converWindowState(Qt::WindowStates states);
00073 protected:
00074   virtual bool filterEvent(QObject *obj, QEvent *e);
00075 private:
00076   bool m_acceptClose;
00077 private:
00078   static QList<JQWindowBridge *> sm_windows;
00079   static jclass sm_windowClass;
00080   static jmethodID sm_windowOpenedMID;
00081   static jmethodID sm_windowClosingMID;
00082   static jmethodID sm_windowClosedMID;
00083   static jmethodID sm_windowActivatedMID;
00084   static jmethodID sm_windowDeactivatedMID;
00085   static jmethodID sm_windowGainedFocusMID;
00086   static jmethodID sm_windowLostFocusMID;
00087   static jmethodID sm_windowStateChangedMID;
00088 };
00089 
00090 /*^**************************************************************************^*/
00091 /*- Macro Definitions.                                                       -*/
00092 /*^**************************************************************************^*/
00093 
00094 #define jqWindowCast(bridge) (reinterpret_cast<JQWindowBridge *>(bridge))
00095 #define jqWindowBridge jqWindowCast(bridge)
00096 
00097 #endif //JQWINDOWBRIDGE_H
00098 
00099 /*^*****************************************************************************
00100   File History:
00101 
00102  - 2007-10-31 17:36:22 Slobodan
00103    Initial version
00104 
00105 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.