Commit Graph

4444 Commits

Author SHA1 Message Date
Robin Dunn
e6f2325f63 Add some missing wxBitmap --> wxBitmapBundle changes 2022-05-16 15:33:41 -07:00
Vadim Zeitlin
2ba9007d0e Add wxCHECK_CXX_STD() and use it to test for C++17 and C++20
Unlike direct tests of __cplusplus, using this macro also works with
(recent enough, i.e. MSVS 2015.3 or later) MSVC versions, even if
/Zc:__cplusplus is not used.

This simplifies some checks and makes some other ones (notably the check
for C++20 used before wxALLOW_COMBINING_ENUMS macro definition) work
with MSVC versions with C++20 support as intended.
2022-05-11 16:57:18 +01:00
Vadim Zeitlin
a7eee933c6 Merge branch 'tsan-warnings'
Fix a harmless warning from thread sanitizer and make wxAtomicInc() more
useful.

See #22417.
2022-05-11 02:37:26 +02:00
Vadim Zeitlin
bb52a5c5b5 Merge branch 'imaglist-mask'
Make handling of masks in wxImageList simpler and more useful.

See #22400.
2022-05-11 02:35:59 +02:00
Vadim Zeitlin
c036bdf3e5 Recommend using std::atomic instead of our functions
The standard class is much more flexible and type-safe.
2022-05-11 00:18:02 +02:00
Vadim Zeitlin
cf66ce5f94 Return the new value from wxAtomicInc() too
This is easy to do and can be useful when using an atomic initialization
counter.

The only platform where not returning the new value might be more
efficient than returning it is Solaris which is not really relevant any
more and on all the other platforms the functions we were already using
provided this value already (or almost, in case of using gcc builtins,
when we just have to use a different one).
2022-05-11 00:16:47 +02:00
Vadim Zeitlin
937fa42d10 Document that wxGetTimeZone() doesn't account for DST
This is intentional and won't be changed, although we could, perhaps,
add a wxGetDST() function or similar to make it easier to take DST into
account as well.

Closes #22399.
2022-05-08 16:18:29 +02:00
Vadim Zeitlin
0e544960b0 Fix example of creating wxUILocale in its documentation
There are several ways to do it, and it's not clear which one of them
should be illustrated here, but it should definitely be one that works.

Closes #22389.
2022-05-07 16:34:45 +02:00
Vadim Zeitlin
6feeed9fe9 Handle transparency to the best of our ability in wxImageList
Don't take the value of "mask" parameter of wxImageList constructor too
prescriptively, it predates support for alpha in wxWidgets by many years
and was never meant to actually suppress using it.

Instead, do the best thing we can in all cases, i.e. use alpha if it's
specified and supported and use mask otherwise. But only create the mask
from light grey colour if we have nothing else if "mask" is true in
wxImageList constructor, as this is a potentially destructive action
that must not be performed if the user has explicitly decided to set
this parameter to false.

Incidentally fix handling of alpha with comctl32.dll v5 (which is used
in the absence of any manifest) by converting it to a mask in this case:
this is not ideal, but better than just using black background as it
happened before, and restores pre-3.1.5 behaviour.

Also simplify the generic version which just has to create the default
mask if necessary and doesn't have to do anything at all in all the
other cases.

Note that these changes required relaxing some of the existing unit
tests as wxMSW implementation now can add alpha channel to the bitmaps
that didn't have it -- but this is a more useful behaviour, and so it
makes more sense to adapt the tests to it rather than doing a less
useful thing just to conform to the tests.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-spac options.

Closes #22349.
2022-05-06 02:12:54 +01:00
PB
68dee47694 Explain how to best use wxFrame as input form
Add information about the recommended way of using wxFrame
as a form, i.e., to not create the input controls as its
direct children but use wxPanel for this instead.

Closes #22395.
2022-05-05 17:32:43 +02:00
DietmarSchwertberger
ec737396d8 Unify wxGrid code for processing row and column mouse events
Reuse the same code for handling mouse events for both rows and columns
instead of duplicating almost (but not quite) the same code for both of
them.

As part of resolving the inconsistencies between the two versions, add
wxEVT_GRID_ROW_AUTO_SIZE corresponding to the existing event with the
same name for the columns.

Closes #22380.
2022-05-05 17:23:45 +02:00
Vadim Zeitlin
eb5ad7255c Merge branch 'shared-client-data'
Allow sharing client data in wxGrid-related classes.

See #22369.
2022-05-01 02:55:36 +02:00
Vadim Zeitlin
9a36e26d4a Merge remote-tracking branch 'MaartenBent/wxdc-dpi'
Make wxDC and wxGraphicsContext DPI aware, i.e. add {From,To}DIP() to
them too and make the values returned from Get{DPI,PPI}() consistent
with wxWindow.

