From 7243eb6d3be736c27ac4c0c6158156a8e79b7c68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 16 Jul 2011 10:05:02 +0000 Subject: [PATCH] Add support for column header images to wxListCtrl XRC handler. Fixes #13319 (patch). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/overviews/xrc_format.h | 2 ++ samples/xrc/myframe.cpp | 6 +++--- samples/xrc/rc/controls.xrc | 15 +++++++++++++-- src/xrc/xh_listc.cpp | 2 ++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index c8896ee651..a8ab31e9fc 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -1039,6 +1039,8 @@ following properties: The title of the column. } @row3col{width, integer, The column width. } +@row3col{image, integer, + The zero-based index of the image associated with the item in the 'small' image list. } @endTable The columns are appended to the control in order of their appearance and may be diff --git a/samples/xrc/myframe.cpp b/samples/xrc/myframe.cpp index 4bc975327f..2a3dfe2cca 100644 --- a/samples/xrc/myframe.cpp +++ b/samples/xrc/myframe.cpp @@ -229,9 +229,9 @@ void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) // XRCCTRL wxListCtrl * const list = XRCCTRL(dlg, "controls_listctrl", wxListCtrl); - list->InsertItem(0, "Athos"); list->SetItem(0, 1, "90"); - list->InsertItem(1, "Porthos"); list->SetItem(1, 1, "120"); - list->InsertItem(2, "Aramis"); list->SetItem(2, 1, "80"); + list->InsertItem(0, "Athos", 0); list->SetItem(0, 1, "90", 2); + list->InsertItem(1, "Porthos", 5); list->SetItem(1, 1, "120", 3); + list->InsertItem(2, "Aramis", 1); list->SetItem(2, 1, "80", 4); #endif // wxUSE_LISTCTRL #if wxUSE_TREECTRL diff --git a/samples/xrc/rc/controls.xrc b/samples/xrc/rc/controls.xrc index 8a92a50b0b..33d56d5be2 100644 --- a/samples/xrc/rc/controls.xrc +++ b/samples/xrc/rc/controls.xrc @@ -511,14 +511,25 @@ lay them out using wxSizers, absolute positioning, everything you like! 220,160 + + 16,16 + + + + + + + Name - 150 + 105 + 0 Weight wxLIST_FORMAT_RIGHT - 50 + 105 + 1 diff --git a/src/xrc/xh_listc.cpp b/src/xrc/xh_listc.cpp index d0a7e78b04..acce070d34 100644 --- a/src/xrc/xh_listc.cpp +++ b/src/xrc/xh_listc.cpp @@ -128,6 +128,8 @@ void wxListCtrlXmlHandler::HandleListCol() HandleCommonItemAttrs(item); if (HasParam(wxT("width"))) item.SetWidth((int)GetLong(wxT("width"))); + if (HasParam(wxT("image"))) + item.SetImage((int)GetLong(wxT("image"))); list->InsertColumn(list->GetColumnCount(), item); } -- 2.45.2