2
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2, as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include <qdockwindow.h>
23
#include <kopalette.h>
24
#include <kopalettemanager.h>
25
#include <kotoolboxpalette.h>
27
KoToolBoxPalette::KoToolBoxPalette(QWidget * parent, const char * name)
28
: KoPalette(parent, name)
30
m_page = new QToolBox(this);
32
setMainWidget(m_page);
33
m_style = PALETTE_TOOLBOX;
36
KoToolBoxPalette::~KoToolBoxPalette()
41
void KoToolBoxPalette::resetFont()
43
KoPalette::resetFont();
48
void KoToolBoxPalette::plug(QWidget *w, const QString & label, int position)
51
m_page->insertItem( position, w, label );
55
void KoToolBoxPalette::unplug(const QWidget *w)
57
m_page->removeItem( const_cast<QWidget*>(w) );
60
void KoToolBoxPalette::showPage(QWidget *w)
62
m_page->setCurrentItem( w );
66
int KoToolBoxPalette::indexOf(QWidget *w)
68
if (m_hiddenPages.find(w) != m_hiddenPages.end()) {
69
return m_page->indexOf(w);
72
return m_page->indexOf(w);
77
void KoToolBoxPalette::makeVisible(bool v)
79
if (v && m_page->count() > 0) {
87
bool KoToolBoxPalette::isHidden(QWidget * w)
89
return (m_hiddenPages.find(w) != m_hiddenPages.end());
92
void KoToolBoxPalette::togglePageHidden(QWidget *w)
94
if (m_hiddenPages.find(w) != m_hiddenPages.end()) {
95
int i = *m_hiddenPages.find(w);
96
m_page->insertItem(i, w, w->caption());
100
int i = m_page->indexOf(w);
101
m_page->removeItem(w);
102
m_hiddenPages[w] = i;
103
if (m_page->count() == 0) {
110
void KoToolBoxPalette::hidePage( QWidget * w)
112
if (m_hiddenPages.find(w) != m_hiddenPages.end()) return;
113
int i = m_page->indexOf(w);
114
m_page->removeItem(w);
115
m_hiddenPages[w] = i;
116
if (m_page->count() == 0) {
121
#include "kotoolboxpalette.moc"