lib

KoFontTab.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002 Montel Laurent <lmontel@mandrakesoft.com>
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 as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KoFontTab.h"
21
22KoFontTab::KoFontTab( uint fontListCriteria, TQWidget* parent, const char* name, WFlags fl )
23 : KoFontTabBase( parent, name, fl )
24{
25 TQStringList list;
26 TDEFontChooser::getFontList(list, fontListCriteria);
27
28 characterFont->setFamilyList( list );
29 characterFont->setSampleBoxVisible(false);
30 comparisonFont = characterFont->font();
31 connect( characterFont, TQ_SIGNAL( fontSelected( const TQFont & ) ), this, TQ_SLOT( slotFontChanged( const TQFont & ) ) );
32}
33
34KoFontTab::~KoFontTab()
35{
36}
37
38TQFont KoFontTab::getSelection()
39{
40 return characterFont->font();
41}
42
43void KoFontTab::setSelection( const TQFont &font )
44{
45 characterFont->setFont( font );
46}
47
48void KoFontTab::slotFontChanged( const TQFont &font )
49{
50 if ( comparisonFont.family() != font.family() ) emit familyChanged();
51 if ( comparisonFont.bold() != font.bold() ) emit boldChanged();
52 if ( comparisonFont.italic() != font.italic() ) emit italicChanged();
53 if ( comparisonFont.pointSize() != font.pointSize() ) emit sizeChanged();
54 comparisonFont = font;
55}
56
57#include "KoFontTab.moc"
static void getFontList(TQStringList &list, uint fontListCriteria)
const char * name(StdAction id)