[Libreoffice-commits] core.git: include/vcl vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 8 07:47:17 UTC 2020
include/vcl/weld.hxx | 1 +
vcl/source/app/salvtables.cxx | 15 +++++++++++++++
vcl/unx/gtk3/gtk3gtkinst.cxx | 28 ++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
New commits:
commit 8a84493d1fe92faefecbd3352f911632cbb0e324
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Apr 7 20:52:50 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 8 09:46:41 2020 +0200
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 at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 7dbe6643491e..18eeb67f38a1 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -679,6 +679,7 @@ public:
// font size is in points, not pixels, e.g. see Window::[G]etPointFont
virtual void set_entry_font(const vcl::Font& rFont) = 0;
+ virtual vcl::Font get_entry_font() = 0;
virtual bool get_popup_shown() const = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index febffea547fc..13f596d5bc36 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5948,6 +5948,8 @@ public:
virtual void set_entry_font(const vcl::Font&) override { assert(false); }
+ virtual vcl::Font get_entry_font() override { assert(false); return vcl::Font(); }
+
virtual ~SalInstanceComboBoxWithoutEdit() override
{
m_xComboBox->SetSelectHdl(Link<ListBox&, void>());
@@ -6071,6 +6073,13 @@ public:
pEdit->Invalidate();
}
+ virtual vcl::Font get_entry_font() override
+ {
+ Edit* pEdit = m_xComboBox->GetSubEdit();
+ assert(pEdit);
+ return pEdit->GetPointFont(*pEdit);
+ }
+
virtual ~SalInstanceComboBoxWithEdit() override
{
m_xComboBox->SetTextFilter(nullptr);
@@ -6149,6 +6158,12 @@ public:
rEntry.Invalidate();
}
+ virtual vcl::Font get_entry_font() override
+ {
+ Edit& rEntry = m_pEntry->getEntry();
+ return rEntry.GetPointFont(rEntry);
+ }
+
virtual void set_entry_placeholder_text(const OUString& rText) override
{
Edit& rEntry = m_pEntry->getEntry();
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
More information about the Libreoffice-commits
mailing list