JQMenuItemBridge.h

00001 /*
00002  * @(#)JQMenuItemBridge.h  0.2.0 / 2007-11-09
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 JQMENUITEMBRIDGE_H
00010 #define JQMENUITEMBRIDGE_H
00011 
00012 #include "JavaQxQSwing.h"
00013 
00014 #include "JQActionComponentBridge.h"
00015 #include "QLabelAdapter.h"
00016 
00017 /*^**************************************************************************^*/
00018 /*- JQMenuItemBridge Class.                                                  -*/
00019 /*^**************************************************************************^*/
00020 
00027 class JAVAQX_EXPORT JQMenuItemBridge : public JQActionComponentBridge
00028 {
00029   Q_OBJECT
00030 protected:
00031   JQMenuItemBridge(JNIEnv *env, jobject obj);
00032 public slots: // native calls
00033   void setText(JNIEnv *env, jstring text);
00034   void setShortcut(JNIEnv *env, jstring shortcut);
00035   void setIcon(JNIEnv *env, jobject iconSet);
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 actionTriggered(jint modifiers);
00041 protected slots:
00042   void triggeredSlot();
00043 protected:
00044   inline QLabelAdapter *label() const;
00045 protected:
00046   virtual QWidget *createQWidget();
00047   virtual QAction *createQAction();
00048   virtual void deleteQWidget(QWidget *widget);
00049   virtual void deleteQAction(QAction *action);
00050   virtual QWidget *convertToQWidget(QAction *action);
00051   virtual QAction *convertToQAction(QWidget *widget);
00052 private:
00053   QShortcut *m_shortcut;
00054 private:
00055   static jmethodID sm_actionTriggeredMID;
00056 };
00057 
00058 /*^**************************************************************************^*/
00059 /*- JQMenuItemBridge :: Protected Inline Member Function .                   -*/
00060 /*^**************************************************************************^*/
00061 
00067 inline QLabelAdapter *JQMenuItemBridge::label() const
00068 {
00069   return static_cast<QLabelAdapter *>(widget());
00070 }
00071 
00072 /*^**************************************************************************^*/
00073 /*- Macro Definition.                                                        -*/
00074 /*^**************************************************************************^*/
00075 
00076 #define jqMenuItemBridge (reinterpret_cast<JQMenuItemBridge *>(bridge))
00077 
00078 #endif //JQMENUITEMBRIDGE_H
00079 
00080 /*^*****************************************************************************
00081   File History:
00082 
00083  - 2007-11-09 19:21:03 Slobodan
00084    Initial version
00085 
00086 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.