sw/source/ui/index/cnttab.cxx            |   39 ++++++++++++++++++++++++++-----
 sw/source/uibase/inc/swuicnttab.hxx      |   13 +++++-----
 sw/uiconfig/swriter/ui/tocentriespage.ui |   27 +++++++++------------
 3 files changed, 52 insertions(+), 27 deletions(-)

New commits:
commit 4d5cefb561535d968654c114b0ea9671e4e7771c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Jan 30 20:19:20 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jan 31 09:51:24 2022 +0100

    gtk4: use ToggleButtons if we want to show an image
    
    SAL_USE_VCLPLUGIN=gtk4 make screenshot
    
    now finally passes, so that's the end of this phase
    
    Change-Id: Iddb1e7d13a3218497419ae434b8bc4e2e80e74fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129185
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 1f7393fe3fa8..44b13a9c8db4 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1812,14 +1812,14 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* 
pPage, weld::DialogControl
     , m_xSortContentRB(m_xBuilder->weld_radio_button("sortcontents"))
     , m_xSortKeyFrame(m_xBuilder->weld_widget("sortkeyframe"))
     , m_xFirstKeyLB(m_xBuilder->weld_combo_box("key1lb"))
-    , m_xFirstSortUpRB(m_xBuilder->weld_radio_button("up1cb"))
-    , m_xFirstSortDownRB(m_xBuilder->weld_radio_button("down1cb"))
+    , m_xFirstSortUpRB(m_xBuilder->weld_toggle_button("up1cb"))
+    , m_xFirstSortDownRB(m_xBuilder->weld_toggle_button("down1cb"))
     , m_xSecondKeyLB(m_xBuilder->weld_combo_box("key2lb"))
-    , m_xSecondSortUpRB(m_xBuilder->weld_radio_button("up2cb"))
-    , m_xSecondSortDownRB(m_xBuilder->weld_radio_button("down2cb"))
+    , m_xSecondSortUpRB(m_xBuilder->weld_toggle_button("up2cb"))
+    , m_xSecondSortDownRB(m_xBuilder->weld_toggle_button("down2cb"))
     , m_xThirdKeyLB(m_xBuilder->weld_combo_box("key3lb"))
-    , m_xThirdSortUpRB(m_xBuilder->weld_radio_button("up3cb"))
-    , m_xThirdSortDownRB(m_xBuilder->weld_radio_button("down3cb"))
+    , m_xThirdSortUpRB(m_xBuilder->weld_toggle_button("up3cb"))
+    , m_xThirdSortDownRB(m_xBuilder->weld_toggle_button("down3cb"))
     , m_xTokenWIN(new SwTokenWindow(m_xBuilder->weld_container("token")))
 {
     const OUString sNoCharSortKey(SwResId(STR_NOSORTKEY));
@@ -1862,6 +1862,17 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* 
pPage, weld::DialogControl
     m_xCommaSeparatedCB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ModifyClickHdl));
     m_xRelToStyleCB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ModifyClickHdl));
 
+    m_xFirstSortUpRB->set_active(true);
+    m_xSecondSortUpRB->set_active(true);
+    m_xThirdSortUpRB->set_active(true);
+
+    m_xFirstSortUpRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+    m_xFirstSortDownRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+    m_xSecondSortUpRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+    m_xSecondSortDownRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+    m_xThirdSortUpRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+    m_xThirdSortDownRB->connect_toggled(LINK(this, SwTOXEntryTabPage, 
ToggleHdl));
+
     FieldUnit aMetric = ::GetDfltMetric(false);
     ::SetFieldUnit(*m_xTabPosMF, aMetric);
 
@@ -1921,6 +1932,22 @@ IMPL_LINK_NOARG(SwTOXEntryTabPage, ModifyHdl, 
LinkParamNone*, void)
     OnModify(false);
 }
 
