Font.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef FONT_H
00011 #define FONT_H
00012 
00013 #include <string>
00014 
00015 class QFont;
00016 
00017 /**
00018  *  Provides a font for widget text.
00019  *
00020  *  This class provides basic capabilities to set the display format of text in
00021  *  a widget.  The following settings can be set in the font:
00022  *  - Face
00023  *  - %Point size
00024  *  - Bold
00025  *  - Italic
00026  *  - Underline
00027  *
00028  *  Additional properties can be set on the font by creating a Qt font object
00029  *  calling setQFont().  The font's properties can also be returned as a
00030  *  QFont by calling getQFont() to provide flexibility for connecting to other
00031  *  widgets.
00032  */
00033 class Font
00034 {
00035 public:
00036    /**
00037     *  Sets the font name.
00038     *
00039     *  @param   face
00040     *           The font name, which should be one of the valid system fonts.
00041     *           This method does nothing if an empty string is passed in.
00042     */
00043    virtual void setFace(const std::string& face) = 0;
00044 
00045    /**
00046     *  Returns the font name.
00047     *
00048     *  @return  The font name.
00049     */
00050    virtual std::string getFace() const = 0;
00051 
00052    /**
00053     *  Sets the point size for the font.
00054     *
00055     *  @param   iSize
00056     *           The font point size.
00057     */
00058    virtual void setPointSize(int iSize) = 0;
00059 
00060    /**
00061     *  Returns the font point size.
00062     *
00063     *  @return  The font point size.
00064     */
00065    virtual int getPointSize() const = 0;
00066 
00067    /**
00068     *  Sets the bold state for the font.
00069     *
00070     *  @param   bBold
00071     *           Pass in \b true to display bold text or \b false to display
00072     *           normal text.
00073     */
00074    virtual void setBold(bool bBold) = 0;
00075 
00076    /**
00077     *  Returns the bold state of the font.
00078     *
00079     *  @return  Returns \b true if the font displays bold text or \b false if
00080     *           the font displays normal text.
00081     */
00082    virtual bool getBold() const = 0;
00083 
00084    /**
00085     *  Sets the italics state for the font.
00086     *
00087     *  @param   bItalic
00088     *           Pass in \b true to display italicized text or \b false to
00089     *           display normal text.
00090     */
00091    virtual void setItalic(bool bItalic) = 0;
00092 
00093    /**
00094     *  Returns the italics state of the font.
00095     *
00096     *  @return  Returns \b true if the font displays italicized text or
00097     *           \b false if the font displays normal text.
00098     */
00099    virtual bool getItalic() const = 0;
00100 
00101    /**
00102     *  Sets the underline state for the font.
00103     *
00104     *  @param   bUnderline
00105     *           Pass in \b true to display underlined text or \b false to
00106     *           display normal text.
00107     */
00108    virtual void setUnderline(bool bUnderline) = 0;
00109 
00110    /**
00111     *  Returns the underline state of a text object.
00112     *
00113     *  @return  Returns \b true if the font displays underlined text or
00114     *           \b false if the font displays normal text.
00115     */
00116    virtual bool getUnderline() const = 0;
00117 
00118    /**
00119     *  Sets the values of this font to those of a given Qt font.
00120     *
00121     *  @param   font
00122     *           The Qt font object from which to set this font's values.  All
00123     *           values in the font are used to display text, not just the face,
00124     *           point size, bold, italic, and underline.
00125     */
00126    virtual void setQFont(const QFont& font) = 0;
00127 
00128    /**
00129     *  Returns the values in the font as a Qt font.
00130     *
00131     *  @return  Returns a reference to a Qt font.  Modifying the values in the
00132     *           QFont will also modify the values in this font.
00133     */
00134    virtual QFont& getQFont() = 0;
00135 
00136    /**
00137     *  Returns read-only access to the values in the font as a Qt font.
00138     *
00139     *  @return  Returns a const reference to a Qt font.  To modify the values
00140     *           in the font call the non-const version of getQFont() or call
00141     *           one of the specific set methods to set a certain value.
00142     */
00143    virtual const QFont& getQFont() const = 0;
00144 
00145 protected:
00146    /**
00147     *  This object should be destroyed by calling ObjectFactory::destroyObject().
00148     */
00149    virtual ~Font() {}
00150 };
00151 
00152 #endif

Software Development Kit - Opticks 4.9.0 Build 16218