Also improve CMake build: add support for finding Cairo when not using
GTK, fix a warning when creating the inplace-config, and mark some
variables as advanced.

See #22346.
2022-05-01 02:53:12 +02:00
Frode Roxrud Gill
f646e8b11c Allow cloning client data stored in wxGrid attributes etc
Add wxSharedClientDataContainer class storing ref-counted client data
and use it instead of plain wxClientDataContainer in wxGridCellAttr,
wxGridCellEditor and wxGridCellRenderer classes.

This allows to keep the same client data associated with many grid cells
without having to make many copies of it.
2022-04-28 00:28:58 +02:00
Vadim Zeitlin
05014523bc Merge branch 'document_missing_webview_event' of https://github.com/swt2c/wxWidgets
More documentation fixes: inconsistent or missing declarations.

See #22366.
2022-04-27 19:45:16 +02:00
Scott Talbert
1a531def4b Fix wxTextCtrl::OSXEnableNewLineReplacement documentation 2022-04-26 22:31:54 -04:00
Scott Talbert
db8eb640eb Document missing wxWebView events 2022-04-26 20:12:24 -04:00
Maarten Bent
6072d3aeee Add documentation for wxDC and wxGraphicsContext FromDIP and ToDIP
Remove documentation of removed function GetDPIScaleFactor.
2022-04-26 21:35:05 +02:00
Lauri Nurmi
e3bf759615 Add wxTRANSLATE_IN_CONTEXT() macro for marking strings for translation
Similarly to wxTRANSLATE(), this macro does not do much itself.
2022-04-24 11:30:31 +03:00
Uwe Runtemund
28f62b2e59 Add support for creating wxBitmapBundle from wxIconBundle
This is useful for converting existing code using wxIconBundle for
similar purposes to switch to using wxBitmapBundle instead.

Closes #22347.
2022-04-23 17:31:46 +02:00
Vadim Zeitlin
ac60d78d8d Merge branch 'toolbar-bitmap-size'
Make wxToolBar::SetToolBitmapSize() take size in logical pixels.

See #22338.
2022-04-21 21:24:46 +02:00
PB
8c9c6f5088 Fix examples in wxBitmapBundle documentation
Add the missing label parameter to AddTool() calls.

Closes #22345.
2022-04-21 21:21:51 +02:00
Scott Talbert
be106d3fed Document missing wxEVT_FULLSCREEN 2022-04-20 22:54:06 -04:00
Vadim Zeitlin
eb6506e677 Make wxToolBar::SetToolBitmapSize() take size in logical pixels
Previously it interpreted its argument as being in DIPs, which was
perhaps more convenient, but inconsistent with most of the other
functions and broke the general rule that FromDIP() should be used with
all hard-coded sizes.

Update the sample to use FromDIP() when calling it now, improve the
documentation and fix a bug in AdjustToolBitmapSize() which resulted in
not increasing the bitmap size when moving toolbar sample using "large"
toolbar size from a standard DPI display to a high DPI one: the old code
considered that the new size was the same as the old one and returned
before comparing it with m_requestedBitmapSize, which resulted in the
bitmaps not changing size at all instead of doubling their size as they
were expected to.
2022-04-19 23:36:02 +01:00
Scott Talbert
6fa4e1b912 Fix wxWebViewFactory::GetVersionInfo documentation 2022-04-18 23:25:13 -04:00
Scott Talbert
cfbf667513 Fix wxMenuItem::AddExtraAccel documentation 2022-04-18 22:36:55 -04:00
Uwe Runtemund
94f698cc15 Add functions for getting current ribbon tool rectangle
wxRibbonButtonBar::GetItemRect() and wxRibbonToolBar::GetActiveTool()
are helpful for positioning other windows (e.g. popup ones) that should
be aligned to tools and buttons in the ribbon bar.

Closes #22329.
2022-04-19 00:46:58 +02:00
Vadim Zeitlin
692073ea7d Merge branch 'fix_lc_removesortindicator_doc' of https://github.com/swt2c/wxWidgets
Fix a couple of wrong signatures in the documentation.

See #22326.
2022-04-19 00:40:40 +02:00
Vadim Zeitlin
bf3b653492 Merge branch 'auibook-help'
Fix infinite recursion when processing wxEVT_HELP for wxAuiNotebook
pages.

See #22323.

Closes #22309.
2022-04-19 00:38:39 +02:00
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
Vadim Zeitlin
e3bf5d6845 Document wxDC::GetContentScaleFactor() too
This function existed since a long time but somehow was never
documented.

