m_listCtrl->AssociateModel( m_list_model.get() );
#if 1
- m_listCtrl->AppendTextColumn (wxT("editable string"), 0, wxDATAVIEW_CELL_EDITABLE, 120, wxALIGN_RIGHT );
- m_listCtrl->AppendIconTextColumn(wxIcon(small1_xpm), 1, wxDATAVIEW_CELL_INERT )->SetTitle( wxT("icon") );
+ m_listCtrl->AppendTextColumn (wxT("editable string"), 0, wxDATAVIEW_CELL_EDITABLE, 120 );
+ m_listCtrl->AppendIconTextColumn(wxIcon(small1_xpm), 1, wxDATAVIEW_CELL_INERT )->SetTitle( wxT("icon") );
#else
m_listCtrl->AppendTextColumn (wxT("editable string"), 0, wxDATAVIEW_CELL_EDITABLE );
m_listCtrl->AppendIconTextColumn(wxT("icon"), 1, wxDATAVIEW_CELL_INERT );
#include "wx/icon.h"
#include "wx/list.h"
#include "wx/listimpl.cpp"
+#include "wx/imaglist.h"
//-----------------------------------------------------------------------------
// classes
wxDataViewColumn *GetColumnFromHeader(NMHEADER *nmHDR)
{ return GetColumn(GetColumnIdxFromHeader(nmHDR)); }
- int m_scrollOffsetX;
- int m_buttonHeight;
- bool m_delayedUpdate;
+ int m_scrollOffsetX;
+ int m_buttonHeight;
+ bool m_delayedUpdate;
+ wxImageList *m_imageList;
private:
DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindowMSW)
SetAlignment(align);
SetFlags(flags);
- Init(width < 0 ? wxDVC_TOGGLE_DEFAULT_WIDTH : width);
+ Init(width < 0 ? wxDVC_DEFAULT_WIDTH : width);
}
wxDataViewColumn::~wxDataViewColumn()
return false;
}
+ m_imageList = new wxImageList( 16, 16 );
+ Header_SetImageList( (HWND) m_hWnd, m_imageList->GetHIMAGELIST() );
+
// we need to subclass the m_hWnd to force wxWindow::HandleNotify
// to call wxDataViewHeaderWindow::MSWOnNotify
SubclassWin(m_hWnd);
wxDataViewHeaderWindowMSW::~wxDataViewHeaderWindow()
{
+ delete m_imageList;
UnsubclassWin();
}
// remove old columns
for (int j=0, max=Header_GetItemCount((HWND)m_hWnd); j < max; j++)
Header_DeleteItem((HWND)m_hWnd, 0);
+
+ m_imageList->RemoveAll();
// add the updated array of columns to the header control
unsigned int cols = GetOwner()->GetColumnCount();
hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
if (col->GetBitmap().IsOk())
{
- hdi.mask |= HDI_BITMAP;
- hdi.hbm = (HBITMAP) col->GetBitmap().GetHBITMAP();
+ m_imageList->Add( col->GetBitmap() );
+ hdi.mask |= HDI_IMAGE;
+ hdi.iImage = m_imageList->GetImageCount()-1;
}
hdi.pszText = (wxChar *) col->GetTitle().wx_str();
hdi.cxy = col->GetWidth();
hdi.cchTextMax = sizeof(hdi.pszText)/sizeof(hdi.pszText[0]);
hdi.fmt = HDF_LEFT | HDF_STRING;
if (col->GetBitmap().IsOk())
- hdi.fmt |= HDF_BITMAP;
+ hdi.fmt |= HDF_IMAGE;
//hdi.fmt &= ~(HDF_SORTDOWN|HDF_SORTUP);