File indexing completed on 2024-05-19 04:44:31
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include "KReportScriptCheck.h" 0019 #include <KProperty> 0020 0021 #include <QSizeF> 0022 #include <QPointF> 0023 0024 namespace Scripting 0025 { 0026 0027 CheckBox::CheckBox(KReportItemCheckBox *c) 0028 { 0029 m_check = c; 0030 } 0031 0032 0033 CheckBox::~CheckBox() 0034 { 0035 } 0036 0037 bool CheckBox::value() const 0038 { 0039 return m_check->value(); 0040 } 0041 0042 void CheckBox::setValue(bool v) 0043 { 0044 m_check->setValue(v); 0045 } 0046 0047 QString CheckBox::checkStyle() const 0048 { 0049 return m_check->m_checkStyle->value().toString(); 0050 } 0051 0052 void CheckBox::setCheckStyle(const QString &style) 0053 { 0054 m_check->m_checkStyle->setValue(style); 0055 } 0056 0057 QColor CheckBox::foregroundColor() const 0058 { 0059 return m_check->m_foregroundColor->value().value<QColor>(); 0060 } 0061 void CheckBox::setForegroundColor(const QColor& c) 0062 { 0063 m_check->m_foregroundColor->setValue(c); 0064 } 0065 0066 QColor CheckBox::lineColor() const 0067 { 0068 return m_check->m_lineColor->value().value<QColor>(); 0069 } 0070 void CheckBox::setLineColor(const QColor& c) 0071 { 0072 m_check->m_lineColor->setValue(c); 0073 } 0074 0075 int CheckBox::lineWeight() const 0076 { 0077 return m_check->m_lineWeight->value().toInt(); 0078 } 0079 void CheckBox::setLineWeight(int w) 0080 { 0081 m_check->m_lineWeight->setValue(w); 0082 } 0083 0084 int CheckBox::lineStyle() const 0085 { 0086 return m_check->m_lineStyle->value().toInt(); 0087 } 0088 void CheckBox::setLineStyle(int s) 0089 { 0090 if (s < 0 || s > 5) { 0091 s = 1; 0092 } 0093 m_check->m_lineStyle->setValue(s); 0094 } 0095 0096 QPointF CheckBox::position() const 0097 { 0098 return KReportItemBase::scenePosition(m_check->position()); 0099 } 0100 0101 void CheckBox::setPosition(const QPointF &p) 0102 { 0103 m_check->setPosition(KReportItemBase::positionFromScene(p)); 0104 } 0105 0106 QSizeF CheckBox::size() const 0107 { 0108 return KReportItemBase::sceneSize(m_check->size()); 0109 } 0110 0111 void CheckBox::setSize(const QSizeF &s) 0112 { 0113 m_check->setSize(KReportItemBase::sizeFromScene(s)); 0114 } 0115 }