JQCheckBoxMenuItemBridge.h

00001 /*
00002  * @(#)JQCheckBoxMenuItemBridge.h  0.2.0 / 2007-11-14
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 JQCHECKBOXMENUITEMBRIDGE_H
00010 #define JQCHECKBOXMENUITEMBRIDGE_H
00011 
00012 #include "JavaQxQSwing.h"
00013 
00014 #include "JQActionComponentBridge.h"
00015 
00016 /*^**************************************************************************^*/
00017 /*- JQCheckBoxMenuItemBridge Class.                                          -*/
00018 /*^**************************************************************************^*/
00019 
00026 class JAVAQX_EXPORT JQCheckBoxMenuItemBridge : public JQActionComponentBridge
00027 {
00028   Q_OBJECT
00029 protected:
00030   JQCheckBoxMenuItemBridge(JNIEnv *env, jobject obj);
00031 public slots: // native calls
00032   void setText(JNIEnv *env, jstring text);
00033   void setShortcut(JNIEnv *env, jstring shortcut);
00034   void setIcon(JNIEnv *env, jobject iconSet);
00035   void setChecked(JNIEnv *env, jboolean checked);
00036 public: // native calls
00037   static void initialize(JNIEnv *env, jclass cls);
00038   static jlong newInstance(JNIEnv *env, jobject obj);
00039 public: // native callbacks
00040   void checkedChanged(jint modifiers, jboolean checked);
00041 protected slots:
00042   void toggledSlot(bool checked);
00043   void stateChangedSlot(int state);
00044 protected:
00045   inline QCheckBox *checkBox() const;
00046 protected:
00047   virtual QWidget *createQWidget();
00048   virtual QAction *createQAction();
00049   virtual void deleteQWidget(QWidget *widget);
00050   virtual void deleteQAction(QAction *action);
00051   virtual QWidget *convertToQWidget(QAction *action);
00052   virtual QAction *convertToQAction(QWidget *widget);
00053 private:
00054   QShortcut *m_shortcut;
00055 private:
00056   static jmethodID sm_checkedChangedMID;
00057 };
00058 
00059 /*^**************************************************************************^*/
00060 /*- JQCheckBoxMenuItemBridge :: Protected Inline Member Function.            -*/
00061 /*^**************************************************************************^*/
00062 
00068 inline QCheckBox *JQCheckBoxMenuItemBridge::checkBox() const
00069 {
00070   return static_cast<QCheckBox *>(widget());
00071 }
00072 
00073 /*^**************************************************************************^*/
00074 /*- Macro Definition.                                                        -*/
00075 /*^**************************************************************************^*/
00076 
00077 #define jqCheckBoxMenuItemBridge \
00078     (reinterpret_cast<JQCheckBoxMenuItemBridge *>(bridge))
00079 
00080 #endif //JQCHECKBOXMENUITEMBRIDGE_H
00081 
00082 /*^*****************************************************************************
00083   File History:
00084 
00085  - 2007-11-14 09:03:27 Slobodan
00086    Initial version
00087 
00088 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.