lib
cursoredit.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "cursoredit.h"
00022
00023 #include <qmap.h>
00024 #include <qvariant.h>
00025 #include <qcursor.h>
00026
00027 #ifdef QT_ONLY
00028
00029 #else
00030 #include <klocale.h>
00031 #include <kdebug.h>
00032 #endif
00033
00034 #include "property.h"
00035
00036 using namespace KoProperty;
00037
00038
00039 Property::ListData *m_cursorListData = 0;
00040
00041
00042 CursorEdit::CursorEdit(Property *property, QWidget *parent, const char *name)
00043 : ComboBox(property, parent, name)
00044 {
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00067 if (!m_cursorListData) {
00068 QValueList<QVariant> keys;
00069 keys
00070 << Qt::BlankCursor
00071 << Qt::ArrowCursor
00072 << Qt::UpArrowCursor
00073 << Qt::CrossCursor
00074 << Qt::WaitCursor
00075 << Qt::IbeamCursor
00076 << Qt::SizeVerCursor
00077 << Qt::SizeHorCursor
00078 << Qt::SizeBDiagCursor
00079 << Qt::SizeFDiagCursor
00080 << Qt::SizeAllCursor
00081 << Qt::SplitVCursor
00082 << Qt::SplitHCursor
00083 << Qt::PointingHandCursor
00084 << Qt::ForbiddenCursor
00085 << Qt::WhatsThisCursor;
00086 QStringList strings;
00087 strings << i18n("Mouse Cursor Shape", "No Cursor")
00088 << i18n("Mouse Cursor Shape", "Arrow")
00089 << i18n("Mouse Cursor Shape", "Up Arrow")
00090 << i18n("Mouse Cursor Shape", "Cross")
00091 << i18n("Mouse Cursor Shape", "Waiting")
00092 << i18n("Mouse Cursor Shape", "I")
00093 << i18n("Mouse Cursor Shape", "Size Vertical")
00094 << i18n("Mouse Cursor Shape", "Size Horizontal")
00095 << i18n("Mouse Cursor Shape", "Size Slash")
00096 << i18n("Mouse Cursor Shape", "Size Backslash")
00097 << i18n("Mouse Cursor Shape", "Size All")
00098 << i18n("Mouse Cursor Shape", "Split Vertical")
00099 << i18n("Mouse Cursor Shape", "Split Horizontal")
00100 << i18n("Mouse Cursor Shape", "Pointing Hand")
00101 << i18n("Mouse Cursor Shape", "Forbidden")
00102 << i18n("Mouse Cursor Shape", "What's This?");
00103 m_cursorListData = new Property::ListData(keys, strings);
00104 }
00105
00106 if(property)
00107 property->setListData(new Property::ListData(*m_cursorListData));
00108 }
00109
00110 CursorEdit::~CursorEdit()
00111 {
00112 delete m_cursorListData;
00113 m_cursorListData = 0;
00114 }
00115
00116 QVariant
00117 CursorEdit::value() const
00118 {
00119 return QCursor(ComboBox::value().toInt());
00120 }
00121
00122 void
00123 CursorEdit::setValue(const QVariant &value, bool emitChange)
00124 {
00125 ComboBox::setValue(value.toCursor().shape(), emitChange);
00126 }
00127
00128 void
00129 CursorEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value)
00130 {
00131 ComboBox::drawViewer(p, cg, r, value.toCursor().shape());
00132 }
00133
00134 void
00135 CursorEdit::setProperty(Property *prop)
00136 {
00137 if(prop && prop != property())
00138 prop->setListData(new Property::ListData(*m_cursorListData));
00139 ComboBox::setProperty(prop);
00140 }
00141
00142 #include "cursoredit.moc"
|