00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef QFONTADAPTER_H
00010 #define QFONTADAPTER_H
00011
00012 #include <QFont>
00013
00014 #include "JavaQxCore.h"
00015
00016
00017
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:
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
00056
00057
00058 #define qFontCast(fontPonter) (reinterpret_cast<QFontAdapter *>(fontPonter))
00059 #define qFontAdapter qFontCast(fontPonter)
00060
00061 #endif //QFONTADAPTER_H
00062
00063
00064
00065
00066
00067
00068
00069