You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
2.7 KiB
122 lines
2.7 KiB
15 years ago
|
/*
|
||
|
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
|
||
|
*
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License version 2, as published by the Free Software Foundation.
|
||
|
|
||
|
This library 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
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
|
||
|
*/
|
||
|
|
||
|
|
||
13 years ago
|
#include <tqdockwindow.h>
|
||
14 years ago
|
#include <tqtoolbox.h>
|
||
15 years ago
|
|
||
|
#include <kopalette.h>
|
||
|
#include <kopalettemanager.h>
|
||
|
#include <kotoolboxpalette.h>
|
||
|
|
||
14 years ago
|
KoToolBoxPalette::KoToolBoxPalette(TQWidget * parent, const char * name)
|
||
|
: KoPalette(parent, name)
|
||
15 years ago
|
{
|
||
14 years ago
|
m_page = new TQToolBox(this);
|
||
15 years ago
|
m_page->unsetFont();
|
||
|
setMainWidget(m_page);
|
||
|
m_style = PALETTE_TOOLBOX;
|
||
|
}
|
||
|
|
||
|
KoToolBoxPalette::~KoToolBoxPalette()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
void KoToolBoxPalette::resetFont()
|
||
|
{
|
||
|
KoPalette::resetFont();
|
||
|
m_page->unsetFont();
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
void KoToolBoxPalette::plug(TQWidget *w, const TQString & label, int position)
|
||
15 years ago
|
{
|
||
|
w->unsetFont();
|
||
|
m_page->insertItem( position, w, label );
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
void KoToolBoxPalette::unplug(const TQWidget *w)
|
||
15 years ago
|
{
|
||
14 years ago
|
m_page->removeItem( const_cast<TQWidget*>(w) );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
void KoToolBoxPalette::showPage(TQWidget *w)
|
||
15 years ago
|
{
|
||
|
m_page->setCurrentItem( w );
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
int KoToolBoxPalette::indexOf(TQWidget *w)
|
||
15 years ago
|
{
|
||
14 years ago
|
if (m_hiddenPages.find(w) != m_hiddenPages.end()) {
|
||
15 years ago
|
return m_page->indexOf(w);
|
||
|
}
|
||
|
else {
|
||
|
return m_page->indexOf(w);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void KoToolBoxPalette::makeVisible(bool v)
|
||
|
{
|
||
|
if (v && m_page->count() > 0) {
|
||
|
show();
|
||
|
}
|
||
|
else {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
14 years ago
|
bool KoToolBoxPalette::isHidden(TQWidget * w)
|
||
15 years ago
|
{
|
||
14 years ago
|
return (m_hiddenPages.find(w) != m_hiddenPages.end());
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
void KoToolBoxPalette::togglePageHidden(TQWidget *w)
|
||
15 years ago
|
{
|
||
14 years ago
|
if (m_hiddenPages.find(w) != m_hiddenPages.end()) {
|
||
|
int i = *m_hiddenPages.find(w);
|
||
15 years ago
|
m_page->insertItem(i, w, w->caption());
|
||
|
show();
|
||
|
}
|
||
|
else {
|
||
|
int i = m_page->indexOf(w);
|
||
|
m_page->removeItem(w);
|
||
|
m_hiddenPages[w] = i;
|
||
|
if (m_page->count() == 0) {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
14 years ago
|
void KoToolBoxPalette::hidePage( TQWidget * w)
|
||
15 years ago
|
{
|
||
14 years ago
|
if (m_hiddenPages.find(w) != m_hiddenPages.end()) return;
|
||
15 years ago
|
int i = m_page->indexOf(w);
|
||
|
m_page->removeItem(w);
|
||
|
m_hiddenPages[w] = i;
|
||
|
if (m_page->count() == 0) {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#include "kotoolboxpalette.moc"
|