X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42d54220ee7a57a075871901134db84139ad9ebf..adb799d6ef8e1ba754ab08b26e64fa40219f95f8:/src/msw/utilsgui.cpp diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 70887df327..ebcb3ef138 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -6,7 +6,7 @@ // Created: 21.06.2003 (extracted from msw/utils.cpp) // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// License: wxWindows license +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -44,7 +44,7 @@ #if wxUSE_RESOURCES bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) { - if (file != wxT("")) + if (file != wxEmptyString) // Don't know what the correct cast should be, but it doesn't // compile in BC++/16-bit without this cast. #if !defined(__WIN32__) @@ -83,22 +83,23 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value, bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file) { static const wxChar defunkt[] = wxT("$$default"); - if (file != wxT("")) + + wxChar buf[1024]; + if (file != wxEmptyString) { - int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt, - (LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file); - if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0) + int n = GetPrivateProfileString(section, entry, defunkt, + buf, WXSIZEOF(buf), file); + if (n == 0 || wxStrcmp(buf, defunkt) == 0) return FALSE; } else { - int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt, - (LPTSTR)wxBuffer, 1000); - if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0) + int n = GetProfileString(section, entry, defunkt, buf, WXSIZEOF(buf)); + if (n == 0 || wxStrcmp(buf, defunkt) == 0) return FALSE; } if (*value) delete[] (*value); - *value = copystring(wxBuffer); + *value = wxStrcpy(new wxChar[wxStrlen(buf) + 1], buf); return TRUE; } @@ -333,7 +334,7 @@ void wxDisplaySizeMM(int *width, int *height) void wxClientDisplayRect(int *x, int *y, int *width, int *height) { -#if defined(__WIN16__) || defined(__WXMICROWIN__) +#if defined(__WXMICROWIN__) *x = 0; *y = 0; wxDisplaySize(width, height); #else @@ -360,8 +361,7 @@ wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) if ( hWnd ) { int len = GetWindowTextLength((HWND)hWnd) + 1; - ::GetWindowText((HWND)hWnd, str.GetWriteBuf(len), len); - str.UngetWriteBuf(); + ::GetWindowText((HWND)hWnd, wxStringBuffer(str, len), len); } return str; @@ -379,9 +379,8 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) for ( ;; ) { - int count = ::GetClassName((HWND)hWnd, str.GetWriteBuf(len), len); + int count = ::GetClassName((HWND)hWnd, wxStringBuffer(str, len), len); - str.UngetWriteBuf(); if ( count == len ) { // the class name might have been truncated, retry with larger @@ -401,11 +400,7 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) { -#ifndef __WIN32__ - return (WXWORD)GetWindowWord((HWND)hWnd, GWW_ID); -#else // Win32 return (WXWORD)GetWindowLong((HWND)hWnd, GWL_ID); -#endif // Win16/32 } // ---------------------------------------------------------------------------- @@ -442,4 +437,18 @@ extern void HIMETRICToPixel(LONG *x, LONG *y) *y /= (iHeightMM * 100); } +void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) +{ +#ifdef __WXWINCE__ + POINT points[2]; + points[0].x = x1; + points[0].y = y1; + points[1].x = x2; + points[1].y = y2; + Polyline(hdc, points, 2); +#else + MoveToEx(hdc, x1, y1, NULL); LineTo((HDC) hdc, x2, y2); +#endif +} +