Implement icon text column using native GTK renderers in wxDVC.
This has a possible advantage of a more native look and feel (although it's hard to tell the difference between drawing the icon ourselves and how the default GTK+ renderer does it to be honest) and a very real advantage of allowing to edit in place cells with icons. It also reduces code duplication in GTK implementation. Modify the sample to make the icon-text column in the list model editable to show that it works. This required storing the values of the second column as well, so do it in its own array and to avoid calling it "m_array2", rename the existing m_array to m_textColValues (which accounts for most of the diff in the sample) and call the new one m_iconColValues. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -545,13 +545,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
m_ctrl[1]->AssociateModel( m_list_model.get() );
|
||||
|
||||
// the various columns
|
||||
#if 1
|
||||
m_ctrl[1]->AppendTextColumn("editable string", 0, wxDATAVIEW_CELL_EDITABLE, 120);
|
||||
m_ctrl[1]->AppendIconTextColumn(wxIcon(wx_small_xpm), 1, wxDATAVIEW_CELL_INERT )->SetTitle( "icon");
|
||||
#else
|
||||
m_ctrl[1]->AppendTextColumn("editable string", 0, wxDATAVIEW_CELL_EDITABLE);
|
||||
m_ctrl[1]->AppendIconTextColumn("icon", 1, wxDATAVIEW_CELL_INERT);
|
||||
#endif
|
||||
m_ctrl[1]->AppendIconTextColumn("icon", 1, wxDATAVIEW_CELL_EDITABLE);
|
||||
m_ctrl[1]->AppendColumn(
|
||||
new wxDataViewColumn("attributes", new wxDataViewTextRenderer, 2 ));
|
||||
}
|
||||
|
Reference in New Issue
Block a user