]> git.saurik.com Git - wxWidgets.git/commitdiff
Add support for column header images to wxListCtrl XRC handler.
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 16 Jul 2011 10:05:02 +0000 (10:05 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 16 Jul 2011 10:05:02 +0000 (10:05 +0000)
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
samples/xrc/myframe.cpp
samples/xrc/rc/controls.xrc
src/xrc/xh_listc.cpp

index c8896ee6513ab4d319389f9acb52983b269f3619..a8ab31e9fc51660f09741a5d0a5b3b5301b67a9e 100644 (file)
@@ -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
index 4bc975327f7cfd8a98b3dd98509b5380b5607821..2a3dfe2ccaf71968d832d8249f1afeb29854b698 100644 (file)
@@ -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
index 8a92a50b0b98606ca5199f51b04437a2b52a0f08..33d56d5be290f83a481a378fb3a2ed7d68cb6f3d 100644 (file)
@@ -511,14 +511,25 @@ lay them out using wxSizers, absolute positioning, everything you like!
                                 <object class="wxListCtrl" name="controls_listctrl">
                                     <size>220,160</size>
                                     <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">
                                         <text>Name</text>
-                                        <width>150</width>
+                                        <width>105</width>
+                                        <image>0</image>
                                     </object>
                                     <object class="listcol">
                                         <text>Weight</text>
                                         <align>wxLIST_FORMAT_RIGHT</align>
-                                        <width>50</width>
+                                        <width>105</width>
+                                        <image>1</image>
                                     </object>
                                     <!-- the items are added from the code -->
                                 </object>
index d0a7e78b0404fd547be288fa995ef3fde8f80884..acce070d341d53ab3ebd7335f355ebd242bbc909 100644 (file)
@@ -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);
 }