Commit Graph

6704 Commits

Author SHA1 Message Date
Vadim Zeitlin
751a73a2ca Add optional label to wxFileDialogCustomize::AddTextCtrl()
Creating a text with a label is a common operation and can be
implemented to look slightly better than AddStaticText() followed by
AddTextCtrl() without a label when using IFileDialog.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
095c4dfc94 Add event generation to MSW IFileDialog-based implementation
Inherit wxFileDialogCustomControl from wxEvtHandler to allow Bind()ing
to events on it and use this to handle wxEVT_BUTTON and wxEVT_CHECKBOX
in the sample.

And inherit from IFileDialogControlEvents in wxMSW code to actually
generate these events when they happen.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
359ab98cb2 Start adding new API for wxFileDialog customization
wxFileDialog::SetCustomizeHook() can be implemented in terms of
IFileDialogCustomize in wxMSW, which means that it can be used with the
new style dialogs shown by IFileDialog, unlike SetExtraControlCreator(),
which could only be supported when using older style common dialogs.

Add support for a few different controls and wxMSW implementation, more
controls, generic implementation and the documentation will be updated
later.

Also update the sample to show the new API in action and allow toggling
between using it and the old API for testing.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
63f44b5bfa Call MSWOnInitDone() when using IFileDialog too
This allows to use the new style dialog for the file dialogs for which
Centre() or SetSize() had been called, as we can now position the window
even when not using a hook function.

As there is no IFileDialogEvents function corresponding to CDN_INITDONE
notification, use the first call to OnTypeChange() instead.
2022-06-03 01:35:30 +01:00
taler21
4b9721536c Center the print preview frame after fully creating it
Center the frame correctly in the sample and demonstrate the right way
to do it in the documentation.
2022-05-23 15:07:06 +01:00
Vadim Zeitlin
f0de5a93f8 Use reasonable size for wxPreviewFrame by default
Give a reasonable default size to wxPreviewCanvas and fit wxPreviewFrame
to its contents.

Remove the useless call to Fit() from SizerWithButtons: the size set
inside it was just ignored anyhow.

This also allows to stop hardcoding the size in the sample, so don't do
this any more.

See #22439.
2022-05-19 17:04:32 +01:00
Vadim Zeitlin
6268b5c619 Fix building font sample in STL mode after recent breakage
The changes of adb8bbab4d (Sort font names in the dialog showing them in
the font sample, 2022-05-12) didn't compile with wxUSE_STL==1 because
wxSortedArrayString doesn't inherit from wxArrayString in this case.

Fix this by using wxArrayString and its Sort() method instead.
2022-05-12 21:00:01 +02:00
Vadim Zeitlin
adb8bbab4d Sort font names in the dialog showing them in the font sample
This makes the list of the fonts much more readable, compared to listing
them in essentially random order.

Incidentally stop using manual memory allocation to avoid giving a bad
example.
2022-05-12 16:31:40 +01:00
Vadim Zeitlin
d456f87321 Use appropriate initial size for the wrapsizer sample frame
Ensure the frame is big enough to show its contents, otherwise some
controls were truncated and not visible at all initially, at least under
MSW.
2022-05-11 15:24:34 +01:00
Vadim Zeitlin
84e15a8fd2 Merge branch 'wxsvg-mac' of https://github.com/MaartenBent/wxWidgets
Improve wxSVGFileDC on macOS: use correct scaling.

See #22390.
2022-05-05 17:29:20 +02:00
Vadim Zeitlin
bf0f9cf55b Merge branch 'msw-scroll-beyond-2_27'
Increase usable scrolling range in wxMSW by a factor of 10,000 by
switching to handling the device origin in wxWidgets itself instead of
letting GDI handle it.

See #22382.
2022-05-05 17:24:58 +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
Maarten Bent
1d6c366f14 Make all pages in the drawing sample DPI aware 2022-05-03 22:56:07 +02:00
Vadim Zeitlin
c6e45280d7 Increase maximum allowed size of test virtual grid in the sample
This allows to see that the grid is currently not redrawn correctly
under MSW when it has more than ~6,000,000 rows due to overflowing the
device space span of 2^27.
2022-05-01 02:12:50 +01: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
Maarten Bent
8665960c55 Simplify printing and drawing sample constructors
Don't use FromDIP for 0.
Include DIP in drawing sample variable and function names to make it clear these sizes are in DIP.
Show both logical and DIP coordinates in statusbar.
2022-04-26 21:25:55 +02:00
Vadim Zeitlin
5d5591816d Update to bakefile 0.2.13 to fix DLL directory creation
Fix the bug introduced in ec0734f96f (Install DLLs in bindir, not
libdir, when using MSW toolchains, 2021-01-09): the directory where the
DLLs were installed wasn't created any more, resulting in errors if it
didn't exist.

Update to latest bakefile version adding the missing mkdir command to
fix this and also use a released bakefile version for the wx makefiles.

Regenerate configure to match the new version.

See #14601.
2022-04-23 23:11:31 +02:00
Maarten Bent
b50633f440 Fix bitmap size when saving image in drawing sample
wxBitmap::CreateWithDIPSize expects an DPI independent size.
And when saving as SVG, it also expects a DPI independent size.

