lib

kopalette.cpp
1/*
2 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
3 *
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.
7
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.
12
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.
16 */
17
18#include <tqwidget.h>
19#include <tqdockwindow.h>
20#include <tqvariant.h>
21#include <tqlabel.h>
22#include <tqtoolbutton.h>
23#include <tqtabwidget.h>
24#include <tqlayout.h>
25#include <tqtooltip.h>
26#include <tqwhatsthis.h>
27#include <tqimage.h>
28#include <tqpixmap.h>
29#include <tqlayout.h>
30
31#include <kdebug.h>
32#include <tdeglobal.h>
33#include <tdelocale.h>
34#include <tdeglobalsettings.h>
35#include <tdeaccelmanager.h>
36#include <tdeconfig.h>
37
38#include <KoView.h>
39
40#include "kopalette.h"
41
42KoPalette::KoPalette(TQWidget * parent, const char * name)
43 : TQDockWindow(parent, name)
44{
45
46 TDEAcceleratorManager::setNoAccel(this);
47 setCloseMode( TQDockWindow::Never);
48 setResizeEnabled(true);
49 setOpaqueMoving(true);
50 setFocusPolicy(TQWidget::NoFocus);
51 setVerticallyStretchable(false);
52 setHorizontallyStretchable(false);
53
54 setNewLine(true);
55 layout() -> setSpacing(0);
56 layout() -> setMargin(0);
57
58 resetFont();
59}
60
61void KoPalette::resetFont()
62{
63
64 TDEConfig * cfg = TDEGlobal::config();
65 Q_ASSERT(cfg);
66 cfg->setGroup("");
67 m_font = TDEGlobalSettings::generalFont();
68 float ps = TQMIN(9, TDEGlobalSettings::generalFont().pointSize() * 0.8);
69 ps = cfg->readNumEntry("palettefontsize", (int)ps);
70 if (ps < 6) ps = 6;
71 m_font.setPointSize((int)ps);
72 setFont(m_font);
73
74}
75
76KoPalette::~KoPalette()
77{
78}
79
80void KoPalette::setMainWidget(TQWidget * widget)
81{
82 setWidget(widget);
83 resize( TQSize(285, 233).expandedTo(minimumSizeHint()) );
84 clearWState( WState_Polished );
85 widget->setFont(m_font);
86 m_page = widget;
87}
88
89#include "kopalette.moc"
const char * name(StdAction id)