diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-07-28 14:41:52 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-08-09 10:53:11 +0200 |
commit | be11a3573a21e83dfb6a473d98bc8ba9bf57057c (patch) | |
tree | b9f4efec78e2020569daa4d5f8d8e38fe6b0010c /vcl | |
parent | fd9763cb7ecb05c43bcd23f6aedf73489e1bccb8 (diff) |
vcl: allow editing a column other than the first one in GtkInstanceTreeView
This is basically commit fe38553aef2121f358fb58e450ec69314aad851e
for the native GTK widgets, so the "Edit Text" button in
Insert->Bookmarks dialog works.
Change-Id: Ifcd115de60ecee2c4e4c19535ce55156aa84ff79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137563
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 0576c8ac84c2..49ae4676be32 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -14190,6 +14190,12 @@ private: { nCol = to_internal_model(nCol); + // recompute these 2 based on new 1st editable column + m_nTextCol = -1; + m_nTextView = -1; + int nIndex(0); + int nViewColumn(0); + bool isSet(false); for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = g_list_next(pEntry)) { GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data); @@ -14201,10 +14207,27 @@ private: if (reinterpret_cast<sal_IntPtr>(pData) == nCol) { g_object_set(G_OBJECT(pCellRenderer), "editable", bEditable, "editable-set", true, nullptr); + isSet = true; + } + if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer)) + { + gboolean is_editable(false); + g_object_get(pCellRenderer, "editable", &is_editable, nullptr); + if (is_editable && m_nTextCol == -1) + { + assert(m_nTextView == -1); + m_nTextCol = nIndex; + m_nTextView = nViewColumn; + } + } + if (isSet && m_nTextCol != -1) // both tasks done? + { break; } + ++nIndex; } g_list_free(pRenderers); + ++nViewColumn; } } |