Commit Graph

4372 Commits

Author SHA1 Message Date
Vadim Zeitlin
3fa634677c Merge branch 'headercol-bmp-bundle'
Use wxBitmapBundle in wxHeaderColumn.

See #22137.
2022-03-04 03:37:37 +01:00
Alexander Koshelev
33d8510d41 Use wxBitmapBundle in wxHeaderColumn 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
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
84cb293e71 Make wxBitmap::Rescale() less horrible for commonly used icons
Make the results look somewhat better by using wxIMAGE_QUALITY_NEAREST
which preserves sharp horizontal and vertical edges in the images which
are common in the icons, with which this function is often used, instead
of blurring them as wxIMAGE_QUALITY_HIGH does.

This is also much (factor of ~40) faster, which shouldn't hurt neither.
2022-02-23 00:04:02 +00:00
Vadim Zeitlin
34facd225a Add wxXmlResourceHandler::GetBitmapBundle(wxXmlNode) overload
Do it for consistency with the existing GetBitmap() overload and also
because this can be useful when we need to test for the bitmap bundle
presence before using it.

Also document both the new overload and the original one, which was
mistakenly left undocumented when it was added.
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
Mehmet Soyturk
8aa5c55f61 Change wxRichTextParagraph::m_cachedLines data type to vector
Now wxRichTextParagraph::m_cachedLines is stored as a wxVector instead
of a wxList.

See #2523, closes #2577.
2022-02-17 01:20:01 +01:00
Blake-Madden
4c5f39426e Add example of using wxString::ToCDouble() to the documentation
Add an example showing the meaning of the return value.

Also, a couple other small edits.

Closes #22129.
2022-02-16 22:42:58 +00: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
Vadim Zeitlin
f0e6a8b15a Merge branch 'bitmap-scale-fixes'
Really fix setting wxBitmap scale factor in wxMSW and rename
wxBitmap::CreateWithLogicalSize() to CreateWithDIPSize().

See #22118.
2022-02-13 00:27:24 +01:00
Blake-Madden
ddf90dc3e0 Fix comment in example for banner window
Should say top edge, not left.

Closes #22122.
2022-02-11 18:48:03 +01:00
Vadim Zeitlin
74424cbeb2 Rename wxBitmap::CreateWithLogicalSize() to CreateWithDIPSize()
The new name, recently introduced in 94716fd801 (Add
wxBitmap::CreateWithLogicalSize(), 2022-01-22), was perhaps more clear,
but also misleading and confusing because the postcondition

	CreateWithLogicalSize(size, 2).GetLogicalSize() == size

was not satisfied under MSW, so rename it once again, and hopefully
finally, because the new name is consistent with GetDIPSize() returning
the same size.

Also try to improve the documentation a bit more.
2022-02-11 17:30:57 +00:00
Alexander Koshelev
429b5561ff Use wxBitmapBundle in wxWizard 2022-02-11 18:04:56 +03:00
Alexander Koshelev
7a2a1e9074 Use wxBitmapBundle in wxHtmlWindow 2022-02-11 16:16:45 +03:00
Vadim Zeitlin
25fec4aca9 Merge branch 'webview_edge_static' of https://github.com/TcT2k/wxWidgets
Allow usage of static loader with wxWebViewEdge.

See #22083.
2022-02-08 20:49:35 +01:00
Vadim Zeitlin
85853db83b Update wxAUI documentation after wxBitmapBundle transition
Change various occurrences of wxBitmap to wxBitmapBundle to reflect the
changes of 9a5123afed (Use wxBitmapBundle in wxAuiToolBar and
wxAuiPaneInfo too, 2021-11-14).

Closes #22106.
2022-02-08 20:40:55 +01:00
Tobias Taschner
57ebad4f7d Allow usage of static loader with wxWebViewEdge
Add a new build option wxUSE_WEBVIEW_EDGE_STATIC.
If it is set to 1 the WebView2 loader is static linked into the binary
and removes the runtime dependency on WebView2Loader.dll.
2022-02-07 22:49:33 +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
Alexander Koshelev
80bb72468c Use wxBitmapBundle in wxComboCtrl instead of wxBitmap
Replace wxBitmap with wxBitmapBundle in wxComboCtrl to make it show the
bitmap appropriate to the current DPI scaling.

Also add an event handler updating bitmaps on DPI change.

Closes #22032.
2022-02-05 16:11:14 +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
Blake-Madden
49c508c7a9 Fix typo in "By default" in the documentation
It was misspelt as "Bu default" in a couple of places.

Closes #22072.
2022-01-30 22:59:26 +01:00
Artur Wieczorek
7e4cd9f1c1 Get rid of unnecessary friend classes 2022-01-30 10:33:17 +01:00
Artur Wieczorek
bd784b3186 Refactor functions converting wxArrayString to string in wxArrayStringProperty::GenerateValueAsString()
Because ConvertArrayToString() and ArrayStringToString() produce string
values it would more intuitive to just to return this string as a function
value instead of passing it through the parameter.
2022-01-29 20:32:09 +01:00
Artur Wieczorek
6d318ad0e2 Refactor wxMultiChoiceProperty::GenerateValueAsString()
Because this function produces a string value it would more intuitive to
just to return this string as a function value instead of passing it
through the parameter.
2022-01-29 00:12:27 +01:00
Artur Wieczorek
3c87cc1e49 Get rid of unused member variable 2022-01-28 23:55:12 +01:00
Vadim Zeitlin
4cff1fce29 Merge branch 'unsigned-arith-conv'
Avoid arithmetic conversion warnings from gcc 12.

