FontSizeComboBox.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 FONTSIZECOMBOBOX_H
00011 #define FONTSIZECOMBOBOX_H
00012 
00013 #include <QtGui/QComboBox>
00014 
00015 /**
00016  *  A widget used to choose a font size from an editable combo box.
00017  */
00018 class FontSizeComboBox : public QComboBox
00019 {
00020    Q_OBJECT
00021 
00022 public:
00023    /**
00024     *  Creates a font size combo box.
00025     *  The QFontDatabase will be queried to determine valid font sizes.
00026     *
00027     *  @param   pParent
00028     *           The parent widget.
00029     */
00030    FontSizeComboBox(QWidget* pParent);
00031 
00032    /**
00033     *  Destroys the font size combo box and all child items.
00034     */
00035    virtual ~FontSizeComboBox();
00036 
00037    /**
00038     * Sets the font size.
00039     *
00040     *  @param   fontSize
00041     *           The font size to use.
00042     *           If this value is greater than zero and does not exist in the combo box, it will be added and selected.
00043     *           If this value is not greater than zero, the combo box will be cleared and set to an invalid index.
00044     */
00045    void setCurrentValue(int fontSize);
00046 
00047    /**
00048     * Returns the selected font size.
00049     *
00050     *  @return   The selected font size or -1 if no font size is selected.
00051     */
00052    int getCurrentValue() const;
00053 
00054 signals:
00055    /**
00056     * Emitted when the user presses the \b Enter key with the combo box active.
00057     *
00058     *  @param   fontSize
00059     *           The selected font size.
00060     */
00061    void valueEdited(int fontSize);
00062 
00063    /**
00064     * Emitted when a new combo box item is activated by the user.
00065     *
00066     *  @param   fontSize
00067     *           The selected font size.
00068     */
00069    void valueActivated(int fontSize);
00070 
00071    /**
00072     * Emitted when the user changes the value of the combo box.
00073     *
00074     *  @param   fontSize
00075     *           The selected font size.
00076     */
00077    void valueChanged(int fontSize);
00078 
00079 private slots:
00080    void translateEdited();
00081    void translateActivated();
00082    void translateChanged();
00083 
00084 private:
00085    FontSizeComboBox(const FontSizeComboBox& rhs);
00086    FontSizeComboBox& operator=(const FontSizeComboBox& rhs);
00087 };
00088 
00089 #endif

Software Development Kit - Opticks 4.9.0 Build 16218