|
gtkmm
4.2.0
|
An interface implemented by widgets displaying fonts. More...
#include <gtkmm/fontchooser.h>

Public Types | |
| enum | Level { Level::FAMILY = 0x0, Level::STYLE = 1 << 0, Level::SIZE = 1 << 1, Level::VARIATIONS = 1 << 2, Level::FEATURES = 1 << 3 } |
Specifies the granularity of font selection that is desired in a GtkFontChooser. More... | |
| typedef sigc::slot< bool(const Glib::RefPtr< const Pango::FontFamily >&, const Glib::RefPtr< const Pango::FontFace >&)> | SlotFontFilter |
| Font filter callback. More... | |
Public Types inherited from sigc::trackable | |
| typedef internal::func_destroy_notify | func_destroy_notify |
Public Types inherited from sigc::notifiable | |
| typedef internal::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
| FontChooser (FontChooser&& src) noexcept | |
| FontChooser& | operator= (FontChooser&& src) noexcept |
| ~FontChooser () noexcept override | |
| GtkFontChooser* | gobj () |
| Provides access to the underlying C GObject. More... | |
| const GtkFontChooser* | gobj () const |
| Provides access to the underlying C GObject. More... | |
| Glib::RefPtr< Pango::FontFamily > | get_font_family () |
Gets the PangoFontFamily representing the selected font family. More... | |
| Glib::RefPtr< const Pango::FontFamily > | get_font_family () const |
Gets the PangoFontFamily representing the selected font family. More... | |
| Glib::RefPtr< Pango::FontFace > | get_font_face () |
Gets the PangoFontFace representing the selected font group details (i.e. family, slant, weight, width, etc). More... | |
| Glib::RefPtr< const Pango::FontFace > | get_font_face () const |
Gets the PangoFontFace representing the selected font group details (i.e. family, slant, weight, width, etc). More... | |
| int | get_font_size () const |
| The selected font size. More... | |
| Pango::FontDescription | get_font_desc () const |
| Gets the currently-selected font. More... | |
| void | set_font_desc (const Pango::FontDescription& font_desc) |
| Sets the currently-selected font from font_desc. More... | |
| Glib::ustring | get_font () const |
| Gets the currently-selected font name. More... | |
| void | set_font (const Glib::ustring& fontname) |
| Sets the currently-selected font. More... | |
| Glib::ustring | get_preview_text () const |
| Gets the text displayed in the preview area. More... | |
| void | set_preview_text (const Glib::ustring& text) |
| Sets the text displayed in the preview area. More... | |
| bool | get_show_preview_entry () const |
| Returns whether the preview entry is shown or not. More... | |
| void | set_show_preview_entry (bool show_preview_entry=true) |
| Shows or hides the editable preview entry. More... | |
| void | set_filter_func (const SlotFontFilter& slot) |
| Adds a filter function that decides which fonts to display in the font chooser. More... | |
| void | set_font_map (const Glib::RefPtr< Pango::FontMap >& fontmap) |
| Sets a custom font map to use for this font chooser widget. More... | |
| Glib::RefPtr< Pango::FontMap > | get_font_map () |
Gets the custom font map of this font chooser widget, or nullptr if it does not have one. More... | |
| Glib::RefPtr< const Pango::FontMap > | get_font_map () const |
Gets the custom font map of this font chooser widget, or nullptr if it does not have one. More... | |
| void | set_level (Level level) |
| Sets the desired level of granularity for selecting fonts. More... | |
| Level | get_level () const |
| Returns the current level of granularity for selecting fonts. More... | |
| Glib::ustring | get_font_features () const |
| Gets the currently-selected font features. More... | |
| Glib::ustring | get_language () const |
| Gets the language that is used for font features. More... | |
| void | set_language (const Glib::ustring& language) |
| Sets the language to use for font features. More... | |
| Glib::SignalProxy< void(const Glib::ustring&)> | signal_font_activated () |
| Glib::PropertyProxy< Glib::ustring > | property_font () |
| The font description as a string, e.g. "Sans Italic 12". More... | |
| Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_font () const |
| The font description as a string, e.g. "Sans Italic 12". More... | |
| Glib::PropertyProxy< Pango::FontDescription > | property_font_desc () |
The font description as a PangoFontDescription. More... | |
| Glib::PropertyProxy_ReadOnly< Pango::FontDescription > | property_font_desc () const |
The font description as a PangoFontDescription. More... | |
| Glib::PropertyProxy< Glib::ustring > | property_preview_text () |
| The string with which to preview the font. More... | |
| Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_preview_text () const |
| The string with which to preview the font. More... | |
| Glib::PropertyProxy< bool > | property_show_preview_entry () |
| Whether to show an entry to change the preview text. More... | |
| Glib::PropertyProxy_ReadOnly< bool > | property_show_preview_entry () const |
| Whether to show an entry to change the preview text. More... | |
| Glib::PropertyProxy< Level > | property_level () |
| The level of granularity to offer for selecting fonts. More... | |
| Glib::PropertyProxy_ReadOnly< Level > | property_level () const |
| The level of granularity to offer for selecting fonts. More... | |
| Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_font_features () const |
| The selected font features. More... | |
| Glib::PropertyProxy< Glib::ustring > | property_language () |
| The language for which the font features were selected. More... | |
| Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_language () const |
| The language for which the font features were selected. More... | |
Public Member Functions inherited from Glib::Interface | |
| Interface () | |
| Interface (Interface &&src) noexcept | |
| Interface & | operator= (Interface &&src) noexcept |
| Interface (const Glib::Interface_Class &interface_class) | |
| Interface (GObject *castitem) | |
| ~Interface () noexcept override | |
| Interface (const Interface &)=delete | |
| Interface & | operator= (const Interface &)=delete |
| GObject * | gobj () |
| const GObject * | gobj () const |
Public Member Functions inherited from Glib::ObjectBase | |
| ObjectBase (const ObjectBase &)=delete | |
| ObjectBase & | operator= (const ObjectBase &)=delete |
| void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
| void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
| void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
| void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
| PropertyType | get_property (const Glib::ustring &property_name) const |
| sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
| sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
| void | freeze_notify () |
| void | thaw_notify () |
| virtual void | reference () const |
| virtual void | unreference () const |
| GObject * | gobj () |
| const GObject * | gobj () const |
| GObject * | gobj_copy () const |
Public Member Functions inherited from sigc::trackable | |
| trackable () noexcept | |
| trackable (const trackable &src) noexcept | |
| trackable (trackable &&src) noexcept | |
| ~trackable () | |
| void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
| void | notify_callbacks () |
| trackable & | operator= (const trackable &src) |
| trackable & | operator= (trackable &&src) noexcept |
| void | remove_destroy_notify_callback (notifiable *data) const |
Static Public Member Functions | |
| static void | add_interface (GType gtype_implementer) |
| static GType | get_type () |
| Get the GType for this class, for use with the underlying GObject type system. More... | |
Protected Member Functions | |
| FontChooser () | |
| You should derive from this class to use it. More... | |
| virtual void | on_font_activated (const Glib::ustring& fontname) |
| This is a default handler for the signal signal_font_activated(). More... | |
Protected Member Functions inherited from Glib::ObjectBase | |
| ObjectBase () | |
| ObjectBase (const char *custom_type_name) | |
| ObjectBase (const std::type_info &custom_type_info) | |
| ObjectBase (ObjectBase &&src) noexcept | |
| ObjectBase & | operator= (ObjectBase &&src) noexcept |
| virtual | ~ObjectBase () noexcept=0 |
| void | initialize (GObject *castitem) |
| void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Related Functions | |
(Note that these are not member functions.) | |
| Glib::RefPtr< Gtk::FontChooser > | wrap (GtkFontChooser* object, bool take_copy=false) |
| A Glib::wrap() method for this object. More... | |
An interface implemented by widgets displaying fonts.
FontChooser widgets list the available fonts, styles and sizes, allowing the user to select a font.
To set the font which is initially selected, use set_font_name().
To get the selected font use get_font_name().
To change the text which is shown in the preview area, use set_preview_text().
| typedef sigc::slot<bool(const Glib::RefPtr<const Pango::FontFamily>&, const Glib::RefPtr<const Pango::FontFace>&)> Gtk::FontChooser::SlotFontFilter |
Font filter callback.
For instance,
| font_family | A Pango FontFamily. |
| font_face | A Font Face belonging to the font_family. |
This is used for deciding what fonts should be shown in a FontChooser. See set_filter_func().
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
|
static |
| Glib::ustring Gtk::FontChooser::get_font | ( | ) | const |
Gets the currently-selected font name.
Note that this can be a different string than what you set with [method Gtk.FontChooser.set_font], 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 [method Pango.FontDescription.equal] if you want to compare two font descriptions.
nullptr if no font is selected. | Pango::FontDescription Gtk::FontChooser::get_font_desc | ( | ) | const |
Gets the currently-selected font.
Note that this can be a different string than what you set with [method Gtk.FontChooser.set_font], 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 [method Pango.FontDescription.equal] if you want to compare two font descriptions.
PangoFontDescription for the current font, or nullptr if no font is selected. | Glib::RefPtr<Pango::FontFace> Gtk::FontChooser::get_font_face | ( | ) |
Gets the PangoFontFace representing the selected font group details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns nullptr.
PangoFontFace representing the selected font group details, or nullptr. The returned object is owned by fontchooser and must not be modified or freed. | Glib::RefPtr<const Pango::FontFace> Gtk::FontChooser::get_font_face | ( | ) | const |
Gets the PangoFontFace representing the selected font group details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns nullptr.
PangoFontFace representing the selected font group details, or nullptr. The returned object is owned by fontchooser and must not be modified or freed. | Glib::RefPtr<Pango::FontFamily> Gtk::FontChooser::get_font_family | ( | ) |
Gets the PangoFontFamily representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns nullptr.
PangoFontFamily representing the selected font family, or nullptr. The returned object is owned by fontchooser and must not be modified or freed. | Glib::RefPtr<const Pango::FontFamily> Gtk::FontChooser::get_font_family | ( | ) | const |
Gets the PangoFontFamily representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns nullptr.
PangoFontFamily representing the selected font family, or nullptr. The returned object is owned by fontchooser and must not be modified or freed. | Glib::ustring Gtk::FontChooser::get_font_features | ( | ) | const |
Gets the currently-selected font features.
| Glib::RefPtr<Pango::FontMap> Gtk::FontChooser::get_font_map | ( | ) |
Gets the custom font map of this font chooser widget, or nullptr if it does not have one.
PangoFontMap, or nullptr. | Glib::RefPtr<const Pango::FontMap> Gtk::FontChooser::get_font_map | ( | ) | const |
Gets the custom font map of this font chooser widget, or nullptr if it does not have one.
PangoFontMap, or nullptr. | int Gtk::FontChooser::get_font_size | ( | ) | const |
The selected font size.
| Glib::ustring Gtk::FontChooser::get_language | ( | ) | const |
Gets the language that is used for font features.
| Level Gtk::FontChooser::get_level | ( | ) | const |
Returns the current level of granularity for selecting fonts.
| Glib::ustring Gtk::FontChooser::get_preview_text | ( | ) | const |
Gets the text displayed in the preview area.
| bool Gtk::FontChooser::get_show_preview_entry | ( | ) | const |
Returns whether the preview entry is shown or not.
true if the preview entry is shown or false if it is hidden.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
|
protectedvirtual |
This is a default handler for the signal signal_font_activated().
|
noexcept |
| Glib::PropertyProxy< Glib::ustring > Gtk::FontChooser::property_font | ( | ) |
The font description as a string, e.g. "Sans Italic 12".
Default value: "Sans 10"
| Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FontChooser::property_font | ( | ) | const |
The font description as a string, e.g. "Sans Italic 12".
Default value: "Sans 10"
| Glib::PropertyProxy< Pango::FontDescription > Gtk::FontChooser::property_font_desc | ( | ) |
The font description as a PangoFontDescription.
| Glib::PropertyProxy_ReadOnly< Pango::FontDescription > Gtk::FontChooser::property_font_desc | ( | ) | const |
The font description as a PangoFontDescription.
| Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FontChooser::property_font_features | ( | ) | const |
The selected font features.
The format of the string is compatible with CSS and with Pango attributes.
Default value: ""
| Glib::PropertyProxy< Glib::ustring > Gtk::FontChooser::property_language | ( | ) |
The language for which the font features were selected.
Default value: ""
| Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FontChooser::property_language | ( | ) | const |
The language for which the font features were selected.
Default value: ""
| Glib::PropertyProxy< Level > Gtk::FontChooser::property_level | ( | ) |
The level of granularity to offer for selecting fonts.
Default value: Gtk::FontChooser::Level::STYLE | Gtk::FontChooser::Level::SIZE
| Glib::PropertyProxy_ReadOnly< Level > Gtk::FontChooser::property_level | ( | ) | const |
The level of granularity to offer for selecting fonts.
Default value: Gtk::FontChooser::Level::STYLE | Gtk::FontChooser::Level::SIZE
| Glib::PropertyProxy< Glib::ustring > Gtk::FontChooser::property_preview_text | ( | ) |
The string with which to preview the font.
Default value: "The quick brown fox jumps over the lazy dog."
| Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FontChooser::property_preview_text | ( | ) | const |
The string with which to preview the font.
Default value: "The quick brown fox jumps over the lazy dog."
| Glib::PropertyProxy< bool > Gtk::FontChooser::property_show_preview_entry | ( | ) |
Whether to show an entry to change the preview text.
Default value: true
| Glib::PropertyProxy_ReadOnly< bool > Gtk::FontChooser::property_show_preview_entry | ( | ) | const |
Whether to show an entry to change the preview text.
Default value: true
| void Gtk::FontChooser::set_filter_func | ( | const SlotFontFilter& | slot | ) |
Adds a filter function that decides which fonts to display in the font chooser.
| slot | A callback, to be called for each font. |
| void Gtk::FontChooser::set_font | ( | const Glib::ustring & | fontname | ) |
Sets the currently-selected font.
| fontname | A font name like “Helvetica 12” or “Times Bold 18”. |
| void Gtk::FontChooser::set_font_desc | ( | const Pango::FontDescription & | font_desc | ) |
Sets the currently-selected font from font_desc.
| font_desc | A PangoFontDescription. |
| void Gtk::FontChooser::set_font_map | ( | const Glib::RefPtr< Pango::FontMap > & | fontmap | ) |
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.
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:
| fontmap | A PangoFontMap. |
| void Gtk::FontChooser::set_language | ( | const Glib::ustring & | language | ) |
Sets the language to use for font features.
| language | A language. |
| void Gtk::FontChooser::set_level | ( | Level | level | ) |
Sets the desired level of granularity for selecting fonts.
| level | The desired level of granularity. |
| void Gtk::FontChooser::set_preview_text | ( | const Glib::ustring & | text | ) |
Sets the text displayed in the preview area.
The text is used to show how the selected font looks.
| text | The text to display in the preview area. |
| void Gtk::FontChooser::set_show_preview_entry | ( | bool | show_preview_entry = true | ) |
Shows or hides the editable preview entry.
| show_preview_entry | Whether to show the editable preview entry or not. |
| Glib::SignalProxy<void(const Glib::ustring&)> Gtk::FontChooser::signal_font_activated | ( | ) |
void on_my_font_activated(const Glib::ustring& fontname)Flags: Run First
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.
| fontname | The font name. |
|
related |
A Glib::wrap() method for this object.
| object | The C instance. |
| take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
1.8.11