1
/* This file is part of the KDE project
2
Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.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 as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
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.
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., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
20
#include "koCharSelectDia.h"
21
#include "koCharSelectDia.moc"
26
#include <kcharselect.h>
28
/******************************************************************/
29
/* class KoCharSelectDia */
30
/******************************************************************/
32
KoCharSelectDia::KoCharSelectDia( QWidget *parent, const char *name, const QChar &_chr, const QString &_font, bool _enableFont , bool _modal)
33
: KDialogBase( Plain, i18n("Select Character"), Ok | Cancel, Ok , parent, name, _modal )
35
initDialog(_chr,_font,_enableFont);
37
setButtonOKText(i18n("&Insert"),
38
i18n("Insert the selected character in the text"));
42
KoCharSelectDia::KoCharSelectDia( QWidget *parent, const char *name, const QString &_font, const QChar &_chr, bool _modal )
43
: KDialogBase( Plain, i18n("Select Character"), User1 | Close, User1 , parent, name, _modal )
45
initDialog(_chr,_font,true);
47
setButtonText( User1, i18n("&Insert") );
48
setButtonTip( User1, i18n("Insert the selected character in the text") );
52
void KoCharSelectDia::initDialog(const QChar &_chr, const QString &_font, bool /*_enableFont*/)
54
QWidget *page = plainPage();
56
grid = new QGridLayout( page, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
58
charSelect = new KCharSelect( page, "", _font, _chr );
59
connect(charSelect, SIGNAL(doubleClicked()),this, SLOT(slotDoubleClicked()));
60
charSelect->resize( charSelect->sizeHint() );
61
charSelect->enableFontCombo( true );
62
grid->addWidget( charSelect, 0, 0 );
64
grid->addColSpacing( 0, charSelect->width() );
65
grid->addRowSpacing( 0, charSelect->height() );
66
grid->setRowStretch( 0, 0 );
67
charSelect->setFocus();
70
KoCharSelectDia::~KoCharSelectDia()
74
void KoCharSelectDia::closeDialog()
79
bool KoCharSelectDia::selectChar( QString &_font, QChar &_chr, bool _enableFont )
83
KoCharSelectDia *dlg = new KoCharSelectDia( 0L, "Select Character", _chr, _font, _enableFont );
85
if ( dlg->exec() == Accepted )
98
QChar KoCharSelectDia::chr()
100
return charSelect->chr();
103
QString KoCharSelectDia::font()
105
return charSelect->font();
108
void KoCharSelectDia::slotUser1()
110
emit insertChar(chr(),font());
113
void KoCharSelectDia::slotDoubleClicked()
115
emit insertChar(chr(),font());