Commit Graph
229 Commits
Author SHA1 Message Date
Bill Su 673ee930e7 wxScrolled<>: simplify autoscroll zone config API 2026-02-21 00:52:13 -05:00
Bill Su af88a67896 Improve auto-scrolling in wxScrolled
Support auto-scrolling both orientations simultaneously and make
auto-scroll region configurable.

Also allow changing auto-scroll dir without ending drag operation and
starting another one.

Closes #25978.
2026-02-14 22:05:33 +01:00
Daniel Collins acd8b7295e Document that wxApp::OnExit() should be called from overrides
And update the samples to follow the advice in the documentation.

Closes #26173.
2026-02-10 01:05:59 +01:00
Robert Roebling e3c25deebb Add wxSYS_COLOUR_LISTBOXHIGHLIGHT
Unlike wxSYS_COLOUR_HIGHLIGHT, this returns the background of the
selected items, not the selected text.

Closes #26109.
2026-01-28 01:06:27 +01:00
Vadim Zeitlin bb5aa0f67a Improve code showing wxOverlay use in the drawing sample
Make the code work on all platforms by adding SetOpacity(-1) call needed
under wxMSW to enable overlay transparency and using wxGCDC to take into
account the brush transparency.
2025-11-01 17:45:46 +01:00
Maarten Bent 36fa157d23 Use wxLogWarning for changing appearance errors in drawing sample
wxLogStatus is unnoticeable in the drawing sample, see #25587.

