diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-04-07 20:52:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-04-08 09:46:41 +0200 |
commit | 8a84493d1fe92faefecbd3352f911632cbb0e324 (patch) | |
tree | c3e2dcc8c349fec29e30c4a7e918a4f425de9c4b /vcl/unx | |
parent | b7056b800f50eaa861177891ef0ee9d103f65069 (diff) |
add get_entry_font to match set_entry_font
Change-Id: I5996c2cb9470de251d9bc8638c9ab7917e533f7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91853
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 29d1ad3b0b9f..69904fe34b17 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -8444,6 +8444,7 @@ class GtkInstanceEntry : public GtkInstanceWidget, public virtual weld::Entry { private: GtkEntry* m_pEntry; + std::unique_ptr<vcl::Font> m_xFont; gulong m_nChangedSignalId; gulong m_nInsertTextSignalId; gulong m_nCursorPosSignalId; @@ -8621,11 +8622,19 @@ public: virtual void set_font(const vcl::Font& rFont) override { + m_xFont.reset(new vcl::Font(rFont)); PangoAttrList* pAttrList = create_attr_list(rFont); gtk_entry_set_attributes(m_pEntry, pAttrList); pango_attr_list_unref(pAttrList); } + virtual vcl::Font get_font() override + { + if (m_xFont) + return *m_xFont; + return GtkInstanceWidget::get_font(); + } + void fire_signal_changed() { signal_changed(); @@ -12577,6 +12586,7 @@ private: GtkCellRenderer* m_pTextRenderer; GtkMenu* m_pMenu; GtkWidget* m_pToggleButton; + std::unique_ptr<vcl::Font> m_xFont; std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter; vcl::QuickSelectionEngine m_aQuickSelectionEngine; std::vector<int> m_aSeparatorRows; @@ -13405,6 +13415,7 @@ public: virtual void set_entry_font(const vcl::Font& rFont) override { + m_xFont.reset(new vcl::Font(rFont)); PangoAttrList* pAttrList = create_attr_list(rFont); GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBox)); assert(pChild && GTK_IS_ENTRY(pChild)); @@ -13413,6 +13424,18 @@ public: pango_attr_list_unref(pAttrList); } + virtual vcl::Font get_entry_font() override + { + if (m_xFont) + return *m_xFont; + GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBox)); + assert(pChild && GTK_IS_ENTRY(pChild)); + GtkEntry* pEntry = GTK_ENTRY(pChild); + PangoContext* pContext = gtk_widget_get_pango_context(GTK_WIDGET(pEntry)); + return pango_to_vcl(pango_context_get_font_description(pContext), + Application::GetSettings().GetUILanguageTag().getLocale()); + } + virtual void disable_notify_events() override { if (GtkEntry* pEntry = get_entry()) @@ -13716,6 +13739,11 @@ public: m_xEntry->set_font(rFont); } + virtual vcl::Font get_entry_font() override + { + return m_xEntry->get_font(); + } + virtual void grab_focus() override { m_xEntry->grab_focus(); } virtual void connect_focus_in(const Link<Widget&, void>& rLink) override |