diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-05 21:01:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-06 21:37:57 +0200 |
commit | 2671476e7c8acc6569840e66e6d306b890b431fd (patch) | |
tree | 5d7a5a21fc61851a5d01ada24a6d6e87af5b4051 /vcl | |
parent | a134845061b16e43d192feaceac3ecb8f4a51cdb (diff) |
gtk4: don't need to 'formatMenuButton' anymore
Change-Id: I84e53f23986d15dde571c6bc7559ef68be345d23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116762
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index af796bc96e68..533e2628cf6f 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -9181,6 +9181,12 @@ GtkPositionType show_menu(GtkWidget* pMenuButton, GtkWindow* pMenu) #endif +/* four types of uses of this + a) textual menubutton, always with pan-down symbol, e.g. math, format, font, modify + b) image + text, always with additional pan-down symbol, e.g. writer, format, watermark + c) gear menu, never with text and without pan-down symbol where there is a replacement + icon for pan-down, e.g. file, new, templates + d) image, always with additional pan-down symbol, e.g. calc, insert, header/footer */ #if !GTK_CHECK_VERSION(4, 0, 0) class GtkInstanceMenuButton : public GtkInstanceToggleButton, public MenuHelper, public virtual weld::MenuButton #else @@ -9353,6 +9359,7 @@ private: gtk_widget_set_halign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); gtk_widget_set_valign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); gtk_box_prepend(m_pBox, GTK_WIDGET(m_pImage)); + gtk_widget_set_halign(m_pLabel, GTK_ALIGN_START); #endif gtk_widget_show(GTK_WIDGET(m_pImage)); } @@ -9479,11 +9486,15 @@ public: #if !GTK_CHECK_VERSION(4, 0, 0) m_pLabel = gtk_bin_get_child(GTK_BIN(m_pMenuButton)); find_image(GTK_WIDGET(m_pMenuButton), &m_pImage); + m_pBox = formatMenuButton(m_pLabel); #else - m_pLabel = find_label_widget(GTK_WIDGET(m_pMenuButton)); + GtkWidget* pToggleButton = gtk_widget_get_first_child(GTK_WIDGET(m_pMenuButton)); + assert(GTK_IS_BUTTON(pToggleButton)); + GtkWidget* pChild = gtk_button_get_child(GTK_BUTTON(pToggleButton)); + m_pBox = GTK_IS_BOX(pChild) ? GTK_BOX(pChild) : nullptr; + m_pLabel = m_pBox ? gtk_widget_get_first_child(GTK_WIDGET(m_pBox)) : nullptr; (void)pMenuAlign; #endif - m_pBox = formatMenuButton(m_pLabel); #if GTK_CHECK_VERSION(4, 0, 0) m_pActionGroup = G_ACTION_GROUP(g_simple_action_group_new()); |