Commit Graph

6555 Commits

Author SHA1 Message Date
Vadim Zeitlin
aa2780b472 Set wxUSE_DPI_AWARE_MANIFEST=2 for all samples, not just toolbar
This is required for high resolution bitmaps support and it will be
needed in other samples too, so use it for all of them.

This probably will result in some problems due to remaining bugs with
high DPI support, but it should make them more noticeable and so should
help with finding and fixing them.
2021-10-20 16:19:41 +01:00
Vadim Zeitlin
b20552116c Allow wxBitmapBundle to specify its preferred bitmap size
Using bitmaps of preferred size avoids scaling and results in much
better appearance, so add methods allowing querying the bundle about the
bitmaps it supports and implement them in the various implementations.

This is not actually used anywhere yet, but will be soon.
2021-10-19 02:20:26 +01:00
Vadim Zeitlin
4e5d2d97e2 Allow using wxBitmapBundle for wxButton bitmaps
Take wxBitmapBundle in wxButton::SetBitmapLabel() and related functions
in order to be able to associate several bitmaps to be used in different
resolutions with the button, instead of just a single bitmap.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
e8a15050d2 Add missing references to wxSize parameters in wxBitmapBundle
Pass wxSize by const reference instead of "const" value.

Note that passing wxSize by value might be not such a bad thing,
actually, but we use const reference for it everywhere else, so do it
here as well for consistency (and the original intention was to do it
like this, missing "&" was just a typo subsequently propagated through
copy-pasting).

No real changes.
2021-10-16 15:56:40 +02:00
Vadim Zeitlin
fb4e188cea Add wxHAS_SVG feature test macro
This is more clear and future-proof than using wxHAS_RAW_BITMAP for
checking for SVG availability.
2021-10-05 16:12:01 +01:00
Vadim Zeitlin
0216654272 Make wxBitmapBundleImpl public and show how to use it
Show how a custom implementation of wxBitmapBundleImpl can be defined in
the toolbar sample.
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
ab619010bd Add FromSVG() overload taking const data
Passing non-const data is inconvenient and error-prone, as data can't be
used again after it was modified by Nano SVG, which resulted in the
button using SVG bitmap not working any longer in the toolbar sample
after recreating the toolbar.

So make it easier to do the right thing, while still keeping the
overload taking non-const data for the situations when avoiding an extra
copy is worth it.
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
ac02ae877f Add simple wxBitmapBundle::FromSVG() implementation using NanoSVG
Add nanosvg submodule and use it in the generic implementation of this
function.

This is incomplete yet and, notably, doesn't cache the rasterized
images, but already shows that using SVG images works (at least in the
toolbar sample).
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
043461077e Use wxBitmapBundle::GetDefaultSize() in the toolbar sample
This actually reverts the sample to the version in master, which used
wxBitmap::Get{Width,Height}(), but just replaces "w" and "h" variables
with a single "sizeBitmap" one.
2021-10-05 15:49:44 +01:00
Vadim Zeitlin
15e35a5e7c Document that FromDIP() is not needed with SetToolBitmapSize()
wxMSW wxToolBar adjusts the bitmap size to DPI automatically.
2021-10-05 15:49:44 +01:00
Vadim Zeitlin
24df75a27f Simplify frame construction in the toolbar sample
Also stop hard-coding (100, 100) position for it, there is no real need
for it and it's better to let the window be positioned automatically.

No real changes.
2021-10-05 15:49:44 +01:00
Vadim Zeitlin
9a578b9c8f Update bitmap size automatically on DPI change in wxMSW wxToolBar
Remove the now unnecessary wxEVT_DPI_CHANGED event handler in the
sample.
2021-10-05 15:49:44 +01:00
Vadim Zeitlin
b33df7360a Implement loading resource bundle from Windows resources
This allows to use resources defined in the .rc files under MSW instead
of embedding them in the program text as arrays.
2021-10-05 15:49:43 +01:00
Vadim Zeitlin
97f6c85d9b Add first version of wxBitmapBundle and use it in wxToolBar
This first version provides only a generic implementation of
wxBitmapBundle using a collection of bitmaps and only supports using it
in wxToolBar in wxMSW and wxGTK.

More methods of creating wxBitmapBundle will be provided later and more
functions taking wxBitmap will be changed to take wxBitmapBundle later
too and, of course, all the other ports will be updated to use the new
API too.
2021-10-05 15:49:43 +01:00
Vadim Zeitlin
7043963831 Add wxHAS_IMAGE_RESOURCES defined under MSW and Mac
Unlike the existing wxHAS_IMAGES_IN_RESOURCES constant defined only
under MSW, the new one is also defined under Mac and could be defined
for the other platforms/ports later (e.g. wxQt could probably support it
too).

It's unfortunate that two very similar constants are needed, but it
doesn't seem wise to change the meaning of the existing constant, as
this would change how the commonly used wxICON() and wxBITMAP() macros
behave and would break all our own samples that use them for their frame
icon but don't embed this icon into the bundle resources under Mac.

