Krita Source Code Documentation
Loading...
Searching...
No Matches
KoDualColorButton.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2
3 SPDX-FileCopyrightText: 1999 Daniel M. Duley <mosfet@kde.org>
4 SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-only
7*/
8
9#ifndef KODUALCOLORBUTTON_H
10#define KODUALCOLORBUTTON_H
11
12#include <kritaui_export.h>
14#include <QWidget>
15
16class KoColor;
17class KoColorSpace;
37class KRITAUI_EXPORT KoDualColorButton : public QWidget
38{
39 Q_OBJECT
40 Q_ENUMS( Selection )
41 Q_PROPERTY( KoColor foregroundColor READ foregroundColor WRITE setForegroundColor )
42 Q_PROPERTY( KoColor backgroundColor READ backgroundColor WRITE setBackgroundColor )
43 Q_PROPERTY( bool popDialog READ popDialog WRITE setPopDialog )
44
45
46 public:
47 enum Selection {
49 Background
50 };
51
59 KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor,
60 QWidget *parent = 0, QWidget* dialogParent = 0 );
61
62 KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor,
63 const KoColorDisplayRendererInterface *displayRenderer,
64 QWidget *parent = 0, QWidget* dialogParent = 0 );
65
69 ~KoDualColorButton() override;
70
75
80
86 bool popDialog() const;
87
92 QSize sizeHint() const override;
93
94 public Q_SLOTS:
98 void setForegroundColor( const KoColor &color );
99
103 void setBackgroundColor( const KoColor &color );
104
105 void slotSetForeGroundColorFromDialog (const KoColor color);
106
107 void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
108
114 void setColorSpace(const KoColorSpace *cs);
115
123 QColor getColorFromDisplayRenderer(KoColor c);
124
130 void setPopDialog( bool popDialog );
131
132 void openForegroundDialog();
133
134 void openBackgroundDialog();
135 Q_SIGNALS:
139 void foregroundColorChanged( const KoColor &color );
140
144 void backgroundColorChanged( const KoColor &color );
145
146 protected:
154 virtual void metrics( QRect &foregroundRect, QRect &backgroundRect );
155
156 void paintEvent( QPaintEvent *event ) override;
157 void mousePressEvent( QMouseEvent *event ) override;
158 void mouseMoveEvent( QMouseEvent *event ) override;
159 void mouseReleaseEvent( QMouseEvent *event ) override;
160 void dragEnterEvent( QDragEnterEvent *event ) override;
161 void dropEvent( QDropEvent *event ) override;
162 void changeEvent(QEvent *event) override;
163 bool event(QEvent *event) override;
164
165 private:
166 class Private;
167 Private *const d;
168};
169
170#endif
171
A widget for selecting two related colors.
bool popDialog() const
KoColor foregroundColor() const
KoColor backgroundColor() const
void foregroundColorChanged(const KoColor &color)
void backgroundColorChanged(const KoColor &color)
static KoColorDisplayRendererInterface * instance()