Commit Graph

20044 Commits

Author SHA1 Message Date
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
Stefan Csomor
dc2ff0d6b4 wxOSX: Rewiring GetBestSize for single line text control again
see #22374
2022-04-30 20:34:28 +02:00
Maarten Bent
dc5fe63cb2 Don't implement FromDIP and ToDIP in headers 2022-04-29 00:38:46 +02: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
Maarten Bent
5bea1dc18a Fix static build using extended RTTI
Fix declaration of 'o' hides previous local declaration warnings.

Change two wxCONSTRUCTOR_5 definitions using wxBitmapBundle instead of
wxBitmap (this does not give build errors).

wxGenericCalendarCtrl is missing all XTI implementations, so just use
RTTI. And fix building the xti sample.

Note the shared build still fails due to WXDLLIMPEXP related issues.

Closes #22300.

Closes #22301.
2022-04-14 23:17:05 +02:00
Vadim Zeitlin
7b0d77e0c0 Remove checks for [v]snprintf() and vsscanf() declarations
Consider that all still supported/existing platforms provide these
declarations, if they provide these functions at all (and they probably
all do, so we almost certainly could remove all the test for them, but
keep them for now).

Note that we still test for broken declarations as this might still be
useful on HP-UX 11 systems, where this problem was reported "only" 8
years ago.

By not using AC_CHECK_FUNCS() we avoid the problem when using it with
snprintf() when cross-compiling with the latest MinGW API headers, see
https://sourceforge.net/p/mingw-w64/bugs/935/ for more details.

This commit is best viewed ignoring whitespace-only changes.
2022-04-14 00:33:51 +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
Vadim Zeitlin
bf75fe9d64 Remove redundant forward decls and headers from wx/*/bitmap.h
No real changes, just don't redeclare the classes already forward
declared in wx/bitmap.h in the files included (only) from it and don't
include redundant headers.

Also forward declare wxCursor and wxPixelDataBase in wx/bitmap.h itself
for consistency, as many (even though not all) headers use them.

Do not forward declare wxControl in wx/{msw,osx}/bitmap.h, however,
there is no reason to do it in this header.
2022-04-10 17:09:52 +01:00
Artur Wieczorek
891e6a26a3 Simplify wxPGPropArgCls 2022-04-10 13:43:09 +02:00
Artur Wieczorek
1a31eef189 Cleanup wxPropertyGridInterface declarations
Move definitions of GetPropertyValueAs*() functions away from class
declaration to avoid polluting the header.
2022-04-10 13:40:08 +02:00
Artur Wieczorek
69f45b31a3 Use reference instead of pointer 2022-04-10 13:37:55 +02: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
ce6123029b Don't override DoFreeze()/DoThaw() in wxPropertyGridManager
Both implementations don't add any additional features to the base
functions and therefore are not needed. wxPropertyGrid and other wxPG
controls are children of wxPropertyGridManager and DoFreeze/DoThaw calls
are forwarded directly to them in wxWindowBase::Freeze()/Thaw().

Closes #22269.
2022-04-10 13:24:35 +02:00
Vadim Zeitlin
7773c123de Merge branch 'msw-fix-focus-native-modal'
Fix focus after showing a native modal dialog in wxMSW.

See #22290.
2022-04-09 22:53:06 +02:00
Paul Cornett
fd352f9ac7 Avoid -Wdeprecated-copy warning, see #22291 2022-04-09 07:43:16 -07: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