00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef QIMSYSPREEDITITEM_H
00022 #define QIMSYSPREEDITITEM_H
00023
00024 #include "qimsysglobal.h"
00025 #include "dbus.h"
00026 #include <QMetaType>
00027 #include <QTextCharFormat>
00028
00029 struct QIMSYS_EXPORT QimsysPreeditItem {
00030 QString text;
00031 int cursor;
00032 int selection;
00033 QTextCharFormat::UnderlineStyle underline;
00034
00035 inline bool operator==(const QimsysPreeditItem &other) {
00036 return (text == other.text && cursor == other.cursor && selection == other.selection && underline == other.underline);
00037 }
00038 };
00039
00040 typedef QList<QimsysPreeditItem> QimsysPreeditItemList;
00041
00042 QIMSYS_EXPORT QDebug &operator<<(QDebug &debug, const QimsysPreeditItem &elem);
00043
00044 Q_DECLARE_METATYPE(QimsysPreeditItem)
00045 Q_DECLARE_METATYPE(QimsysPreeditItemList)
00046
00047 DATASTREAM_IN(QimsysPreeditItem &e,
00048 int underline;
00049 s >> e.text >> e.cursor >> e.selection >> underline;
00050 e.underline = (QTextCharFormat::UnderlineStyle)underline;
00051 )
00052
00053 DATASTREAM_OUT(const QimsysPreeditItem &e,
00054 s << e.text << e.cursor << e.selection << (int)e.underline;
00055 )
00056
00057 #ifndef QIMSYS_NO_DBUS
00058 DBUSARGUMENT_IN(QimsysPreeditItem &e,
00059 arg.beginStructure();
00060 e.text = qdbus_cast<QString>(arg);
00061 e.cursor = qdbus_cast<int>(arg);
00062 e.selection = qdbus_cast<int>(arg);
00063 e.underline = (QTextCharFormat::UnderlineStyle)qdbus_cast<int>(arg);
00064 arg.endStructure();
00065 )
00066
00067 DBUSARGUMENT_OUT(const QimsysPreeditItem &e,
00068 arg.beginStructure();
00069 arg << e.text;
00070 arg << e.cursor;
00071 arg << e.selection;
00072 arg << (int)e.underline;
00073 arg.endStructure();
00074 )
00075
00076 DBUSARGUMENT_IN(QimsysPreeditItemList &c,
00077 arg.beginArray();
00078 while (!arg.atEnd())
00079 {
00080 QimsysPreeditItem e = qdbus_cast<QimsysPreeditItem>(arg);
00081 c.append(e);
00082 }
00083 arg.endArray();
00084 )
00085
00086 DBUSARGUMENT_OUT(QimsysPreeditItemList &c,
00087 arg.beginArray();
00088 foreach(QimsysPreeditItem e, c)
00089 {
00090 arg << e;
00091 }
00092 arg.endArray();
00093 )
00094 #endif
00095
00096 #endif