Merge branch 'improve-manifest-docs'

Improve manifest docs.

See #23123.
This commit is contained in:
Vadim Zeitlin 2023-01-13 16:02:26 +00:00
commit 804a82df8c
6 changed files with 57 additions and 41 deletions

View file

@ -233,4 +233,4 @@ If you use another IDE, under Unix you should run `wx-config --cxxflags` and
`wx-config --libs` commands separately and copy-and-paste their output to the
"Additional preprocessor options" and "Additional linker options" fields in
your IDE, respectively. Under MSW systems you need to configure the IDE using
the instructions in the ["manual setup"](@ref msw_build_apps) section.
the instructions in the [manual setup](@ref msw_build_apps) section.

View file

@ -41,7 +41,7 @@
<ul>
<li>Readme:
<a href="readme.txt"><b>General ReadMe</b></a>,
<a href="msw/readme.txt">wxMSW</a> (<a href="msw/winxp.txt">wxMSW for WinXP</a>),
<a href="msw/readme.txt">wxMSW</a>,
<a href="gtk/readme.txt">wxGTK</a>,
<a href="osx/readme.txt">wxOSX</a>,
<a href="qt/readme.txt">wxQt</a>

View file

@ -245,14 +245,13 @@ executed from a DOS command line window (cmd.exe, *not* Bash sh.exe).
Make Parameters {#msw_build_make_params}
================================================================
----------------------------------------------------------------
NOTE: If you use configure to build the library with MinGW, the
contents of this section does not apply, just pass the arguments
to configure directly in this case.
Library configuration
----------------------------------------------------------------
### Library configuration
While it is never necessary to do it, you may want to change some of
the options in the `%%WXWIN%\include\wx\msw\setup.h` file before building
@ -265,8 +264,7 @@ build options for different configurations too if you edit any
configuration-specific file.
Makefile parameters
----------------------------------------------------------------
### Makefile parameters
When building using makefiles, you can specify many build settings
(unlike when using the project files where you are limited to choosing
@ -478,12 +476,42 @@ instructions here are out of date, you can always simply copy a makefile or
project file from `$WXWIN\samples\minimal` or some other sample and adapt it to
your application.
If you are not using Visual Studio please see
@subpage plat_msw_winxp "Theme Support" to enable visual styles in your
application.
Using a Manifest {#msw_manifest}
----------------
All Windows applications should use a "manifest", which is a special kind of
Windows resource containing information about the application compatibility,
required, among else, for the application UI to look correctly instead
of looking very outdated and different from other native applications.
MSVS projects automatically generate the manifest and embed it into the final
executable by default, so you don't need to do anything special when using
them, however you need to ensure that a manifest specifying the use of the v6
of the Common Controls Library is included when using another compiler.
The most straightforward way to do this is to include one of the manifests
provided by wxWidgets in the `include\wx\msw\wx.rc` file. It is sufficient to
simply include it from your own `.rc` file in order to use a correct manifest
automatically.
To be precise, wxWidgets offers three manifests, differing only in which
DPI-awareness mode they use. Which of the three is used depends on the value of
`wxUSE_DPI_AWARE_MANIFEST` define. See [MSW Platform-Specific Build Issues](@ref high_dpi_platform_msw)
section of the High DPI overview for more information.
Note that the behaviour described above is customizable and you may define
`wxUSE_NO_MANIFEST` before including `wx/msw/wx.rc` to prevent including a
manifest if you prefer to embed it in some other way and so don't want to use
the wxWidgets-provided or, on the contrary, predefine `wxUSE_RC_MANIFEST=1` to
force using wxWidgets manifest even with MSVC, where it wouldn't be used by
default.
More information about application manifests in general is available at
https://learn.microsoft.com/en-us/windows/win32/controls/cookbook-overview#using-manifests-or-directives-to-ensure-that-visual-styles-can-be-applied-to-applications
Advanced Library Configurations {#msw_advanced}
===============================
-------------------------------
Build instructions to less common library configurations using different UI
backends are available here.

View file

@ -1,25 +0,0 @@
Microsoft Windows Theme Support from wxWidgets {#plat_msw_winxp}
-------------------------------------------
Windows XP introduced the themes (called "visual styles" in the Microsoft
documentation) which have been used since then for Win32 controls.
As wxWidgets uses the standard Windows controls for most of its
classes, it can take advantage of it without (almost) any effort from your part.
The only thing you need to do if you want your program to honour the visual style is to
add the manifest file to your program (this is not at all specific to
wxWidgets programs but is required for all Windows applications).
wxWidgets now includes manifest resources in wx.rc, so it should be enough to
include "wx/msw/wx.rc" in your application's resource file and you get
proper look automatically. Notice that MSVS automatically generates the manifest
and embeds it in the executables it produces. Therefore, wxWidgets by default doesn't
use its own manifest when using MSVC (i.e., wxUSE_RC_MANIFEST is not defined as 1).
If you don't want to use wxWidgets manifest with any compiler you may define wxUSE_NO_MANIFEST
as 1 prior to including wx/msw/wx.rc.
wxWidgets offers three manifests, differing only in which DPI-awareness mode they use.
Which of the three is used depends on the value of wxUSE_DPI_AWARE_MANIFEST define.
See more in @ref high_dpi_platform_msw "MSW Platform-Specific Build Issues" the High DPI guide.
More information about application manifests is available at
https://learn.microsoft.com/en-us/windows/win32/controls/cookbook-overview#using-manifests-or-directives-to-ensure-that-visual-styles-can-be-applied-to-applications

View file

@ -22,7 +22,7 @@ sample ICON "sample.ico"
// set this to 1 if you don't want to use manifest resource provided by wxWidgets.
// An aplication manifest is needed for the application UI to look properly and other
// things - see docs/msw/winxp.md for more information)
// things - see docs/msw/install.md for more information)
#define wxUSE_NO_MANIFEST 0
// to enable full High DPI suppport, we need to opt in into Per-Monitor (V2) DPI awareness,

View file

@ -783,12 +783,23 @@ wxApp::wxApp()
{
if ( GetComCtl32Version() < 610 )
{
// Check if we have wx resources in this program: this is not
// mandatory, but recommended and could be the simplest way to
// resolve the problem when not using MSVC.
wxString maybeNoResources;
if ( !::LoadIcon(wxGetInstance(), wxT("wxICON_AAA")) )
{
maybeNoResources = " (unless you don't include wx/msw/wx.rc "
"from your resource file intentionally, you should do it "
"and use the manifest defined in it)";
}
wxMessageBox
(
R"(WARNING!
wxString::Format(R"(WARNING!
This application doesn't use a correct manifest specifying
the use of Common Controls Library v6.
the use of Common Controls Library v6%s.
This is deprecated and won't be supported in the future
wxWidgets versions, however for now you can still set
@ -797,9 +808,11 @@ https://docs.wxwidgets.org/latest/classwx_system_options.html
for how to do it) to skip this check.
Please use the appropriate manifest when building the
application or contact us by posting to wx-dev@googlegroups.com
application as described at
https://docs.wxwidgets.org/latest/plat_msw_install.html#msw_manifest
or contact us by posting to wx-dev@googlegroups.com
if you believe not using the manifest should remain supported.
)",
)", maybeNoResources),
"wxWidgets Warning"
);
}