// Create the ListView control.
m_hWnd = (WXHWND)CreateWindowEx(exStyle,
WC_LISTVIEW,
- "",
+ _T(""),
wstyle,
x, y, width, height,
(HWND) parent->GetHWND(),
NULL);
if ( !m_hWnd ) {
- wxLogError("Can't create list control window.");
+ wxLogError(_T("Can't create list control window."));
return FALSE;
}
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
HWND hWndListControl = CreateWindowEx(exStyle,
WC_LISTVIEW,
- "",
+ _T(""),
style,
x, y, width, height,
(HWND) GetParent()->GetHWND(),
// Sets the background colour (GetBackgroundColour already implicit in
// wxWindow class)
-void wxListCtrl::SetBackgroundColour(const wxColour& col)
+bool wxListCtrl::SetBackgroundColour(const wxColour& col)
{
- wxWindow::SetBackgroundColour(col);
+ if ( !wxWindow::SetBackgroundColour(col) )
+ return FALSE;
ListView_SetBkColor((HWND) GetHWND(), PALETTERGB(col.Red(), col.Green(), col.Blue()));
+
+ return TRUE;
}
// Gets information about this column
if ( item.m_mask & wxLIST_MASK_TEXT )
{
lvCol.mask |= LVCF_TEXT;
- lvCol.pszText = new char[513];
+ lvCol.pszText = new wxChar[513];
lvCol.cchTextMax = 512;
}
#endif
lvItem.iItem = info.m_itemId;
+ lvItem.iSubItem = info.m_col;
if ( info.m_mask & wxLIST_MASK_TEXT )
{
lvItem.mask |= LVIF_TEXT;
- lvItem.pszText = new char[513];
+ lvItem.pszText = new wxChar[513];
lvItem.cchTextMax = 512;
}
else
else if ( code == wxLIST_RECT_LABEL )
code2 = LVIR_LABEL;
+#ifdef __WXWINE__
+ bool success = (ListView_GetItemRect((HWND) GetHWND(), (int) item, &rect2 ) != 0);
+#else
bool success = (ListView_GetItemRect((HWND) GetHWND(), (int) item, &rect2, code2) != 0);
+#endif
rect.x = rect2.left;
rect.y = rect2.top;
lvCol.fmt = LVCFMT_CENTER;
}
+ lvCol.mask |= LVCF_WIDTH;
if ( item.m_mask & wxLIST_MASK_WIDTH )
{
- lvCol.mask |= LVCF_WIDTH;
- lvCol.cx = item.m_width;
-
- if ( lvCol.cx == wxLIST_AUTOSIZE)
+ if ( item.m_width == wxLIST_AUTOSIZE)
lvCol.cx = LVSCW_AUTOSIZE;
- else if ( lvCol.cx == wxLIST_AUTOSIZE_USEHEADER)
+ else if ( item.m_width == wxLIST_AUTOSIZE_USEHEADER)
lvCol.cx = LVSCW_AUTOSIZE_USEHEADER;
+ else
+ lvCol.cx = item.m_width;
+ }
+ else
+ {
+ // always give some width to the new column: this one is compatible
+ // with wxGTK
+ lvCol.cx = 80;
}
+
lvCol.mask |= LVCF_SUBITEM;
lvCol.iSubItem = col;
- bool success = (ListView_InsertColumn((HWND) GetHWND(), col, & lvCol) != 0);
+ bool success = ListView_InsertColumn((HWND) GetHWND(), col, & lvCol) != -1;
if ( success )
- m_colCount ++;
+ {
+ m_colCount++;
+ }
+ else
+ {
+ wxLogDebug(_T("Failed to insert the column '%s' into listview!"),
+ lvCol.pszText);
+ }
+
return success;
}
else return FALSE;
}
-bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
+bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxListEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
}
default :
- return wxControl::MSWNotify(wParam, lParam, result);
+ return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject( this );
if ( !event.m_item.m_text.IsNull() )
{
info->item.pszText = AddPool(event.m_item.m_text);
- info->item.cchTextMax = strlen(info->item.pszText) + 1;
+ info->item.cchTextMax = wxStrlen(info->item.pszText) + 1;
}
}
// wxConvertToMSWListItem(this, event.m_item, info->item);
return TRUE;
}
-char *wxListCtrl::AddPool(const wxString& str)
+wxChar *wxListCtrl::AddPool(const wxString& str)
{
// Remove the first element if 3 strings exist
if ( m_stringPool.Number() == 3 )
delete[] (char *)node->Data();
delete node;
}
- wxNode *node = m_stringPool.Add((char *) (const char *)str);
- return (char *)node->Data();
+ wxNode *node = m_stringPool.Add(WXSTRINGCAST str);
+ return (wxChar *)node->Data();
}
// List item structure
if ( needText )
{
- lvItem.pszText = new char[513];
+ lvItem.pszText = new wxChar[513];
lvItem.cchTextMax = 512;
}
// lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM ;
}
else
{
- lvItem.pszText = (char *) (const char *)info.m_text ;
+ lvItem.pszText = WXSTRINGCAST info.m_text ;
if ( lvItem.pszText )
lvItem.cchTextMax = info.m_text.Length();
else