summaryrefslogtreecommitdiffstats
path: root/kcoloredit/paletteview.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kcoloredit/paletteview.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcoloredit/paletteview.cpp')
-rw-r--r--kcoloredit/paletteview.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/kcoloredit/paletteview.cpp b/kcoloredit/paletteview.cpp
new file mode 100644
index 00000000..8e05a2d7
--- /dev/null
+++ b/kcoloredit/paletteview.cpp
@@ -0,0 +1,75 @@
+/***************************************************************************
+ paletteview.cpp - description
+ -------------------
+ begin : Sun Jul 9 2000
+ copyright : (C) 2000 by Artur Rataj
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+
+#include "kcoloreditview.h"
+#include "paletteview.h"
+
+PaletteView::PaletteView(const int defaultCellWidth, const int defaultCellHeight, const int cellSpacing,
+ KColorEditView* view, QWidget *parent, const char *name) :
+ QFrame(parent, name, QWidget::WResizeNoErase*0) {
+ setFrameStyle(StyledPanel|Sunken);
+ setLineWidth(2);
+ QGridLayout* topLayout = new QGridLayout(this, 2, 2);
+ topLayout->setMargin(2);
+ topLayout->setRowStretch(0, 10);
+ topLayout->setRowStretch(1, 0);
+ topLayout->setColStretch(0, 10);
+ topLayout->setColStretch(1, 0);
+ scrollBar = new QScrollBar(this);
+ hScrollBar = new QScrollBar(0, 1, 1, 1, 0, QScrollBar::Horizontal, this);
+ scrolledArea = new PaletteViewScrolledArea(defaultCellWidth,
+ defaultCellHeight, cellSpacing, scrollBar, hScrollBar, view, this);
+ connect(scrollBar, SIGNAL( valueChanged(int) ),
+ SLOT( slotRepaintScrolledArea() ));
+ topLayout->addWidget(scrolledArea, 0, 0);
+ connect(hScrollBar, SIGNAL( valueChanged(int) ),
+ SLOT( slotRepaintScrolledArea() ));
+ QHBoxLayout* hScrollBarLayout = new QHBoxLayout();
+ hScrollBarLayout->addWidget(hScrollBar, 10);
+ hScrollBarLayout->addWidget(new QWidget(this), 0);
+ topLayout->addLayout(hScrollBarLayout, 1, 0);
+ topLayout->addWidget(scrollBar, 0, 1);
+}
+
+PaletteView::~PaletteView() {
+}
+
+void PaletteView::redraw() {
+ slotRepaintScrolledArea();
+}
+
+void PaletteView::setScrollBarValue(const int value) {
+ scrollBar->setValue(value);
+ hScrollBar->setValue(0);
+}
+
+void PaletteView::slotViewColorNames(bool viewColorNames) {
+ scrolledArea->slotViewColorNames(viewColorNames);
+ setScrollBarValue(0);
+ scrolledArea->redraw();
+}
+
+void PaletteView::slotCursorFollowsChosenColor(bool follows) {
+ scrolledArea->slotCursorFollowsChosenColor(follows);
+}
+
+void PaletteView::slotRepaintScrolledArea() {
+ scrolledArea->redraw();
+}
+#include "paletteview.moc"