summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-08-18 19:23:45 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-08-18 22:34:44 +0200
commit5ac75131556b687a01517ce4520a05bb49c1d840 (patch)
tree034f9bc19db8a7cfc907ee0afe71cc5fa5aed4a3 /starmath
parentf85cd07295321cf875addeb52aa9e982808b74ae (diff)
Use combobox for category list on Elements sidebar panel
And replace GtkPaned with GtkBox: the elements are not expected to have a resize handle between them. Change-Id: I9ba170458754fe28052007e8051d3814dc7d2ea0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138501 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/SmElementsPanel.cxx10
-rw-r--r--starmath/source/SmElementsPanel.hxx4
-rw-r--r--starmath/uiconfig/smath/ui/sidebarelements_math.ui54
3 files changed, 19 insertions, 49 deletions
diff --git a/starmath/source/SmElementsPanel.cxx b/starmath/source/SmElementsPanel.cxx
index 432e58d0e707..08ff6af95ab9 100644
--- a/starmath/source/SmElementsPanel.cxx
+++ b/starmath/source/SmElementsPanel.cxx
@@ -40,16 +40,16 @@ std::unique_ptr<PanelLayout> SmElementsPanel::Create(weld::Widget& rParent,
SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings)
: PanelLayout(&rParent, "MathElementsPanel", "modules/smath/ui/sidebarelements_math.ui")
, mrBindings(rBindings)
- , mxCategoryList(m_xBuilder->weld_tree_view("categorylist"))
+ , mxCategoryList(m_xBuilder->weld_combo_box("categorylist"))
, mxElementsControl(std::make_unique<SmElementsControl>(m_xBuilder->weld_icon_view("elements")))
{
for (const auto& rCategoryId : SmElementsControl::categories())
mxCategoryList->append_text(SmResId(rCategoryId));
- mxCategoryList->set_size_request(-1, mxCategoryList->get_height_rows(6));
+ mxCategoryList->set_size_request(-1, -1);
mxCategoryList->connect_changed(LINK(this, SmElementsPanel, CategorySelectedHandle));
- mxCategoryList->select(0);
+ mxCategoryList->set_active(0);
mxElementsControl->setElementSetIndex(0);
mxElementsControl->SetSelectHdl(LINK(this, SmElementsPanel, ElementClickHandler));
@@ -61,9 +61,9 @@ SmElementsPanel::~SmElementsPanel()
mxCategoryList.reset();
}
-IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::TreeView&, rList, void)
+IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::ComboBox&, rList, void)
{
- const int nActive = rList.get_selected_index();
+ const int nActive = rList.get_active();
if (nActive == -1)
return;
mxElementsControl->setElementSetIndex(nActive);
diff --git a/starmath/source/SmElementsPanel.hxx b/starmath/source/SmElementsPanel.hxx
index d80d53e7211f..d7e4609a4246 100644
--- a/starmath/source/SmElementsPanel.hxx
+++ b/starmath/source/SmElementsPanel.hxx
@@ -40,14 +40,14 @@ public:
~SmElementsPanel();
private:
- DECL_LINK(CategorySelectedHandle, weld::TreeView&, void);
+ DECL_LINK(CategorySelectedHandle, weld::ComboBox&, void);
DECL_LINK(ElementClickHandler, OUString, void);
SmViewShell* GetView() const;
const SfxBindings& mrBindings;
- std::unique_ptr<weld::TreeView> mxCategoryList;
+ std::unique_ptr<weld::ComboBox> mxCategoryList;
std::unique_ptr<SmElementsControl> mxElementsControl;
};
diff --git a/starmath/uiconfig/smath/ui/sidebarelements_math.ui b/starmath/uiconfig/smath/ui/sidebarelements_math.ui
index 80bdfda4064b..b9a5736abb9d 100644
--- a/starmath/uiconfig/smath/ui/sidebarelements_math.ui
+++ b/starmath/uiconfig/smath/ui/sidebarelements_math.ui
@@ -2,14 +2,6 @@
<!-- Generated with glade 3.38.1 -->
<interface domain="sm">
<requires lib="gtk+" version="3.20"/>
- <object class="GtkTreeStore" id="liststore1">
- <columns>
- <!-- column-name text -->
- <column type="gchararray"/>
- <!-- column-name id -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name expander -->
@@ -18,47 +10,24 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkPaned" id="MathElementsPanel">
+ <object class="GtkBox" id="MathElementsPanel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="border-width">6</property>
- <property name="wide-handle">True</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkScrolledWindow">
+ <object class="GtkComboBoxText" id="categorylist">
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="shadow-type">in</property>
- <child>
- <object class="GtkTreeView" id="categorylist">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="model">liststore1</property>
- <property name="headers-visible">False</property>
- <property name="search-column">0</property>
- <property name="show-expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection2"/>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn0">
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="tooltip-text" translatable="yes" context="mathelementspanel|ElementCategories|tooltip_text">Element categories</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkScrolledWindow">
@@ -81,8 +50,9 @@
</child>
</object>
<packing>
- <property name="resize">True</property>
- <property name="shrink">True</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>