See #22063, #22057.
2022-01-27 23:40:03 +01:00
Jeinzi
d94dc0cab5 Add missing parenthesis to an example in wxTextCtrl docs
Closes #22062.
2022-01-27 17:07:15 +01:00
Vadim Zeitlin
37a4bf8693 Add wxColour::Get{Red,Green,Blue,Alpha}() to avoid gcc 12 warnings
These functions return the colour components as unsigned int and so
promote to this type in arithmetic expressions, unlike unsigned char
returned by the existing accessors without the "Get" prefix, which
promotes to (signed) int and results in gcc 12 -Warith-conversion
warnings when the result is then converted to unsigned, as it happened
in our own wxColour::GetRGB() and GetRGBA() functions and would probably
happen in a lot of code outside wx, which could also be updated to use
the new functions instead of inserting casts.
2022-01-27 15:46:42 +01:00
PB
5ba37d867c Support creating wxBitmapBundle from SVG in application resource
Allow creating wxBitmapBitmap from SVG image stored in an application
resource on the platforms where wxHAS_IMAGE_RESOURCES is defined.

On Windows, load the bundle from a resource with RT_RCDATA type and on
MacOS from a file with an extension "svg" placed in the "Resources"
subdirectory of the application bundle.

Closes #22061.
2022-01-27 14:39:35 +01:00
Alexander Koshelev
3f3561e2c6 Change inactive bitmap to in wxBitmapBundle wxAnimationCtrl 2022-01-27 14:29:25 +01:00
Alexander Koshelev
2b94729a33 Change wxBitmap to wxBitmapBundle in wxBannerWindow 2022-01-27 14:29:25 +01:00
Alexander Koshelev
85becc9362 Change wxBitmap to wxBitmapBundle in wxBitmapToggleButton 2022-01-27 14:29:25 +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
Gerhard Gruber
1533026945 Allow better control over splitter position on resize
Add an event which can be handled by the application to determine the
splitter position when the splitter window itself is resized.

This can be used to e.g. preserve the splitter at the given proportion
of the window (and not just in the middle, as it would be already
possible by using gravity 0.5).

Closes #22035.
2022-01-27 14:00:51 +01: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
3cc4ef5f77 Merge branch 'art-wx-logo'
Add wx logo art ID and use SVG to provide it in any size.

See #22046.
2022-01-23 17:29:22 +01:00
Vadim Zeitlin
22a3b4a8af Merge branch 'msw-icon-scale-factor'
Make scale factor-related functions available in wxIcon in wxMSW too.

See #22045.
2022-01-23 17:27:28 +01:00
Vadim Zeitlin
4cc3c5ee87 Merge branch 'bitmap-bundle-icon'
Add functions for wxIcon interoperability to wxBitmapBundle too.

See #22044.
2022-01-23 17:26:27 +01:00
Vadim Zeitlin
fc2b7e5266 Add wxBitmapBundle::GetIconFor()
This is to GetBitmapFor() as GetIcon() is to GetBitmap().
2022-01-23 16:04:50 +01:00
Vadim Zeitlin
84b5e4639e Add wxBitmapBundle::IsSameAs()
This is useful if only for compatibility with wxBitmap or wxIcon, that
have the same member function with the same semantics.
2022-01-23 16:04:50 +01:00
Vadim Zeitlin
fe2aba3b99 Add wxBitmapBundle::GetIcon()
This is just a convenient wrapper for GetBitmap() that will be useful in
the classes using wxIcon in their public API to preserve compatibility
after switching to using wxBitmapBundle instead of wxIcon internally.
2022-01-23 16:04:50 +01:00
Vadim Zeitlin
99445aa64c Document wxBitmapBundle::GetBitmap(wxDefaultSize) behaviour
The size parameter is explicitly allowed to be wxDefaultSize here,
meaning to return the bitmap in the default bundle size.
2022-01-23 16:04:50 +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
b4946c2fe3 Move scale factor-related functions to wxGDIImage from wxBitmap
This makes them available in wxIcon (and, less importantly, wxCursor)
too which is needed in order to use icons correctly in high DPI.

This is also more consistent with the other platforms, where wxIcon does
have these methods.

Document these methods in wxIcon now that they're available there under
all platforms and also document wxIcon::GetSize() which had been
available even before, but wasn't documented.
2022-01-23 01:59:59 +01:00
Vadim Zeitlin
94716fd801 Add wxBitmap::CreateWithLogicalSize()
The new function has a more clear name than CreateScaled() it replaces
and uses a more useful parameter order, with the scale factor, which
must always be specified when using it, coming before, and not after,
the depth, which almost never needs to be specified and so can be left
at its default value in 99% of cases.
2022-01-22 22:44:00 +00:00
Vadim Zeitlin
dad828da38 Use rounding in both wxWindow::FromPhys() and ToPhys()
It seems better to round, rather than truncate, in ToPhys(), for the
same reasons as in wxBitmap::CreateScaled() (see parent commit), and
then ceil() mustn't be used in FromPhys() neither, as this would break
round-tripping via both functions.

So, finally, keep the behaviour simple and, hopefully, the least
surprising, by just rounding the result in both functions.
2022-01-22 21:40:36 +00:00
Vadim Zeitlin
65bb454311 Add wxBitmap::GetLogical{Width,Height,Size}()
These functions have better names than the existing GetScaledXXX() ones,
so add them to be able to use them in the new code, even if we still
keep the old ones for compatibility.
2022-01-22 18:56:21 +00:00