File indexing completed on 2024-05-19 04:44:33
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007-2008 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 #ifndef KRSCRIPTLABEL_H 0019 #define KRSCRIPTLABEL_H 0020 0021 #include <QObject> 0022 0023 #include "KReportItemLabel.h" 0024 0025 /** 0026 @brief Label item script interface 0027 0028 The user facing interface for scripting report label items 0029 */ 0030 namespace Scripting 0031 { 0032 class Label : public QObject 0033 { 0034 Q_OBJECT 0035 public: 0036 explicit Label(KReportItemLabel *); 0037 0038 ~Label() override; 0039 0040 public Q_SLOTS: 0041 //!Return the label caption 0042 QString caption() const; 0043 //!Sets the label caption 0044 void setCaption(const QString&); 0045 0046 //! @return the horizontal alignment as an integer 0047 //! Valid values are left: -1, center: 0, right; 1 0048 int horizontalAlignment() const; 0049 0050 //! Sets the horizontal alignment 0051 //! Valid values for alignment are left: -1, center: 0, right; 1 0052 void setHorizonalAlignment(int); 0053 0054 //! @return the vertical alignment 0055 //! Valid values are top: -1, middle: 0, bottom: 1 0056 int verticalAlignment() const; 0057 0058 //! Sets the vertical alignment 0059 //! Valid values for aligmnt are top: -1, middle: 0, bottom: 1 0060 void setVerticalAlignment(int); 0061 0062 //! @return the background color of the lable 0063 QColor backgroundColor() const; 0064 0065 //! Set the background color of the label to the given color 0066 void setBackgroundColor(const QColor&); 0067 0068 //! @return the foreground (text) color of the label 0069 QColor foregroundColor() const; 0070 0071 //! Sets the foreground (text) color of the label to the given color 0072 void setForegroundColor(const QColor&); 0073 0074 //! @return the opacity of the label 0075 int backgroundOpacity() const; 0076 0077 //! Sets the background opacity of the label 0078 //! Valid values are in the range 0-100 0079 void setBackgroundOpacity(int); 0080 0081 //! @return the border line color of the label 0082 QColor lineColor() const; 0083 0084 //! Sets the border line color of the label to the given color 0085 void setLineColor(const QColor&); 0086 0087 //! @return the border line weight (thickness) of the label 0088 int lineWeight() const; 0089 0090 //! Sets the border line weight (thickness) of the label 0091 void setLineWeight(int); 0092 0093 //! @return the border line style of the label. Values are from Qt::Penstyle range 0-5 0094 int lineStyle() const; 0095 0096 //! Sets the border line style of the label to the given style in the range 0-5 0097 void setLineStyle(int); 0098 0099 //! @returns the position of the label in points 0100 QPointF position() const; 0101 0102 //! Sets the position of the label to the given point coordinates 0103 void setPosition(const QPointF&); 0104 0105 //! @returns the size of the label in points 0106 QSizeF size() const; 0107 0108 //! Sets the size of the label to the given size in points 0109 void setSize(const QSizeF&); 0110 0111 private: 0112 KReportItemLabel *m_label; 0113 }; 0114 } 0115 0116 #endif