// 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
#endif
lvItem.iItem = info.m_itemId;
+ lvItem.iSubItem = info.m_col;
if ( info.m_mask & wxLIST_MASK_TEXT )
{
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("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 );