lib

kopalette.cc

00001 /*
00002  *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
00003  *
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2, as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00016  */
00017 
00018 #include <qwidget.h>
00019 #include <qdockwindow.h>
00020 #include <qvariant.h>
00021 #include <qlabel.h>
00022 #include <qtoolbutton.h>
00023 #include <qtabwidget.h>
00024 #include <qlayout.h>
00025 #include <qtooltip.h>
00026 #include <qwhatsthis.h>
00027 #include <qimage.h>
00028 #include <qpixmap.h>
00029 #include <qlayout.h>
00030 
00031 #include <kdebug.h>
00032 #include <kglobal.h>
00033 #include <klocale.h>
00034 #include <kglobalsettings.h>
00035 #include <kaccelmanager.h>
00036 #include <kconfig.h>
00037 
00038 #include <KoView.h>
00039 
00040 #include "kopalette.h"
00041 
00042 KoPalette::KoPalette(QWidget * parent, const char * name)
00043     : QDockWindow(parent, name)
00044 {
00045 
00046 #if KDE_VERSION >= KDE_MAKE_VERSION(3,3,90)
00047     KAcceleratorManager::setNoAccel(this);
00048 #endif
00049     setCloseMode( QDockWindow::Never);
00050     setResizeEnabled(true);
00051     setOpaqueMoving(true);
00052     setFocusPolicy(QWidget::NoFocus);
00053     setVerticallyStretchable(false);
00054     setHorizontallyStretchable(false);
00055 
00056     setNewLine(true);
00057     layout() -> setSpacing(0);
00058     layout() -> setMargin(0);
00059 
00060     resetFont();
00061 }
00062 
00063 void KoPalette::resetFont()
00064 {
00065             
00066     KConfig * cfg = KGlobal::config();
00067     Q_ASSERT(cfg);
00068     cfg->setGroup("");
00069     m_font  = KGlobalSettings::generalFont();
00070     float ps = QMIN(9, KGlobalSettings::generalFont().pointSize() * 0.8);
00071     ps = cfg->readNumEntry("palettefontsize", (int)ps);
00072     if (ps < 6) ps = 6;
00073     m_font.setPointSize((int)ps);
00074     setFont(m_font);
00075 
00076 }
00077 
00078 KoPalette::~KoPalette()
00079 {
00080 }
00081 
00082 void KoPalette::setMainWidget(QWidget * widget)
00083 {
00084     setWidget(widget);
00085     resize( QSize(285, 233).expandedTo(minimumSizeHint()) );
00086     clearWState( WState_Polished );
00087     widget->setFont(m_font);
00088     m_page = widget;
00089 }
00090 
00091 #include "kopalette.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys