QFontAdapter.h

00001 /*
00002  * @(#)QFontAdapter.h  0.2.0 / 2007-08-27
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 QFONTADAPTER_H
00010 #define QFONTADAPTER_H
00011 
00012 #include <QFont>
00013 
00014 #include "JavaQxCore.h"
00015 
00016 /*^**************************************************************************^*/
00017 /*- QFontAdapter Class.                                                      -*/
00018 /*^**************************************************************************^*/
00019 
00026 class JAVAQX_EXPORT QFontAdapter : public QFont
00027 {
00028 protected:
00029   QFontAdapter(jstring name, jint style, jint size);
00030   QFontAdapter(const QFont &font);
00031 public:
00032   static void initialize(JNIEnv *env, jclass cls);
00033   static QFontAdapter *toQFont(JNIEnv *env, jobject font);
00034   static QFontAdapter *toQFont(jobject font);
00035   static jobject toJFont(JNIEnv *env, jclass fontClass, const QFont &font);
00036   static jobject toJFont(const QFont &font);
00037 public: // native calls
00038   static jlong newInstance(JNIEnv *env, jobject obj, jstring name, jint style,
00039                            jint size);
00040   static jlong newFontMetricsInstance(JNIEnv *env, jobject obj,
00041                                       jlong fontPonter);
00042   static jstring getDefaultFontName(JNIEnv *env, jclass cls);
00043 private:
00044   static jint fontStyle(const QFont &font);
00045 private:
00046   static jclass sm_fontClass;
00047   static jfieldID sm_lockFID;
00048   static jmethodID sm_constructorMID;
00049   static jmethodID sm_createMID;
00050   static jmethodID sm_createFontMetricsMID;
00051   static jmethodID sm_getFontPointerMID;
00052 };
00053 
00054 /*^**************************************************************************^*/
00055 /*- Macro Definitions.                                                       -*/
00056 /*^**************************************************************************^*/
00057 
00058 #define qFontCast(fontPonter) (reinterpret_cast<QFontAdapter *>(fontPonter))
00059 #define qFontAdapter qFontCast(fontPonter)
00060 
00061 #endif //QFONTADAPTER_H
00062 
00063 /*^*****************************************************************************
00064   File History:
00065 
00066  - 2007-08-27 17:02:29 Slobodan
00067    Initial version
00068 
00069 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.