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
This commit is contained in:
@@ -1039,6 +1039,8 @@ following properties:
|
|||||||
The title of the column. }
|
The title of the column. }
|
||||||
@row3col{width, integer,
|
@row3col{width, integer,
|
||||||
The column width. }
|
The column width. }
|
||||||
|
@row3col{image, integer,
|
||||||
|
The zero-based index of the image associated with the item in the 'small' image list. }
|
||||||
@endTable
|
@endTable
|
||||||
|
|
||||||
The columns are appended to the control in order of their appearance and may be
|
The columns are appended to the control in order of their appearance and may be
|
||||||
|
@@ -229,9 +229,9 @@ void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
|||||||
// XRCCTRL
|
// XRCCTRL
|
||||||
wxListCtrl * const list = XRCCTRL(dlg, "controls_listctrl", wxListCtrl);
|
wxListCtrl * const list = XRCCTRL(dlg, "controls_listctrl", wxListCtrl);
|
||||||
|
|
||||||
list->InsertItem(0, "Athos"); list->SetItem(0, 1, "90");
|
list->InsertItem(0, "Athos", 0); list->SetItem(0, 1, "90", 2);
|
||||||
list->InsertItem(1, "Porthos"); list->SetItem(1, 1, "120");
|
list->InsertItem(1, "Porthos", 5); list->SetItem(1, 1, "120", 3);
|
||||||
list->InsertItem(2, "Aramis"); list->SetItem(2, 1, "80");
|
list->InsertItem(2, "Aramis", 1); list->SetItem(2, 1, "80", 4);
|
||||||
#endif // wxUSE_LISTCTRL
|
#endif // wxUSE_LISTCTRL
|
||||||
|
|
||||||
#if wxUSE_TREECTRL
|
#if wxUSE_TREECTRL
|
||||||
|
@@ -511,14 +511,25 @@ lay them out using wxSizers, absolute positioning, everything you like!
|
|||||||
<object class="wxListCtrl" name="controls_listctrl">
|
<object class="wxListCtrl" name="controls_listctrl">
|
||||||
<size>220,160</size>
|
<size>220,160</size>
|
||||||
<style>wxLC_REPORT|wxBORDER_SIMPLE</style>
|
<style>wxLC_REPORT|wxBORDER_SIMPLE</style>
|
||||||
|
<imagelist-small>
|
||||||
|
<size>16,16</size>
|
||||||
|
<bitmap stock_id="wxART_HELP_BOOK"/>
|
||||||
|
<bitmap stock_id="wxART_INFORMATION"/>
|
||||||
|
<bitmap stock_id="wxART_GO_UP"/>
|
||||||
|
<bitmap stock_id="wxART_PLUS"/>
|
||||||
|
<bitmap stock_id="wxART_GO_DOWN"/>
|
||||||
|
<bitmap stock_id="wxART_WARNING"/>
|
||||||
|
</imagelist-small>
|
||||||
<object class="listcol">
|
<object class="listcol">
|
||||||
<text>Name</text>
|
<text>Name</text>
|
||||||
<width>150</width>
|
<width>105</width>
|
||||||
|
<image>0</image>
|
||||||
</object>
|
</object>
|
||||||
<object class="listcol">
|
<object class="listcol">
|
||||||
<text>Weight</text>
|
<text>Weight</text>
|
||||||
<align>wxLIST_FORMAT_RIGHT</align>
|
<align>wxLIST_FORMAT_RIGHT</align>
|
||||||
<width>50</width>
|
<width>105</width>
|
||||||
|
<image>1</image>
|
||||||
</object>
|
</object>
|
||||||
<!-- the items are added from the code -->
|
<!-- the items are added from the code -->
|
||||||
</object>
|
</object>
|
||||||
|
@@ -128,6 +128,8 @@ void wxListCtrlXmlHandler::HandleListCol()
|
|||||||
HandleCommonItemAttrs(item);
|
HandleCommonItemAttrs(item);
|
||||||
if (HasParam(wxT("width")))
|
if (HasParam(wxT("width")))
|
||||||
item.SetWidth((int)GetLong(wxT("width")));
|
item.SetWidth((int)GetLong(wxT("width")));
|
||||||
|
if (HasParam(wxT("image")))
|
||||||
|
item.SetImage((int)GetLong(wxT("image")));
|
||||||
|
|
||||||
list->InsertColumn(list->GetColumnCount(), item);
|
list->InsertColumn(list->GetColumnCount(), item);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user