Commit Graph

20012 Commits

Author SHA1 Message Date
Paul Cornett
b401dfbdac Use wxOverlay::IsNative() rather than wxHAS_NATIVE_OVERLAY 2022-02-08 09:56:36 -08:00
Paul Cornett
38a7861391 Add wxOverlay::IsNative() method
This will replace the wxHAS_NATIVE_OVERLAY macro, allowing the determination
to be made at runtime. Ideally this should not be necessary, but it seems the
generic implementation may not always be good enough.
2022-02-08 09:34:07 -08:00
paulcor
0c1a66dc5d Use a common base class for wxOverlay implementations (#22107)
Use a common base class for wxOverlay implementations

This will allow for the possibility of choosing the implementation
dynamically at runtime.
2022-02-07 19:28:55 -08: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
Alexander Koshelev
d225b8d56c MSW: change wxBitmap to wxBitmapBundle in wxBitmapComboBox 2022-02-07 16:09:54 +03:00
Vadim Zeitlin
7d92f321c7 Add wxImageList::Init() to wxMSW version
Initialize all fields in a single place, just as it's done in most of
the other classes.

No real changes.
2022-02-06 22:53:57 +00: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
338cd95c2d Move GetBitmapFromBundle() to wxMenuItemBase
This is just a refactoring to avoid duplicating this function code in
all ports and just have it once in the base class.
2022-02-05 20:39:19 +01:00
Vadim Zeitlin
d745ff0a90 Remove wxMenuItem::GetBitmapBundle() from wxGTK
This function doesn't exist in the other ports and is not really needed
in this one neither, so just remove it for now.

If we really want to have it, we need to make it available everywhere.
2022-02-05 20:34:04 +01:00
Vadim Zeitlin
99948ffc1d Ensure that menu item HBITMAPs live for long enough
We must keep storing the currently used bitmap in wxMSW wxMenuItem to
ensure that its HBITMAP remains valid, as keeping wxBitmapBundle is not
enough: it may not preserve the bitmap at all (if it generates it on
demand, for example), and we may also use a different bitmap from what
we get from it (e.g. we convert mask to alpha).
2022-02-05 20:31:18 +01:00
Vadim Zeitlin
2b7e668221 Move bitmap resizing from wxDefaultArtProvider to base class
No real changes, this is just a refactoring in preparation for the next
commit.

This commit is best viewed with --color-moved git option.
2022-02-05 17:52:47 +00: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
Vadim Zeitlin
ff8e60caea Fix regression in selection change in wxOSX wxDataViewCtrl
The change of 8aae7ad937 (Fatal exception fixed in DVC on macOS while
wxDataViewModel::Cleared call + editing item., 2022-01-17) broke change
of selection when deleting an item from wxDataViewCtrl and the unit test
checking for this but, somehow, only when it was merged into the latest
master and not when it was originally done.

It's not really clear how did it work before, but fix this now by
distinguishing between just deleting some items and clearing everything
and only returning nil from -[wxCocoaOutlineDataSource
outlineView🧒ofItem:] in the latter case, but not the former one.

Also replace wxDataViewCtrl::m_Deleting boolean with an (opaque)
pointer, so that we could improve this further in the future without
breaking the ABI.

See #22025.
2022-02-04 17:12:40 +01:00
Alexander Koshelev
28d8ed37d6 wxBitmapBundle for wxMenuItem on GTK 2022-02-04 15:45:49 +03:00
Alexander Koshelev
337940f009 wxBitmapBundle for wxMenuItem on Mac 2022-02-04 15:45:49 +03: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
Vadim Zeitlin
c701a47176 Simplify code using wxDataViewCtrl::m_Deleting in wxOSX
Use a RAII-based helper class to reset this flag automatically on scope
exit instead of doing it manually.

This also ensures that we restore the original value rather than just
resetting it which would be more correct in the (admittedly, very
unlikely) case when any of the functions changing m_Deleting is called
recursively.
2022-02-04 02:27:27 +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
Vadim Zeitlin
0ea99046e1 Fix vetoing of wxEVT_SPLITTER_DOUBLECLICKED after recent changes
The change of semantics of DoSendEvent() broke the logic in
OnDoubleClickSash(), fix it now and remove DoSendEvent() entirely as
it became useless now that it doesn't test whether the event was vetoed
any more and the code is simpler without it.
2022-02-02 14:45:00 +01:00
Tobias Taschner
03efe56cf9 Allow WebView2 Edge updates without restart
The previous implementation initialized the version number only once.
This caused subsequent calls to wxWebView::GetBackendVersionInfo() to
return the same version number even if the runtime has been updated or
a fixed version runtime had been activated via
wxWebViewEdge::MSWSetBrowserExecutableDir().

This change allows to require a minimum runtime version and allow
a runtime update without requiring a restart of the application.

Closes #22076.
2022-02-01 23:15:18 +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
Tobias Taschner
f256e5ae59 Add additional wxBitmapBundle::FromSVG() overload
This overload can work on non 0 terminated unsigned char arrays.
Especially useful for headers created by bin2c.py
2022-02-01 09:46:48 +01:00
Vadim Zeitlin
ae7fa19ae3 Improve fallback logic in wxArtProvider::GetBitmap{,Bundle}()
This improves the changes of f78db92462 (Avoid bitmap scaling in
wxArtProvider::GetBitmapBundle(), 2021-12-17) and still uses a custom
bundle to avoid scaling the bitmap if possible, but does it in
GetBitmapBundle() itself rather than CreateBitmapBundle().

This allows to also use CreateBitmapBundle() from GetBitmap(), as there
is no possibility of infinite recursion due to calling each of these
functions from the other one any more, and so allows defining art
providers overriding only CreateBitmapBundle() instead of having to
always override both it and CreateBitmap().

Also add a unit test, even if just a trivial one, for these functions,
to at least check that they don't crash.
2022-01-31 22:53:13 +00:00
Gerhard Gruber
5da9d12272 Added an example how to use the new splitter resize event. 2022-01-31 18:20:28 +01:00
Artur Wieczorek
93365e02de Use more relevant macros in wxPropertyGrid 2022-01-30 12:06:27 +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
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
Vadim Zeitlin
28b84a1e96 Avoid gcc 12 -Warith-conversion in wxImageHistogram::MakeKey()
Explicitly convert the operands to unsigned because we do actually want
the result to be unsigned here.

Co-Authored-By: Scott Talbert <swt@techie.net>
2022-01-27 15:30:22 +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
Tobias Taschner
dd185a0b27 Fix timing issue with wxWebViewEdge::SetPage()
When SetPage() was called during the webview was still initializing
it would silently fail. This will now load the contents when the
webview is ready. Additionally error handling for the underlying
NavigateToString() has been added so it wont fail silently.

Closes #22052.
2022-01-27 14:11:19 +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
Vadim Zeitlin
224d8ffdaf Merge branch 'ak_high_dpi' of https://github.com/kosh543/wxWidgets
Add support for wxBitmapBundle to XRC.

See #22040.
2022-01-27 14:04:01 +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
Alexander Koshelev
df1504dd8f XRC: add GetBitmapBundle function
The function creates wxBitmapBundle from <bitmaps> xrc tag.

Co-authored-by: VZ <vz-github@zeitlins.org>
2022-01-24 17:26:42 +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
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