Also minor improvements to the just added documentation of
wxDC::GetDPIScaleFactor().
2022-04-19 00:27:23 +02:00
Artur Wieczorek
b06b950574 Document changes in wxImageFileProperty
Remove references to the non-public member variables
from documentation.
2022-04-18 22:17:31 +02:00
Scott Talbert
19d3e2d902 Fix wxIcon::GetLogicalSize documentation 2022-04-17 23:41:46 -04:00
Scott Talbert
7a98e93bb4 Fix wxListCtrl::RemoveSortIndicator documentation 2022-04-17 22:27:29 -04: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
fac4822ab3 Make wxAuiNotebook::FindPage() work correctly
Make this function virtual in the base class so that it could be
overridden to do the right thing in wxAuiNotebook, instead of just
always returning NULL as before and add a unit test checking that it
works.

Explain that wxBookCtrlBase::m_pages may not be used in the derived
classes, but that in this case they must override all the methods using
it.

Finally, "soft-deprecate" wxAuiNotebook::GetPageIndex(), which is
identical to FindPage() now.

This fixes infinite recursion when handling wxEVT_HELP in wxAuiNotebook
in wxUniv too, see #22309.

Closes #15932.
2022-04-16 23:01:57 +01:00
Vadim Zeitlin
8afbf79d02 Take const pointer in wxAuiTabContainer::GetIdxFromWindow()
Allow passing const pointers to this function, as it doesn't need to
modify them at all.
2022-04-16 22:52:30 +01:00
PB
92deb92e29 Use doubled backslashes in examples in wxFileName documentation
Fix syntax of C strings in the examples.

Closes #22311.
2022-04-16 15:34:08 +02:00
Maarten Bent
5d40285226 Add GetDPIScaleFactor documentation for wxDC and wxGraphicsContext 2022-04-16 01:11:34 +02:00
Maarten Bent
9a255463f9 Fix wrong wxMenuItem::GetBitmap() return type documentation
This function returns wxBitmap by object, not by (const) reference since
wxBitmapBundle-related changes.

Also change signature of the other methods taking wxBitmapBundle instead
of wxBitmap now.

And some other minor improvements.

Closes #22306.
2022-04-14 23:22:41 +02:00
Vadim Zeitlin
24970061fa Add wxBitmap(wxImage, wxDC) ctor to all ports
This ctor was previously present only in wxMSW, make it available in all
ports to allow the same code to compile everywhere.

In most of them wxDC argument is simply ignored, but in wxGTK and wxOSX
it is used to assign the appropriate scale factor for the new bitmap.

Enable previously wxMSW-only unit test checking for this.
2022-04-12 19:08:56 +01:00
Vadim Zeitlin
d08498eb16 Add wxBitmap(size, dc) ctor to all ports
Previously this ctor was only available in wxMSW and wxOSX, which was
especially strange as the equivalent Create() overload, taking wxDC, was
already available in all ports.
2022-04-10 17:17:02 +01:00
Artur Wieczorek
04bad7a720 Preserve original image in wxImageFileProperty
Rescale only the copy of the original image to preserve image quality.
2022-04-10 13:34:03 +02:00
Artur Wieczorek
9542e86770 Don't store wxImage/wxBitmap objects on the heap in wxImageFileProperty
To simplify managing the life cycle of the objects.
2022-04-10 13:31:14 +02:00
Artur Wieczorek
fd11c4e50a Remove from documentation reference to not implemented function 2022-04-10 13:27:58 +02:00
Vadim Zeitlin
717e851225 Allow to leave another window enabled in wxWindowDisabler
Allow specifying another window to "skip", i.e. not to disable, in
wxWindowDisabler.

This is not used yet, but will be in the upcoming commit.
2022-04-07 23:38:16 +01:00
Vadim Zeitlin
53844108dd Make wxWindowDisabler ctors explicit
Implicitly converting a bool or a wxWindow pointer to this class makes
no sense and shouldn't be allowed, so don't allow it.
2022-04-07 23:22:55 +01: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
Scott Talbert
5614f73b2b Document missing wxGridStringTable parent class
See https://github.com/wxWidgets/Phoenix/issues/2131

Closes #22258.
2022-04-02 16:48:54 +02:00
utelle
b507c97b92 Handle Windows CRT locale names in wxLocaleIdent::FromTag() too
Recognize strings returned by setlocale() when using MSVC under MSW too,
if only because it was possible to construct wxLocale using them in the
previous versions and so doing this avoids breaking the existing code.

Also don't assert in FromTag(), even if the input is incorrect, as it is
potentially user-defined (e.g. can come from environment variables under
Unix).

Closes #22247, #22252.
2022-04-02 16:45:20 +02:00