summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-06-04 11:08:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-06-05 09:37:19 +0200
commit36f57d5aebe448701ffe3bbc529f29d2112dec94 (patch)
tree3619f0c119870677d2e9a7a051991b230beec502
parentupdate the CellRenderer comment (diff)
downloadcore-36f57d5aebe448701ffe3bbc529f29d2112dec94.tar.gz
core-36f57d5aebe448701ffe3bbc529f29d2112dec94.zip
document the mapping to CellRenderers
and clarify that g-lo-CellIndex is the index from the external pov Change-Id: Id747acaeabab50755188732637a72c1fce8a97dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95519 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 396ed5b71645..1d4fa5ae530f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9809,6 +9809,11 @@ public:
, m_pVAdjustment(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pTreeView)))
, m_pChangeEvent(nullptr)
{
+ /* The outside concept of a column maps to a gtk CellRenderer, rather than
+ a TreeViewColumn. If the first TreeViewColumn has two CellRenderers, and
+ the first CellRenderer is an image, that CellRenderer is considered to
+ be index -1.
+ */
m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
int nIndex(0);
int nViewColumn(0);
@@ -9820,7 +9825,6 @@ public:
for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
{
GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data);
- g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nIndex));
if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
{
if (m_nTextCol == -1)
@@ -9850,6 +9854,8 @@ public:
else if (m_nImageCol == -1)
m_nImageCol = nIndex;
}
+ int nExternalIndex = to_external_model(nIndex);
+ g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nExternalIndex));
++nIndex;
}
g_list_free(pRenderers);