Commit Graph

6677 Commits

Author SHA1 Message Date
Vadim Zeitlin
4d163de84e Merge branch 'dc-content-scale-factor'
Add GetDPIScaleFactor() to wxDC and wxGraphicsContext to allow scaling
the coordinates and sizes depending on the DPI.

See #22314.
2022-04-19 00:28:09 +02:00
utelle
8ab635b451 Improve wxLocale backwards compatibility and enhance wxUILocale
Restore the old behaviour of wxLocale, which is supposed to use the
default locale and not the preferred language, which may not be the same
(see #22281).

Also apply the following fixes and improvements to wxUILocale:

- Add new GetSystemLocale() method.
- Change the MSW implementation to use the default locale instead of the
  preferred UI language for Windows versions below Windows 10.
- Change the Unix implementation to respect LANGUAGE environment
  variable and use it for determining the preferred UI languages.
- Use wxUILocale in wxTranslations to determine the preferred UI
  languages.
- Use wxUILocale during initialization of internat sample.

Closes #22281.

Closes #22318.
2022-04-17 18:04:21 +02:00
Vadim Zeitlin
a47382f95d Revert accidental changes to the samples
This reverts parts of 533958be10 (recreating Xcode project files with
new script, 2022-04-16) that seem to have been committed accidentally
and are now preventing CI builds from passing.
2022-04-16 15:33:05 +02:00
Stefan Csomor
533958be10 recreating Xcode project files with new script 2022-04-16 14:27:24 +02:00
Maarten Bent
48fe7725c4 Make the polygon page in the drawing sample DPI aware
Use wxDC::GetDPIScaleFactor to scale the coordinates.

Initialize wxGCDC with a wxWindow, so it can infer the scale from the window.
2022-04-16 01:11:34 +02:00
Maarten Bent
5bea1dc18a Fix static build using extended RTTI
Fix declaration of 'o' hides previous local declaration warnings.

Change two wxCONSTRUCTOR_5 definitions using wxBitmapBundle instead of
wxBitmap (this does not give build errors).

wxGenericCalendarCtrl is missing all XTI implementations, so just use
RTTI. And fix building the xti sample.

Note the shared build still fails due to WXDLLIMPEXP related issues.

Closes #22300.

Closes #22301.
2022-04-14 23:17:05 +02:00
Vadim Zeitlin
85daadd659 Merge branch 'cmake-improvements' of https://github.com/MaartenBent/wxWidgets
Use newer CMake PCH support instead of cotire and many other
improvements to CMake build system.

See #22295.
2022-04-13 15:56:09 +02:00
Maarten Bent
87465898f3 Fix unused variable warnings 2022-04-10 23:41:44 +02:00
DietmarSchwertberger
a6cc2c7238 Fix recent regression in grid sample
Changes of 3719ab3725 (Add support for rearranging wxGrid rows order
interactively, 2022-04-02) broke TabularGridFrame in the sample, fix it
by removing the duplicate call to wxSizer::Add().

See #22260.

Closes #22296.
2022-04-10 17:50:43 +02:00
Vadim Zeitlin
f84864dcca Merge branch 'master' of https://github.com/dghart/wxWidgets
Add a missing XPM to the xrc sample

The merge also rebakes the sample makefiles.

See #22270.
2022-04-07 17:42:05 +02:00
Vadim Zeitlin
19e3a47d98 Update version to 3.1.7 and rebake the makefiles
Make it possible to distinguish the latest master from 3.1.6 before
making any changes.

Closes #22282.
2022-04-07 17:40:13 +02:00
DietmarSchwertberger
3719ab3725 Add support for rearranging wxGrid rows order interactively
Add EnableDragRowMove() function and wxEVT_GRID_ROW_MOVE, similarly to
the existing column function and event.

Closes #22260.
2022-04-07 17:39:56 +02:00
dghart
cd43393654 Update xrcdemo.bkl
Add an xpm missed by commit 49fd3a22
2022-04-04 20:41:23 +00:00
Vadim Zeitlin
ce1d350f41 Add logging of context menu events to the widgets sample
Show when (and if) they are generated.
2022-03-30 01:07:38 +02:00
Vadim Zeitlin
70e119140c Merge branch 'win-transparency'
Improve shaped sample and its documentation.

See #22230.
2022-03-28 00:16:31 +01:00
utelle
6d6e5cde21 Enhance wxUILocale and wxLocaleIdent
Many improvements and fixes to wxUILocale:

- Add wxUILocale method for retrieving wxLocaleIdent identifier,
  localized names, layout direction.
- Add wxLocaleIdent attributes, getter, and setter for
  platform-dependent tags under Windows: extension, sort order.
- Modify method wxLocaleIdent::FromTag to support not only BCP 47-like
  tags, but also platform-dependent syntax.
- Modify method wxLocaleIdent::GetTag to allow specifying the tag type.
- Update internat sample to better show using wxUILocale.
- Update German and French message catalogs for internat sample (German
  fully translated, French msgIds only).
- Introduced wxUILocaleImplStdC under Windows, because locale "en-US" is
  not equivalent to the C locale.
- Adjust wxLocale class to restore previous wxUILocale in the
  destructor.
- Implement wxLocale::GetInfo method through wxUILocale methods.
- Removed LCID dependency in wxLocale.
- Move the implementation of some static wxUILocale methods from
  intl.cpp to uilocale.cpp.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #2615.
2022-03-28 01:11:40 +02:00
Vadim Zeitlin
9e5c8a8027 Respect bitmap content scale factor in wxMSW wxMemoryDC
Apply it manually because MSW doesn't do it automatically for us and
also adjust the font size in wxMemoryDC as the base class version only
does it for the device contexts associated with a window, but we also
need to do it when using a wxMemoryDC for a bitmap using scale factor
different from that of the main display.

As the result of these changes, contents drawn on wxMemoryDC, both
directly via its own methods, or via wxGraphicsContext (using either
GDI+ or Direct2D) created from it, it appears the same as in wxWindowDC
(e.g. wxPaintDC) created for a window using the same scale.

Closes #22130.

Closes #22234.
2022-03-28 01:03:07 +02:00
Vadim Zeitlin
0390951677 Fix forwarding of menu commands in the richtext sample
Fall back on the main rich text control if there is no currently focused
window, as the control itself never has focus when a menu is opened with
wxGTK/Wayland, i.e. none of the menu commands, such as wxID_COPY/CUT,
worked for it in this case.

Closes #22121.
2022-03-28 00:55:54 +02:00
Vadim Zeitlin
279af795ed Make transparency window in the shaped sample work under MSW
Still show transparent window even if IsTransparentBackgroundSupported()
returns false, just don't make their background transparent and only use
SetTransparent() in this case. In fact, don't try to use transparent
background style at all by default and add a separate menu item to do it
if wanted.

Also add a slider to allow changing opacity of the window.

Finally, make the window big enough in high DPI under MSW by using
FromDIP().
2022-03-25 01:46:24 +01:00
Vadim Zeitlin
49de73c10d Add example of wxEVT_DPI_CHANGED handler to the display sample
Just to allow testing that this event is received as expected.

See #19130.
2022-03-24 21:40:44 +01:00
Vadim Zeitlin
108108e54e Add wxArtProvider::Get[Native]DIPSizeHint()
Also add "wxWindow* win = NULL" argument to the existing functions to
convert from DIPs using the given window instead of the default DPI
scaling factor.

Closes #22022.
2022-03-24 21:35:26 +01:00
Andriy Byelikov
3900ece2ee Renormalize .vcxproj.filters files
This fixes the problem with inconsistent file formats in the repository
apparently introduced in e3535d6481 (Mark MSVS *.vcxproj.filters files
as using CR LF as well, 2021-11-24), which resulted in the files changed
by this commit (sometimes) appearing modified in new clones.

Closes #22214.
2022-03-23 13:57:52 +01:00
Vadim Zeitlin
3ec0697c04 Don't crash in toolbar sample if there is no toolbar
Using many menu commands after removing the toolbar could result in a
crash because they used the toolbar pointer without checking for its
validity.

Add wxEVT_UPDATE_UI handler disabling these commands to prevent this
from happening.

This required rearranging the menu item IDs to allow using a single
range for all of them.
2022-03-20 02:38:35 +01:00
Vadim Zeitlin
9b2f55833e Add wxPreferencesPage::GetIcon() returning wxBitmapBundle
Allow returning a wxBitmapBundle rather than an individual wxBitmap.

Also make GetLargeIcon() non-pure even in wxOSX, as it now doesn't need
to be overridden if GetIcon() is -- but don't make GetIcon() pure
virtual neither to allow the existing code overriding GetLargeIcon() to
keep working.

This incidentally fixes the icons for the standard pages under macOS
broken by 388d322b68 (carry changes to toolbar over to prefs on osx,
2021-09-28), which replaced return statements with assignments,
resulting in the icon being set to the last value assigned to it instead
of the correct one -- this commit restores the previous control flow in
wxStockPreferencesPage::GetLargeIcon() (now called GetIcon()).

Closes #22187.
2022-03-17 23:49:18 +01:00
PB
e5f195da33 Copy SVG files with samples
Add few recently added SVG files used for bitmap bundles in samples
also to bakefiles and CMakeLists.

Closes #22197.
2022-03-17 23:48:01 +01:00
Paul Cornett
7463d514bf Fix text drawing in caret sample with wxGTK3 and wxOSX
Don't use wxClientDC for drawing the text, just refresh the updated
character.

See #17820.
2022-03-10 16:18:20 +01:00
Vadim Zeitlin
3fa634677c Merge branch 'headercol-bmp-bundle'
Use wxBitmapBundle in wxHeaderColumn.

See #22137.
2022-03-04 03:37:37 +01:00
Alexander Koshelev
8f43e103e9 Use wxBitmapBundle in wxHeaderColumn in samples 2022-03-04 03:37:20 +01:00
Vadim Zeitlin
9a3d3156ab Merge branch 'better-bitmap-resize'
Use "nearest" algorithm for resizing bitmaps.

See #22152.
2022-02-27 22:44:50 +00:00
Jouk
e7096e85d2 Fix combo sample build without wxHAS_SVG
Just don't use bitmaps at all if SVG support is unavailable.

Closes #22161.
2022-02-25 18:32:24 +01:00
Lauri Nurmi
1ad25bdd5c Demonstrate how to interrupt closing an application
Add a menu item to the dialogs sample for simulating having unsaved
documents in the application. Then demonstrate how to do something
when the user attempts to close the application, e.g. show a dialog,
and possibly cancel closing.

This code was originally written for debugging some issue related to
closing an application, but besides that it serves as an example of a
very common pattern a lot of real world applications need in some form.

Mention the example in samples/dialogs in wxCloseEvent documentation
2022-02-25 00:37:58 +01:00
Vadim Zeitlin
ef22f4c3db Add wxSuffixDebug to MSVS properties file
This property expands to either (just) "d" (even in Unicode builds) or
nothing depending on whether we're building in debug or release and can
be used to construct the configuration-independent names for the third
party libraries, most of which use just this suffix and not wxSuffix,
which expands to "ud" in (Unicode) debug build.

This allows to use exactly the same link dependencies for both debug and
release configurations, as demonstrated by the updated minimal MSVS
project file, which is convenient when creating new projects not using
wxwidgets.props, as it allows to enter the dependencies just once and
use them for all build configurations instead of having to enter them
separately for the debug and the release ones.
2022-02-23 22:12:57 +00:00
Vadim Zeitlin
ce8bf736fa Allow using wxImage::Scale() for zooming in image sample
By default, continue to use wxDC::SetUserScale(), but allow also using
wxImage::Scale() with various parameters to compare how the results look
like.
2022-02-22 02:26:06 +00:00
Vadim Zeitlin
c227d10728 Add "Double zoom" command to the image sample image view window
Just a convenient way to go to 200% zoom instead of having to use "Zoom
in" command several times to get close to it.
2022-02-22 02:18:33 +00:00
Vadim Zeitlin
652d37ea61 Add "pressed" and "current" wxBitmapButton XRC properties
New names are consistent with the names of the preferred SetBitmapXXX()
functions.

Document them and show using one of them in the sample.
2022-02-20 18:06:09 +01:00
Alexander Koshelev
1278aae752 Use wxBitmapBundle in wxTaskBarIcon
Update the sample to use wxBitmapBundle too.

Closes #22138.
2022-02-19 21:44:27 +00:00
Paul Cornett
3aad506c5b Avoid some -Wfloat-conversion warnings 2022-02-13 18:11:55 -08:00
Vadim Zeitlin
c08c539d18 Merge branch 'ak_wizard' of https://github.com/kosh543/wxWidgets
Use wxBitmapBundle in wxWizard.

See #22124.
2022-02-13 00:30:26 +01:00
Vadim Zeitlin
9dc34611c7 Merge branch 'ak_htmllistbox' of https://github.com/kosh543/wxWidgets
Use wxBitmapBundle in wxHtmlWindow.

See #22123.
2022-02-13 00:29:39 +01:00
Alexander Koshelev
e6a8e8ccfb Use svg files in wizard sample 2022-02-11 18:04:56 +03:00
Alexander Koshelev
bbcaa7b9e0 Use wxBitmapBundle in html about sample 2022-02-11 16:47:47 +03:00
Alexander Koshelev
e5e93bba22 XRC sample: use wxBitmapBundle in wxBitmapComboBox 2022-02-09 14:43:14 +03:00
Alexander Koshelev
685e3af613 Use wxBitmapBundle in combo sample
Replace PNG files with SVG ones.

Closes #22103.
2022-02-08 20:54:05 +01:00
Tobias Taschner
d2a17b37c8 Rebake for static web view edge 2022-02-07 22:49:33 +01:00
Vadim Zeitlin
0dd31947b5 Merge branch 'statbmp-mask-fix'
Fix using bitmaps with masks in wxStaticBitmap and bitmap rescaling in
wxArtProvider.

See #22096.

Closes #22094.
2022-02-06 16:03:52 +01:00
Vadim Zeitlin
d860015d6d Merge branch 'bitmap-bundle-menu'
Use wxBitmapBundle for the menu items.

See #22087.
2022-02-06 16:03:32 +01:00
Tobias Taschner
0a7b3bb3cf Add wxTopLevelWindow::SetContentProtection()
This method allows to exclude a top level window from screen captures.
Windows 7 or newer is required and any macOS version is supported.
Other platforms are not implemented and will return false.

The display example has been extended to demo this ability.

Closes #22066.
2022-02-06 15:59:22 +01:00
Vadim Zeitlin
a34ddaa006 Use scalable icon in the menu sample
Replace the old XPM with a call to wxArtProvider::GetBitmapBundle(),
which looks well even in high DPI.

Also add an item to a popup menu for testing.
2022-02-05 20:53:36 +01:00
Vadim Zeitlin
52bff00b19 Add accelerators to artprov sample menu entries
Allow testing various things more quickly.
2022-02-05 17:53:29 +00:00
Vadim Zeitlin
2b72d94af0 Fix using dangling pointer in artprov sample
Don't cast wxString pointer to const char*, this could never work and
didn't crash only by some miracle.
2022-02-05 17:53:29 +00:00