Also show DPI independent coordinates in the status bar.
2022-04-21 22:04:10 +02:00
Maarten Bent
e97926e555 Don't override wxUSE_DPI_AWARE_MANIFEST in resource file 2022-04-21 22:04:10 +02:00
Maarten Bent
5b5275c388 Make the printing sample DPI aware 2022-04-21 22:04:09 +02:00
Maarten Bent
3587b3469f Make the polygon page in the drawing sample DPI aware
Remove unneeded wxGCDC constructor argument.

Make showing a clipping region, textured background, and changing
origin DPI aware.
2022-04-21 21:55:50 +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
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
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
9be821c71a Create a full page text, rather than a button, in notebook sample
This is much more realistic and looks less weirdly.

Also add the text directly as a page, without wrapping it in a panel,
just to show that this is possible and works too.

No real changes.
2022-04-16 20:01:23 +01:00
Vadim Zeitlin
9b25ed038a Add an accelerator for the font dialog in the dialogs sample
No real changes, just make it faster to bring up the font dialog for
testing.
2022-04-16 16:40:49 +01:00
Vadim Zeitlin
a47382f95d Revert accidental changes to the samples
This reverts parts of 533958be10 (recreating Xcode project files with
new script, 2022-04-16) that seem to have been committed accidentally
and are now preventing CI builds from passing.
2022-04-16 15:33:05 +02:00
Stefan Csomor
533958be10 recreating Xcode project files with new script 2022-04-16 14:27:24 +02:00
Maarten Bent
48fe7725c4 Make the polygon page in the drawing sample DPI aware
Use wxDC::GetDPIScaleFactor to scale the coordinates.

Initialize wxGCDC with a wxWindow, so it can infer the scale from the window.
2022-04-16 01:11:34 +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
85daadd659 Merge branch 'cmake-improvements' of https://github.com/MaartenBent/wxWidgets
Use newer CMake PCH support instead of cotire and many other
improvements to CMake build system.

See #22295.
2022-04-13 15:56:09 +02:00
Maarten Bent
87465898f3 Fix unused variable warnings 2022-04-10 23:41:44 +02:00
DietmarSchwertberger
a6cc2c7238 Fix recent regression in grid sample
Changes of 3719ab3725 (Add support for rearranging wxGrid rows order
interactively, 2022-04-02) broke TabularGridFrame in the sample, fix it
by removing the duplicate call to wxSizer::Add().

See #22260.

Closes #22296.
2022-04-10 17:50:43 +02:00
Vadim Zeitlin
f84864dcca Merge branch 'master' of https://github.com/dghart/wxWidgets
Add a missing XPM to the xrc sample

The merge also rebakes the sample makefiles.

See #22270.
2022-04-07 17:42:05 +02: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
dghart
cd43393654 Update xrcdemo.bkl
Add an xpm missed by commit 49fd3a22
2022-04-04 20:41:23 +00:00
Vadim Zeitlin
ce1d350f41 Add logging of context menu events to the widgets sample
Show when (and if) they are generated.
2022-03-30 01:07:38 +02:00
Vadim Zeitlin
70e119140c Merge branch 'win-transparency'
Improve shaped sample and its documentation.

See #22230.
2022-03-28 00:16:31 +01: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
Vadim Zeitlin
0390951677 Fix forwarding of menu commands in the richtext sample
Fall back on the main rich text control if there is no currently focused
window, as the control itself never has focus when a menu is opened with
wxGTK/Wayland, i.e. none of the menu commands, such as wxID_COPY/CUT,
worked for it in this case.

Closes #22121.
2022-03-28 00:55:54 +02:00
Vadim Zeitlin
279af795ed Make transparency window in the shaped sample work under MSW
Still show transparent window even if IsTransparentBackgroundSupported()
returns false, just don't make their background transparent and only use
SetTransparent() in this case. In fact, don't try to use transparent
background style at all by default and add a separate menu item to do it
if wanted.

Also add a slider to allow changing opacity of the window.

Finally, make the window big enough in high DPI under MSW by using
FromDIP().
2022-03-25 01:46:24 +01:00
Vadim Zeitlin
49de73c10d Add example of wxEVT_DPI_CHANGED handler to the display sample
Just to allow testing that this event is received as expected.

See #19130.
2022-03-24 21:40:44 +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
Andriy Byelikov
3900ece2ee Renormalize .vcxproj.filters files
This fixes the problem with inconsistent file formats in the repository
apparently introduced in e3535d6481 (Mark MSVS *.vcxproj.filters files
as using CR LF as well, 2021-11-24), which resulted in the files changed
by this commit (sometimes) appearing modified in new clones.

Closes #22214.
2022-03-23 13:57:52 +01:00
Vadim Zeitlin
3ec0697c04 Don't crash in toolbar sample if there is no toolbar
Using many menu commands after removing the toolbar could result in a
crash because they used the toolbar pointer without checking for its
validity.

Add wxEVT_UPDATE_UI handler disabling these commands to prevent this
from happening.

This required rearranging the menu item IDs to allow using a single
range for all of them.
2022-03-20 02:38:35 +01:00