org.kde.koala

Class KFontChooser

public class KFontChooser extends QWidget

While KFontChooser as an ordinary widget can be embedded in custom dialogs and therefore is very flexible, in most cases it is preferable to use the convenience functions in KFontDialog. \image html kfontchooser.png "KDE Font Chooser" See KFontChooserSignals for signals emitted by KFontChooser

Version: $Id: KFontChooser.java 473384 2005-10-23 14:17:09Z rdale $

Author: Preston Brown , Bernd Wuebben

UNKNOWN: A font selection widget.

Field Summary
static intFamilyList
  • FamilyList - Identifies the family (leftmost) list.
  • static intFixedWidthFonts
    The selection criteria for the font families shown in the dialog.
    static intFontDiffFamily
  • FontDiffFamily - Identifies a requested change in the font family.
  • static intFontDiffSize
    static intFontDiffStyle
    static intScalableFonts
    static intSizeList
    static intSmoothScalableFonts
    static intStyleList
    Constructor Summary
    protected KFontChooser(Class dummy)
    KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize, boolean diff, int sizeIsRelativeState)
    Constructs a font picker widget.
    KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize, boolean diff)
    KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize)
    KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame)
    KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList)
    KFontChooser(QWidget parent, String name, boolean onlyFixed)
    KFontChooser(QWidget parent, String name)
    KFontChooser(QWidget parent)
    KFontChooser()
    Method Summary
    QColorbackgroundColor()
    StringclassName()
    QColorcolor()
    voiddispose()
    Delete the wrapped C++ instance ahead of finalize()
    voidenableColumn(int column, boolean state)
    Enables or disable a font column in the chooser.
    protected voidfinalize()
    Deletes the wrapped C++ instance
    QFontfont()
    intfontDiffFlags()
    static voidgetFontList(String[] list, int fontListCriteria)
    Creates a list of font strings.
    static StringgetXLFD(QFont theFont)
    Converts a QFont into the corresponding X Logical Font Description (XLFD).
    booleanisDisposed()
    Has the wrapped C++ instance been deleted?
    QMetaObjectmetaObject()
    StringsampleText()
    voidsetBackgroundColor(QColor col)
    Sets the background color to use in the preview.
    voidsetColor(QColor col)
    Sets the color to use in the preview.
    voidsetFont(QFont font, boolean onlyFixed)
    Sets the currently selected font in the chooser.
    voidsetFont(QFont font)
    voidsetSampleBoxVisible(boolean visible)
    Shows or hides the sample text box.
    voidsetSampleText(String text)
    Sets the sample text.
    voidsetSizeIsRelative(int relative)
    Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size.
    QSizesizeHint()
    Reimplemented for internal reasons.
    intsizeIsRelative()

    Field Detail

    FamilyList

    public static final int FamilyList
  • FamilyList - Identifies the family (leftmost) list.
  • StyleList - Identifies the style (center) list.
  • SizeList - Identifies the size (rightmost) list.
  • @short

    FixedWidthFonts

    public static final int FixedWidthFonts
    The selection criteria for the font families shown in the dialog.
  • FixedWidthFont when included only fixed-width fonts are returned. The fonts where the width of every character is equal.
  • ScalableFont when included only scalable fonts are returned; certain configurations allow bitmap fonts to remain unscaled and thus these fonts have limited number of sizes.
  • SmoothScalableFont when included only return smooth scalable fonts. this will return only non-bitmap fonts which are scalable to any size requested. Setting this option to true will mean the "scalable" flag is irrelavant.
  • @short The selection criteria for the font families shown in the dialog.

    FontDiffFamily

    public static final int FontDiffFamily
  • FontDiffFamily - Identifies a requested change in the font family.
  • FontDiffStyle - Identifies a requested change in the font style.
  • FontDiffSize - Identifies a requested change in the font size.
  • @short

    FontDiffSize

    public static final int FontDiffSize

    FontDiffStyle

    public static final int FontDiffStyle

    ScalableFonts

    public static final int ScalableFonts

    SizeList

    public static final int SizeList

    SmoothScalableFonts

    public static final int SmoothScalableFonts

    StyleList

    public static final int StyleList

    Constructor Detail

    KFontChooser

    protected KFontChooser(Class dummy)

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize, boolean diff, int sizeIsRelativeState)
    Constructs a font picker widget. It normally comes up with all font families present on the system; the getFont method below does allow some more fine-tuning of the selection of fonts that will be displayed in the dialog.

    Consider the following code snippet;

    		    ArrayList list;
    		    KFontChooser.getFontList(list,SmoothScalableFonts);
    		    KFontChooser chooseFont = new KFontChooser(0, "FontList", false, list);
    		 

    The above creates a font chooser dialog with only SmoothScaleble fonts.

    Parameters: parent The parent widget. name The widget name. onlyFixed Only display fonts which have fixed-width character sizes. fontList A list of fonts to display, in XLFD format. If no list is formatted, the internal KDE font list is used. If that has not been created, X is queried, and all fonts available on the system are displayed. diff Display the difference version dialog. See KFontDialog.getFontDiff(). makeFrame Draws a frame with titles around the contents. visibleListSize The minimum number of visible entries in the fontlists. sizeIsRelativeState If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to sizeIsRelativeState, user choice may be retrieved by calling sizeIsRelative().

    UNKNOWN: Constructs a font picker widget.

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize, boolean diff)

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame, int visibleListSize)

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList, boolean makeFrame)

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed, String[] fontList)

    KFontChooser

    public KFontChooser(QWidget parent, String name, boolean onlyFixed)

    KFontChooser

    public KFontChooser(QWidget parent, String name)

    KFontChooser

    public KFontChooser(QWidget parent)

    KFontChooser

    public KFontChooser()

    Method Detail

    backgroundColor

    public QColor backgroundColor()

    Returns: The background color currently used in the preview (default: the base color of the active colorgroup)

    UNKNOWN:

    className

    public String className()

    color

    public QColor color()

    Returns: The color currently used in the preview (default: the text color of the active color group)

    UNKNOWN:

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()

    enableColumn

    public void enableColumn(int column, boolean state)
    Enables or disable a font column in the chooser. Use this function if your application does not need or supports all font properties.

    Parameters: column Specify the columns. An or'ed combination of FamilyList, StyleList and SizeList is possible. state If false the columns are disabled.

    UNKNOWN: Enables or disable a font column in the chooser.

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    font

    public QFont font()

    Returns: The currently selected font in the chooser.

    UNKNOWN:

    fontDiffFlags

    public int fontDiffFlags()

    Returns: The bitmask corresponding to the attributes the user wishes to change.

    UNKNOWN:

    getFontList

    public static void getFontList(String[] list, int fontListCriteria)
    Creates a list of font strings.

    Parameters: list The list is returned here. fontListCriteria should contain all the restrictions for font selection as OR-ed values

    See Also: KFontChooser KFontChooser KFontChooser KFontChooser KFontChooser

    UNKNOWN: Creates a list of font strings.

    getXLFD

    public static String getXLFD(QFont theFont)
    Converts a QFont into the corresponding X Logical Font Description (XLFD).

    Parameters: theFont The font to convert.

    Returns: A string representing the given font in XLFD format.

    UNKNOWN: Converts a QFont into the corresponding X Logical Font Description (XLFD).

    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?

    metaObject

    public QMetaObject metaObject()

    sampleText

    public String sampleText()

    Returns: The current text in the sample text input area.

    UNKNOWN:

    setBackgroundColor

    public void setBackgroundColor(QColor col)
    Sets the background color to use in the preview.

    UNKNOWN: Sets the background color to use in the preview.

    setColor

    public void setColor(QColor col)
    Sets the color to use in the preview.

    UNKNOWN: Sets the color to use in the preview.

    setFont

    public void setFont(QFont font, boolean onlyFixed)
    Sets the currently selected font in the chooser.

    Parameters: font The font to select. onlyFixed Readjust the font list to display only fixed width fonts if true, or vice-versa.

    UNKNOWN: Sets the currently selected font in the chooser.

    setFont

    public void setFont(QFont font)

    setSampleBoxVisible

    public void setSampleBoxVisible(boolean visible)
    Shows or hides the sample text box.

    Parameters: visible Set it to true to show the box, to false to hide it.

    UNKNOWN: Shows or hides the sample text box.

    setSampleText

    public void setSampleText(String text)
    Sets the sample text. Normally you should not change this text, but it can be better to do this if the default text is too large for the edit area when using the default font of your application.

    Parameters: text The new sample text. The current will be removed.

    UNKNOWN: Sets the sample text.

    setSizeIsRelative

    public void setSizeIsRelative(int relative)
    Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size. NOTE: If parameter sizeIsRelative was not set in the constructor of the widget this setting will be ignored.

    UNKNOWN: Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size.

    sizeHint

    public QSize sizeHint()
    Reimplemented for internal reasons.

    UNKNOWN: Reimplemented for internal reasons.

    sizeIsRelative

    public int sizeIsRelative()

    Returns: Whether the font size is to be interpreted as relative size (default: QButton:Off)

    UNKNOWN: