Commit Graph

20058 Commits

Author SHA1 Message Date
Vadim Zeitlin
0e21b52d57 Extract mask creation from wxImage in a separate function
Allow reusing the code for creating a mask from wxImage mask from
elsewhere.

No real changes yet, this is a just a refactoring.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
e75f100841 Make GetImageListBitmap() member of wxGenericImageList too
Just simplify the code a little by avoiding having to pass m_useMask and
m_size to all calls of this function.

No real changes.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
dcc39d942f Make GetImageListBitmaps() member function of wxImageList
No real changes, just simplify the code a bit by using a member function
as this avoids having to pass m_useMask to it separately.
2022-05-05 19:06:18 +01: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
Joonas Kuusela
1660584a45 Fix using wx/tipwin.h as the first include wx header
Include wx/defs.h from wx/tipwin.h to ensure wxUSE_TIPWINDOW is defined
before testing its value.

Closes #22392.
2022-05-05 16:10:46 +02:00
Vadim Zeitlin
bdfa9359ae Move wxGrid::Get{Row,Col}Pos() out of line
Don't define these functions in the header file, this is unnecessary.

No real changes.
2022-05-02 21:43:42 +01:00
Vadim Zeitlin
d64ba81378 Merge branch 'dc-cleanup'
Some cleanup in wxDC code: remove unnecessary casts, use RAII helpers
instead of manual memory and other resources management.

No real changes.

See #22378.
2022-05-01 03:11:06 +02:00
Vadim Zeitlin
4fcf3ba465 Merge branch 'fix-build-without-base64' of https://github.com/PBfordev/wxWidgets
Fix build when wxUSE_BASE64==0.

See #22377.
2022-05-01 03:07:35 +02:00
PB
ed3b1c6ca3 Simplify MSVC pragma for embedding application manifest
Instead of defining a manifest for each individual CPU architecture, use
a single manifest with an asterisk for the architecture.

Should have been part of 77d8926126 (Simplify Windows application
manifests, 2021-12-17).

Closes #22376.
2022-05-01 03:03:20 +02:00
Vadim Zeitlin
a7791781d9 Merge branch 'listbook-images'
Show images added to its wxImageList later in wxListbook again and also
improve determining the size of the list control under MSW.

See #22372.
2022-05-01 02:57:24 +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
Vadim Zeitlin
481b73d14c Use wxScopedArray<> instead of manual memory management in wxDC
Update similar code in all ports to use wxScopedArray for arrays of
points, dashes etc in various wxDC implementations instead of using
new[] and delete[] manually.

No real changes, just make the code safer and shorter.
2022-04-30 21:14:58 +01:00
Vadim Zeitlin
6383bc39ff Add convenient wxDCImpl::CalcBoundingBox() overloads and use them
No real changes, just make the code updating the bounding box slightly
shorter by providing convenient and slightly higher-level overloads.

For now these functions are only in wxDCImpl, it's not clear if we
really need them in wxDC, so don't add them to the public API.
2022-04-30 20:51:53 +01:00
Stefan Csomor
dc2ff0d6b4 wxOSX: Rewiring GetBestSize for single line text control again
see #22374
2022-04-30 20:34:28 +02:00
PB
4ddaa9c0ce Fix building wxIniConfig when wxUSE_BASE64=0
Use guards for wxUSE_BASE64 just as wxConfigBase does.
2022-04-30 16:29:13 +02:00
Maarten Bent
dc5fe63cb2 Don't implement FromDIP and ToDIP in headers 2022-04-29 00:38:46 +02:00
Vadim Zeitlin
ebf5e8813e Show images added to its wxImageList later in wxListbook again
Fix a regression in 3.1.6 which resulted in not showing any images if
the associated image list was empty when it was associated with the
control, as HasImages() returned false in this case and so wxLC_ICON
style was not set.

The fix is to return true from HasImages() if we have image list even if
it is currently empty, as we can't know when (or if) it will become
non-empty and it's better to assume that it will be used (as nothing
really catastrophic should happen if it is not used, finally) rather
than not taking into account the images added to it later.

Closes #22364.
2022-04-28 17:24:58 +01:00
Vadim Zeitlin
35a3bac439 Use wxObjectDataPtr in wxSharedClientDataContainer
This is slightly more economical, both at run-time and, maybe more
importantly, at compile-time than using wxSharedPtr that we don't really
need here, simple intrusive ref counting smart pointer is enough.
2022-04-28 00:47:19 +02:00
Vadim Zeitlin
e2a5c1ffc8 Don't provide wxSharedClientDataContainer::m_data accessors
This is not really necessary and breaks encapsulation of this private
method. It is enough to provide just a way to copy the data from another
object as this is all that the derived classes really need.
2022-04-28 00:36:40 +02:00
Vadim Zeitlin
de8877d3ee Make more ctors of wxGrid classes explicit
Don't allow nonsensical implicit conversion from int to
wxGridCellFloatFormat etc.

No real changes.
2022-04-28 00:30:44 +02:00
Vadim Zeitlin
5db2244bc8 Use wxString() rather than wxEmptyString in wxGrid classes
No real changes, just use default ctor for the default value of some
parameters.
2022-04-28 00:30:15 +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
6935b831bd Merge branch 'messages-with-context' of https://github.com/lanurmi/wxWidgets
Add wxTRANSLATE_IN_CONTEXT() and use it in a few places, notably for the
key names.

See #22354.
2022-04-27 19:17:12 +02:00
DietmarSchwertberger
1b158caa83 Improve usability of wxGrid actions using mouse dragging
Implement auto scrolling and handle ESCAPE to cancel the actions done by
dragging the mouse, such as resizing or selecting an area.

Closes #22292.
2022-04-27 19:09:40 +02:00
Stefan Csomor
d9ec9ab1f1 Use Cocoa native layout inset method
Don't hardcode inset sizes any longer.

This improves various issues under macOS 12, see #22134 and #22135 (but
doesn't fully fix the former problem yet).

Closes #22351.
2022-04-25 21:51:00 +02:00
Lauri Nurmi
180b8e5183 Mark system cursor names translatable in a context, and do get translation
It looks like wxGetTranslation() was not actually called for these strings
earlier, so do call it.

The context fulfills also the same purpose as TRANSLATORS: comments --
removing comments as redundant.
2022-04-24 11:30:31 +03: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
c4dc0353cc Fix wxGTK1 build after adding wxBitmap(wxImage, wxDC) ctor
This fixes a compilation problem introduced in 24970061fa (Add
wxBitmap(wxImage, wxDC) ctor to all ports, 2022-04-12).
2022-04-23 15:04:25 +02:00
Maarten Bent
e8cf1f989b Add ToDIP to wxDC and wxGraphicsContext 2022-04-21 22:04:10 +02:00
Maarten Bent
59443803b4 Only scale MSW wxMemoryDC without window with content scale factor 2022-04-21 22:04:09 +02:00
Maarten Bent
1a1d19e93b Improve print preview and printing with high DPI
All print related scaling is based on 96DPI, so always let the printing contexts return this,
and also adjust the font to this DPI.
2022-04-21 22:04:06 +02:00
Maarten Bent
3da3103eb5 Override FromDIP in wxSVGFileDC and wxPostScriptDC
These are DPI independent.
2022-04-21 21:55:53 +02:00
Maarten Bent
15a37b91fb Add FromDIP to wxDC and wxGraphicsContext
Using the same implementation as wxWindow has.
2022-04-20 20:37:53 +02:00
Maarten Bent
fda41cdd1b Remove GetDPIScaleFactor from wxDC and wxGraphicsContext
This reverts most of the changes from ee2b02614e (Add GetDPIScaleFactor to wxDC
and wxGraphicsContext, 2022-04-16).

This is not supposed to be used to scale pixels, FromDIP will be added instead.

Temporary use scale=1 in the drawing sample until FromDIP is added.
2022-04-20 20:33:29 +02: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
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
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
3439087685 Merge branch 'fontdlg-dpi'
Fix font sizes in MSW font dialog in high DPI.

See #22322.
2022-04-19 00:35:20 +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
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
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
Maarten Bent
4a3098aebb Optimize MSW wxNotebook background painting
MSWDefWindowProc(WM_PAINT, ...) in OnPaint causes performance issues on
large screens so only use it when an actual custom background colour is
set.

Closes #22308.

Closes #22320.
2022-04-17 17:59:24 +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
Vadim Zeitlin
caac3a4f19 Load SetThreadDpiAwarenessContext() function pointer only once
A small optimization to avoid resolving this function dynamically every
time it is needed and just do it once, on first use.
2022-04-16 17:49:09 +01:00
Stefan Csomor
533958be10 recreating Xcode project files with new script 2022-04-16 14:27:24 +02:00
Maarten Bent
ee2b02614e Add GetDPIScaleFactor to wxDC and wxGraphicsContext
It can be used to scale coordinates and sizes to make them DPI aware.

In the common headers, use wxDisplay::GetStdPPIValue() as default DPI value,
so the correct values are used on Windows (96) and macOS (72).

In wxMemoryDC use m_contentScaleFactor as the DPIScaleFactor, see e4c2298e5e
(Use window scale factor for all MSW wxDCs associated with windows, 2022-04-04).
2022-04-16 01:11:33 +02:00
Vadim Zeitlin
54bdc6bbd2 Merge branch 'configure-snprintf'
Don't use AC_CHECK_FUNCS(snprintf) which doesn't work with the latest
MinGW API headers (see https://sourceforge.net/p/mingw-w64/bugs/935/)
and some other minor cleanup.

See #22302.
2022-04-14 23:18:16 +02:00