summaryrefslogtreecommitdiffabout
path: root/microkde/fncolordialog.h
blob: 52356be4a881996544a940227780de77228423d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*  this program for Sharp SLA300, B500, C7x0, C860 Linux PDA
	Copyright (C) 2003-2005 Joe Kanemori.<kanemori@ymg.urban.ne.jp>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundatibannwaon; either version 2 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
/*
2005/02/27 FreeNote 1.11.10pre
・PDFの出力形式を一部変更
・インポート時のバグfix

*/
#ifndef  FNPALETTEDIALOG_H
#define  FNPALETTEDIALOG_H
#include <qwidget.h> 
#include <qpixmap.h>
#include <qpainter.h>
#include <qcolor.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qslider.h>
#include <qspinbox.h>

//-----------------------------------------------------------------------------
// FNPaletteBase
//-----------------------------------------------------------------------------
class /* Q_EXPORT */ FNPaletteBase : public QWidget
{ 
    Q_OBJECT
public:
	
    FNPaletteBase(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);

	
    virtual ~FNPaletteBase();

	
    void setBGColor(QColor c) {
		bgcolor_ = c;
		selection_ = c;
		redraw();
	};
	QColor color() const {
		return selection_;
	};

protected:
	virtual void paintEvent(QPaintEvent*);		
	virtual void resizeEvent(QResizeEvent* evt);
	virtual void redraw(bool force=false);		
	virtual void drawImpl(QPainter& pa);
	virtual void mouseReleaseEvent(QMouseEvent* evt); 
	virtual bool pickColor(int x, int y);
	QColor selection_;
private:
    QPixmap wbuf_;	
    QColor bgcolor_;
	bool _isblock;

signals:
	void clicked(FNPaletteBase* sender);
};




//-----------------------------------------------------------------------------
// FNColorPalette
//-----------------------------------------------------------------------------
class /* Q_EXPORT */ FNColorPalette : public FNPaletteBase
{ 
    Q_OBJECT
public:
    FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
    virtual ~FNColorPalette();
};




//-----------------------------------------------------------------------------
// FNHSVPalette
//-----------------------------------------------------------------------------
class /*Q_EXPORT */ FNHSVPalette : public FNPaletteBase
{
    Q_OBJECT
public:
    FNHSVPalette(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
    virtual ~FNHSVPalette();
public slots:
    void hueChanged(int v);
protected:
	virtual void drawImpl(QPainter& pa);
	int _hue;
};




//-----------------------------------------------------------------------------
// FNColorDialog
//-----------------------------------------------------------------------------
class /*Q_EXPORT */FNColorDialog : public QDialog
{
	Q_OBJECT
public:
	FNColorDialog(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
	virtual ~FNColorDialog();
	void setColor(QColor c);
	QColor color() const;
public slots:
	virtual void basePaletteClicked(FNPaletteBase*);
	virtual void hsvPaletteClicked(FNPaletteBase*);
	void rgbChanged(int);
private:
	FNHSVPalette*   _palette;
	FNColorPalette* _base[16];
	QSlider* _hue;
	FNColorPalette* _select;
	QSpinBox* _r;
	QSpinBox* _g;
	QSpinBox* _b;
    bool _isblock;

};
#endif //FNPALETTEDIALOG_H