File indexing completed on 2024-05-12 16:35:16
0001 /* This file is part of the KDE project 0002 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org> 0003 Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef CALLIGRA_SHEETS_CHARACTER_SELECT_DIALOG 0022 #define CALLIGRA_SHEETS_CHARACTER_SELECT_DIALOG 0023 0024 #include <KoDialog.h> 0025 0026 class QWidget; 0027 0028 namespace Calligra 0029 { 0030 namespace Sheets 0031 { 0032 0033 /** 0034 * A dialog for selecting a character. 0035 */ 0036 class CharacterSelectDialog : public KoDialog 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 0042 // constructor 0043 CharacterSelectDialog(QWidget *parent, const QString &name, const QChar &_chr, 0044 const QString &_font, bool _modal = true); 0045 0046 //constructor when you want to insert multi char 0047 CharacterSelectDialog(QWidget *parent, const QString &name, const QString &_font, 0048 const QChar &_chr, bool _modal = true); 0049 ~CharacterSelectDialog() override; 0050 /** 0051 * Shows the selection dialog and returns true if user pressed ok, after filling the font and character parameters. 0052 * @param font will be filled when the user pressed Ok with the selected font. 0053 * @param character will be filled when the user pressed Ok with the selected character. 0054 * @param parent the parent widget this dialog will be associated with. 0055 * @param name the char name. 0056 */ 0057 static bool selectChar(QString &font, QChar &character, QWidget* parent = 0, const char* name = 0); 0058 0059 Q_SIGNALS: 0060 /** 0061 * Emitted when the user presses the 'insert' button. 0062 * @param character the character that the user selected 0063 * @param font the font name that was selected when the user inserted the character. 0064 */ 0065 void insertChar(QChar character , const QString &font); 0066 0067 private: 0068 void initDialog(const QChar &_chr, const QString &_font); 0069 QChar chr() const; 0070 QString font() const; 0071 void closeDialog(); 0072 0073 private Q_SLOTS: 0074 void slotUser1(); 0075 void slotDoubleClicked(); 0076 0077 private: 0078 class Private; 0079 Private * const d; 0080 }; 0081 0082 } // namespace Sheets 0083 } // namespace Calligra 0084 0085 #endif // CALLIGRA_SHEETS_CHARACTER_SELECT_DIALOG