Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkFontChooser
is an interface that can be implemented by widgets
for choosing fonts.
In GTK, the main objects that implement this interface are
FontChooserWidget
, FontChooserDialog
and
FontButton
.
Synopsis
- newtype FontChooser = FontChooser (ManagedPtr FontChooser)
- class (GObject o, IsDescendantOf FontChooser o) => IsFontChooser o
- toFontChooser :: (MonadIO m, IsFontChooser o) => o -> m FontChooser
- fontChooserGetFont :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m (Maybe Text)
- fontChooserGetFontDesc :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m (Maybe FontDescription)
- fontChooserGetFontFace :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m (Maybe FontFace)
- fontChooserGetFontFamily :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m (Maybe FontFamily)
- fontChooserGetFontFeatures :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m Text
- fontChooserGetFontMap :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m (Maybe FontMap)
- fontChooserGetFontSize :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m Int32
- fontChooserGetLanguage :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m Text
- fontChooserGetLevel :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m [FontChooserLevel]
- fontChooserGetPreviewText :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m Text
- fontChooserGetShowPreviewEntry :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> m Bool
- fontChooserSetFilterFunc :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> Maybe FontFilterFunc -> m ()
- fontChooserSetFont :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> Text -> m ()
- fontChooserSetFontDesc :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> FontDescription -> m ()
- fontChooserSetFontMap :: (HasCallStack, MonadIO m, IsFontChooser a, IsFontMap b) => a -> Maybe b -> m ()
- fontChooserSetLanguage :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> Text -> m ()
- fontChooserSetLevel :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> [FontChooserLevel] -> m ()
- fontChooserSetPreviewText :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> Text -> m ()
- fontChooserSetShowPreviewEntry :: (HasCallStack, MonadIO m, IsFontChooser a) => a -> Bool -> m ()
- constructFontChooserFont :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o)
- getFontChooserFont :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text)
- setFontChooserFont :: (MonadIO m, IsFontChooser o) => o -> Text -> m ()
- constructFontChooserFontDesc :: (IsFontChooser o, MonadIO m) => FontDescription -> m (GValueConstruct o)
- getFontChooserFontDesc :: (MonadIO m, IsFontChooser o) => o -> m (Maybe FontDescription)
- setFontChooserFontDesc :: (MonadIO m, IsFontChooser o) => o -> FontDescription -> m ()
- getFontChooserFontFeatures :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text)
- constructFontChooserLanguage :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o)
- getFontChooserLanguage :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text)
- setFontChooserLanguage :: (MonadIO m, IsFontChooser o) => o -> Text -> m ()
- constructFontChooserLevel :: (IsFontChooser o, MonadIO m) => [FontChooserLevel] -> m (GValueConstruct o)
- getFontChooserLevel :: (MonadIO m, IsFontChooser o) => o -> m [FontChooserLevel]
- setFontChooserLevel :: (MonadIO m, IsFontChooser o) => o -> [FontChooserLevel] -> m ()
- constructFontChooserPreviewText :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o)
- getFontChooserPreviewText :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text)
- setFontChooserPreviewText :: (MonadIO m, IsFontChooser o) => o -> Text -> m ()
- constructFontChooserShowPreviewEntry :: (IsFontChooser o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFontChooserShowPreviewEntry :: (MonadIO m, IsFontChooser o) => o -> m Bool
- setFontChooserShowPreviewEntry :: (MonadIO m, IsFontChooser o) => o -> Bool -> m ()
- type FontChooserFontActivatedCallback = Text -> IO ()
- afterFontChooserFontActivated :: (IsFontChooser a, MonadIO m) => a -> ((?self :: a) => FontChooserFontActivatedCallback) -> m SignalHandlerId
- onFontChooserFontActivated :: (IsFontChooser a, MonadIO m) => a -> ((?self :: a) => FontChooserFontActivatedCallback) -> m SignalHandlerId
Exported types
newtype FontChooser Source #
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Memory-managed wrapper type.
FontChooser (ManagedPtr FontChooser) | Deprecated: (Since version 4.10)Use |
Instances
Eq FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser (==) :: FontChooser -> FontChooser -> Bool # (/=) :: FontChooser -> FontChooser -> Bool # | |
GObject FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser | |
ManagedPtrNewtype FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser toManagedPtr :: FontChooser -> ManagedPtr FontChooser | |
TypedObject FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser | |
HasParentTypes FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser | |
IsGValue (Maybe FontChooser) Source # | Convert |
Defined in GI.Gtk.Interfaces.FontChooser gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe FontChooser -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe FontChooser) | |
type ParentTypes FontChooser Source # | |
Defined in GI.Gtk.Interfaces.FontChooser type ParentTypes FontChooser = '[Object] |
class (GObject o, IsDescendantOf FontChooser o) => IsFontChooser o Source #
Type class for types which can be safely cast to FontChooser
, for instance with toFontChooser
.
Instances
(GObject o, IsDescendantOf FontChooser o) => IsFontChooser o Source # | |
Defined in GI.Gtk.Interfaces.FontChooser |
toFontChooser :: (MonadIO m, IsFontChooser o) => o -> m FontChooser Source #
Cast to FontChooser
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getFont, getFontDesc, getFontFace, getFontFamily, getFontFeatures, getFontMap, getFontSize, getLanguage, getLevel, getPreviewText, getProperty, getQdata, getShowPreviewEntry.
Setters
setData, setDataFull, setFilterFunc, setFont, setFontDesc, setFontMap, setLanguage, setLevel, setPreviewText, setProperty, setShowPreviewEntry.
getFont
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m (Maybe Text) | Returns: A string with the name of the current font |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the currently-selected font name.
Note that this can be a different string than what you set with
fontChooserSetFont
, as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, “Helvetica Italic Bold 12” could be
normalized to “Helvetica Bold Italic 12”.
Use fontDescriptionEqual
if you want to compare two
font descriptions.
getFontDesc
fontChooserGetFontDesc Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m (Maybe FontDescription) | Returns: A |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the currently-selected font.
Note that this can be a different string than what you set with
fontChooserSetFont
, as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, “Helvetica Italic Bold 12” could be
normalized to “Helvetica Bold Italic 12”.
Use fontDescriptionEqual
if you want to compare two
font descriptions.
getFontFace
fontChooserGetFontFace Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m (Maybe FontFace) | Returns: A |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the PangoFontFace
representing the selected font group
details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns Nothing
.
getFontFamily
fontChooserGetFontFamily Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m (Maybe FontFamily) | Returns: A |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the PangoFontFamily
representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns Nothing
.
getFontFeatures
fontChooserGetFontFeatures Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m Text | Returns: the currently selected font features |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the currently-selected font features.
The format of the returned string is compatible with the
CSS font-feature-settings property.
It can be passed to [funcpango
.AttrFontFeatures.new].
getFontMap
fontChooserGetFontMap Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m (Maybe FontMap) | Returns: a |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the custom font map of this font chooser widget,
or Nothing
if it does not have one.
getFontSize
fontChooserGetFontSize Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m Int32 | Returns: A n integer representing the selected font size, or -1 if no font size is selected. |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
The selected font size.
getLanguage
fontChooserGetLanguage Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m Text | Returns: the currently selected language |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the language that is used for font features.
getLevel
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m [FontChooserLevel] | Returns: the current granularity level |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Returns the current level of granularity for selecting fonts.
getPreviewText
fontChooserGetPreviewText Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m Text | Returns: the text displayed in the preview area |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Gets the text displayed in the preview area.
getShowPreviewEntry
fontChooserGetShowPreviewEntry Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> m Bool | Returns: |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Returns whether the preview entry is shown or not.
setFilterFunc
fontChooserSetFilterFunc Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> Maybe FontFilterFunc |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Adds a filter function that decides which fonts to display in the font chooser.
setFont
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> Text |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets the currently-selected font.
setFontDesc
fontChooserSetFontDesc Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> FontDescription |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets the currently-selected font from fontDesc
.
setFontMap
fontChooserSetFontMap Source #
:: (HasCallStack, MonadIO m, IsFontChooser a, IsFontMap b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets a custom font map to use for this font chooser widget.
A custom font map can be used to present application-specific fonts instead of or in addition to the normal system fonts.
c code
FcConfig *config; PangoFontMap *fontmap; config = FcInitLoadConfigAndFonts (); FcConfigAppFontAddFile (config, my_app_font_file); fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT); pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config); gtk_font_chooser_set_font_map (font_chooser, fontmap);
Note that other GTK widgets will only be able to use the application-specific font if it is present in the font map they use:
c code
context = gtk_widget_get_pango_context (label); pango_context_set_font_map (context, fontmap);
setLanguage
fontChooserSetLanguage Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> Text |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets the language to use for font features.
setLevel
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> [FontChooserLevel] |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets the desired level of granularity for selecting fonts.
setPreviewText
fontChooserSetPreviewText Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> Text |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Sets the text displayed in the preview area.
The text
is used to show how the selected font looks.
setShowPreviewEntry
fontChooserSetShowPreviewEntry Source #
:: (HasCallStack, MonadIO m, IsFontChooser a) | |
=> a |
|
-> Bool |
|
-> m () |
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Shows or hides the editable preview entry.
Properties
font
The font description as a string, e.g. "Sans Italic 12".
constructFontChooserFont :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “font
” property. This is rarely needed directly, but it is used by new
.
getFontChooserFont :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text) Source #
Get the value of the “font
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #font
setFontChooserFont :: (MonadIO m, IsFontChooser o) => o -> Text -> m () Source #
Set the value of the “font
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #font:=
value ]
fontDesc
The font description as a PangoFontDescription
.
constructFontChooserFontDesc :: (IsFontChooser o, MonadIO m) => FontDescription -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “font-desc
” property. This is rarely needed directly, but it is used by new
.
getFontChooserFontDesc :: (MonadIO m, IsFontChooser o) => o -> m (Maybe FontDescription) Source #
Get the value of the “font-desc
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #fontDesc
setFontChooserFontDesc :: (MonadIO m, IsFontChooser o) => o -> FontDescription -> m () Source #
Set the value of the “font-desc
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #fontDesc:=
value ]
fontFeatures
The selected font features.
The format of the string is compatible with CSS and with Pango attributes.
getFontChooserFontFeatures :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text) Source #
Get the value of the “font-features
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #fontFeatures
language
The language for which the font features were selected.
constructFontChooserLanguage :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “language
” property. This is rarely needed directly, but it is used by new
.
getFontChooserLanguage :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text) Source #
Get the value of the “language
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #language
setFontChooserLanguage :: (MonadIO m, IsFontChooser o) => o -> Text -> m () Source #
Set the value of the “language
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #language:=
value ]
level
The level of granularity to offer for selecting fonts.
constructFontChooserLevel :: (IsFontChooser o, MonadIO m) => [FontChooserLevel] -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “level
” property. This is rarely needed directly, but it is used by new
.
getFontChooserLevel :: (MonadIO m, IsFontChooser o) => o -> m [FontChooserLevel] Source #
Get the value of the “level
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #level
setFontChooserLevel :: (MonadIO m, IsFontChooser o) => o -> [FontChooserLevel] -> m () Source #
Set the value of the “level
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #level:=
value ]
previewText
The string with which to preview the font.
constructFontChooserPreviewText :: (IsFontChooser o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “preview-text
” property. This is rarely needed directly, but it is used by new
.
getFontChooserPreviewText :: (MonadIO m, IsFontChooser o) => o -> m (Maybe Text) Source #
Get the value of the “preview-text
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #previewText
setFontChooserPreviewText :: (MonadIO m, IsFontChooser o) => o -> Text -> m () Source #
Set the value of the “preview-text
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #previewText:=
value ]
showPreviewEntry
Whether to show an entry to change the preview text.
constructFontChooserShowPreviewEntry :: (IsFontChooser o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “show-preview-entry
” property. This is rarely needed directly, but it is used by new
.
getFontChooserShowPreviewEntry :: (MonadIO m, IsFontChooser o) => o -> m Bool Source #
Get the value of the “show-preview-entry
” property.
When overloading is enabled, this is equivalent to
get
fontChooser #showPreviewEntry
setFontChooserShowPreviewEntry :: (MonadIO m, IsFontChooser o) => o -> Bool -> m () Source #
Set the value of the “show-preview-entry
” property.
When overloading is enabled, this is equivalent to
set
fontChooser [ #showPreviewEntry:=
value ]
Signals
fontActivated
type FontChooserFontActivatedCallback Source #
Deprecated: (Since version 4.10)Use FontDialog
and FontDialogButton
instead
Emitted when a font is activated.
This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.
afterFontChooserFontActivated :: (IsFontChooser a, MonadIO m) => a -> ((?self :: a) => FontChooserFontActivatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the fontActivated signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
fontChooser #fontActivated callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onFontChooserFontActivated :: (IsFontChooser a, MonadIO m) => a -> ((?self :: a) => FontChooserFontActivatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the fontActivated signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
fontChooser #fontActivated callback