+IMPL_LINK(SwTOXEntryTabPage, ToggleHdl, weld::Toggleable&, rToggle, void)
+{
+    if (&rToggle == m_xFirstSortUpRB.get())
+        m_xFirstSortDownRB->set_active(!m_xFirstSortUpRB->get_active());
+    else if (&rToggle == m_xFirstSortDownRB.get())
+        m_xFirstSortUpRB->set_active(!m_xFirstSortDownRB->get_active());
+    else if (&rToggle == m_xSecondSortUpRB.get())
+        m_xSecondSortDownRB->set_active(!m_xSecondSortUpRB->get_active());
+    else if (&rToggle == m_xSecondSortDownRB.get())
+        m_xSecondSortUpRB->set_active(!m_xSecondSortDownRB->get_active());
+    else if (&rToggle == m_xThirdSortUpRB.get())
+        m_xThirdSortDownRB->set_active(!m_xThirdSortUpRB->get_active());
+    else if (&rToggle == m_xThirdSortDownRB.get())
+        m_xThirdSortUpRB->set_active(!m_xThirdSortDownRB->get_active());
+}
+
 // bAllLevels is used as signal to change all levels of the example
 void SwTOXEntryTabPage::OnModify(bool bAllLevels)
 {
diff --git a/sw/source/uibase/inc/swuicnttab.hxx 
b/sw/source/uibase/inc/swuicnttab.hxx
index 8d3fc168da2f..ddf6769fe353 100644
--- a/sw/source/uibase/inc/swuicnttab.hxx
+++ b/sw/source/uibase/inc/swuicnttab.hxx
@@ -350,14 +350,14 @@ class SwTOXEntryTabPage final : public SfxTabPage
     std::unique_ptr<weld::RadioButton> m_xSortContentRB;
     std::unique_ptr<weld::Widget> m_xSortKeyFrame;
     std::unique_ptr<weld::ComboBox> m_xFirstKeyLB;
-    std::unique_ptr<weld::RadioButton> m_xFirstSortUpRB;
-    std::unique_ptr<weld::RadioButton> m_xFirstSortDownRB;
+    std::unique_ptr<weld::ToggleButton> m_xFirstSortUpRB;
+    std::unique_ptr<weld::ToggleButton> m_xFirstSortDownRB;
     std::unique_ptr<weld::ComboBox> m_xSecondKeyLB;
-    std::unique_ptr<weld::RadioButton> m_xSecondSortUpRB;
-    std::unique_ptr<weld::RadioButton> m_xSecondSortDownRB;
+    std::unique_ptr<weld::ToggleButton> m_xSecondSortUpRB;
+    std::unique_ptr<weld::ToggleButton> m_xSecondSortDownRB;
     std::unique_ptr<weld::ComboBox> m_xThirdKeyLB;
-    std::unique_ptr<weld::RadioButton> m_xThirdSortUpRB;
-    std::unique_ptr<weld::RadioButton> m_xThirdSortDownRB;
+    std::unique_ptr<weld::ToggleButton> m_xThirdSortUpRB;
+    std::unique_ptr<weld::ToggleButton> m_xThirdSortDownRB;
     std::unique_ptr<SwTokenWindow> m_xTokenWIN;
 
     DECL_LINK(StyleSelectHdl, weld::ComboBox&, void);
@@ -373,6 +373,7 @@ class SwTOXEntryTabPage final : public SfxTabPage
     DECL_LINK(ChapterInfoHdl, weld::ComboBox&, void);
     DECL_LINK(ChapterInfoOutlineHdl, weld::SpinButton&, void);
     DECL_LINK(NumberFormatHdl, weld::ComboBox&, void);
+    DECL_LINK(ToggleHdl, weld::Toggleable&, void);
 
     DECL_LINK(AllLevelsHdl, weld::Button&, void);
 
diff --git a/sw/uiconfig/swriter/ui/tocentriespage.ui 
b/sw/uiconfig/swriter/ui/tocentriespage.ui
index 64f531bcf988..b5200c07f781 100644
--- a/sw/uiconfig/swriter/ui/tocentriespage.ui
+++ b/sw/uiconfig/swriter/ui/tocentriespage.ui
@@ -1029,15 +1029,15 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="up1cb">
+                      <object class="GtkToggleButton" id="up1cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|up1cb|tooltip_text">Ascending</property>
                         <property name="image">image1</property>
                         <property name="use-underline">True</property>
+                        <property name="always-show-image">True</property>
                         <property name="active">True</property>
-                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="up1cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|up1cb">Sorts the 
bibliography entries in ascending alphanumerical order.</property>
@@ -1050,15 +1050,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="down1cb">
+                      <object class="GtkToggleButton" id="down1cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|down1cb|tooltip_text">Descending</property>
                         <property name="image">image2</property>
                         <property name="use-underline">True</property>
-                        <property name="draw-indicator">True</property>
-                        <property name="group">up1cb</property>
+                        <property name="always-show-image">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="down1cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|down1cb">Sorts the 
bibliography entries in a descending alphanumerical order.</property>
@@ -1071,15 +1070,15 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="up2cb">
+                      <object class="GtkToggleButton" id="up2cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|up2cb|tooltip_text">Ascending</property>
                         <property name="image">image3</property>
                         <property name="use-underline">True</property>
+                        <property name="always-show-image">True</property>
                         <property name="active">True</property>
-                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="up2cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|up2cb">Sorts the 
bibliography entries in ascending alphanumerical order.</property>
@@ -1092,15 +1091,15 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="up3cb">
+                      <object class="GtkToggleButton" id="up3cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|up3cb|tooltip_text">Ascending</property>
                         <property name="image">image4</property>
                         <property name="use-underline">True</property>
+                        <property name="always-show-image">True</property>
                         <property name="active">True</property>
-                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="up3cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|up3cb">Sorts the 
bibliography entries in ascending alphanumerical order.</property>
@@ -1113,15 +1112,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="down2cb">
+                      <object class="GtkToggleButton" id="down2cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|down2cb|tooltip_text">Descending</property>
                         <property name="image">image5</property>
                         <property name="use-underline">True</property>
-                        <property name="draw-indicator">True</property>
-                        <property name="group">up2cb</property>
+                        <property name="always-show-image">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="down2cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|down2cb">Sorts the 
bibliography entries in a descending alphanumerical order.</property>
@@ -1134,15 +1132,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="down3cb">
+                      <object class="GtkToggleButton" id="down3cb">
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="tooltip-text" translatable="yes" 
context="tocentriespage|down3cb|tooltip_text">Descending</property>
                         <property name="image">image6</property>
                         <property name="use-underline">True</property>
-                        <property name="draw-indicator">True</property>
-                        <property name="group">up3cb</property>
+                        <property name="always-show-image">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="down3cb-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="tocentriespage|extended_tip|down3cb">Sorts the 
bibliography entries in a descending alphanumerical order.</property>

Reply via email to