summaryrefslogtreecommitdiff
path: root/libopie/ofontselector.cpp
authorzecke <zecke>2003-04-13 16:57:28 (UTC)
committer zecke <zecke>2003-04-13 16:57:28 (UTC)
commit0b311079ff19798866291034663757103c6ba935 (patch) (unidiff)
tree70ddccf3a3147475050fa06cc2d807a71ab1d5ee /libopie/ofontselector.cpp
parent1537ccb435ca725c793db6e94e0b9e83484b57e7 (diff)
downloadopie-0b311079ff19798866291034663757103c6ba935.zip
opie-0b311079ff19798866291034663757103c6ba935.tar.gz
opie-0b311079ff19798866291034663757103c6ba935.tar.bz2
Jumbo API documentation update
and some API fixed ColorDialog is now OColorDialog!!! keep the namespace tidy! ColorPopupMenu is now OColorPopupMenu!!! keep the namespace tidy ColorDialog TT couldn't break bc we can so make it const QColor& OTimePicker add some convience methods more I might have forgot
Diffstat (limited to 'libopie/ofontselector.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofontselector.cpp60
1 files changed, 55 insertions, 5 deletions
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp
index b905474..c8471cc 100644
--- a/libopie/ofontselector.cpp
+++ b/libopie/ofontselector.cpp
@@ -44,11 +44,12 @@ public:
44 QComboBox * m_font_size_list; 44 QComboBox * m_font_size_list;
45 QMultiLineEdit *m_preview; 45 QMultiLineEdit *m_preview;
46 46
47 bool m_pointbug; 47 bool m_pointbug : 1;
48 48
49 FontDatabase m_fdb; 49 FontDatabase m_fdb;
50}; 50};
51 51
52namespace {
52 53
53class FontListItem : public QListBoxText { 54class FontListItem : public QListBoxText {
54public: 55public:
@@ -94,7 +95,8 @@ static int findItemCB ( QComboBox *box, const QString &str )
94 return -1; 95 return -1;
95} 96}
96 97
97 98}
99/* static same as anon. namespace */
98static int qt_version ( ) 100static int qt_version ( )
99{ 101{
100 const char *qver = qVersion ( ); 102 const char *qver = qVersion ( );
@@ -102,7 +104,13 @@ static int qt_version ( )
102 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 104 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
103} 105}
104 106
105 107/**
108 * Constructs the Selector object
109 * @param withpreview If a font preview should be given
110 * @param parent The parent of the Font Selector
111 * @param name The name of the object
112 * @param fl WidgetFlags
113 */
106OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 114OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
107{ 115{
108 d = new OFontSelectorPrivate ( ); 116 d = new OFontSelectorPrivate ( );
@@ -152,12 +160,25 @@ OFontSelector::~OFontSelector ( )
152 delete d; 160 delete d;
153} 161}
154 162
163/**
164 * This methods tries to set the font
165 * @param f The wishes font
166 * @return success or failure
167 */
155bool OFontSelector::setSelectedFont ( const QFont &f ) 168bool OFontSelector::setSelectedFont ( const QFont &f )
156{ 169{
157 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); 170 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( )));
158} 171}
159 172
160bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) 173
174/**
175 * This is an overloaded method @see setSelectedFont
176 * @param familyStr The family of the font
177 * @param styleStr The style of the font
178 * @param sizeVal The size of font
179 * @param charset The charset to be used. Will be deprecated by QT3
180 */
181bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
161{ 182{
162 QString sizeStr = QString::number ( sizeVal ); 183 QString sizeStr = QString::number ( sizeVal );
163 184
@@ -188,6 +209,14 @@ bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &s
188 return (( family ) && ( style >= 0 ) && ( size >= 0 )); 209 return (( family ) && ( style >= 0 ) && ( size >= 0 ));
189} 210}
190 211
212/**
213 * This method returns the name, style and size of the currently selected
214 * font or false if no font is selected
215 * @param family The font family will be written there
216 * @param style The style will be written there
217 * @param size The size will be written there
218 * @return success or failure
219 */
191bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) 220bool OFontSelector::selectedFont ( QString &family, QString &style, int &size )
192{ 221{
193 QString dummy; 222 QString dummy;
@@ -195,6 +224,11 @@ bool OFontSelector::selectedFont ( QString &family, QString &style, int &size )
195} 224}
196 225
197 226
227/**
228 * This method does return the font family or QString::null if there is
229 * no font item selected
230 * @return the font family
231 */
198QString OFontSelector::fontFamily ( ) const 232QString OFontSelector::fontFamily ( ) const
199{ 233{
200 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 234 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
@@ -202,6 +236,10 @@ QString OFontSelector::fontFamily ( ) const
202 return fli ? fli-> family ( ) : QString::null; 236 return fli ? fli-> family ( ) : QString::null;
203} 237}
204 238
239/**
240 * This method will return the style of the font or QString::null
241 * @return the style of the font
242 */
205QString OFontSelector::fontStyle ( ) const 243QString OFontSelector::fontStyle ( ) const
206{ 244{
207 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 245 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
@@ -210,6 +248,9 @@ QString OFontSelector::fontStyle ( ) const
210 return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; 248 return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null;
211} 249}
212 250
251/**
252 * This method will return the font size or 10 if no font size is available
253 */
213int OFontSelector::fontSize ( ) const 254int OFontSelector::fontSize ( ) const
214{ 255{
215 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 256 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
@@ -218,6 +259,9 @@ int OFontSelector::fontSize ( ) const
218 return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; 259 return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10;
219} 260}
220 261
262/**
263 * returns the charset of the font or QString::null
264 */
221QString OFontSelector::fontCharSet ( ) const 265QString OFontSelector::fontCharSet ( ) const
222{ 266{
223 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 267 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
@@ -225,6 +269,10 @@ QString OFontSelector::fontCharSet ( ) const
225 return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; 269 return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null;
226} 270}
227 271
272/**
273 * Overloaded member function see above
274 * @see selectedFont
275 */
228bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) 276bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset )
229{ 277{
230 int ffa = d-> m_font_family_list-> currentItem ( ); 278 int ffa = d-> m_font_family_list-> currentItem ( );
@@ -327,7 +375,9 @@ void OFontSelector::changeFont ( )
327 emit fontSelected ( f ); 375 emit fontSelected ( f );
328} 376}
329 377
330 378/**
379 * Return the selected font
380 */
331QFont OFontSelector::selectedFont ( ) 381QFont OFontSelector::selectedFont ( )
332{ 382{
333 int ffa = d-> m_font_family_list-> currentItem ( ); 383 int ffa = d-> m_font_family_list-> currentItem ( );