Commit Graph

6658 Commits

Author SHA1 Message Date
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
Alexander Koshelev
27be2ed641 wxBitmapBundle for wxMenuItem on MSW 2022-02-04 15:45:49 +03:00
Vadim Zeitlin
bd86215843 Merge branch 'macos-dvc-isdeleting'
Fix crash in wxDataViewModel::Cleared() under Mac.

See #22025.
2022-02-04 02:28:55 +01:00
oneeyeman1
995c6e6df5 Add wxSpinCtrl::SetIncrement() and implement it for all ports
SetIncrement() was already available in wxSpinCtrlDouble and GTK version
of wxSpinCtrl, now implement support for it in wxMSW and wxOSX as well.

In fact, in wxMSW, implement it at wxSpinButton level, so that both this
class and wxSpinCtrl inheriting from it (in wxMSW only) support setting
custom increment now.

Also add support for it to XRC, show it in the sample and add a unit
test verifying that it works.

Closes #2597.
2022-02-04 02:16:06 +01:00
Vadim Zeitlin
e5e9794607 Merge branch 'SplitterResizeExample' of https://github.com/skeetor/wxWidgets
Add an example how to use the new splitter resize event and other minor
updates to the splitter sample and wxSplitterWindow itself.

See #22065.
2022-02-02 23:24:07 +01:00
Gerhard Gruber
9c28cda792 Updated sample to allow switching doubleclick on sash on or off. 2022-02-02 22:32:07 +01:00
Vadim Zeitlin
23c5cd3de1 Restore removed event.Skip() in the splitter sample
There doesn't seem to be any reason for removing this one, so restore it
and add the same explanatory comment as was added to the other handlers.
2022-02-02 14:26:22 +01:00
Tobias Taschner
73d37d460d Add tango art for refresh and stop
Use the added art IDs in webview sample
2022-02-01 09:50:32 +01:00
Gerhard Gruber
bfb5d32582 Fix bug in wxSplitterWindow not handling the event state correct in case of sash pos changing or resize. 2022-01-31 18:20:28 +01:00
Gerhard Gruber
5da9d12272 Added an example how to use the new splitter resize event. 2022-01-31 18:20:28 +01:00
PB
754f75c1cd Fix memory leaks in artprov sample
The list control used in the Resources Browser dialog had
dynamically allocated wxStrings assigned as item data that
were never freed.

Closes #22070.
2022-01-30 22:58:07 +01:00
Alexander Koshelev
b2629a97e5 Add wxBitmapBundle::GetPreferredLogicalSizeFor()
We often need the logical bitmap size when using it in size computations
involving window size, so add a function returning it directly to
wxBitmapBundle, similarly to wxBitmap::GetLogicalSize(), to avoid using
FromPhys() everywhere.

Also rename the existing wxBitmapBundle::GetPreferredSizeFor() to
GetPreferredBitmapSizeFor() to make it more clear that this is similar
to wxBitmap::GetSize() and so returns the size in physical units.

Closes #22056.
2022-01-27 14:29:25 +01:00
Vadim Zeitlin
311aa370de Merge branch 'dvc-bmpbundle'
Use wxBitmapBundle in wxDVC-related classes.

See #22051.
2022-01-27 14:10:29 +01:00
Ger Hobbelt
4902b8137b Improve startup time of the display sample under MSW
Performance tweak for samples/display, resulting in a much faster
application start, particularly when built in debug mode, when Windows
messages are dumped to the system debug channel for
inspection/diagnosis.

Speed up the Append() loop below by foregoing the repeated resizing of
the choice drop-down via repeated calls to GetBestSize() which happens
deep inside the Append() call chain and executes another inner loop
calling SendMessage() to get the control contents. (This exhibits
1/2*O(N^2) behaviour thanks to the linear growth of the length of the
inner loop to the length of the outer loop (= number of items to add),
while it is re-executed for every new added item.)

With the 'display' sample, that's about 500+ rounds and about 500*500/2
SendMessage() calls less now on my dev/test rig, taking noticeable time
to start the display application.

---

Issue was found due to the barrage of '(winmsg)' Windows Message debug
log lines zipping by in the monitor app when the sample was build in
Debug Mode. Only significant difference with the Release Build is those
debug lines being output, hence the performance gain is less, but still
measurable, in a Release build. When the machine is otherwise severely
loaded (UI render core maxing out), "measurable" becomes "obnoxiously
noticeable" again on Win10/64.

Closes #22049.
2022-01-27 14:08:33 +01:00
Alexander Koshelev
49fd3a227c XRC: ability to create wxStaticBitmap with wxBitmapBundle 2022-01-24 17:26:52 +03:00
Vadim Zeitlin
4073f3b9bf Use wxBitmapBundle in wxDataViewCtrl-related classes
Extend the existing use of wxIcon in wxDataViewIconText,
wxDataViewCheckIconText, the corresponding renderers and
wxDataViewTreeCtrl to wxBitmapBundle.

As with the other classes, the existing setters have been preserved as
they remain almost entirely compatible with the existing code and the
return type of the existing getters was preserved, with new getters
being introduced for returning wxBitmapBundle only where they're really
required.

Update the sample to use wxBitmapBundle with its wxDataViewTreeCtrl.
2022-01-23 21:55:30 +01:00
Vadim Zeitlin
90bbde8777 Fix "tall row" height in the dataview sample in high DPI
Add missing FromDIP() to ensure that the rows are really tall.
2022-01-23 17:29:43 +01:00
Vadim Zeitlin
2208f53ba3 Add wxART_WX_LOGO and use it in the webview sample
Embed SVG data of the wx logo into the library itself to make it
available to all wx programs, including the samples. This is a bit
wasteful, but <12KiB is not really noticeable compared to the library
size.
2022-01-23 15:40:04 +01:00
Vadim Zeitlin
2af0b12d26 Avoid assert on text sample startup under MSW
Use wxTE_RICH2 for a control that we call EnableProofCheck() on, as
using this function without this style asserts in wxMSW.

This should have been done in 5ba2461fd1 (Switch to using GSpell for
wxTextCtrl proof checker in wxGTK, 2021-09-08).
2022-01-20 00:13:16 +01:00
valid-ptr
0199a8ce49 dataview sample: Added test for wxDataViewModel::Cleared functionality: Ctrl-W will clear MyMusicTreeModel. Ctrl-W can be pressed while editing some item (artist is editable) 2022-01-18 17:03:41 +03:00