Closes #25914.
2025-10-25 16:05:43 +02:00
ali kettab 0135b809c4 Fix use of wxGC with a scrolled window in drawing sample
No Response / no-response (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.8 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
Update Documentation / Update Online Documentation (push) Has been cancelled
A clip region set using SetDeviceClippingRegion() on a DC should not scroll
when the canvas we are drawing on scrolls.  The drawing sample behaves like
this if the DC is a wxDC instance but not if it is a wxGC instance (because
it is not properly prepared when the canvas is scrolled, i.e.: GetDeviceOrigin()
always returns (0, 0) for a wxGC). So this bug should be fixed by preparing
the correct DC that we are actually using for drawing.

Closes #25877.
2025-10-14 12:45:29 +02:00
Stefan Csomor 18a60c9875 Drawing Sample adaptions for building under iOS (#25855)
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.8 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
No Response / no-response (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
* bracket code in drawing sample so that iOS can build it too, adding a simple keyboard navigation for iphone
2025-10-05 14:56:22 +02:00
Maarten Bent 656afd8c72 Add and use a wxSVGFileDC constructor accepting wxSize
Add a constant for the default SVG dpi resolution.
2025-09-14 14:23:22 +02:00
Maarten Bent 700defddcc Save SVG files with the actual drawing size
First render to a temporary wxSVGFileDC, then use the size of the bounding box as input for the actual SVG size.
Use a slightly larger size to account for lines drawn with a bigger wxPen width.
2025-09-14 14:23:21 +02:00
Maarten Bent 1534390071 Use correct FromDIP in drawing sample
Use FromDIP of the wxDC, not the wxWindow.
2025-09-14 14:23:21 +02:00
Vadim Zeitlin 655f902e71 Test WarpPointer() in the drawing sample
This seems like the least inappropriate way for testing this function,
even though it's not really related to drawing.
2025-08-22 02:08:26 +02:00
Vadim Zeitlin 34031f3f04 Fix height of cursor boxes in the drawing sample
Remove wrong FromPhys() call, wxSYS_CURSOR_Y is expressed in logical
pixels, this is a leftover from an old and never used version of the
code in which it was wrongly expressed in physical ones.
2025-07-27 19:49:51 +02:00
Vadim Zeitlin c87b291d32 Add wxCursorBundle and implement support for it in wxGTK
This new class allows to let wxWidgets select the appropriate cursor,
similarly to how wxBitmapBundle allows to select the bitmap of the
appropriate size.

Document the new class and show using it in the drawing sample.
2025-05-07 23:16:11 +02:00
Vadim Zeitlin 3f85f59543 Add wxSysMetricChangedEvent and generate it in wxMSW
This event can be used to react to the changes in the default system
cursor size.
2025-05-07 23:16:11 +02:00
Vadim Zeitlin dbf906eaed Show stock cursors in the drawing sample too
Allow seeing the shapes (and sizes) of different standard cursors.
2025-05-04 19:39:07 +02:00
Vadim Zeitlin e958b31ba9 Show the current cursor size in the drawing sample
There doesn't seem to be any sample more suitable than this one, so add
a "Cursors" screen to it, as we already have "Colours" screens there.

For now just show the cursor size.
2025-05-04 18:26:36 +02:00
Paul Cornett b79a391ffb Avoid some unnecessary float conversions 2025-03-28 16:18:57 -07:00
Vadim Zeitlin 1c06d46a9f Use CSS colour values in wxColourDatabase by default
Allow reverting to using the traditional values for the conflicting
colours by calling UseScheme(Traditional) if really needed.

This is another attempt for changing wxColourDatabase to use more
standard colour values, after the previous attempt in bb131fdbc5
(updated colour definitions to the new official X version (patch
771272), 2003-07-17) which was reverted almost immediately after in
5e2ab1ea5d (reverted the last change (colour values changes), it cerated
too many problems, 2003-07-19), see #6031. Unlike the previous ones, it
provides an escape hatch in the form of UseScheme() and also leaves
traditional wx colour names not clashing with CSS ones still available.

Also update the "drawing" sample to allow showing both colour schemes,
and extend its view port to fit all the colour names vertically.

See #23518.
2024-12-13 23:51:34 +01:00
Vadim Zeitlin 946dd04c43 Show standard colours in alphabetical order in "drawing" sample
This is nicer than showing them in the apparently random order in which
they appear in the hash table.
2024-12-13 23:13:16 +01:00
Vadim Zeitlin 082f9d4034 Add simple wxOverlayDC helper and use it
Using wxOverlayDC is simpler than creating wxClientDC and wxDCOverlay on
top of it and allows to avoid using wxClientDC directly.
2024-07-22 11:32:29 +02:00
Vadim Zeitlin 8cba40bad1 Avoid AppearanceResult::Success conflict with X11 constant
X11/X.h #defines Success as 0, resulting in compilation errors due to a
name clash if this header happens to be included before wx/app.h.

We could #undef Success here, but it seems better to avoid the problem
by just renaming our constant, which was introduced only recently and so
shouldn't be used in many places yet.

See #24633.
2024-07-04 01:11:31 +02:00
Vadim Zeitlin cd981a297b Add wxApp::SetAppearance() to explicitly set dark or light mode
Allow the application to override the default system mode and,
incidentally, also to provide a more portable way of enabling dark mode
under MSW.

Show how to use the new function in the drawing sample.

Closes #19185.

Closes #23867.
2024-04-12 02:40:54 +02:00
Vadim Zeitlin e43f913313 Remove all blank "Modified by:" lines from top comment blocks
Having this line is not useful at all as it doesn't contain any
information and shouldn't be filled in the future as git-shortlog can
provide the information about people who changed the given file more
more reliably than consulting the comments in any case.

Keep the non-blank lines for historical purposes.
2023-10-22 01:22:48 +02:00
Vadim Zeitlin 487018f42e Handle mouse capture loss gracefully in the drawing sample
Reset the selection and avoid the assert which happened when the capture
was lost unexpectedly (e.g. due to switching to another window using
some key combination without releasing the mouse).
2023-02-14 17:56:47 +00:00
Vadim Zeitlin a7b39f63b3 Send wxEVT_SYS_COLOUR_CHANGED on dark/light theme change in wxMSW
wxOSX already does it, so do it in wxMSW too for consistency and because
it seems useful to be able to react to the same event in all cases.

Update the drawing sample to refresh its system colours scheme whenever
the theme is changed.
2022-12-26 22:10:32 +00:00
Vadim Zeitlin 7ce2ba9b0c Add wxSystemAppearance::AreAppsDark() and IsSystemDark()
This allows to determine if dark mode is enabled (for the applications
and/or the system UI itself, respectively) system-wide which is useful
now that IsDark() returns false unless MSWEnableDarkMode() is called.

Also document the incompatible change to IsDark().
2022-12-26 22:02:11 +00:00
Artur Wieczorek 48d226bb84 Adjust scrolled contents only for wxPaintDC (drawing sample)
Adjust scrolled contents for screen drawing directly in EVT_PAINT
handler instead of doing so conditionally for generic wxDC.
This also helps demonstrating if wxPaintDC transformations
are transferred properly to wxGCDC.
2022-11-29 18:41:08 +01:00
Vadim Zeitlin 4f4c5fcfdf Use nullptr instead of NULL in the code and documentation
This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.

Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.

And also use null in the assert messages.

Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
2022-10-18 01:25:25 +02:00
Vadim Zeitlin 0ef1cdcc21 Remove support for wxMotif
This port hasn't been updated for ages and is not used by anybody any
longer, so remove its code to facilitate maintenance.

Also remove references to this port from the documentation and most of
the other places (VMS-specific descrip.vms files still check for it
because it's not clear how to update them all), including configure.

Regenerate the latter and rebake all makefiles.

Finally document that this port is not available any longer.
2022-10-16 16:39:56 +02:00
PB 88d526660f Replace wxOVERRIDE and wxNOEXCEPT with override and noexcept
Don't use deprecated macros in wxWidgets itself.
2022-10-15 18:10:45 +02:00
Kenneth Porter 974a7658da Add wxColourDatabase::GetAllNames()
Return all known colour names from this function and show them in the
drawing sample.

Closes #9264.

Closes #22724.
2022-08-29 00:44:49 +02:00
Maarten Bent 1d6c366f14 Make all pages in the drawing sample DPI aware 2022-05-03 22:56:07 +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
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 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
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
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 3aad506c5b Avoid some -Wfloat-conversion warnings 2022-02-13 18:11:55 -08:00
Vadim Zeitlin b6cff426ce Merge branch 'remove-bcc-support'
Remove support for Borland C++ compiler, it wasn't tested since a long
time and probably didn't work anyhow and there was no interest in
keeping support for it since many years.

See https://github.com/wxWidgets/wxWidgets/pull/2087
2020-10-16 01:58:13 +02:00
Paul Cornett b5a554b9a6 Avoid -Wdouble-promotion warnings 2020-10-14 11:07:55 -07:00
PB f57f214122 Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
Artur Wieczorek fe064de26b Use dedicated functions to convert between degrees and radians 2020-10-04 21:47:43 +02:00
Artur Wieczorek 0c3494592a Fix calculating mouse position in drawing sample
Displayed logical mouse position was improper for rotated wxDC.
2020-10-01 17:47:12 +02:00
Stefan Csomor c8ede8d430 Fix #include form for a wx header in the sample
Use quotes, not angle brackets, for #includes in wx source tree itself.

No real changes.
2020-07-19 00:15:33 +02:00
Vadim Zeitlin bb489418b0 Number renderers using consecutive digits in the sample
This has the disadvantage of not using the same accelerators in
different wxWidgets builds, but the advantage of appearing logical to a
casual user when running the sample, while having "0, 1, 3, 4" sequence
was surprising.

Alternatively, we could always add all menu items, but disable the ones
that are not available in the current build. It could be surprising to
see "GDI+" under non-MSW systems too though.
2020-03-27 11:51:56 +01:00
Vadim Zeitlin e7c8039d13 Simplify renderer selection in the drawing sample
Make "Use default wxGraphicsContext" part of the renderer selection
radio group and put it in correct order, as having "1, 0, 3, 4"
accelerators order in the menu was really surprising.

Remove wxEVT_UPDATE_UI handlers as they complicated things in the sample
code (which is supposed to be simple, after all) without much benefit
and arguably even added to the confusion during run-time as menu items
could both be manually selected and checked automatically.
2020-03-27 11:43:19 +01:00
Vadim Zeitlin 62bb47cfdb Use white background for drawing lines in the drawing sample
This makes the display more readable, black on red was really not ideal.

No real changes.
2020-03-27 11:39:03 +01:00
Artur Wieczorek bb9c8b11de Add demonstration of affine transformations to drawing sample
This adds a demonstration of drawing with affine 2D transformation applied
to wxDC. Transformation paramaters (translation, scale, rotation angle)
can be set/reset with new menu "Transformation".
2019-12-27 20:17:19 +01:00