author | sandman <sandman> | 2002-10-01 20:58:30 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-01 20:58:30 (UTC) |
commit | 2906826d9ebc268bc233f97956ee1dc5b338c69b (patch) (unidiff) | |
tree | d6af20025d6ac5e9220a3f1458d1985df8a6cc93 | |
parent | 88bef2791f8e4c99e0e9d34ddfe518b5baa2df72 (diff) | |
download | opie-2906826d9ebc268bc233f97956ee1dc5b338c69b.zip opie-2906826d9ebc268bc233f97956ee1dc5b338c69b.tar.gz opie-2906826d9ebc268bc233f97956ee1dc5b338c69b.tar.bz2 |
OFontSelector has now an optional builtin preview widget
-rw-r--r-- | libopie/ofontselector.cpp | 51 | ||||
-rw-r--r-- | libopie/ofontselector.h | 5 |
2 files changed, 47 insertions, 9 deletions
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp index e1090b5..b905474 100644 --- a/libopie/ofontselector.cpp +++ b/libopie/ofontselector.cpp | |||
@@ -2,162 +2,177 @@ | |||
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qmultilineedit.h> | ||
34 | 35 | ||
35 | #include <qpe/fontdatabase.h> | 36 | #include <qpe/fontdatabase.h> |
36 | 37 | ||
37 | #include "ofontselector.h" | 38 | #include "ofontselector.h" |
38 | 39 | ||
39 | class OFontSelectorPrivate { | 40 | class OFontSelectorPrivate { |
40 | public: | 41 | public: |
41 | QListBox * m_font_family_list; | 42 | QListBox * m_font_family_list; |
42 | QComboBox * m_font_style_list; | 43 | QComboBox * m_font_style_list; |
43 | QComboBox * m_font_size_list; | 44 | QComboBox * m_font_size_list; |
45 | QMultiLineEdit *m_preview; | ||
44 | 46 | ||
45 | bool m_pointbug; | 47 | bool m_pointbug; |
46 | 48 | ||
47 | FontDatabase m_fdb; | 49 | FontDatabase m_fdb; |
48 | }; | 50 | }; |
49 | 51 | ||
50 | 52 | ||
51 | class FontListItem : public QListBoxText { | 53 | class FontListItem : public QListBoxText { |
52 | public: | 54 | public: |
53 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) | 55 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) |
54 | { | 56 | { |
55 | m_name = t; | 57 | m_name = t; |
56 | m_styles = styles; | 58 | m_styles = styles; |
57 | m_sizes = sizes; | 59 | m_sizes = sizes; |
58 | 60 | ||
59 | QString str = t; | 61 | QString str = t; |
60 | str [0] = str [0]. upper ( ); | 62 | str [0] = str [0]. upper ( ); |
61 | setText ( str ); | 63 | setText ( str ); |
62 | } | 64 | } |
63 | 65 | ||
64 | QString family ( ) const | 66 | QString family ( ) const |
65 | { | 67 | { |
66 | return m_name; | 68 | return m_name; |
67 | } | 69 | } |
68 | 70 | ||
69 | const QStringList &styles ( ) const | 71 | const QStringList &styles ( ) const |
70 | { | 72 | { |
71 | return m_styles; | 73 | return m_styles; |
72 | } | 74 | } |
73 | 75 | ||
74 | const QValueList<int> &sizes ( ) const | 76 | const QValueList<int> &sizes ( ) const |
75 | { | 77 | { |
76 | return m_sizes; | 78 | return m_sizes; |
77 | } | 79 | } |
78 | 80 | ||
79 | private: | 81 | private: |
80 | QStringList m_styles; | 82 | QStringList m_styles; |
81 | QValueList<int> m_sizes; | 83 | QValueList<int> m_sizes; |
82 | QString m_name; | 84 | QString m_name; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
86 | static int findItemCB ( QComboBox *box, const QString &str ) | 88 | static int findItemCB ( QComboBox *box, const QString &str ) |
87 | { | 89 | { |
88 | for ( int i = 0; i < box-> count ( ); i++ ) { | 90 | for ( int i = 0; i < box-> count ( ); i++ ) { |
89 | if ( box-> text ( i ) == str ) | 91 | if ( box-> text ( i ) == str ) |
90 | return i; | 92 | return i; |
91 | } | 93 | } |
92 | return -1; | 94 | return -1; |
93 | } | 95 | } |
94 | 96 | ||
95 | 97 | ||
96 | static int qt_version ( ) | 98 | static int qt_version ( ) |
97 | { | 99 | { |
98 | const char *qver = qVersion ( ); | 100 | const char *qver = qVersion ( ); |
99 | 101 | ||
100 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 102 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
101 | } | 103 | } |
102 | 104 | ||
103 | 105 | ||
104 | OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 106 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
105 | { | 107 | { |
106 | d = new OFontSelectorPrivate ( ); | 108 | d = new OFontSelectorPrivate ( ); |
107 | 109 | ||
108 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); | 110 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); |
109 | gridLayout->setRowStretch ( 4, 10 ); | 111 | gridLayout->setRowStretch ( 4, 10 ); |
110 | 112 | ||
111 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); | 113 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); |
112 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); | 114 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); |
113 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 115 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); |
114 | 116 | ||
115 | QLabel *label = new QLabel( tr( "Style" ), this ); | 117 | QLabel *label = new QLabel( tr( "Style" ), this ); |
116 | gridLayout->addWidget( label, 0, 1 ); | 118 | gridLayout->addWidget( label, 0, 1 ); |
117 | 119 | ||
118 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); | 120 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); |
119 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 121 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); |
120 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); | 122 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); |
121 | 123 | ||
122 | label = new QLabel( tr( "Size" ), this ); | 124 | label = new QLabel( tr( "Size" ), this ); |
123 | gridLayout->addWidget( label, 2, 1 ); | 125 | gridLayout->addWidget( label, 2, 1 ); |
124 | 126 | ||
125 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); | 127 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); |
126 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), | 128 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), |
127 | this, SLOT( fontSizeClicked( int ) ) ); | 129 | this, SLOT( fontSizeClicked( int ) ) ); |
128 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); | 130 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); |
129 | 131 | ||
130 | d-> m_pointbug = ( qt_version ( ) <= 233 ); | 132 | d-> m_pointbug = ( qt_version ( ) <= 233 ); |
131 | 133 | ||
134 | if ( withpreview ) { | ||
135 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); | ||
136 | d-> m_preview-> setAlignment ( AlignCenter ); | ||
137 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); | ||
138 | d-> m_preview-> setMargin ( 3 ); | ||
139 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | ||
140 | gridLayout-> addRowSpacing ( 5, 4 ); | ||
141 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); | ||
142 | gridLayout-> setRowStretch ( 6, 5 ); | ||
143 | } | ||
144 | else | ||
145 | d-> m_preview = 0; | ||
146 | |||
132 | loadFonts ( d-> m_font_family_list ); | 147 | loadFonts ( d-> m_font_family_list ); |
133 | } | 148 | } |
134 | 149 | ||
135 | OFontSelector::~OFontSelector ( ) | 150 | OFontSelector::~OFontSelector ( ) |
136 | { | 151 | { |
137 | delete d; | 152 | delete d; |
138 | } | 153 | } |
139 | 154 | ||
140 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 155 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
141 | { | 156 | { |
142 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 157 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
143 | } | 158 | } |
144 | 159 | ||
145 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) | 160 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) |
146 | { | 161 | { |
147 | QString sizeStr = QString::number ( sizeVal ); | 162 | QString sizeStr = QString::number ( sizeVal ); |
148 | 163 | ||
149 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 164 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |
150 | if ( !family ) | 165 | if ( !family ) |
151 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); | 166 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); |
152 | if ( !family ) | 167 | if ( !family ) |
153 | family = d-> m_font_family_list-> firstItem ( ); | 168 | family = d-> m_font_family_list-> firstItem ( ); |
154 | d-> m_font_family_list-> setCurrentItem ( family ); | 169 | d-> m_font_family_list-> setCurrentItem ( family ); |
155 | fontFamilyClicked ( d-> m_font_family_list-> index ( family )); | 170 | fontFamilyClicked ( d-> m_font_family_list-> index ( family )); |
156 | 171 | ||
157 | int style = findItemCB ( d-> m_font_style_list, styleStr ); | 172 | int style = findItemCB ( d-> m_font_style_list, styleStr ); |
158 | if ( style < 0 ) | 173 | if ( style < 0 ) |
159 | style = findItemCB ( d-> m_font_style_list, "Regular" ); | 174 | style = findItemCB ( d-> m_font_style_list, "Regular" ); |
160 | if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 ) | 175 | if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 ) |
161 | style = 0; | 176 | style = 0; |
162 | d-> m_font_style_list-> setCurrentItem ( style ); | 177 | d-> m_font_style_list-> setCurrentItem ( style ); |
163 | fontStyleClicked ( style ); | 178 | fontStyleClicked ( style ); |
@@ -275,53 +290,73 @@ void OFontSelector::fontFamilyClicked ( int index ) | |||
275 | 290 | ||
276 | d-> m_font_size_list-> clear ( ); | 291 | d-> m_font_size_list-> clear ( ); |
277 | QValueList<int> sl = fli-> sizes ( ); | 292 | QValueList<int> sl = fli-> sizes ( ); |
278 | 293 | ||
279 | for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 294 | for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
280 | d-> m_font_size_list-> insertItem ( QString::number ( *it )); | 295 | d-> m_font_size_list-> insertItem ( QString::number ( *it )); |
281 | 296 | ||
282 | i = findItemCB ( d-> m_font_size_list, oldsize ); | 297 | i = findItemCB ( d-> m_font_size_list, oldsize ); |
283 | if ( i < 0 ) | 298 | if ( i < 0 ) |
284 | i = findItemCB ( d-> m_font_size_list, "10" ); | 299 | i = findItemCB ( d-> m_font_size_list, "10" ); |
285 | if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 )) | 300 | if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 )) |
286 | i = 0; | 301 | i = 0; |
287 | 302 | ||
288 | if ( i >= 0 ) { | 303 | if ( i >= 0 ) { |
289 | d-> m_font_size_list-> setCurrentItem ( i ); | 304 | d-> m_font_size_list-> setCurrentItem ( i ); |
290 | fontSizeClicked ( i ); | 305 | fontSizeClicked ( i ); |
291 | } | 306 | } |
292 | changeFont ( ); | 307 | changeFont ( ); |
293 | } | 308 | } |
294 | 309 | ||
295 | void OFontSelector::fontStyleClicked ( int /*index*/ ) | 310 | void OFontSelector::fontStyleClicked ( int /*index*/ ) |
296 | { | 311 | { |
297 | changeFont ( ); | 312 | changeFont ( ); |
298 | } | 313 | } |
299 | 314 | ||
300 | void OFontSelector::fontSizeClicked ( int /*index*/ ) | 315 | void OFontSelector::fontSizeClicked ( int /*index*/ ) |
301 | { | 316 | { |
302 | changeFont ( ); | 317 | changeFont ( ); |
303 | } | 318 | } |
304 | 319 | ||
305 | void OFontSelector::changeFont ( ) | 320 | void OFontSelector::changeFont ( ) |
306 | { | 321 | { |
307 | emit fontSelected ( selectedFont ( )); | 322 | QFont f = selectedFont ( ); |
323 | |||
324 | if ( d-> m_preview ) | ||
325 | d-> m_preview-> setFont ( f ); | ||
326 | |||
327 | emit fontSelected ( f ); | ||
308 | } | 328 | } |
309 | 329 | ||
310 | 330 | ||
311 | QFont OFontSelector::selectedFont ( ) | 331 | QFont OFontSelector::selectedFont ( ) |
312 | { | 332 | { |
313 | int ffa = d-> m_font_family_list-> currentItem ( ); | 333 | int ffa = d-> m_font_family_list-> currentItem ( ); |
314 | int fst = d-> m_font_style_list-> currentItem ( ); | 334 | int fst = d-> m_font_style_list-> currentItem ( ); |
315 | int fsi = d-> m_font_size_list-> currentItem ( ); | 335 | int fsi = d-> m_font_size_list-> currentItem ( ); |
316 | 336 | ||
317 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); | 337 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); |
318 | 338 | ||
319 | if ( fli ) { | 339 | if ( fli ) { |
320 | return d-> m_fdb. font ( fli-> family ( ), \ | 340 | return d-> m_fdb. font ( fli-> family ( ), \ |
321 | fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ | 341 | fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ |
322 | fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ | 342 | fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ |
323 | d-> m_fdb. charSets ( fli-> family ( )) [0] ); | 343 | d-> m_fdb. charSets ( fli-> family ( )) [0] ); |
324 | } | 344 | } |
325 | else | 345 | else |
326 | return QFont ( ); | 346 | return QFont ( ); |
327 | } | 347 | } |
348 | |||
349 | |||
350 | void OFontSelector::resizeEvent ( QResizeEvent *re ) | ||
351 | { | ||
352 | if ( d-> m_preview ) { | ||
353 | d-> m_preview-> setMinimumHeight ( 1 ); | ||
354 | d-> m_preview-> setMaximumHeight ( 32767 ); | ||
355 | } | ||
356 | |||
357 | QWidget::resizeEvent ( re ); | ||
358 | |||
359 | if ( d-> m_preview ) | ||
360 | d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( )); | ||
361 | |||
362 | } | ||
diff --git a/libopie/ofontselector.h b/libopie/ofontselector.h index a9c8a72..10d16f0 100644 --- a/libopie/ofontselector.h +++ b/libopie/ofontselector.h | |||
@@ -11,67 +11,70 @@ | |||
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef __OPIE_FONTSELECTOR_H__ | 29 | #ifndef __OPIE_FONTSELECTOR_H__ |
30 | #define __OPIE_FONTSELECTOR_H__ | 30 | #define __OPIE_FONTSELECTOR_H__ |
31 | 31 | ||
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | class QListBox; | 34 | class QListBox; |
35 | class OFontSelectorPrivate; | 35 | class OFontSelectorPrivate; |
36 | 36 | ||
37 | 37 | ||
38 | class OFontSelector : public QWidget | 38 | class OFontSelector : public QWidget |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | OFontSelector ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 43 | OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | virtual ~OFontSelector ( ); | 44 | virtual ~OFontSelector ( ); |
45 | 45 | ||
46 | bool selectedFont ( QString &family, QString &style, int &size ); | 46 | bool selectedFont ( QString &family, QString &style, int &size ); |
47 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); | 47 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); |
48 | 48 | ||
49 | QFont selectedFont ( ); | 49 | QFont selectedFont ( ); |
50 | 50 | ||
51 | bool setSelectedFont ( const QFont & ); | 51 | bool setSelectedFont ( const QFont & ); |
52 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); | 52 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); |
53 | 53 | ||
54 | QString fontFamily ( ) const; | 54 | QString fontFamily ( ) const; |
55 | QString fontStyle ( ) const; | 55 | QString fontStyle ( ) const; |
56 | int fontSize ( ) const; | 56 | int fontSize ( ) const; |
57 | QString fontCharSet ( ) const; | 57 | QString fontCharSet ( ) const; |
58 | 58 | ||
59 | signals: | 59 | signals: |
60 | void fontSelected ( const QFont & ); | 60 | void fontSelected ( const QFont & ); |
61 | 61 | ||
62 | protected slots: | 62 | protected slots: |
63 | virtual void fontFamilyClicked ( int ); | 63 | virtual void fontFamilyClicked ( int ); |
64 | virtual void fontStyleClicked ( int ); | 64 | virtual void fontStyleClicked ( int ); |
65 | virtual void fontSizeClicked ( int ); | 65 | virtual void fontSizeClicked ( int ); |
66 | 66 | ||
67 | protected: | ||
68 | virtual void resizeEvent ( QResizeEvent *re ); | ||
69 | |||
67 | private: | 70 | private: |
68 | void loadFonts ( QListBox * ); | 71 | void loadFonts ( QListBox * ); |
69 | 72 | ||
70 | void changeFont ( ); | 73 | void changeFont ( ); |
71 | 74 | ||
72 | private: | 75 | private: |
73 | OFontSelectorPrivate *d; | 76 | OFontSelectorPrivate *d; |
74 | }; | 77 | }; |
75 | 78 | ||
76 | #endif | 79 | #endif |
77 | 80 | ||