Rewrite a complex expression in wxClassInfo::IsKindOf() as several statements
to avoid what looks like a gcc optimizer bug as it was dereferencing
m_baseInfo1 pointer even when it was null.
The new version is not completely equivalent to the old one as it doesn't
check for info == NULL which is not really necessary, but this is just a side
effect and doesn't affect anything, the important change is avoiding doing
everything in a single expression.
Closes#17483.
All versions of MinGW seem to have this function, so use it to ensure that
wxGetCwd() returns the correct result even when the current directory contains
non-ASCII characters.
Closes https://github.com/wxWidgets/wxWidgets/pull/307
If wxPropertyGrid has wxPG_AUTO_SORT flag set then renaming the label of any property can change the order of displayed properties including this one which is currently selected. To be properly displayed in the new location this selected property has to be refreshed separately.
Current implementation suffers for two issues:
1. Because wxClientDC and wxWindowDC are not distinguished in wxMSWDCImpl::Clear and in both cases DC coordinates are obtained with GetClientRect() Win API what leads to this that for wxWindowDC the entire area is not cleared.
2. Translations like moving logical origin or scaling are not taken into account in wxMemoryDC coordinates calculations (only device origin is included) so for transformed DC calculated coordinates are invalid and finally the entire area is not cleared.
To fix these issues we can use GetClipBox() Win API to obtain actual logical coordinates of the clipping box (with all translations and scaling already included) and this way we can avoid using separate methods of retrieving coordinates for wxClientDC, wxWindowDC and wxMemoryDC.
In these tests clipping region is set for transformed wxDC/wxGCDC (with changed device origin, logical origin and scale) to check if all these transformations are taken into account in the clipping box calculations.
Because wxDC can be the subject of geometric transformations (like translation, scaling) so we cannot assume in the calculations of the clipping box that DC origin is always at (0,0) and its logical size is the same as physical size. To get correct result we have to use logical coordinates of wxDC area in all clipping box calculations.
Focus rectangle was still drawn around the label when it was empty with some
themes, so hide it completely to ensure this doesn't happen.
Closes#17443.
If there is requested to set/unset a single property (without recursion) as a read-only (wxPropertyGridInterface::SetPropertyReadOnly) or to hide/show it (wxPropertyGridInterface::HideProperty) then first check if property is already in the requested state and if so do nothing. This prevents from unneeded refreshing of the display.
When wxPGProperty's text or background colours are modified with dedicated wxPropertyGridInterface utility functions (SetPropertyBackgroundColour, SetPropertyTextColour, SetPropertyColoursToDefault) then it is enough to redraw the property with new colours because its internal state remains unmodified and full refreshing is not necessary.
Closes#17588
This doesn't make sense, these functions can only be ever used with a single
parameter ("cellpos" for the former and "cellspan" for the latter), so just
hard-code it inside the functions themselves.
No real changes, just make the code less confusing.
Introduce a new type for XRC values imaginatively called just "pair of
integers" which can be used for values not expressed in pixels and hence for
which it doesn't make sense to use dialog units nor to scale them by the DPI.
Use this new type for wxGridBagSizer position and span elements to prevent
them from being changed when using higher than normal DPI.
Closes#17592.
"position" argument is input/output and must point after the newly inserted
text on return, but we didn't do it when handling the insertion specially.
Closes#17591.
Flushing native Direct2D renderer (invoking wxGCDC::Flush() -> wxGraphicsContext::Flush() -> ID2D1RenderTarget::Flush()) is apparently not enough to update underlying DC (with selected in bitmap) and therefore we have to destroy the renderer (which in turn invokes ID2D1RenderTarget::EndDraw()) to do so.
ID2D1RenderTarget::PushAxisAlignedClip/PopAxisAlignedClip used to clip the region (with wxGraphicsRenderer::Clip) and ID2D1RenderTarget::PushLayer/PopLayer used to rendering to the transparent layer (with wxGraphicsRenderer::BeginLayer) are non independent but have to be used in the controlled sequences: "A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot overlap" (and of course finally each Push* call must have a matching Pop* call).
To control the sequence of access to the AxisAlignedClips and Layers there is implemented a wxStack data member holding Clips/Layers parameters which reflects a physical stack of respective Clips/Layers in ID2D1RenderTarget. This way we know in which order to pop and what to pop from ID2D1RenderTarget stack if there is a need to do so.
Closes#17590
When there is no clipping region currently set then current effective clipping region is identical with entire DC surface and therefore DC size should be returned as a region size.
Closes#17013
Graphics renderers accept negative clipping box size but for internal calculations done in wxDCImpl::DoSetClippingRegion() we need to have a box defined by (x,y) at top-left corner and having non-negative size so we need to recalculate parameters if necessary.
While setting a clipping box there is necessary to intersect it either with current clipping region location if such region exists or with wxDC surface extents if no clipping region is set. This way effective clipping box will be always inside the wxDC surface.
Note: Effective clipping box can be an empty region.
See #17013
Because CreateRectRgn() Win API requires that (x1,y1) parameters represent the top-left corner of the clipping box so if a box with negative values of the width or height is passed to wxMSWDCImpl::DoSetClippingRegion() (what means that (x,y) doesn't represent top-left corner) we need to recalculate passed parameters to get the box with (x,y) at top-left corner.
This reverts commit 71dfb3b414 which fixed
appearance of the captions in high contrast mode but broke them for wxGTK.
Ideal would be to make this code work in wxGTK too or, in the worst, case only
use this code for wxMSW, but for now at least avoid breaking wxGTK appearance
by default.
See #16186.
1. Added checking if actual drawing output is really clipped at the edge of the clipping box.
2. Added tests for wxGCDC with GDI+, Direct2D, Cairo renderers under wxMSW.
3. Added new test to check calculations for bounding box set entirely outside DC area.
This improves their appearance especially when they're used as children of
wxNotebook, which uses a different background colour than plain wxPanel by
default.
This generalizes what was already done for wxChoicebook in 6cab632f
(see #12503) to all book controls.
Closes#16878.
Simplify the officialbuild.bat script by only checking for "vcXX" instead of
accepting both them and "vsYYYY".
Also add instructions for using it in the corresponding HOWTO.
Closes#17514.
This reverts 6c40531fb7 ("Make main thread wake
up code more efficient and less error-prone in wxMSW") as, while being more
efficient, the new code doesn't work at all when we're not running the message
loop ourselves as it happens when the user opens a menu or starts resizing a
window because in both cases Windows runs a local message loop dispatching the
messages itself and this message loop doesn't react to our event object being
signalled.
So this approach can't work and needs to be reverted, even if it reintroduces
the danger of overflowing the message queue (see #9053).
Closes#17579.
Disable thread-safe initialization for static local variables in Visual Studio
2015 when XP toolset is used as this results in crashes when using DLLs under
XP, see #13116.
Closes#17403.
Allocating 100px (+ margins) for empty listboxes in wxMSW resulted in a
surprising behaviour when the best size of a listbox became (significantly)
smaller after adding some items to it.
One possible solution could be to ensure that all listboxes are at least as
wide as empty ones, but it seems wrong to insist on always allocating 100+ px
when a listbox could be much narrower.
So try to mitigate the problem by making the empty listboxes narrower by
default which should reduce the chance of them becoming narrower still after
appending some items to them, even if it doesn't completely eliminate it.
Also, as a side effect, this commit replaces non-font-and-DPI-dependent
hard-coded 100px value with a more reasonable value based on text metrics.
Due to an oversight, it wasn't declared as const, making it impossible to
subtract from a const wxTimeSpan object.
Fix this and add a unit test verifying that this compiles and works as
expected.
Closes#17583.
If there is no wxBitmap selected into wxMemoryDC which is passed to wxGraphicsContext then there is raised an assertion warning (harmless in this context but caught and reported by CppUnit). To suppress this message we need to select any bitmap into wxMemoryDC prior to creating a wxGraphicsContext.
Try to make it possible to understand where exactly do the GTK+ errors
appearing in the buildbot slaves output originate from by installing a custom
Glib log handler and prefixing the normal log messages with the name of the
test running when they're generated.
This required a small refactoring of DetailListener which is now always
installed, in order to always have access to the current test name, but still
needs to be explicitly enabled to produce output.
Destroying a window with mouse capture results in an assert, which is
translated into an exception when running the test suite. As this exception is
thrown from wxWindowBase dtor, it results in an immediate program termination
when using C++11 and can also have the same effect even when using C++98 if
this exception is thrown while already handling another exception due to a
test failure.
Try to avoid this by using a "safe" DeleteTestWindow() function instead of
deleting the window directly. Currently this function ensures that the window
doesn't have mouse capture before deleting it, but it could also be used to
check for other things later. Also, this commit only uses this function for
the two controls which do happen to be destroyed with mouse capture currently
(at least when using wxGTK), but it should probably be generalized to all
controls in the future.