X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e373f51b6c2a9a43436e24b690c18f334e0605e6..ef609210f1656775cbbd09e45d36e2abb90e47d5:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index a9f6be255f..a8a91ee309 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -115,7 +115,7 @@ bool wxListCtrl::Create(wxWindow *parent, // Create the ListView control. m_hWnd = (WXHWND)CreateWindowEx(exStyle, WC_LISTVIEW, - "", + _T(""), wstyle, x, y, width, height, (HWND) parent->GetHWND(), @@ -124,7 +124,7 @@ bool wxListCtrl::Create(wxWindow *parent, NULL); if ( !m_hWnd ) { - wxLogError("Can't create list control window."); + wxLogError(_T("Can't create list control window.")); return FALSE; } @@ -229,7 +229,7 @@ void wxListCtrl::RecreateWindow() WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; HWND hWndListControl = CreateWindowEx(exStyle, WC_LISTVIEW, - "", + _T(""), style, x, y, width, height, (HWND) GetParent()->GetHWND(), @@ -360,11 +360,14 @@ long wxListCtrl::ConvertToMSWStyle(long& oldStyle, long style) const // 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 @@ -378,7 +381,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const if ( item.m_mask & wxLIST_MASK_TEXT ) { lvCol.mask |= LVCF_TEXT; - lvCol.pszText = new char[513]; + lvCol.pszText = new wxChar[513]; lvCol.cchTextMax = 512; } @@ -495,11 +498,12 @@ bool wxListCtrl::GetItem(wxListItem& info) const #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 @@ -662,7 +666,11 @@ bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const 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; @@ -1086,7 +1094,7 @@ long wxListCtrl::InsertColumn(long col, wxListItem& item) } else { - wxLogDebug("Failed to insert the column '%s' into listview!", + wxLogDebug(_T("Failed to insert the column '%s' into listview!"), lvCol.pszText); } @@ -1154,7 +1162,7 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id) 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; @@ -1272,7 +1280,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result) } default : - return wxControl::MSWNotify(wParam, lParam, result); + return wxControl::MSWOnNotify(idCtrl, lParam, result); } event.SetEventObject( this ); @@ -1289,7 +1297,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result) 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); @@ -1300,7 +1308,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result) 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 ) @@ -1309,8 +1317,8 @@ char *wxListCtrl::AddPool(const wxString& str) 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 @@ -1348,7 +1356,7 @@ static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, L 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 ; @@ -1459,7 +1467,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ } 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