JQTextComponentBridge.h

00001 /*
00002  * @(#)JQTextComponentBridge.h  0.2.0 / 2007-12-11
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 JQTEXTCOMPONENTBRIDGE_H
00010 #define JQTEXTCOMPONENTBRIDGE_H
00011 
00012 #include "JavaQxQSwing.h"
00013 
00014 #include "JQComponentBridge.h"
00015 
00016 /*^**************************************************************************^*/
00017 /*- JQTextComponentBridge Class.                                             -*/
00018 /*^**************************************************************************^*/
00019 
00026 class JAVAQX_EXPORT JQTextComponentBridge : public JQComponentBridge
00027 {
00028   Q_OBJECT
00029 protected:
00030   JQTextComponentBridge(JNIEnv *env, jobject obj, QWidget *textComponent);
00031 public slots: // native calls
00032   virtual void setDocument(JNIEnv *env, jobject document) = 0;
00033   virtual void setEditable(JNIEnv *env, jboolean editable) = 0;
00034   virtual void insertText(JNIEnv *env, jstring text) = 0;
00035   virtual void cut(JNIEnv *env) = 0;
00036   virtual void copy(JNIEnv *env) = 0;
00037   virtual void paste(JNIEnv *env) = 0;
00038   virtual void clear(JNIEnv *env) = 0;
00039   virtual void selectAll(JNIEnv *env) = 0;
00040 public: // native calls
00041   static void initialize(JNIEnv *env, jclass cls);
00042 public: // native callbacks
00043   void undoAvailable(jboolean available);
00044   void redoAvailable(jboolean available);
00045   void cutAvailable(jboolean available);
00046   void copyAvailable(jboolean available);
00047   void pasteAvailable(jboolean available);
00048   void clearAvailable(jboolean available);
00049   void selectAllAvailable(jboolean available);
00050 public slots:
00051   void undoAvailableSlot(bool available);
00052   void redoAvailableSlot(bool available);
00053   void clipboardDataChanged();
00054 private:
00055   bool m_undoAvailable;
00056   bool m_redoAvailable;
00057   bool m_cutAvailable;
00058   bool m_copyAvailable;
00059   bool m_pasteAvailable;
00060   bool m_clearAvailable;
00061   bool m_selectAllAvailable;
00062 private:
00063   static jmethodID sm_undoAvailableMID;
00064   static jmethodID sm_redoAvailableMID;
00065   static jmethodID sm_cutAvailableMID;
00066   static jmethodID sm_copyAvailableMID;
00067   static jmethodID sm_pasteAvailableMID;
00068   static jmethodID sm_clearAvailableMID;
00069   static jmethodID sm_selectAllAvailableMID;
00070 };
00071 
00072 /*^**************************************************************************^*/
00073 /*- Macro Definition.                                                        -*/
00074 /*^**************************************************************************^*/
00075 
00076 #define jqTextComponentBridge \
00077     (reinterpret_cast<JQTextComponentBridge *>(bridge))
00078 
00079 #endif //JQTEXTCOMPONENTBRIDGE_H
00080 
00081 /*^*****************************************************************************
00082   File History:
00083 
00084  - 2007-12-11 21:50:00 Slobodan
00085    Initial version
00086 
00087 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.