///////////////////////////////////////////////////////////////////////////////
-// Name: msw/utilsgui.cpp
-// Purpose: Various utility functions only available in GUI
+// Name: src/msw/utilsgui.cpp
+// Purpose: Various utility functions only available in wxMSW GUI
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.06.2003 (extracted from msw/utils.cpp)
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// License: wxWindows licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// implementation
// ============================================================================
+// Emit a beeeeeep
+void wxBell()
+{
+ ::MessageBeep((UINT)-1); // default sound
+}
+
// ---------------------------------------------------------------------------
// helper functions for showing a "busy" cursor
// ---------------------------------------------------------------------------
return true;
}
-// MSW only: get user-defined resource from the .res file.
-// Returns NULL or newly-allocated memory, so use delete[] to clean up.
-
-#ifndef __WXMICROWIN__
-wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
-{
- HRSRC hResource = ::FindResource(wxGetInstance(),
- resourceName.wx_str(),
- resourceType.wx_str());
- if ( hResource == 0 )
- return NULL;
-
- HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
- if ( hData == 0 )
- return NULL;
-
- wxChar *theText = (wxChar *)::LockResource(hData);
- if ( !theText )
- return NULL;
-
- // Not all compilers put a zero at the end of the resource (e.g. BC++ doesn't).
- // so we need to find the length of the resource.
- int len = ::SizeofResource(wxGetInstance(), hResource) + 1;
- wxChar *s = new wxChar[len];
- wxStrlcpy(s, theText, len);
-
- // Obsolete in WIN32
-#ifndef __WIN32__
- UnlockResource(hData);
-#endif
-
- // No need??
- // GlobalFree(hData);
-
- return s;
-}
-#endif // __WXMICROWIN__
-
// ----------------------------------------------------------------------------
// get display info
// ----------------------------------------------------------------------------
void wxGetMousePosition( int* x, int* y )
{
POINT pt;
- GetCursorPos( & pt );
+ wxGetCursorPosMSW( & pt );
if ( x ) *x = pt.x;
if ( y ) *y = pt.y;
}
#endif
}
-void wxClientDisplayRect(int *x, int *y, int *width, int *height)
-{
-#if defined(__WXMICROWIN__)
- *x = 0; *y = 0;
- wxDisplaySize(width, height);
-#else
- // Determine the desktop dimensions minus the taskbar and any other
- // special decorations...
- RECT r;
-
- SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
- if (x) *x = r.left;
- if (y) *y = r.top;
- if (width) *width = r.right - r.left;
- if (height) *height = r.bottom - r.top;
-#endif
-}
-
// ---------------------------------------------------------------------------
// window information functions
// ---------------------------------------------------------------------------
// Metafile helpers
// ----------------------------------------------------------------------------
-extern void PixelToHIMETRIC(LONG *x, LONG *y)
+void PixelToHIMETRIC(LONG *x, LONG *y, HDC hdcRef)
{
- ScreenHDC hdcRef;
-
int iWidthMM = GetDeviceCaps(hdcRef, HORZSIZE),
iHeightMM = GetDeviceCaps(hdcRef, VERTSIZE),
iWidthPels = GetDeviceCaps(hdcRef, HORZRES),
*y /= iHeightPels;
}
-extern void HIMETRICToPixel(LONG *x, LONG *y)
+void HIMETRICToPixel(LONG *x, LONG *y, HDC hdcRef)
{
- ScreenHDC hdcRef;
-
int iWidthMM = GetDeviceCaps(hdcRef, HORZSIZE),
iHeightMM = GetDeviceCaps(hdcRef, VERTSIZE),
iWidthPels = GetDeviceCaps(hdcRef, HORZRES),
*y /= (iHeightMM * 100);
}
+void HIMETRICToPixel(LONG *x, LONG *y)
+{
+ HIMETRICToPixel(x, y, ScreenHDC());
+}
+
+void PixelToHIMETRIC(LONG *x, LONG *y)
+{
+ PixelToHIMETRIC(x, y, ScreenHDC());
+}
+
void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2)
{
#ifdef __WXWINCE__
s_initialized = true;
wxLogNull nolog;
- wxDynamicLibrary dll(_T("shlwapi.dll"));
+ wxDynamicLibrary dll(wxT("shlwapi.dll"));
if ( dll.IsLoaded() )
{
s_pfnSHAutoComplete =
- (SHAutoComplete_t)dll.GetSymbol(_T("SHAutoComplete"));
+ (SHAutoComplete_t)dll.GetSymbol(wxT("SHAutoComplete"));
if ( s_pfnSHAutoComplete )
{
// won't be unloaded until the process termination, no big deal
HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */);
if ( FAILED(hr) )
{
- wxLogApiError(_T("SHAutoComplete"), hr);
+ wxLogApiError(wxT("SHAutoComplete"), hr);
return false;
}
return false;
#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
}
-