diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /lib/koproperty/editors/cursoredit.cpp | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/koproperty/editors/cursoredit.cpp')
-rw-r--r-- | lib/koproperty/editors/cursoredit.cpp | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/lib/koproperty/editors/cursoredit.cpp b/lib/koproperty/editors/cursoredit.cpp new file mode 100644 index 00000000..a0b3227c --- /dev/null +++ b/lib/koproperty/editors/cursoredit.cpp @@ -0,0 +1,138 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Cedric Pasteur <[email protected]> + Copyright (C) 2004 Alexander Dymo <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "cursoredit.h" + +#include <qmap.h> +#include <qvariant.h> +#include <qcursor.h> + +#include <klocale.h> +#include <kdebug.h> + +#include "property.h" + +using namespace KoProperty; + +//QMap<QString, QVariant> *CursorEdit::m_spValues = 0; +Property::ListData *m_cursorListData = 0; + + +CursorEdit::CursorEdit(Property *property, QWidget *parent, const char *name) +: ComboBox(property, parent, name) +{ + /* + if(!m_spValues) { + m_spValues = new QMap<QString, QVariant>(); + (*m_spValues)[i18n("Arrow")] = Qt::ArrowCursor; + (*m_spValues)[i18n("Up Arrow")] = Qt::UpArrowCursor; + (*m_spValues)[i18n("Cross")] = Qt::CrossCursor; + (*m_spValues)[i18n("Waiting")] = Qt::WaitCursor; + (*m_spValues)[i18n("iBeam")] = Qt::IbeamCursor; + (*m_spValues)[i18n("Size Vertical")] = Qt::SizeVerCursor; + (*m_spValues)[i18n("Size Horizontal")] = Qt::SizeHorCursor; + (*m_spValues)[i18n("Size Slash")] = Qt::SizeBDiagCursor; + (*m_spValues)[i18n("Size Backslash")] = Qt::SizeFDiagCursor; + (*m_spValues)[i18n("Size All")] = Qt::SizeAllCursor; + (*m_spValues)[i18n("Blank")] = Qt::BlankCursor; + (*m_spValues)[i18n("Split Vertical")] = Qt::SplitVCursor; + (*m_spValues)[i18n("Split Horizontal")] = Qt::SplitHCursor; + (*m_spValues)[i18n("Pointing Hand")] = Qt::PointingHandCursor; + (*m_spValues)[i18n("Forbidden")] = Qt::ForbiddenCursor; + (*m_spValues)[i18n("What's this")] = Qt::WhatsThisCursor; + }*/ + +//! @todo NOT THREAD-SAFE + if (!m_cursorListData) { + QValueList<QVariant> keys; + keys + << Qt::BlankCursor + << Qt::ArrowCursor + << Qt::UpArrowCursor + << Qt::CrossCursor + << Qt::WaitCursor + << Qt::IbeamCursor + << Qt::SizeVerCursor + << Qt::SizeHorCursor + << Qt::SizeBDiagCursor + << Qt::SizeFDiagCursor + << Qt::SizeAllCursor + << Qt::SplitVCursor + << Qt::SplitHCursor + << Qt::PointingHandCursor + << Qt::ForbiddenCursor + << Qt::WhatsThisCursor; + QStringList strings; + strings << i18n("Mouse Cursor Shape", "No Cursor") + << i18n("Mouse Cursor Shape", "Arrow") + << i18n("Mouse Cursor Shape", "Up Arrow") + << i18n("Mouse Cursor Shape", "Cross") + << i18n("Mouse Cursor Shape", "Waiting") + << i18n("Mouse Cursor Shape", "I") + << i18n("Mouse Cursor Shape", "Size Vertical") + << i18n("Mouse Cursor Shape", "Size Horizontal") + << i18n("Mouse Cursor Shape", "Size Slash") + << i18n("Mouse Cursor Shape", "Size Backslash") + << i18n("Mouse Cursor Shape", "Size All") + << i18n("Mouse Cursor Shape", "Split Vertical") + << i18n("Mouse Cursor Shape", "Split Horizontal") + << i18n("Mouse Cursor Shape", "Pointing Hand") + << i18n("Mouse Cursor Shape", "Forbidden") + << i18n("Mouse Cursor Shape", "What's This?"); + m_cursorListData = new Property::ListData(keys, strings); + } + + if(property) + property->setListData(new Property::ListData(*m_cursorListData)); +} + +CursorEdit::~CursorEdit() +{ + delete m_cursorListData; + m_cursorListData = 0; +} + +QVariant +CursorEdit::value() const +{ + return QCursor(ComboBox::value().toInt()); +} + +void +CursorEdit::setValue(const QVariant &value, bool emitChange) +{ + ComboBox::setValue(value.toCursor().shape(), emitChange); +} + +void +CursorEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value) +{ + ComboBox::drawViewer(p, cg, r, value.toCursor().shape()); +} + +void +CursorEdit::setProperty(Property *prop) +{ + if(prop && prop != property()) + prop->setListData(new Property::ListData(*m_cursorListData)); + ComboBox::setProperty(prop); +} + +#include "cursoredit.moc" |