Do change the toolbar sample to use the new constant however, as this
one does include the bitmaps it uses in its bundle under Mac.
2021-09-22 23:24:32 +01:00
Vadim Zeitlin
19002a54ad Regenerate toolbar sample bitmaps in 32 and 64 pixel sizes
They're more appropriate than 16 and 32 pixels nowadays.

Also add SVG versions of the icons, from which these bitmaps were
created.
2021-09-21 23:45:09 +02:00
Vadim Zeitlin
47211fa520 Show how to use higher resolution toolbar bitmaps in high DPI
Update the toolbar sample to show how to use bigger images for the
toolbar in high DPI.
2021-09-15 21:15:19 +02:00
Vadim Zeitlin
d6f1f79cef Remove unnecessary calls to wxToolBar::SetToolBitmapSize()
This is unnecessary, just as an existing comment said, so don't bother
doing it.
2021-09-15 21:15:19 +02:00
Vadim Zeitlin
fe615bdeea Get rid of INIT_TOOL_BMP() macro in the toolbar sample
It isn't really useful any more now that all ports use wxBITMAP_PNG()
and just obfuscates the code.

No real changes.
2021-09-15 21:15:19 +02:00
Vadim Zeitlin
8a337fcdd9 Use PNG icons instead of BMP and XPM ones in the toolbar sample
Update the sample for the 21st century (with just a bit of delay) and
use PNGs under all platforms instead of using BMPs under MSW and XPMs
elsewhere.

Copy PNG icons from Tango, even if we already have almost of them in
art/tango because we plan to also use "2x" versions of them in this
sample soon.
2021-09-15 21:15:19 +02:00
Vadim Zeitlin
3840b0b1c4 Merge branch 'combo-non-text'
Allow using non-text control as main window of wxComboCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/2515
2021-09-11 14:03:02 +02:00
Iwbnwif Yiw
5ba2461fd1 Switch to using GSpell for wxTextCtrl proof checker in wxGTK
Use GSpell rather than GtkSpell because GSpell also allows to check
single line text controls.

Closes https://github.com/wxWidgets/wxWidgets/pull/2516
2021-09-11 14:02:13 +02:00
Vadim Zeitlin
573e4fa0ec Allow using custom main window in wxComboCtrl
Add wxComboCtrl::SetMainControl() which can be used to use some other
window instead of the default wxTextCtrl as the main window of the
combo control.

Update the sample and the documentation to show the new function.
2021-09-08 20:44:34 +02:00
Vadim Zeitlin
50493a920f Remove "fall through" comments from the samples
Use wxFALLTHROUGH when appropriate and just remove the useless "fall
through" comment from a "default" branch.

No real changes.
2021-09-07 19:24:30 +02:00
Blake Madden
1380b1914c Fix typos in sample comments
Closes https://github.com/wxWidgets/wxWidgets/pull/2513
2021-09-07 19:23:31 +02:00
Vadim Zeitlin
61340fcc82 Merge branch 'textctrl-spellcheck'
Add wxTextCtrl::EnableProofCheck() to use native spell checking support.

See https://github.com/wxWidgets/wxWidgets/pull/2473
2021-08-27 21:58:32 +02:00
Vadim Zeitlin
5216d97f08 Use arch suffix consistently in all directories names
For some reason, we used "vc_x64_lib" as the output directory for the
libraries, but "vc_mswu_x64" as the output directory for the samples.

Place the arch suffix, i.e. "_x64" part, always after the compiler
prefix (possibly including version), for consistency with both the
library output directories and with MSBuild project files, as
build/msw/wx_setup.props uses $(wxCompilerPrefix)$(wxArchSuffix)_...
as wxIntRootDir value.
2021-08-26 23:12:40 +02:00
Vadim Zeitlin
91ae4e2f8a Merge branch 'update-xcode-builds' of https://github.com/discnl/wxWidgets
Update Xcode projects to correspond to the latest makefiles and use ARM
architecture instead of i386.

See https://github.com/wxWidgets/wxWidgets/pull/2484
2021-08-26 15:53:16 +02:00
Vadim Zeitlin
e307945170 Merge branch 'ui-locale'
Add wxUILocale class providing functionality which can be implemented
portably for all major platforms, including macOS, and doesn't force
the change of the global C locale, unlike wxLocale.

See https://github.com/wxWidgets/wxWidgets/pull/2464
2021-08-26 15:49:57 +02:00
Vadim Zeitlin
c868088a49 Add MSVS 2019 solutions for the minimal sample and the tests
It seems inconsistent to have MSVS 2019 solution for the main library
itself, but only MSVS 2017 (and earlier) one(s) for the sample and the
tests, so add MSVS 2019 solution to them too.
2021-08-24 17:12:06 +02:00
Vadim Zeitlin
79fe43c22d Don't show message box in text sample unnecessarily
This is going to be just annoying on the platforms where spell checking
is not supported, so show the message inside the text control itself
rather than popping up a message box.

Also put a misspelled word in the control from the very beginning to
show that it is highlighted.
2021-08-23 14:18:38 +02:00
Vadim Zeitlin
2bb3083a93 Use wxTextProofOptions itself to enable or disable the checks
Remove a separate "bool enable" argument of EnableProofCheck() and use
wxTextProofOptions::IsSpellCheckingEnabled() to decide whether the
checks should be enabled or disabled.

Also remove wxTextProofOptions ctor and provide named static factory
functions for creating the objects of this class with clearly defined
meaning.
2021-08-23 14:18:19 +02:00
iwbnwif
472aec2d7e Add support for using native spell checking in wxTextCtrl
Add wxTextCtrl::EnableSpellCheck() and implement it for wxMSW and
wxGTK3.

Closes #17544.
2021-08-23 14:15:38 +02:00
Dimitri Schoolwerth
b4aaaeae1e Remove some stray settings from minimal sample's Xcode projects
Delete a few settings that are either undesired or already set through
Xcode configuration files.
2021-08-23 00:51:19 +02:00
Vadim Zeitlin
a90dd434f7 Remove misleading word from the listctrl sample log message
It was surprising to see "right double click" for a right click.
2021-08-23 00:21:21 +02:00
Vadim Zeitlin
9205209099 Demonstrate the thousands separator in internat sample too
Use a number > 1000 to show the difference between the locales.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
8373b14280 Add a wxGrid with numbers and dates to the internat sample
Show that the numbers and dates in wxGrid use the expected formats.
2021-08-20 23:37:28 +02:00
Vadim Zeitlin
b9cbe6770f Add wxUILocale with minimal functionality
Use it in the sample to show what (little) it can do right now.
2021-08-20 22:02:46 +02:00
Stefan Csomor
7501deb5fe removing erroneously readded plist files in last commit
841bc00f0c contained inadvertently the state before the harmonize plist PR was merged
2021-08-18 07:43:54 +02:00
Stefan Csomor
841bc00f0c setting font name when using SetFamily on macOS
fixes https://trac.wxwidgets.org/ticket/19210
2021-08-18 07:23:04 +02:00
Vadim Zeitlin
6f372ad18a Merge branch 'harmonize-info-plist'
Modernize and make consistent all the different Info.plist files in the
repository.

See https://github.com/wxWidgets/wxWidgets/pull/2466
2021-08-17 23:48:14 +02:00
Vadim Zeitlin
14d8548349 Merge branch 'misc-render-fixes' of https://github.com/discnl/wxWidgets
Fixes for rendering text with bottom/right alignment for wxMSW and not
only.

See https://github.com/wxWidgets/wxWidgets/pull/2446
2021-08-15 18:57:04 +02:00
Vadim Zeitlin
d7e102f766 Reuse Info.plist used by configure for CMake too
The CMake-specific file is almost identical to the file used by
configure now, so don't keep both of them when just one could do.
2021-08-15 18:39:34 +02:00
Vadim Zeitlin
a69af310ad Use CFBundleLocalizations in internant sample Info.plist only
Remove this bundle key from the generic Info.plist files as it's not
really useful there because none of our samples except "internat" is
localized.

So just add a special Info.plist for this sample and add values
corresponding to all the languages for which we have translations to its
CFBundleLocalizations.
2021-08-15 18:39:34 +02:00
Vadim Zeitlin
81c4fa449b Use CMake-compatible variable names in configure Info.plist files
This will allow reusing them for CMake as well, and is required in order
to be able to do it as CMake variables names are fixed.
2021-08-15 18:39:34 +02:00
Vadim Zeitlin
77ba012141 Add NSPrincipalClass to docview sample Info.plist
This is needed for high DPI support.
2021-08-15 16:56:24 +02:00
Vadim Zeitlin
1ca29b6721 Update copyright years in Info.plist files used by configure
Also update inc_year script to update them automatically the next time,
to prevent them from becoming 3 (for one, or 13 for the other one) years
out of date again.
2021-08-15 16:56:24 +02:00
Vadim Zeitlin
bb767e0ebc Remove apparently unused Info.plist in docview sample
Only Info.plist.in is used by configure and it doesn't hardcode the
version, so there is no need to update it there.
2021-08-15 16:56:24 +02:00
Vadim Zeitlin
fc3eedd2c3 Use the same DOCTYPE for CMake Info.plist as for the others
Copy DOCTYPE used in Xcode template.
2021-08-15 16:56:24 +02:00
Vadim Zeitlin
5965d08819 Remove obsolete keys from our Info.plist files
Don't use CFBundleSignature, it was only needed for Classic Mac OS
compatibility. Similarly, LSRequiresCarbon was used to distinguish the
"new" Carbon applications from the Classic ones and is not needed any
longer.

CSResourcesFileMapped might still be used, but it's just an optimization
and we don't need it and it's just a s gratuitous difference with the
template used by Xcode, so remove it too.
2021-08-15 16:56:24 +02:00