X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/97c611f84745e193ac2b156a92dd127aaa9c7d51..42ef83fa71e14e4fcbb537dd0da7bd9ef9701f49:/src/msw/listctrl.cpp?ds=inline diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index c3193b7198..dfbc42e004 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -45,7 +45,7 @@ #include "wx/msw/private.h" -#if defined(__WXWINCE__) +#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) #include #include #if _WIN32_WCE < 400 @@ -291,7 +291,7 @@ IMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl,"wx/listctrl.h") wxBEGIN_PROPERTIES_TABLE(wxListCtrl) wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent ) - wxPROPERTY_FLAGS( WindowStyle , wxListCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + wxPROPERTY_FLAGS( WindowStyle , wxListCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style wxEND_PROPERTIES_TABLE() wxBEGIN_HANDLERS_TABLE(wxListCtrl) @@ -353,23 +353,16 @@ bool wxListCtrl::Create(wxWindow *parent, // explicitly say that we want to use Unicode because otherwise we get ANSI // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build -#if wxUSE_UNICODE - ::SendMessage(GetHwnd(), LVM_SETUNICODEFORMAT, TRUE, 0); -#endif + wxSetCCUnicodeFormat(GetHwnd()); // for comctl32.dll v 4.70+ we want to have this attribute because it's // prettier (and also because wxGTK does it like this) - if ( HasFlag(wxLC_REPORT) && wxTheApp->GetComCtl32Version() >= 470 ) + if ( InReportView() && wxTheApp->GetComCtl32Version() >= 470 ) { ::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); } - // inherit foreground colour but our background should be the same as for - // listboxes and other such "container" windows and not inherited - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - SetForegroundColour(GetParent()->GetForegroundColour()); - return TRUE; } @@ -470,10 +463,9 @@ void wxListCtrl::FreeAllInternalData() if (m_AnyInternalData) { int n = GetItemCount(); - int i = 0; m_ignoreChangeMessages = TRUE; - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) wxDeleteInternalData(this, i); m_ignoreChangeMessages = FALSE; @@ -548,6 +540,17 @@ void wxListCtrl::SetWindowStyleFlag(long flag) // accessors // ---------------------------------------------------------------------------- +/* static */ wxVisualAttributes +wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +{ + wxVisualAttributes attrs = GetCompositeControlsDefaultAttributes(variant); + + // common controls have their own default font + attrs.font = wxGetCCDefaultFont(); + + return attrs; +} + // Sets the foreground, i.e. text, colour bool wxListCtrl::SetForegroundColour(const wxColour& col) { @@ -1716,7 +1719,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_col = nmHDR->iItem; break; -#if defined(__WXWINCE__) && _WIN32_WCE < 400 +#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 case GN_CONTEXTMENU: #endif //__WXWINCE__ case NM_RCLICK: @@ -1730,7 +1733,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // where did the click occur? POINT ptClick; -#if defined(__WXWINCE__) && _WIN32_WCE < 400 +#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 if(nmhdr->code == GN_CONTEXTMENU) { ptClick = ((NMRGINFO*)nmhdr)->ptAction; } else @@ -1776,7 +1779,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // there's a GPF in Windows. // By returning TRUE here, we avoid further processing // of this strange message. - if ( info->iItem >= GetColumnCount() ) + if ( (unsigned)info->iItem >= (unsigned)GetColumnCount() ) return TRUE; } // fall through @@ -1932,7 +1935,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case LVN_ITEMCHANGED: // we translate this catch all message into more interesting - // (and more easy to process) wxWindows events + // (and more easy to process) wxWidgets events // first of all, we deal with the state change events only and // only for valid items (item == -1 for the virtual list @@ -2050,7 +2053,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_item.m_data = GetItemData(iItem); break; -#if defined(__WXWINCE__) && _WIN32_WCE < 400 +#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 case GN_CONTEXTMENU: #endif //__WXWINCE__ case NM_RCLICK: @@ -2065,7 +2068,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) LV_HITTESTINFO lvhti; wxZeroMemory(lvhti); -#if defined(__WXWINCE__) && _WIN32_WCE < 400 +#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 if(nmhdr->code == GN_CONTEXTMENU) { lvhti.pt = ((NMRGINFO*)nmhdr)->ptAction; } else @@ -2297,12 +2300,10 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) // Reset the device origin since it may have been set dc.SetDeviceOrigin(0, 0); - bool drawHRules = ((GetWindowStyle() & wxLC_HRULES) != 0); - bool drawVRules = ((GetWindowStyle() & wxLC_VRULES) != 0); + bool drawHRules = HasFlag(wxLC_HRULES); + bool drawVRules = HasFlag(wxLC_VRULES); - if (!drawHRules && !drawVRules) - return; - if ((GetWindowStyle() & wxLC_REPORT) == 0) + if (!InReportView() || !drawHRules && !drawVRules) return; wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); @@ -2311,7 +2312,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) wxSize clientSize = GetClientSize(); wxRect itemRect; - int cy=0; int itemCount = GetItemCount(); int i; @@ -2322,7 +2322,7 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) { if (GetItemRect(i, itemRect)) { - cy = itemRect.GetTop(); + int cy = itemRect.GetTop(); if (i != 0) // Don't draw the first one { dc.DrawLine(0, cy, clientSize.x, cy); @@ -2614,7 +2614,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, if (info.m_mask & wxLIST_MASK_TEXT) { lvItem.mask |= LVIF_TEXT; - if ( ctrl->GetWindowStyleFlag() & wxLC_USER_TEXT ) + if ( ctrl->HasFlag(wxLC_USER_TEXT) ) { lvItem.pszText = LPSTR_TEXTCALLBACK; }