Remove Windows XP and Vista support
Supporting XP requires too many hacks, and while it wouldn't be very difficult to support Vista as long as we support Windows 7, it's still not worth it because nobody uses this system anyhow. Remove most of XP-specific code and don't use wxDynamicLibrary for using the functions not present in it any longer. Don't use <wspiapi.h> neither as we shouldn't use it any more. Update some comments to not mention Windows versions not supported any longer and also remove mentions of "Vista and newer Windows versions" from the documentation as this is now always the case. This commit is best viewed ignoring whitespace-only changes.
This commit is contained in:
parent
d761ba0f8f
commit
43ff845e77
49 changed files with 273 additions and 676 deletions
|
|
@ -29,7 +29,7 @@ Platforms
|
||||||
|
|
||||||
This version of wxWidgets supports the following primary platforms:
|
This version of wxWidgets supports the following primary platforms:
|
||||||
|
|
||||||
- Windows XP, Vista, 7, 8, 10 and 11 (32/64 bits).
|
- Windows 7, 8, 10 and 11 (32/64 bits).
|
||||||
- Most Unix variants using the GTK+ toolkit (version 2.6 or newer or 3.x).
|
- Most Unix variants using the GTK+ toolkit (version 2.6 or newer or 3.x).
|
||||||
- macOS (10.10 or newer) using Cocoa under both amd64 and ARM platforms.
|
- macOS (10.10 or newer) using Cocoa under both amd64 and ARM platforms.
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ All C++11 compilers are supported including but not limited to:
|
||||||
- Clang (up to 14).
|
- Clang (up to 14).
|
||||||
|
|
||||||
Please use [3.2 branch](https://github.com/wxWidgets/wxWidgets/tree/3.2) if
|
Please use [3.2 branch](https://github.com/wxWidgets/wxWidgets/tree/3.2) if
|
||||||
you must use wxWidgets with a C++98 compiler.
|
you must use wxWidgets with a C++98 compiler or support Windows XP.
|
||||||
|
|
||||||
|
|
||||||
Licence
|
Licence
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,9 @@ paragraphs, but here are some of the benefits:
|
||||||
wxWidgets first-tier "ports", ie implementations of wxWidgets API, are:
|
wxWidgets first-tier "ports", ie implementations of wxWidgets API, are:
|
||||||
|
|
||||||
@li wxMSW: This is the native port for Microsoft Windows systems (from Windows
|
@li wxMSW: This is the native port for Microsoft Windows systems (from Windows
|
||||||
XP up to Windows 11), either 32 or 64 bits. The primarily supported compilers
|
7 up to Windows 11), either 32 or 64 bits. The primarily supported compilers
|
||||||
are Microsoft Visual C++ (versions 2005 up to 2022 are supported, at least 2010
|
are Microsoft Visual C++ (versions 2015 up to 2022 are supported) and GNU g++
|
||||||
is recommended) and GNU g++ (either from the traditional MinGW, TDM-GCC or
|
(either MinGW-w64 or TDM-GCC).
|
||||||
MinGW-w64 distributions).
|
|
||||||
|
|
||||||
@li wxGTK: wxGTK2 and wxGTK3 are the ports using GTK+ library version 2.x and
|
@li wxGTK: wxGTK2 and wxGTK3 are the ports using GTK+ library version 2.x and
|
||||||
3.x respectively. They are very similar, with wxGTK2 being, however, more
|
3.x respectively. They are very similar, with wxGTK2 being, however, more
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@ In order to configure wxWidgets to compile wxX11 you will need to type:
|
||||||
|
|
||||||
@section page_port_wxmsw wxMSW
|
@section page_port_wxmsw wxMSW
|
||||||
|
|
||||||
wxMSW is a port of wxWidgets for the Windows platforms (Windows XP and later
|
wxMSW is a port of wxWidgets for the Windows platforms (current version
|
||||||
are supported). wxMSW provides native look and feel for each Windows version.
|
requires Windows 7 or later). wxMSW provides native look and feel for each Windows version.
|
||||||
This port can be compiled with several compilers including Microsoft
|
This port can be compiled with several compilers including Microsoft
|
||||||
VC++ 2015 or later, MinGW, Cygwin as well as cross-compilation with a
|
VC++ 2015 or later, MinGW, Cygwin as well as cross-compilation with a
|
||||||
Linux-hosted MinGW tool chain.
|
Linux-hosted MinGW tool chain.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Installing wxWidgets for Windows {#plat_msw_install}
|
Installing wxWidgets for Windows {#plat_msw_install}
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
This is wxWidgets for Microsoft Windows (XP, Vista, 7, 8, 10, 11)
|
This is wxWidgets for Microsoft Windows 7 or later (up to 11)
|
||||||
including both 32 bit and 64 bit versions.
|
including both 32 bit and 64 bit versions.
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ Supported Platforms
|
||||||
|
|
||||||
This version of wxWidgets supports the following primary platforms:
|
This version of wxWidgets supports the following primary platforms:
|
||||||
|
|
||||||
* Windows XP, Vista, 7, 8, 10 and 11 (32/64 bits).
|
* Windows 7, 8, 10 and 11 (32/64 bits).
|
||||||
* Most Unix variants using the GTK+ toolkit (version 2.6 or newer)
|
* Most Unix variants using the GTK+ toolkit (version 2.6 or newer)
|
||||||
* macOS (10.10 or newer) using Cocoa (x86-64 or ARM).
|
* macOS (10.10 or newer) using Cocoa (x86-64 or ARM).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ public:
|
||||||
wxButtonBase() { }
|
wxButtonBase() { }
|
||||||
|
|
||||||
// show the authentication needed symbol on the button: this is currently
|
// show the authentication needed symbol on the button: this is currently
|
||||||
// only implemented on Windows Vista and newer (on which it shows the UAC
|
// only implemented in wxMSW where it shows the UAC shield symbol
|
||||||
// shield symbol)
|
|
||||||
void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); }
|
void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); }
|
||||||
bool GetAuthNeeded() const { return DoGetAuthNeeded(); }
|
bool GetAuthNeeded() const { return DoGetAuthNeeded(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ enum
|
||||||
wxCC_BUTTON_STAYS_DOWN = 0x0008,
|
wxCC_BUTTON_STAYS_DOWN = 0x0008,
|
||||||
// Drop-button covers the entire control.
|
// Drop-button covers the entire control.
|
||||||
wxCC_FULL_BUTTON = 0x0010,
|
wxCC_FULL_BUTTON = 0x0010,
|
||||||
// Drop-button goes over the custom-border (used under WinVista).
|
// Drop-button goes over the custom-border (used under Windows).
|
||||||
wxCC_BUTTON_COVERS_BORDER = 0x0020,
|
wxCC_BUTTON_COVERS_BORDER = 0x0020,
|
||||||
|
|
||||||
// Internal use: signals creation is complete
|
// Internal use: signals creation is complete
|
||||||
|
|
|
||||||
|
|
@ -336,9 +336,9 @@ public:
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
// return the handle (HMODULE/HINSTANCE) of the DLL with the given name
|
// return the handle (HMODULE/HINSTANCE) of the DLL with the given name
|
||||||
// and/or containing the specified address: for XP and later systems only
|
// and/or containing the specified address: if a valid address is
|
||||||
// the address is used and the name is ignored but for the previous systems
|
// specified, it is used and then name is ignored, but if the address is
|
||||||
// only the name (which may be either a full path to the DLL or just its
|
// null, the name (which may be either a full path to the DLL or just its
|
||||||
// base name, possibly even without extension) is used
|
// base name, possibly even without extension) is used
|
||||||
//
|
//
|
||||||
// the returned handle reference count is not incremented so it doesn't
|
// the returned handle reference count is not incremented so it doesn't
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ protected:
|
||||||
|
|
||||||
// Switches button into owner-drawn mode: this is used if we need to draw
|
// Switches button into owner-drawn mode: this is used if we need to draw
|
||||||
// something not supported by the native control, such as using non default
|
// something not supported by the native control, such as using non default
|
||||||
// colours or a bitmap on pre-XP systems.
|
// colours or font.
|
||||||
void MakeOwnerDrawn();
|
void MakeOwnerDrawn();
|
||||||
bool IsOwnerDrawn() const;
|
bool IsOwnerDrawn() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,11 +121,6 @@ public:
|
||||||
|
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
|
||||||
|
|
||||||
#if wxUSE_UXTHEME
|
|
||||||
// override wxTextEntry method to work around Windows bug
|
|
||||||
virtual bool SetHint(const wxString& hint) override;
|
|
||||||
#endif // wxUSE_UXTHEME
|
|
||||||
|
|
||||||
virtual void SetLayoutDirection(wxLayoutDirection dir) override;
|
virtual void SetLayoutDirection(wxLayoutDirection dir) override;
|
||||||
|
|
||||||
virtual const wxTextEntry* WXGetTextEntry() const override { return this; }
|
virtual const wxTextEntry* WXGetTextEntry() const override { return this; }
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ public:
|
||||||
virtual int ShowModal() override;
|
virtual int ShowModal() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The real implementations of ShowModal(), used for Windows versions
|
// The real implementations of ShowModal(), one using the traditional shell
|
||||||
// before and since Vista.
|
// function and another one using IFileOpenDialog.
|
||||||
int ShowSHBrowseForFolder(WXHWND owner);
|
int ShowSHBrowseForFolder(WXHWND owner);
|
||||||
int ShowIFileOpenDialog(WXHWND owner);
|
int ShowIFileOpenDialog(WXHWND owner);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,10 @@
|
||||||
|
|
||||||
// We want to use IFileDialog if either wxDirDialog or wxFileDialog are used.
|
// We want to use IFileDialog if either wxDirDialog or wxFileDialog are used.
|
||||||
//
|
//
|
||||||
// IFileOpenDialog implementation needs wxDynamicLibrary for
|
// Using IFileOpenDialog requires a compiler providing declarations and
|
||||||
// run-time linking SHCreateItemFromParsingName(), available
|
// definitions of interfaces available in Windows Vista.
|
||||||
// only under Windows Vista and newer.
|
|
||||||
// It also needs a compiler providing declarations and definitions
|
|
||||||
// of interfaces available in Windows Vista.
|
|
||||||
// And it needs OLE support to actually use these interfaces.
|
// And it needs OLE support to actually use these interfaces.
|
||||||
#if (wxUSE_DIRDLG || wxUSE_FILEDLG) && wxUSE_DYNLIB_CLASS && wxUSE_OLE && \
|
#if (wxUSE_DIRDLG || wxUSE_FILEDLG) && wxUSE_OLE && \
|
||||||
defined(__IFileOpenDialog_INTERFACE_DEFINED__)
|
defined(__IFileOpenDialog_INTERFACE_DEFINED__)
|
||||||
#define wxUSE_IFILEOPENDIALOG 1
|
#define wxUSE_IFILEOPENDIALOG 1
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -31,23 +31,8 @@ inline const NONCLIENTMETRICS GetNonClientMetrics(const wxWindow* win)
|
||||||
0,
|
0,
|
||||||
win) )
|
win) )
|
||||||
{
|
{
|
||||||
#if WINVER >= 0x0600
|
|
||||||
// a new field has been added to NONCLIENTMETRICS under Vista, so
|
|
||||||
// the call to SystemParametersInfo() fails if we use the struct
|
|
||||||
// size incorporating this new value on an older system -- retry
|
|
||||||
// without it
|
|
||||||
nm.cbSize -= sizeof(int);
|
|
||||||
if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS,
|
|
||||||
sizeof(NONCLIENTMETRICS),
|
|
||||||
&nm,
|
|
||||||
0,
|
|
||||||
win) )
|
|
||||||
#endif // WINVER >= 0x0600
|
|
||||||
{
|
|
||||||
// maybe we should initialize the struct with some defaults?
|
|
||||||
wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
|
wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,7 @@ public:
|
||||||
Returns @true if an authentication needed symbol is displayed on the
|
Returns @true if an authentication needed symbol is displayed on the
|
||||||
button.
|
button.
|
||||||
|
|
||||||
@remarks This method always returns @false if the platform is not
|
@remarks This method always returns @false on non-Windows platforms.
|
||||||
Windows Vista or newer.
|
|
||||||
|
|
||||||
@see SetAuthNeeded()
|
@see SetAuthNeeded()
|
||||||
|
|
||||||
|
|
@ -200,8 +199,7 @@ public:
|
||||||
Sets whether an authentication needed symbol should be displayed on the
|
Sets whether an authentication needed symbol should be displayed on the
|
||||||
button.
|
button.
|
||||||
|
|
||||||
@remarks This method doesn't do anything if the platform is not Windows
|
@remarks This method doesn't do anything on non-Windows platforms.
|
||||||
Vista or newer.
|
|
||||||
|
|
||||||
@see GetAuthNeeded()
|
@see GetAuthNeeded()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@
|
||||||
wxCommandLinkButton generates the same event as wxButton but doesn't
|
wxCommandLinkButton generates the same event as wxButton but doesn't
|
||||||
support any of wxButton-specific styles nor adds any new styles of its own.
|
support any of wxButton-specific styles nor adds any new styles of its own.
|
||||||
|
|
||||||
Currently this class uses native implementation under Windows Vista and
|
Currently this class uses native implementation under Windows and a generic
|
||||||
later versions and a generic implementation for the other platforms and
|
implementation for the other platforms.
|
||||||
earlier Windows versions.
|
|
||||||
|
|
||||||
@since 2.9.2
|
@since 2.9.2
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,9 @@ const char wxMessageBoxCaptionStr[] = "Message";
|
||||||
@style{wxICON_QUESTION}
|
@style{wxICON_QUESTION}
|
||||||
Displays a question mark symbol. This icon is automatically used
|
Displays a question mark symbol. This icon is automatically used
|
||||||
with @c wxYES_NO so it's usually unnecessary to specify it explicitly.
|
with @c wxYES_NO so it's usually unnecessary to specify it explicitly.
|
||||||
This style is not supported for message dialogs under wxMSW when a task
|
This style is not supported for message dialogs under wxMSW
|
||||||
dialog is used to implement them (i.e. when running under Windows Vista
|
because <a href="https://docs.microsoft.com/en-us/windows/desktop/uxguide/mess-confirm">Microsoft guidelines</a>
|
||||||
or later) because <a href="https://docs.microsoft.com/en-us/windows/desktop/uxguide/mess-confirm">Microsoft
|
indicate that no icon should be used for routine
|
||||||
guidelines</a> indicate that no icon should be used for routine
|
|
||||||
confirmations. If it is specified, no icon will be displayed.
|
confirmations. If it is specified, no icon will be displayed.
|
||||||
@style{wxICON_INFORMATION}
|
@style{wxICON_INFORMATION}
|
||||||
Displays an information symbol. This icon is used by default if
|
Displays an information symbol. This icon is used by default if
|
||||||
|
|
@ -75,8 +74,7 @@ const char wxMessageBoxCaptionStr[] = "Message";
|
||||||
Alias for @c wxICON_ERROR.
|
Alias for @c wxICON_ERROR.
|
||||||
@style{wxICON_AUTH_NEEDED}
|
@style{wxICON_AUTH_NEEDED}
|
||||||
Displays an authentication needed symbol. This style is only supported
|
Displays an authentication needed symbol. This style is only supported
|
||||||
for message dialogs under wxMSW when a task dialog is used to implement
|
for message dialogs under wxMSW. In other cases
|
||||||
them (i.e. when running under Windows Vista or later). In other cases
|
|
||||||
the default icon selection logic will be used. Note this can be
|
the default icon selection logic will be used. Note this can be
|
||||||
combined with other styles to provide a fallback. For instance, using
|
combined with other styles to provide a fallback. For instance, using
|
||||||
wxICON_AUTH_NEEDED | wxICON_QUESTION will show a shield symbol on
|
wxICON_AUTH_NEEDED | wxICON_QUESTION will show a shield symbol on
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,8 @@
|
||||||
extra explanatory text which is initially collapsed and not shown to the
|
extra explanatory text which is initially collapsed and not shown to the
|
||||||
user but can be expanded to show more information.
|
user but can be expanded to show more information.
|
||||||
|
|
||||||
Notice that currently the native dialog is used only under MSW when using
|
Notice that currently the native dialog is used only under MSW. Elsewhere,
|
||||||
Vista or later Windows version. Elsewhere, or for older versions of
|
a generic implementation which is less familiar to the users is
|
||||||
Windows, a generic implementation which is less familiar to the users is
|
|
||||||
used. Because of this it's recommended to use this class only if you do
|
used. Because of this it's recommended to use this class only if you do
|
||||||
need its extra functionality and use wxMessageDialog which does have native
|
need its extra functionality and use wxMessageDialog which does have native
|
||||||
implementation under all platforms otherwise. However if you do need to put
|
implementation under all platforms otherwise. However if you do need to put
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public:
|
||||||
|
|
||||||
Example return values:
|
Example return values:
|
||||||
- Unix/Mac: @c ~/Downloads
|
- Unix/Mac: @c ~/Downloads
|
||||||
- Windows: @c "C:\Users\username\Downloads" (Only available on Vista and newer)
|
- Windows: @c "C:\Users\username\Downloads"
|
||||||
*/
|
*/
|
||||||
Dir_Downloads,
|
Dir_Downloads,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
/**
|
/**
|
||||||
A helper class making it possible to use system theme for any control.
|
A helper class making it possible to use system theme for any control.
|
||||||
|
|
||||||
Under MSW, there an alternative theme available for the list and list-like
|
Under MSW, there is an alternative theme available for the list and list-like
|
||||||
controls since Windows Vista. This theme us used by Windows Explorer list
|
controls. This theme is used by Windows Explorer list and tree view and so
|
||||||
and tree view and so is arguably more familiar to the users than the standard
|
is arguably more familiar to the users than the standard appearance of these
|
||||||
appearance of these controls.
|
controls.
|
||||||
|
|
||||||
This class is used in wxWidgets to enable this system theme in wxTreeCtrl,
|
This class is used in wxWidgets to enable this system theme in wxTreeCtrl,
|
||||||
wxListCtrl and wxDataViewCtrl and thus give them the same, familiar look.
|
wxListCtrl and wxDataViewCtrl and thus give them the same, familiar look.
|
||||||
|
|
|
||||||
|
|
@ -463,8 +463,8 @@ public:
|
||||||
Notice that hints are known as <em>cue banners</em> under MSW or
|
Notice that hints are known as <em>cue banners</em> under MSW or
|
||||||
<em>placeholder strings</em> under macOS.
|
<em>placeholder strings</em> under macOS.
|
||||||
|
|
||||||
@remarks Currently implemented natively on Windows (Vista and later
|
@remarks Currently implemented natively on Windows, macOS and GTK+ (3.2
|
||||||
only), macOS and GTK+ (3.2 and later).
|
and later).
|
||||||
|
|
||||||
For the platforms without native hints support, the implementation
|
For the platforms without native hints support, the implementation
|
||||||
has several known limitations. Notably, the hint display will not
|
has several known limitations. Notably, the hint display will not
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ public:
|
||||||
The language is determined from the preferred UI language or languages
|
The language is determined from the preferred UI language or languages
|
||||||
list the user configured in the OS. Notice that this may or may not
|
list the user configured in the OS. Notice that this may or may not
|
||||||
correspond to the default @em locale as obtained from
|
correspond to the default @em locale as obtained from
|
||||||
wxLocale::GetSystemLanguage(); modern operation systems (Windows
|
wxLocale::GetSystemLanguage() as operating systems have separate
|
||||||
Vista+, macOS) have separate language and regional (= locale) settings.
|
language and regional (i.e. locale) settings.
|
||||||
|
|
||||||
@param domain
|
@param domain
|
||||||
The catalog domain to look for.
|
The catalog domain to look for.
|
||||||
|
|
@ -118,8 +118,8 @@ public:
|
||||||
The language is determined from the preferred UI language or languages
|
The language is determined from the preferred UI language or languages
|
||||||
list the user configured in the OS. Notice that this may or may not
|
list the user configured in the OS. Notice that this may or may not
|
||||||
correspond to the default @em locale as obtained from
|
correspond to the default @em locale as obtained from
|
||||||
wxLocale::GetSystemLanguage(); modern operation systems (Windows
|
wxLocale::GetSystemLanguage() as operating systems have separate
|
||||||
Vista+, macOS) have separate language and regional (= locale) settings.
|
language and regional (i.e. locale) settings.
|
||||||
|
|
||||||
@param domain
|
@param domain
|
||||||
The catalog domain to look for.
|
The catalog domain to look for.
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
@style{wxTR_TWIST_BUTTONS}
|
@style{wxTR_TWIST_BUTTONS}
|
||||||
Selects alternative style of @c +/@c - buttons and shows rotating
|
Selects alternative style of @c +/@c - buttons and shows rotating
|
||||||
("twisting") arrows instead. Currently this style is only implemented
|
("twisting") arrows instead. Currently this style is only implemented
|
||||||
under Microsoft Windows Vista and later Windows versions and is ignored
|
in wxMSW and is ignored
|
||||||
under the other platforms as enabling it is equivalent to using
|
under the other platforms as enabling it is equivalent to using
|
||||||
wxSystemThemedControl::EnableSystemTheme().
|
wxSystemThemedControl::EnableSystemTheme().
|
||||||
@style{wxTR_NO_LINES}
|
@style{wxTR_NO_LINES}
|
||||||
|
|
|
||||||
|
|
@ -228,12 +228,8 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc,
|
||||||
else
|
else
|
||||||
btnState = TTCS_NORMAL;
|
btnState = TTCS_NORMAL;
|
||||||
|
|
||||||
int offsetY = tabY;
|
|
||||||
if ( wxGetWinVersion() < wxWinVersion_Vista )
|
|
||||||
offsetY++; // WinXP theme needs a little more padding
|
|
||||||
|
|
||||||
wxRect rect(tabX + tabWidth - m_closeBtnSize.x - wnd->FromDIP(4),
|
wxRect rect(tabX + tabWidth - m_closeBtnSize.x - wnd->FromDIP(4),
|
||||||
offsetY + (tabHeight / 2) - (m_closeBtnSize.y / 2),
|
tabY + (tabHeight / 2) - (m_closeBtnSize.y / 2),
|
||||||
m_closeBtnSize.x,
|
m_closeBtnSize.x,
|
||||||
m_closeBtnSize.y);
|
m_closeBtnSize.y);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,22 +88,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress);
|
||||||
#define wxHAS_MT_SAFE_GETBY_FUNCS
|
#define wxHAS_MT_SAFE_GETBY_FUNCS
|
||||||
|
|
||||||
#if wxUSE_IPV6
|
#if wxUSE_IPV6
|
||||||
#ifdef __VISUALC__
|
|
||||||
// this header does dynamic dispatching of getaddrinfo/freeaddrinfo()
|
|
||||||
// by implementing them in its own code if the system versions are
|
|
||||||
// not available (as is the case for anything < XP)
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4706)
|
|
||||||
#include <wspiapi.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
#else
|
|
||||||
// TODO: Use wxDynamicLibrary to bind to these functions
|
|
||||||
// dynamically on older Windows systems, currently a program
|
|
||||||
// built with wxUSE_IPV6==1 won't even start there, even if
|
|
||||||
// it doesn't actually use the socket stuff.
|
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif // __WINDOWS__
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
// we assume that we have gethostbyaddr_r() if and only if we have
|
// we assume that we have gethostbyaddr_r() if and only if we have
|
||||||
|
|
|
||||||
|
|
@ -2522,14 +2522,8 @@ public:
|
||||||
// wouldn't work if reading an incomplete MB char didn't result in an
|
// wouldn't work if reading an incomplete MB char didn't result in an
|
||||||
// error
|
// error
|
||||||
//
|
//
|
||||||
// Moreover, MB_ERR_INVALID_CHARS is not supported for UTF-8 under XP
|
// But MB_ERR_INVALID_CHARS is not supported for UTF-7, so we always
|
||||||
// and for UTF-7 under any Windows version, so we always use our own
|
// use our own conversions in this case.
|
||||||
// conversions in this case.
|
|
||||||
if ( m_CodePage == CP_UTF8 )
|
|
||||||
{
|
|
||||||
return wxMBConvUTF8().MB2WC(buf, psz, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_CodePage == CP_UTF7 )
|
if ( m_CodePage == CP_UTF7 )
|
||||||
{
|
{
|
||||||
return wxMBConvUTF7().MB2WC(buf, psz, n);
|
return wxMBConvUTF7().MB2WC(buf, psz, n);
|
||||||
|
|
|
||||||
|
|
@ -2148,11 +2148,12 @@ int wxDataViewMainWindow::GetDefaultRowHeight() const
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// We would like to use the same line height that Explorer uses. This is
|
// We would like to use the same line height that Explorer uses. This is
|
||||||
// different from standard ListView control since Vista.
|
// different from standard ListView control since Vista.
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista )
|
const int EXTRA_MARGIN = 6;
|
||||||
return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(6);
|
#else // !__WXMSW__
|
||||||
else
|
const int EXTRA_MARGIN = 1;
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__/!__WXMSW__
|
||||||
return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(1);
|
|
||||||
|
return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(EXTRA_MARGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public:
|
||||||
#ifdef HAVE_MSW_THEME
|
#ifdef HAVE_MSW_THEME
|
||||||
// When using themes MSW tooltips use larger bluish version of the
|
// When using themes MSW tooltips use larger bluish version of the
|
||||||
// normal font.
|
// normal font.
|
||||||
if ( UseTooltipTheme() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
titleFont.MakeLarger();
|
titleFont.MakeLarger();
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ public:
|
||||||
wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */);
|
wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */);
|
||||||
|
|
||||||
#ifdef HAVE_MSW_THEME
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( icon.IsOk() && UseTooltipTheme() )
|
if ( icon.IsOk() && wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
// Themed tooltips under MSW align the text with the title, not
|
// Themed tooltips under MSW align the text with the title, not
|
||||||
// with the icon, so use a helper horizontal sizer in this case.
|
// with the icon, so use a helper horizontal sizer in this case.
|
||||||
|
|
@ -171,7 +171,7 @@ public:
|
||||||
{
|
{
|
||||||
// Determine the best colour(s) to use on our own.
|
// Determine the best colour(s) to use on our own.
|
||||||
#ifdef HAVE_MSW_THEME
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( UseTooltipTheme() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP");
|
wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP");
|
||||||
|
|
||||||
|
|
@ -273,24 +273,12 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef HAVE_MSW_THEME
|
|
||||||
// Returns non-null theme only if we're using Win7-style tooltips.
|
|
||||||
static bool UseTooltipTheme()
|
|
||||||
{
|
|
||||||
// Even themed applications under XP still use "classic" tooltips.
|
|
||||||
if ( wxGetWinVersion() <= wxWinVersion_XP )
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return wxUxThemeIsActive();
|
|
||||||
}
|
|
||||||
#endif // HAVE_MSW_THEME
|
|
||||||
|
|
||||||
// For now we just hard code the tip height, would be nice to do something
|
// For now we just hard code the tip height, would be nice to do something
|
||||||
// smarter in the future.
|
// smarter in the future.
|
||||||
static int GetTipHeight()
|
static int GetTipHeight()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MSW_THEME
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( UseTooltipTheme() )
|
if ( wxUxThemeIsActive() )
|
||||||
return 20;
|
return 20;
|
||||||
#endif // HAVE_MSW_THEME
|
#endif // HAVE_MSW_THEME
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ namespace
|
||||||
Helper class to manipulate console from a GUI app.
|
Helper class to manipulate console from a GUI app.
|
||||||
|
|
||||||
Notice that console output is available in the GUI app only if:
|
Notice that console output is available in the GUI app only if:
|
||||||
- AttachConsole() returns TRUE (which means it never works under pre-XP)
|
- AttachConsole() returns TRUE
|
||||||
- we have a valid STD_ERROR_HANDLE
|
- we have a valid STD_ERROR_HANDLE
|
||||||
- command history hasn't been changed since our startup
|
- command history hasn't been changed since our startup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,29 +95,6 @@ SHSTOCKICONID MSWGetStockIconIdForArtProviderId(const wxArtID& art_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// try to load SHGetStockIconInfo dynamically, so this code runs
|
|
||||||
// even on pre-Vista Windows versions
|
|
||||||
HRESULT
|
|
||||||
MSW_SHGetStockIconInfo(SHSTOCKICONID siid,
|
|
||||||
UINT uFlags,
|
|
||||||
SHSTOCKICONINFO *psii)
|
|
||||||
{
|
|
||||||
typedef HRESULT (WINAPI *PSHGETSTOCKICONINFO)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *);
|
|
||||||
static PSHGETSTOCKICONINFO pSHGetStockIconInfo = (PSHGETSTOCKICONINFO)-1;
|
|
||||||
|
|
||||||
if ( pSHGetStockIconInfo == (PSHGETSTOCKICONINFO)-1 )
|
|
||||||
{
|
|
||||||
wxDynamicLibrary shell32(wxT("shell32.dll"));
|
|
||||||
|
|
||||||
pSHGetStockIconInfo = (PSHGETSTOCKICONINFO)shell32.RawGetSymbol( wxT("SHGetStockIconInfo") );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !pSHGetStockIconInfo )
|
|
||||||
return E_FAIL;
|
|
||||||
|
|
||||||
return pSHGetStockIconInfo(siid, uFlags, psii);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // #ifdef wxHAS_SHGetStockIconInfo
|
#endif // #ifdef wxHAS_SHGetStockIconInfo
|
||||||
|
|
||||||
// Wrapper for SHDefExtractIcon().
|
// Wrapper for SHDefExtractIcon().
|
||||||
|
|
@ -200,7 +177,6 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id,
|
||||||
: wxArtProvider::GetNativeSizeHint(client);
|
: wxArtProvider::GetNativeSizeHint(client);
|
||||||
|
|
||||||
#ifdef wxHAS_SHGetStockIconInfo
|
#ifdef wxHAS_SHGetStockIconInfo
|
||||||
// first try to use SHGetStockIconInfo, available only on Vista and higher
|
|
||||||
SHSTOCKICONID stockIconId = MSWGetStockIconIdForArtProviderId( id );
|
SHSTOCKICONID stockIconId = MSWGetStockIconIdForArtProviderId( id );
|
||||||
if ( stockIconId != SIID_INVALID )
|
if ( stockIconId != SIID_INVALID )
|
||||||
{
|
{
|
||||||
|
|
@ -208,7 +184,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id,
|
||||||
|
|
||||||
UINT uFlags = SHGSI_ICONLOCATION | SHGSI_SYSICONINDEX;
|
UINT uFlags = SHGSI_ICONLOCATION | SHGSI_SYSICONINDEX;
|
||||||
|
|
||||||
HRESULT res = MSW_SHGetStockIconInfo(stockIconId, uFlags, &sii);
|
HRESULT res = ::SHGetStockIconInfo(stockIconId, uFlags, &sii);
|
||||||
if ( res == S_OK )
|
if ( res == S_OK )
|
||||||
{
|
{
|
||||||
bitmap = MSWGetBitmapFromIconLocation(sii.szPath, sii.iIcon,
|
bitmap = MSWGetBitmapFromIconLocation(sii.szPath, sii.iIcon,
|
||||||
|
|
|
||||||
|
|
@ -461,13 +461,9 @@ bool wxButton::DoGetAuthNeeded() const
|
||||||
|
|
||||||
void wxButton::DoSetAuthNeeded(bool show)
|
void wxButton::DoSetAuthNeeded(bool show)
|
||||||
{
|
{
|
||||||
// show/hide UAC symbol on Windows Vista and later
|
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_6 )
|
|
||||||
{
|
|
||||||
m_authNeeded = show;
|
m_authNeeded = show;
|
||||||
::SendMessage(GetHwnd(), BCM_SETSHIELD, 0, show);
|
::SendMessage(GetHwnd(), BCM_SETSHIELD, 0, show);
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_BUTTON
|
#endif // wxUSE_BUTTON
|
||||||
|
|
|
||||||
|
|
@ -178,14 +178,6 @@ wxCalendarCtrl::HitTest(const wxPoint& pos,
|
||||||
{
|
{
|
||||||
WinStruct<MCHITTESTINFO> hti;
|
WinStruct<MCHITTESTINFO> hti;
|
||||||
|
|
||||||
// Vista and later SDKs add a few extra fields to MCHITTESTINFO which are
|
|
||||||
// not supported by the previous versions, as we don't use them anyhow we
|
|
||||||
// should pretend that we always use the old struct format to make the call
|
|
||||||
// below work on pre-Vista systems (see #11057)
|
|
||||||
#ifdef MCHITTESTINFO_V1_SIZE
|
|
||||||
hti.cbSize = MCHITTESTINFO_V1_SIZE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hti.pt.x = pos.x;
|
hti.pt.x = pos.x;
|
||||||
hti.pt.y = pos.y;
|
hti.pt.y = pos.y;
|
||||||
switch ( MonthCal_HitTest(GetHwnd(), &hti) )
|
switch ( MonthCal_HitTest(GetHwnd(), &hti) )
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ bool wxComboCtrl::Create(wxWindow *parent,
|
||||||
name) )
|
name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista )
|
if ( wxUxThemeIsActive() )
|
||||||
m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;
|
m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;
|
||||||
|
|
||||||
if ( style & wxCC_STD_BUTTON )
|
if ( style & wxCC_STD_BUTTON )
|
||||||
|
|
@ -346,8 +346,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
if ( hTheme )
|
if ( hTheme )
|
||||||
{
|
{
|
||||||
const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
|
|
||||||
|
|
||||||
RECT rFull;
|
RECT rFull;
|
||||||
wxCopyRectToRECT(borderRect, rFull);
|
wxCopyRectToRECT(borderRect, rFull);
|
||||||
|
|
||||||
|
|
@ -368,10 +366,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
butState = CBXS_DISABLED;
|
butState = CBXS_DISABLED;
|
||||||
}
|
}
|
||||||
// Vista will display the drop-button as depressed always
|
|
||||||
// when the popup window is visilbe
|
|
||||||
else if ( (m_btnState & wxCONTROL_PRESSED) ||
|
else if ( (m_btnState & wxCONTROL_PRESSED) ||
|
||||||
(useVistaComboBox && !IsPopupWindowState(Hidden)) )
|
!IsPopupWindowState(Hidden) )
|
||||||
{
|
{
|
||||||
butState = CBXS_PRESSED;
|
butState = CBXS_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
@ -384,15 +380,13 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
butState = CBXS_NORMAL;
|
butState = CBXS_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int comboBoxPart = 0; // For XP, use the 'default' part
|
int comboBoxPart wxDUMMY_INITIALIZE(0);
|
||||||
RECT* rUseForBg = &rBorder;
|
RECT* rUseForBg = &rBorder;
|
||||||
|
|
||||||
bool drawFullButton = false;
|
bool drawFullButton = false;
|
||||||
int bgState = butState;
|
int bgState = butState;
|
||||||
const bool isFocused = (FindFocus() == GetMainWindowOfCompositeControl()) ? true : false;
|
const bool isFocused = (FindFocus() == GetMainWindowOfCompositeControl()) ? true : false;
|
||||||
|
|
||||||
if ( useVistaComboBox )
|
|
||||||
{
|
|
||||||
// Draw the entire control as a single button?
|
// Draw the entire control as a single button?
|
||||||
if ( !isNonStdButton )
|
if ( !isNonStdButton )
|
||||||
{
|
{
|
||||||
|
|
@ -418,7 +412,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
else
|
else
|
||||||
bgState = CBB_NORMAL;
|
bgState = CBB_NORMAL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw parent's background, if necessary
|
// Draw parent's background, if necessary
|
||||||
|
|
@ -455,8 +448,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
|
|
||||||
int butPart = CP_DROPDOWNBUTTON;
|
int butPart = CP_DROPDOWNBUTTON;
|
||||||
|
|
||||||
if ( useVistaComboBox )
|
|
||||||
{
|
|
||||||
if ( drawFullButton )
|
if ( drawFullButton )
|
||||||
{
|
{
|
||||||
// We need to alter the button style slightly before
|
// We need to alter the button style slightly before
|
||||||
|
|
@ -471,11 +462,9 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||||
else
|
else
|
||||||
butPart = CP_DROPDOWNBUTTONLEFT;
|
butPart = CP_DROPDOWNBUTTONLEFT;
|
||||||
|
|
||||||
}
|
|
||||||
::DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, nullptr );
|
::DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, nullptr );
|
||||||
}
|
}
|
||||||
else if ( useVistaComboBox &&
|
else if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE )
|
||||||
(m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE) )
|
|
||||||
{
|
{
|
||||||
// We'll do this, because DrawThemeParentBackground
|
// We'll do this, because DrawThemeParentBackground
|
||||||
// doesn't seem to be reliable on Vista.
|
// doesn't seem to be reliable on Vista.
|
||||||
|
|
|
||||||
|
|
@ -760,24 +760,6 @@ void wxComboBox::DoSetToolTip(wxToolTip *tip)
|
||||||
|
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
#if wxUSE_UXTHEME
|
|
||||||
|
|
||||||
bool wxComboBox::SetHint(const wxString& hintOrig)
|
|
||||||
{
|
|
||||||
wxString hint(hintOrig);
|
|
||||||
if ( wxUxThemeIsActive() )
|
|
||||||
{
|
|
||||||
// under XP (but not Vista) there is a bug in cue banners
|
|
||||||
// implementation for combobox edit control: the first character is
|
|
||||||
// partially chopped off, so prepend a space to make it fully visible
|
|
||||||
hint.insert(0, " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxTextEntry::SetHint(hint);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_UXTHEME
|
|
||||||
|
|
||||||
wxSize wxComboBox::DoGetSizeFromTextSize(int xlen, int ylen) const
|
wxSize wxComboBox::DoGetSizeFromTextSize(int xlen, int ylen) const
|
||||||
{
|
{
|
||||||
wxSize tsize( wxChoice::DoGetSizeFromTextSize(xlen, ylen) );
|
wxSize tsize( wxChoice::DoGetSizeFromTextSize(xlen, ylen) );
|
||||||
|
|
|
||||||
|
|
@ -101,17 +101,8 @@ void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
|
||||||
{
|
{
|
||||||
if ( dt.IsValid() )
|
if ( dt.IsValid() )
|
||||||
{
|
{
|
||||||
// Don't try setting the date if it's out of range: calendar control
|
// Don't try setting the date if it's out of range as we can't rely on
|
||||||
// under XP (and presumably all the other pre-Vista Windows versions)
|
// DateTime_SetSystemtime() always returning FALSE for it.
|
||||||
// doesn't return false from DateTime_SetSystemtime() in this case but
|
|
||||||
// doesn't actually change the date, so we can't update our m_date
|
|
||||||
// unconditionally and would need to check whether it was changed
|
|
||||||
// before doing it. It looks simpler to just check whether it's in
|
|
||||||
// range here instead.
|
|
||||||
//
|
|
||||||
// If we ever drop support for XP we could rely on the return value of
|
|
||||||
// DateTime_SetSystemtime() but this probably won't happen in near
|
|
||||||
// future.
|
|
||||||
wxDateTime dtStart, dtEnd;
|
wxDateTime dtStart, dtEnd;
|
||||||
GetRange(&dtStart, &dtEnd);
|
GetRange(&dtStart, &dtEnd);
|
||||||
if ( (dtStart.IsValid() && dt < dtStart) ||
|
if ( (dtStart.IsValid() && dt < dtStart) ||
|
||||||
|
|
|
||||||
|
|
@ -169,11 +169,8 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize size;
|
wxSize size;
|
||||||
|
|
||||||
// Use DTM_GETIDEALSIZE to ask the control itself to compute its ideal size.
|
// Use DTM_GETIDEALSIZE to ask the control itself to compute its ideal
|
||||||
SIZE idealSize = { 0, 0 };
|
// size, but we can't use it with DTS_SHOWNONE because handling of
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista )
|
|
||||||
{
|
|
||||||
// We can't use DTM_GETIDEALSIZE with DTS_SHOWNONE because handling of
|
|
||||||
// this flag is completely broken (up to at least Window 10 20H2): it's
|
// this flag is completely broken (up to at least Window 10 20H2): it's
|
||||||
// not just ignored, but we get completely wrong results when this flag
|
// not just ignored, but we get completely wrong results when this flag
|
||||||
// is on, e.g. the returned width is less than the width without it or
|
// is on, e.g. the returned width is less than the width without it or
|
||||||
|
|
@ -216,6 +213,7 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
||||||
// checking for the return value: even if all "real" MSW systems do support
|
// checking for the return value: even if all "real" MSW systems do support
|
||||||
// this message, Wine does not, even when it's configured to return Vista
|
// this message, Wine does not, even when it's configured to return Vista
|
||||||
// or later version to the application, and returns FALSE for it.
|
// or later version to the application, and returns FALSE for it.
|
||||||
|
SIZE idealSize = { 0, 0 };
|
||||||
if ( ::SendMessage(hwnd, DTM_GETIDEALSIZE, 0, (LPARAM)&idealSize) )
|
if ( ::SendMessage(hwnd, DTM_GETIDEALSIZE, 0, (LPARAM)&idealSize) )
|
||||||
{
|
{
|
||||||
size.x = idealSize.cx;
|
size.x = idealSize.cx;
|
||||||
|
|
@ -226,9 +224,8 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
::DestroyWindow(hwnd);
|
::DestroyWindow(hwnd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( !idealSize.cx ) // Compute the size ourselves.
|
if ( !size.x ) // Compute the size ourselves.
|
||||||
{
|
{
|
||||||
// Use the same native format as the underlying native control.
|
// Use the same native format as the underlying native control.
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
|
|
|
||||||
|
|
@ -151,19 +151,7 @@ int wxDirDialog::ShowModal()
|
||||||
// Use IFileDialog under new enough Windows, it's more user-friendly.
|
// Use IFileDialog under new enough Windows, it's more user-friendly.
|
||||||
int rc;
|
int rc;
|
||||||
#if wxUSE_IFILEOPENDIALOG
|
#if wxUSE_IFILEOPENDIALOG
|
||||||
// While the new dialog is available under Vista, it may return a wrong
|
|
||||||
// path there (see http://support.microsoft.com/kb/969885/en-us), so we
|
|
||||||
// don't use it there by default. We could improve the version test to
|
|
||||||
// allow its use if the comdlg32.dll version is greater than 6.0.6002.22125
|
|
||||||
// as this means that the hotfix correcting this bug is installed.
|
|
||||||
if ( wxGetWinVersion() > wxWinVersion_Vista )
|
|
||||||
{
|
|
||||||
rc = ShowIFileOpenDialog(hWndParent);
|
rc = ShowIFileOpenDialog(hWndParent);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rc = wxID_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( rc == wxID_NONE )
|
if ( rc == wxID_NONE )
|
||||||
#endif // wxUSE_IFILEOPENDIALOG
|
#endif // wxUSE_IFILEOPENDIALOG
|
||||||
|
|
@ -234,7 +222,7 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner)
|
||||||
return m_path.empty() ? wxID_CANCEL : wxID_OK;
|
return m_path.empty() ? wxID_CANCEL : wxID_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function for obtaining folder name on Vista and newer.
|
// Function for obtaining folder name using IFileDialog.
|
||||||
//
|
//
|
||||||
// Returns wxID_OK on success, wxID_CANCEL if cancelled by user or wxID_NONE if
|
// Returns wxID_OK on success, wxID_CANCEL if cancelled by user or wxID_NONE if
|
||||||
// an error occurred and we should fall back onto the old dialog.
|
// an error occurred and we should fall back onto the old dialog.
|
||||||
|
|
@ -356,36 +344,6 @@ HRESULT InitShellItemFromPath(wxCOMPtr<IShellItem>& item, const wxString& path)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// We need to link SHCreateItemFromParsingName() dynamically as it's
|
|
||||||
// not available on pre-Vista systems.
|
|
||||||
typedef HRESULT
|
|
||||||
(WINAPI *SHCreateItemFromParsingName_t)(PCWSTR,
|
|
||||||
IBindCtx*,
|
|
||||||
REFIID,
|
|
||||||
void**);
|
|
||||||
|
|
||||||
static SHCreateItemFromParsingName_t
|
|
||||||
s_pfnSHCreateItemFromParsingName = (SHCreateItemFromParsingName_t)-1;
|
|
||||||
if ( s_pfnSHCreateItemFromParsingName == (SHCreateItemFromParsingName_t)-1 )
|
|
||||||
{
|
|
||||||
wxDynamicLibrary dllShell32;
|
|
||||||
if ( dllShell32.Load(wxS("shell32.dll"), wxDL_VERBATIM | wxDL_QUIET) )
|
|
||||||
{
|
|
||||||
wxDL_INIT_FUNC(s_pfn, SHCreateItemFromParsingName, dllShell32);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !s_pfnSHCreateItemFromParsingName )
|
|
||||||
{
|
|
||||||
wxLogLastError(wxS("SHCreateItemFromParsingName() not found"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !s_pfnSHCreateItemFromParsingName )
|
|
||||||
{
|
|
||||||
// There is nothing we can do and the error was already reported.
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SHCreateItemFromParsingName() doesn't support slashes, so if the path
|
// SHCreateItemFromParsingName() doesn't support slashes, so if the path
|
||||||
// uses them, replace them with the backslashes.
|
// uses them, replace them with the backslashes.
|
||||||
wxString pathBS;
|
wxString pathBS;
|
||||||
|
|
@ -402,7 +360,7 @@ HRESULT InitShellItemFromPath(wxCOMPtr<IShellItem>& item, const wxString& path)
|
||||||
pathWithoutSlashes = &path;
|
pathWithoutSlashes = &path;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = s_pfnSHCreateItemFromParsingName
|
hr = ::SHCreateItemFromParsingName
|
||||||
(
|
(
|
||||||
pathWithoutSlashes->wc_str(),
|
pathWithoutSlashes->wc_str(),
|
||||||
nullptr,
|
nullptr,
|
||||||
|
|
|
||||||
|
|
@ -236,47 +236,11 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()
|
||||||
// Getting the module from an address inside it
|
// Getting the module from an address inside it
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
// Tries to dynamically load GetModuleHandleEx() from kernel32.dll and call it
|
|
||||||
// to get the module handle from the given address. Returns nullptr if it fails to
|
|
||||||
// either resolve the function (which can only happen on pre-Vista systems
|
|
||||||
// normally) or if the function itself failed.
|
|
||||||
HMODULE CallGetModuleHandleEx(const void* addr)
|
|
||||||
{
|
|
||||||
typedef BOOL (WINAPI *GetModuleHandleEx_t)(DWORD, LPCTSTR, HMODULE *);
|
|
||||||
static const GetModuleHandleEx_t INVALID_FUNC_PTR = (GetModuleHandleEx_t)-1;
|
|
||||||
|
|
||||||
static GetModuleHandleEx_t s_pfnGetModuleHandleEx = INVALID_FUNC_PTR;
|
|
||||||
if ( s_pfnGetModuleHandleEx == INVALID_FUNC_PTR )
|
|
||||||
{
|
|
||||||
wxDynamicLibrary dll(wxT("kernel32.dll"), wxDL_VERBATIM);
|
|
||||||
|
|
||||||
wxDL_INIT_FUNC_AW(s_pfn, GetModuleHandleEx, dll);
|
|
||||||
|
|
||||||
// dll object can be destroyed, kernel32.dll won't be unloaded anyhow
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !s_pfnGetModuleHandleEx )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// flags are GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
|
|
||||||
// GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
|
||||||
HMODULE hmod;
|
|
||||||
if ( !s_pfnGetModuleHandleEx(6, (LPCTSTR)addr, &hmod) )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return hmod;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path)
|
void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path)
|
||||||
{
|
{
|
||||||
HMODULE hmod = CallGetModuleHandleEx(addr);
|
HMODULE hmod;
|
||||||
if ( !hmod )
|
if ( !::GetModuleHandleEx(0, (LPCTSTR)addr, &hmod) || !hmod )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("GetModuleHandleEx"));
|
wxLogLastError(wxT("GetModuleHandleEx"));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -312,9 +276,11 @@ WXHMODULE wxDynamicLibrary::MSWGetModuleHandle(const wxString& name, void *addr)
|
||||||
// because the former works correctly for comctl32.dll while the latter
|
// because the former works correctly for comctl32.dll while the latter
|
||||||
// returns nullptr when comctl32.dll version 6 is used under XP (note that
|
// returns nullptr when comctl32.dll version 6 is used under XP (note that
|
||||||
// GetModuleHandleEx() is only available under XP and later, coincidence?)
|
// GetModuleHandleEx() is only available under XP and later, coincidence?)
|
||||||
HMODULE hmod = CallGetModuleHandleEx(addr);
|
HMODULE hmod;
|
||||||
|
if ( !addr || !::GetModuleHandleEx(0, (LPCTSTR)addr, &hmod) || !hmod )
|
||||||
|
hmod = ::GetModuleHandle(name.t_str());
|
||||||
|
|
||||||
return hmod ? hmod : ::GetModuleHandle(name.t_str());
|
return hmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_DYNLIB_CLASS
|
#endif // wxUSE_DYNLIB_CLASS
|
||||||
|
|
|
||||||
|
|
@ -150,9 +150,7 @@ void wxHyperlinkCtrl::SetLabel(const wxString &label)
|
||||||
|
|
||||||
wxSize wxHyperlinkCtrl::DoGetBestClientSize() const
|
wxSize wxHyperlinkCtrl::DoGetBestClientSize() const
|
||||||
{
|
{
|
||||||
// LM_GETIDEALSIZE only exists under Vista so use the generic version even
|
if ( !HasNativeHyperlinkCtrl() )
|
||||||
// when using the native control under XP
|
|
||||||
if ( !HasNativeHyperlinkCtrl() || (wxGetWinVersion() < wxWinVersion_6) )
|
|
||||||
return wxGenericHyperlinkCtrl::DoGetBestClientSize();
|
return wxGenericHyperlinkCtrl::DoGetBestClientSize();
|
||||||
|
|
||||||
SIZE idealSize;
|
SIZE idealSize;
|
||||||
|
|
|
||||||
|
|
@ -2343,17 +2343,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HDN_GETDISPINFOW:
|
|
||||||
// letting Windows XP handle this message results in mysterious
|
|
||||||
// crashes in comctl32.dll seemingly because of bad message
|
|
||||||
// parameters
|
|
||||||
//
|
|
||||||
// I have no idea what is the real cause of the bug (which is,
|
|
||||||
// just to make things interesting, impossible to reproduce
|
|
||||||
// reliably) but ignoring all these messages does fix it and
|
|
||||||
// doesn't seem to have any negative consequences
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case NM_CUSTOMDRAW:
|
case NM_CUSTOMDRAW:
|
||||||
if ( m_headerCustomDraw )
|
if ( m_headerCustomDraw )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,6 @@ public:
|
||||||
enum MenuLayoutType
|
enum MenuLayoutType
|
||||||
{
|
{
|
||||||
FullTheme, // full menu themes (Vista or new)
|
FullTheme, // full menu themes (Vista or new)
|
||||||
PseudoTheme, // pseudo menu themes (on XP)
|
|
||||||
Classic
|
Classic
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -293,13 +292,7 @@ public:
|
||||||
MenuLayoutType menu = Classic;
|
MenuLayoutType menu = Classic;
|
||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
if ( wxUxThemeIsActive() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
|
||||||
static wxWinVersion ver = wxGetWinVersion();
|
|
||||||
if ( ver >= wxWinVersion_Vista )
|
|
||||||
menu = FullTheme;
|
menu = FullTheme;
|
||||||
else if ( ver == wxWinVersion_XP )
|
|
||||||
menu = PseudoTheme;
|
|
||||||
}
|
|
||||||
#endif // wxUSE_UXTHEME
|
#endif // wxUSE_UXTHEME
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
@ -678,7 +671,7 @@ wxBitmap wxMenuItem::GetBitmap(bool bChecked) const
|
||||||
{
|
{
|
||||||
wxBitmap bmp = GetBitmapFromBundle(bChecked ? m_bitmap : m_bmpUnchecked);
|
wxBitmap bmp = GetBitmapFromBundle(bChecked ? m_bitmap : m_bmpUnchecked);
|
||||||
#if wxUSE_IMAGE
|
#if wxUSE_IMAGE
|
||||||
if ( bmp.IsOk() && wxGetWinVersion() >= wxWinVersion_Vista)
|
if ( bmp.IsOk() )
|
||||||
{
|
{
|
||||||
// we must use PARGB DIB for the menu bitmaps so ensure that we do
|
// we must use PARGB DIB for the menu bitmaps so ensure that we do
|
||||||
if ( !bmp.HasAlpha() )
|
if ( !bmp.HasAlpha() )
|
||||||
|
|
@ -1296,33 +1289,9 @@ void wxMenuItem::GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& co
|
||||||
bool wxMenuItem::MSWMustUseOwnerDrawn()
|
bool wxMenuItem::MSWMustUseOwnerDrawn()
|
||||||
{
|
{
|
||||||
// we have to use owner drawn item if it has custom colours or font
|
// we have to use owner drawn item if it has custom colours or font
|
||||||
bool mustUseOwnerDrawn = GetTextColour().IsOk() ||
|
return GetTextColour().IsOk() ||
|
||||||
GetBackgroundColour().IsOk() ||
|
GetBackgroundColour().IsOk() ||
|
||||||
GetFont().IsOk();
|
GetFont().IsOk();
|
||||||
|
|
||||||
// Windows XP or earlier don't display menu bitmaps bigger than
|
|
||||||
// standard size correctly (they're truncated) nor can
|
|
||||||
// checked bitmaps use HBMMENU_CALLBACK, so we must use
|
|
||||||
// owner-drawn items to show them correctly there. OTOH Win7
|
|
||||||
// doesn't seem to have any problems with even very large bitmaps
|
|
||||||
// so don't use owner-drawn items unnecessarily there (Vista wasn't
|
|
||||||
// actually tested but I assume it works as 7 rather than as XP).
|
|
||||||
static const wxWinVersion winver = wxGetWinVersion();
|
|
||||||
if ( !mustUseOwnerDrawn && winver < wxWinVersion_Vista )
|
|
||||||
{
|
|
||||||
const wxBitmap& bmpUnchecked = GetBitmap(false),
|
|
||||||
bmpChecked = GetBitmap(true);
|
|
||||||
|
|
||||||
const wxWindow* win = m_parentMenu ? m_parentMenu->GetWindow() : nullptr;
|
|
||||||
if ( (bmpUnchecked.IsOk() && IsGreaterThanStdSize(bmpUnchecked, win)) ||
|
|
||||||
(bmpChecked.IsOk() && IsGreaterThanStdSize(bmpChecked, win)) ||
|
|
||||||
(bmpChecked.IsOk() && IsCheckable()) )
|
|
||||||
{
|
|
||||||
mustUseOwnerDrawn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mustUseOwnerDrawn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
|
|
@ -1330,24 +1299,6 @@ bool wxMenuItem::MSWMustUseOwnerDrawn()
|
||||||
// returns the HBITMAP to use in MENUITEMINFO
|
// returns the HBITMAP to use in MENUITEMINFO
|
||||||
HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const
|
HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const
|
||||||
{
|
{
|
||||||
// Under versions of Windows older than Vista we can't pass HBITMAP
|
|
||||||
// directly as hbmpItem for 2 reasons:
|
|
||||||
// 1. We can't draw it with transparency then (this is not
|
|
||||||
// very important now but would be with themed menu bg)
|
|
||||||
// 2. Worse, Windows inverts the bitmap for the selected
|
|
||||||
// item and this looks downright ugly
|
|
||||||
//
|
|
||||||
// So we prefer to instead draw it ourselves in MSWOnDrawItem() by using
|
|
||||||
// HBMMENU_CALLBACK for normal menu items when inserting it. And use
|
|
||||||
// nullptr for checkable menu items as hbmpChecked/hBmpUnchecked does not
|
|
||||||
// support HBMMENU_CALLBACK.
|
|
||||||
//
|
|
||||||
// However under Vista using HBMMENU_CALLBACK causes the entire menu to be
|
|
||||||
// drawn using the classic theme instead of the current one and it does
|
|
||||||
// handle transparency just fine so do use the real bitmap there
|
|
||||||
#if wxUSE_IMAGE
|
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista )
|
|
||||||
{
|
|
||||||
// We need to store the returned bitmap, so that its HBITMAP remains
|
// We need to store the returned bitmap, so that its HBITMAP remains
|
||||||
// valid for as long as it's used.
|
// valid for as long as it's used.
|
||||||
bool checked = (kind != Unchecked);
|
bool checked = (kind != Unchecked);
|
||||||
|
|
@ -1360,10 +1311,6 @@ HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const
|
||||||
}
|
}
|
||||||
//else: bitmap is not set
|
//else: bitmap is not set
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
#endif // wxUSE_IMAGE
|
|
||||||
|
|
||||||
return (kind == Normal) ? HBMMENU_CALLBACK : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMenuItem::MSGetMenuItemPos() const
|
int wxMenuItem::MSGetMenuItemPos() const
|
||||||
|
|
|
||||||
|
|
@ -277,12 +277,8 @@ wxString wxAssocQueryString(ASSOCSTR assoc,
|
||||||
if ( hr != S_OK )
|
if ( hr != S_OK )
|
||||||
{
|
{
|
||||||
// The only really expected error here is that no association is
|
// The only really expected error here is that no association is
|
||||||
// defined, anything else is not expected. The confusing thing is that
|
// defined, anything else is not expected.
|
||||||
// different errors are returned for this expected error under
|
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) )
|
||||||
// different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
|
|
||||||
// returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
|
|
||||||
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
|
|
||||||
hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
|
|
||||||
{
|
{
|
||||||
wxLogApiError("AssocQueryString", hr);
|
wxLogApiError("AssocQueryString", hr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -743,22 +743,9 @@ bool wxRegKey::DeleteSelf()
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
// deleting a key which doesn't exist is not considered an error
|
// deleting a key which doesn't exist is not considered an error
|
||||||
#if wxUSE_DYNLIB_CLASS
|
m_dwLastError = ::RegDeleteKeyEx((HKEY) m_hRootKey, m_strKey.t_str(),
|
||||||
wxDynamicLibrary dllAdvapi32(wxT("advapi32"));
|
|
||||||
// Minimum supported OS for RegDeleteKeyEx: Vista, XP Pro x64, Win Server 2008, Win Server 2003 SP1
|
|
||||||
typedef LONG (WINAPI *RegDeleteKeyEx_t)(HKEY, LPCTSTR, REGSAM, DWORD);
|
|
||||||
RegDeleteKeyEx_t wxDL_INIT_FUNC_AW(pfn, RegDeleteKeyEx, dllAdvapi32);
|
|
||||||
if (pfnRegDeleteKeyEx)
|
|
||||||
{
|
|
||||||
m_dwLastError = (*pfnRegDeleteKeyEx)((HKEY) m_hRootKey, m_strKey.t_str(),
|
|
||||||
GetMSWViewFlags(m_viewMode),
|
GetMSWViewFlags(m_viewMode),
|
||||||
wxRESERVED_PARAM);
|
wxRESERVED_PARAM);
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // wxUSE_DYNLIB_CLASS
|
|
||||||
{
|
|
||||||
m_dwLastError = RegDeleteKey((HKEY) m_hRootKey, m_strKey.t_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_dwLastError != ERROR_SUCCESS &&
|
if ( m_dwLastError != ERROR_SUCCESS &&
|
||||||
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
|
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
|
||||||
|
|
|
||||||
|
|
@ -38,30 +38,6 @@
|
||||||
#include "wx/msw/wrapcctl.h"
|
#include "wx/msw/wrapcctl.h"
|
||||||
#include "wx/dynlib.h"
|
#include "wx/dynlib.h"
|
||||||
|
|
||||||
// These Vista+ only types used by DrawThemeTextEx may not be available in older SDK headers
|
|
||||||
typedef int(__stdcall *WXDTT_CALLBACK_PROC)(HDC hdc, const wchar_t * pszText,
|
|
||||||
int cchText, RECT * prc, unsigned int dwFlags, WXLPARAM lParam);
|
|
||||||
|
|
||||||
typedef struct _WXDTTOPTS
|
|
||||||
{
|
|
||||||
DWORD dwSize;
|
|
||||||
DWORD dwFlags;
|
|
||||||
COLORREF crText;
|
|
||||||
COLORREF crBorder;
|
|
||||||
COLORREF crShadow;
|
|
||||||
int iTextShadowType;
|
|
||||||
POINT ptShadowOffset;
|
|
||||||
int iBorderSize;
|
|
||||||
int iFontPropId;
|
|
||||||
int iColorPropId;
|
|
||||||
int iStateId;
|
|
||||||
BOOL fApplyOverlay;
|
|
||||||
int iGlowSize;
|
|
||||||
WXDTT_CALLBACK_PROC pfnDrawTextCallback;
|
|
||||||
WXLPARAM lParam;
|
|
||||||
} WXDTTOPTS, *WXPDTTOPTS;
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// methods common to wxRendererMSW and wxRendererXP
|
// methods common to wxRendererMSW and wxRendererXP
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
@ -1048,31 +1024,11 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
|
|
||||||
const int itemState = GetListItemState(flags);
|
const int itemState = GetListItemState(flags);
|
||||||
|
|
||||||
typedef HRESULT(__stdcall *DrawThemeTextEx_t)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, const WXDTTOPTS *);
|
if ( ::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
||||||
typedef HRESULT(__stdcall *GetThemeTextExtent_t)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, RECT *);
|
|
||||||
|
|
||||||
static DrawThemeTextEx_t s_DrawThemeTextEx = nullptr;
|
|
||||||
static GetThemeTextExtent_t s_GetThemeTextExtent = nullptr;
|
|
||||||
static bool s_initDone = false;
|
|
||||||
|
|
||||||
if ( !s_initDone )
|
|
||||||
{
|
|
||||||
if (wxGetWinVersion() >= wxWinVersion_Vista)
|
|
||||||
{
|
|
||||||
wxLoadedDLL dllUxTheme(wxS("uxtheme.dll"));
|
|
||||||
wxDL_INIT_FUNC(s_, DrawThemeTextEx, dllUxTheme);
|
|
||||||
wxDL_INIT_FUNC(s_, GetThemeTextExtent, dllUxTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
s_initDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( s_DrawThemeTextEx && // Not available under XP
|
|
||||||
::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
|
||||||
{
|
{
|
||||||
RECT rc = ConvertToRECT(dc, rect);
|
RECT rc = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
WXDTTOPTS textOpts;
|
DTTOPTS textOpts;
|
||||||
textOpts.dwSize = sizeof(textOpts);
|
textOpts.dwSize = sizeof(textOpts);
|
||||||
textOpts.dwFlags = DTT_STATEID;
|
textOpts.dwFlags = DTT_STATEID;
|
||||||
textOpts.iStateId = itemState;
|
textOpts.iStateId = itemState;
|
||||||
|
|
@ -1119,8 +1075,6 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
*/
|
*/
|
||||||
bool useTopDrawing = false;
|
bool useTopDrawing = false;
|
||||||
|
|
||||||
if ( s_GetThemeTextExtent != nullptr )
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
Get the actual text extent using GetThemeTextExtent() and adjust
|
Get the actual text extent using GetThemeTextExtent() and adjust
|
||||||
drawing rect if needed.
|
drawing rect if needed.
|
||||||
|
|
@ -1129,7 +1083,7 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
and DTT_CALCRECT can also be used to get the text extent.
|
and DTT_CALCRECT can also be used to get the text extent.
|
||||||
This seems to always result in the exact same extent (checked
|
This seems to always result in the exact same extent (checked
|
||||||
with an assert) as using GetThemeTextExtent(), despite having
|
with an assert) as using GetThemeTextExtent(), despite having
|
||||||
an additional WXDTTOPTS argument for various effects.
|
an additional DTTOPTS argument for various effects.
|
||||||
Some effects have been tried (DTT_BORDERSIZE, DTT_SHADOWTYPE
|
Some effects have been tried (DTT_BORDERSIZE, DTT_SHADOWTYPE
|
||||||
and DTT_SHADOWOFFSET) and while rendered correctly with effects
|
and DTT_SHADOWOFFSET) and while rendered correctly with effects
|
||||||
the returned extent remains the same as without effects.
|
the returned extent remains the same as without effects.
|
||||||
|
|
@ -1155,7 +1109,7 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
something like {0, 0, LONG_MAX, LONG_MAX} ).
|
something like {0, 0, LONG_MAX, LONG_MAX} ).
|
||||||
*/
|
*/
|
||||||
RECT rcExtent;
|
RECT rcExtent;
|
||||||
HRESULT hr = s_GetThemeTextExtent(hTheme, dc.GetHDC(),
|
HRESULT hr = ::GetThemeTextExtent(hTheme, dc.GetHDC(),
|
||||||
LVP_LISTITEM, itemState, text.wchar_str(), -1,
|
LVP_LISTITEM, itemState, text.wchar_str(), -1,
|
||||||
defTextFlags, nullptr, &rcExtent);
|
defTextFlags, nullptr, &rcExtent);
|
||||||
if ( SUCCEEDED(hr) )
|
if ( SUCCEEDED(hr) )
|
||||||
|
|
@ -1211,7 +1165,6 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
rc.bottom -= heightDiff;
|
rc.bottom -= heightDiff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( !useTopDrawing )
|
if ( !useTopDrawing )
|
||||||
{
|
{
|
||||||
|
|
@ -1248,7 +1201,7 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_DrawThemeTextEx(hTheme, dc.GetHDC(), LVP_LISTITEM, itemState,
|
::DrawThemeTextEx(hTheme, dc.GetHDC(), LVP_LISTITEM, itemState,
|
||||||
drawText->wchar_str(), -1, textFlags, &rc, &textOpts);
|
drawText->wchar_str(), -1, textFlags, &rc, &textOpts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -285,24 +285,6 @@ WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPar
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nMsg == WM_UPDATEUISTATE )
|
|
||||||
{
|
|
||||||
// DefWindowProc() redraws just the static box text when it gets this
|
|
||||||
// message and it does it using the standard (blue in standard theme)
|
|
||||||
// colour and not our own label colour that we use in PaintForeground()
|
|
||||||
// resulting in the label mysteriously changing the colour when e.g.
|
|
||||||
// "Alt" is pressed anywhere in the window, see #12497.
|
|
||||||
//
|
|
||||||
// To avoid this we simply refresh the window forcing our own code
|
|
||||||
// redrawing the label in the correct colour to be called. This is
|
|
||||||
// inefficient but there doesn't seem to be anything else we can do.
|
|
||||||
//
|
|
||||||
// Notice that the problem is XP-specific and doesn't arise under later
|
|
||||||
// systems.
|
|
||||||
if ( m_hasFgCol && wxGetWinVersion() == wxWinVersion_XP )
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -573,17 +555,11 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&)
|
||||||
|
|
||||||
UINT drawTextFlags = DT_SINGLELINE | DT_VCENTER;
|
UINT drawTextFlags = DT_SINGLELINE | DT_VCENTER;
|
||||||
|
|
||||||
// determine the state of UI queues to draw the text correctly under XP
|
// determine the state of UI queues to draw the text correctly
|
||||||
// and later systems
|
if ( ::SendMessage(GetHwnd(), WM_QUERYUISTATE, 0, 0) & UISF_HIDEACCEL )
|
||||||
static const bool isXPorLater = wxGetWinVersion() >= wxWinVersion_XP;
|
|
||||||
if ( isXPorLater )
|
|
||||||
{
|
|
||||||
if ( ::SendMessage(GetHwnd(), WM_QUERYUISTATE, 0, 0) &
|
|
||||||
UISF_HIDEACCEL )
|
|
||||||
{
|
{
|
||||||
drawTextFlags |= DT_HIDEPREFIX;
|
drawTextFlags |= DT_HIDEPREFIX;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// now draw the text
|
// now draw the text
|
||||||
RECT rc2 = { x, 0, x + width, height };
|
RECT rc2 = { x, 0, x + width, height };
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
void wxSystemThemedControlBase::DoEnableSystemTheme(bool enable, wxWindow* window)
|
void wxSystemThemedControlBase::DoEnableSystemTheme(bool enable, wxWindow* window)
|
||||||
{
|
{
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista && wxUxThemeIsActive() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
// It's possible to call EnableSystemTheme(false) before creating the
|
// It's possible to call EnableSystemTheme(false) before creating the
|
||||||
// window, just don't do anything in this case.
|
// window, just don't do anything in this case.
|
||||||
|
|
|
||||||
|
|
@ -93,19 +93,10 @@ private:
|
||||||
// NotifyIconData: wrapper around NOTIFYICONDATA
|
// NotifyIconData: wrapper around NOTIFYICONDATA
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct NotifyIconData : public NOTIFYICONDATA
|
struct NotifyIconData : public WinStruct<NOTIFYICONDATA>
|
||||||
{
|
{
|
||||||
NotifyIconData(WXHWND hwnd)
|
NotifyIconData(WXHWND hwnd)
|
||||||
{
|
{
|
||||||
wxZeroMemory(*this);
|
|
||||||
|
|
||||||
// Since Vista there is a new member hBalloonIcon which will be used
|
|
||||||
// if a user specified icon is specified in ShowBalloon(). For XP
|
|
||||||
// use the old size
|
|
||||||
cbSize = wxPlatformInfo::Get().CheckOSVersion(6, 0)
|
|
||||||
? sizeof(NOTIFYICONDATA)
|
|
||||||
: NOTIFYICONDATA_V2_SIZE;
|
|
||||||
|
|
||||||
hWnd = (HWND) hwnd;
|
hWnd = (HWND) hwnd;
|
||||||
uCallbackMessage = gs_msgTaskbar;
|
uCallbackMessage = gs_msgTaskbar;
|
||||||
uFlags = NIF_MESSAGE;
|
uFlags = NIF_MESSAGE;
|
||||||
|
|
@ -257,8 +248,7 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
|
||||||
|
|
||||||
wxUnusedVar(icon); // It's only unused if not supported actually.
|
wxUnusedVar(icon); // It's only unused if not supported actually.
|
||||||
|
|
||||||
// User specified icon is only supported since Vista
|
if ( icon.IsOk() )
|
||||||
if ( icon.IsOk() && wxPlatformInfo::Get().CheckOSVersion(6, 0) )
|
|
||||||
{
|
{
|
||||||
m_balloonIcon = icon.GetIconFor(m_win);
|
m_balloonIcon = icon.GetIconFor(m_win);
|
||||||
notifyData.hBalloonIcon = GetHiconOf(m_balloonIcon);
|
notifyData.hBalloonIcon = GetHiconOf(m_balloonIcon);
|
||||||
|
|
|
||||||
|
|
@ -902,7 +902,7 @@ void wxTextCtrl::SetWindowStyleFlag(long style)
|
||||||
// XP but not other ones, and we have no way to determine it so be
|
// XP but not other ones, and we have no way to determine it so be
|
||||||
// conservative here) and only for plain EDIT controls (not RICH ones) and
|
// conservative here) and only for plain EDIT controls (not RICH ones) and
|
||||||
// we have to recreate the control to make it always work
|
// we have to recreate the control to make it always work
|
||||||
if ( IsRich() || wxGetWinVersion() < wxWinVersion_2003 )
|
if ( IsRich() )
|
||||||
{
|
{
|
||||||
const long alignMask = wxTE_LEFT | wxTE_CENTRE | wxTE_RIGHT;
|
const long alignMask = wxTE_LEFT | wxTE_CENTRE | wxTE_RIGHT;
|
||||||
if ( (style & alignMask) != (GetWindowStyle() & alignMask) )
|
if ( (style & alignMask) != (GetWindowStyle() & alignMask) )
|
||||||
|
|
|
||||||
|
|
@ -995,7 +995,7 @@ void wxTextEntry::ForceUpper()
|
||||||
|
|
||||||
bool wxTextEntry::SetHint(const wxString& hint)
|
bool wxTextEntry::SetHint(const wxString& hint)
|
||||||
{
|
{
|
||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista && wxUxThemeIsActive() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
// notice that this message always works with Unicode strings
|
// notice that this message always works with Unicode strings
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1547,32 +1547,12 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent,
|
||||||
tvIns.item.lParam = (LPARAM)param;
|
tvIns.item.lParam = (LPARAM)param;
|
||||||
tvIns.item.mask = mask;
|
tvIns.item.mask = mask;
|
||||||
|
|
||||||
// apparently some Windows versions (2000 and XP are reported to do this)
|
|
||||||
// sometimes don't refresh the tree after adding the first child and so we
|
|
||||||
// need this to make the "[+]" appear
|
|
||||||
//
|
|
||||||
// don't use this hack below for the children of hidden root nor for modern
|
|
||||||
// MSW versions as it would just unnecessarily slow down the item insertion
|
|
||||||
// at best
|
|
||||||
const bool refreshFirstChild =
|
|
||||||
(wxGetWinVersion() < wxWinVersion_Vista) &&
|
|
||||||
!IsHiddenRoot(parent) &&
|
|
||||||
!TreeView_GetChild(GetHwnd(), HITEM(parent));
|
|
||||||
|
|
||||||
HTREEITEM id = TreeView_InsertItem(GetHwnd(), &tvIns);
|
HTREEITEM id = TreeView_InsertItem(GetHwnd(), &tvIns);
|
||||||
if ( id == 0 )
|
if ( id == 0 )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("TreeView_InsertItem"));
|
wxLogLastError(wxT("TreeView_InsertItem"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( refreshFirstChild )
|
|
||||||
{
|
|
||||||
TVGetItemRectParam param2;
|
|
||||||
|
|
||||||
wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param2, FALSE);
|
|
||||||
::InvalidateRect(GetHwnd(), ¶m2.rect, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// associate the application tree item with Win32 tree item handle
|
// associate the application tree item with Win32 tree item handle
|
||||||
param->SetItem(id);
|
param->SetItem(id);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue