Commit Graph

19950 Commits

Author SHA1 Message Date
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
Stefan Csomor
533958be10 recreating Xcode project files with new script 2022-04-16 14:27:24 +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
Vadim Zeitlin
bc81682e7f Refactor wxWindowDisabler to allow skipping more than one window
This is not implemented yet, but this commit changes DoDisable() to
disable all windows except those in the list of the windows not to be
disabled instead of explicitly checking for just a single window to
skip.

Rename m_winDisabled to m_windowsToSkip to better describe its purpose
and also because it's a vector, and so should use plural form in its
name.

Finally note that AfterDisable() is called with NULL argument from the
ctor not taking the window to skip for compatibility with the old code,
but it's not clear if it's really the right thing to do and perhaps this
shouldn't be done.

No real changes yet.
2022-04-07 23:32:05 +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
Vadim Zeitlin
19e3a47d98 Update version to 3.1.7 and rebake the makefiles
Make it possible to distinguish the latest master from 3.1.6 before
making any changes.

Closes #22282.
2022-04-07 17:40:13 +02: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
Vadim Zeitlin
e4c2298e5e Use window scale factor for all MSW wxDCs associated with windows
This ensures that we use correct font sizes with the DCs and, in
particular, fixes the font size in wxAutoBufferedPaintDC when using DPI
scaling different from 100% after the changes of e3557b8c0a (Respect
bitmap content scale factor in wxMSW wxMemoryDC, 2022-03-26).

See #22234.
2022-04-04 13:30:08 +01:00
Vadim Zeitlin
543b581bca Fix type for fallback definitions of INET_E_XXX
These constants must be of type HRESULT, i.e. long, and not unsigned
long that was used for them by default.
2022-04-04 12:40:22 +02:00
utelle
280cb68887 Add wxLanguageInfo::GetCanonicalWithRegion() helper
This simple function allows to simplify the code by avoid to test for
CanonicalRef before using either it or CanonicalName in multiple places.

No real changes.

See #22252.
2022-04-02 16:45:20 +02:00
Tobias Fleischer
e8872b335c Allow using multiple lines in single line wxTextCtrl under Mac
Add new OSX specific OSXEnableNewLineReplacement(bool enable) function
to control if new lines should be replaced with spaces (which is still
done by default) in a single-line wxTextCtrl.

Closes #22245.
2022-03-30 17:59:49 +02:00
Paul Cornett
3985e195cb Don't include <winsock2.h> when wxUSE_SOCKETS==0 2022-03-29 16:44:52 -07:00
Paul Cornett
ffdaec88ee Fix wxDataViewIconTextRenderer background on GTK
Background attribute needs to be set on the icon renderer as well.
See #19301
2022-03-28 21:28:10 -07:00
utelle
6d6e5cde21 Enhance wxUILocale and wxLocaleIdent
Many improvements and fixes to wxUILocale:

- Add wxUILocale method for retrieving wxLocaleIdent identifier,
  localized names, layout direction.
- Add wxLocaleIdent attributes, getter, and setter for
  platform-dependent tags under Windows: extension, sort order.
- Modify method wxLocaleIdent::FromTag to support not only BCP 47-like
  tags, but also platform-dependent syntax.
- Modify method wxLocaleIdent::GetTag to allow specifying the tag type.
- Update internat sample to better show using wxUILocale.
- Update German and French message catalogs for internat sample (German
  fully translated, French msgIds only).
- Introduced wxUILocaleImplStdC under Windows, because locale "en-US" is
  not equivalent to the C locale.
- Adjust wxLocale class to restore previous wxUILocale in the
  destructor.
- Implement wxLocale::GetInfo method through wxUILocale methods.
- Removed LCID dependency in wxLocale.
- Move the implementation of some static wxUILocale methods from
  intl.cpp to uilocale.cpp.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #2615.
2022-03-28 01:11:40 +02:00
Vadim Zeitlin
9e5c8a8027 Respect bitmap content scale factor in wxMSW wxMemoryDC
Apply it manually because MSW doesn't do it automatically for us and
also adjust the font size in wxMemoryDC as the base class version only
does it for the device contexts associated with a window, but we also
need to do it when using a wxMemoryDC for a bitmap using scale factor
different from that of the main display.

As the result of these changes, contents drawn on wxMemoryDC, both
directly via its own methods, or via wxGraphicsContext (using either
GDI+ or Direct2D) created from it, it appears the same as in wxWindowDC
(e.g. wxPaintDC) created for a window using the same scale.

Closes #22130.

Closes #22234.
2022-03-28 01:03:07 +02:00
Paul Cornett
0993d4f18e Make wxCaret init functions private
Init functions are not supposed to be called by derived classes,
they have already been called by the base ctors.
2022-03-27 13:07:37 -07:00
Gerhard Gruber
9dc7248b1d Add conversion to signed/unsigned int to wxString
Add wxString::ToInt() and ToUInt() for convenience and consistency with
the existing ToLong() and ToULong().

Closes #22068.
2022-03-26 00:46:58 +01:00
Vadim Zeitlin
387981e373 Merge branch 'generic-dvc-fixes'
Fixes to generic wxDataViewCtrl under GTK.

See #22220.
2022-03-24 21:39:09 +01:00
Vadim Zeitlin
108108e54e Add wxArtProvider::Get[Native]DIPSizeHint()
Also add "wxWindow* win = NULL" argument to the existing functions to
convert from DIPs using the given window instead of the default DPI
scaling factor.

Closes #22022.
2022-03-24 21:35:26 +01:00
Vadim Zeitlin
506f292be2 Deprecate wxArtProvider::GetSizeHint(bool) overload
This was confusing and completely unnecessary as the version with the
non-default value of the bool argument was just equivalent to calling
GetNativeSizeHint() directly, so why even bother having it.
2022-03-24 00:10:08 +01:00
Vadim Zeitlin
4e4b80760b Move wxArtProvider::DoGetSizeHint() out of line and simplify it
This function has no need to be inline and it can be written in a more
clear way by just calling GetNativeSizeHint() directly instead of
passing by GetSizeHint(true).
2022-03-24 00:05:01 +01:00
Vadim Zeitlin
5f011b84c1 Merge branch 'tz-parse' of https://github.com/lanurmi/wxWidgets
Parse more time sonzes in wxDateTime::ParseDataTime().

See #22217.
2022-03-23 14:38:58 +01:00
Vadim Zeitlin
d77fd33e66 Merge branch 'imagelist-scale-factor'
Scale factor-related fixes to wxImageList and Mac wxDataViewCtrl.

See #22211.
2022-03-23 13:59:46 +01:00
Vadim Zeitlin
b91173f76e Fix comparing wxDataFormat with wxDF_INVALID in wxGTK
Define wxDataFormat::operator==(wxDataFormatId) instead of relying on
the implicit conversion from wxDataFormatId to wxDataFormat, as this
can't be done when the format ID is wxDF_INVALID because creating
wxDataFormat results in an assert failure in this case, while comparing
with wxDF_INVALID is clearly a perfectly valid operation.

Add a unit test checking for this.

Closes #22213.
2022-03-23 13:43:44 +01:00
Vadim Zeitlin
cc02b3cece Revert "Assure that all images in the generic wxImageList have the same scale factor"
This reverts commit b6d305e4f2 because
silently discarding images using a different scale factor is simply too
user-unfriendly: this can silently break the existing code, i.e. it can
still compile perfectly and not give any errors during run-time but not
show any images neither.

Also revert most of dc43d15cf7 (Add tests of storing HiDPI images in
generic wxImageList (wxOSX, wxGTK3), 2021-04-05) as these tests don't
pass any longer because the behaviour was intentionally changed.

See #22189.
2022-03-22 23:01:40 +01:00
Lauri Nurmi
136b1713e1 Refactor time zone parsing into a separate function from ParseRfc822Date()
For now, the new function is private and undocumented.
2022-03-22 19:12:45 +02:00
Paul Cornett
b4475c881a Avoid some -Wduplicated-branches warnings 2022-03-21 11:54:30 -07:00
Paul Cornett
e9e1023393 Simplify wxGtkImage scale handling
Since wxGtkImage is a GtkWidget, we can get the scale directly from it,
no need for an associated wxWindow pointer just to get the scale.
2022-03-21 11:52:01 -07:00
Vadim Zeitlin
616e7c8842 Update menu bitmaps when invoking window is set in wxOSX
Changing invoking window always needs to update the bitmaps because
the scale factor may need to be changed if this window is on a different
display, using different scaling, so do it automatically whenever
SetInvokingWindow() is called instead of having to remember to call
SetupBitmaps() manually everywhere SetInvokingWindow() is.

This required making the base class function virtual, but allows to get
rid of SetupBitmaps() call in wxWindow::DoPopupMenu(), as it can now
rely on this being already done by wxWindowBase::PopupMenu().
2022-03-20 17:34:51 +01:00
Vadim Zeitlin
28605bfcfb Make wxDumpWindow() take const wxWindow pointer
There is no reason not to allow calling this function with const window,
so do allow it, notably to make it possible to use it with "this" from
const wxWindow methods.
2022-03-19 22:56:06 +01:00
Vadim Zeitlin
f54ebf3261 Add wxGetDPIofHDC() helper function and use it in wxMSW code
No real changes, just replace several pairs of calls to GetDeviceCaps()
with a single helper function call.
2022-03-19 22:56:06 +01:00
Marek Roszko
a3a1f8a2f1 Release HDC in WindowHDC destructor even if HWND is invalid
It is possible to use WindowHDC as ScreenHDC by passing a NULL HWND to
its ctor and we still need to release the HDC allocated in this case in
the dtor, so do _not_ check for HWND being valid there.

This fixes a bad resource leak in wxWindow::GetDPI() when it's called
for a window without a valid handle.

Closes #22193.

Closes #22194.
2022-03-19 22:56:06 +01:00
Paul Cornett
28ca585d12 Require window pointer for default wxGtkImage BitmapProvider
Originally a NULL window pointer indicated that a disabled bitmap
was not needed, but now the pointer is always needed for scaling.
2022-03-19 14:32:15 -07:00
PB
dc770deab0 Fix typos and wording in docs and comments
Closes #22191.
2022-03-17 23:53:52 +01:00
Vadim Zeitlin
a845d247fb Merge branch 'splitterwindow-dpi' of https://github.com/MaartenBent/wxWidgets
Handle DPI change in wxSplitterWindow.

See #22182.
2022-03-17 23:51:38 +01:00