File indexing completed on 2024-05-19 04:36:34
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZUI_COLOR_WIDGET_H 0021 #define TIKZUI_COLOR_WIDGET_H 0022 0023 #include "tikzui_export.h" 0024 #include <QFrame> 0025 0026 class QAbstractButton; 0027 0028 namespace tikz { 0029 namespace ui { 0030 0031 class ColorWidgetPrivate; 0032 class ColorPalette; 0033 0034 /** 0035 * Widget that shows a color palette. 0036 * 0037 * The ColorWidget represents a color palette. 0038 * The color palette is loaded for a file by calling @p load(). 0039 * Thereafter, the colors can be obtained with @p color() with parameters 0040 * in the range of rows() and columns(). 0041 */ 0042 class TIKZKITUI_EXPORT ColorWidget : public QFrame 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 /** 0048 * Default constructor. 0049 */ 0050 explicit ColorWidget(QWidget * parent = nullptr); 0051 0052 /** 0053 * Destructor 0054 */ 0055 ~ColorWidget(); 0056 0057 public: 0058 /** 0059 * Set the selected palette to @p palette. 0060 * If @p palette does not exist, the default palette will be selected. 0061 */ 0062 void setPalette(const QString & palette); 0063 0064 private Q_SLOTS: 0065 void setColor(QAbstractButton * button); 0066 0067 void setPaletteFromIndex(int index); 0068 0069 private: 0070 ColorWidgetPrivate * const d; 0071 }; 0072 0073 } 0074 } 0075 0076 #endif // TIKZUI_COLOR_WIDGET_H 0077 0078 // kate: indent-width 4; replace-tabs on;