Commit Graph

67582 Commits

Author SHA1 Message Date
Paul Cornett
9c5ec2f959 Restore resetting of wxMiniFrame cached decor size
This was inadvertently lost in 8cdd20667f, apparently causing wxRESIZE_BORDER
functionality to stop working on some platforms. See #18591
2019-11-28 09:03:38 -08:00
Vadim Zeitlin
2eb312b5f9 Avoid changing checkbox background in wxGrid under non-MSW
Doing this makes the checkbox unusable with the default GTK 3 theme as
the default grid background colour (white) is the same as the colour of
the check mark -- so changing the checkbox background to it makes it
invisible.

Work around this by adding a new SetTransparentPartColour() method that
can be used by wxGrid (and, in the future, user code if we decide that
this is really the best solution to this problem that we can provide) to
make the checkbox blend in with its background without actually changing
its appearance.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
e2bb8b05bf Factor out common checkbox-related code into CheckBoxInfo
No real changes, just extract the same code used in both GTK 2 and GTK 3
implementations of GetCheckBoxSize() and DrawCheckBox() in a helper
class which is now just used from both places.

This makes the code more clear and hopefully easier to maintain in the
future.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
9ae808dc86 Synchronize structure of DrawCheckBox() and GetCheckBoxSize()
Put GTK 3 version first in both functions instead of putting it in the
middle (!) of GTK 2 code in the former one for some reason.

No real changes, the code was just moved around (this commit is best
viewed with "git diff --color-moved").
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
ab02d36e10 Account for vertical alignment in wxGetGridCheckBoxRect() too
Do it if only for consistency with the horizontal alignment.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
6b63016fb2 Use helper wxRect::CentreIn()
No real changes, just make the code a bit more concise and clear.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
57f89c626c Fix the code which tried to account for too small cell rect
It didn't actually manage to do it as it used wrong comparison.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
4f6b29fb0c Remove "X" suffix from GRID_CELL_CHECKBOX_MARGIN_X
The same margin will be used in the vertical direction too.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
04b6fc2f90 Add another cell with boolean renderer/editor to the sample
No real changes, just test the boolean cells appearance with the default
white background too.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
851d11ba2c Determine the checkbox size in wxGetGridCheckBoxRect() itself
It doesn't make much sense to pass the size to the function supposed to
compute it, so call wxRendererNative::GetCheckBoxSize() from the
function itself instead of forcing its callers to do it.

No real changes.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
f4756eaa2f Centre checkboxes in wxGrid vertically by default
Make the alignment used by default in wxGridCellBoolRenderer and
wxGridCellBoolEditor consistent and centre the checkbox vertically in
both of them: previously only the editor tried to do it, but failed,
because the code wrongly overwrote the default alignment as it used
GetAlignment() instead of GetNonDefaultAlignment(), while the renderer
didn't even try.
2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
dacf25ac99 Support wxNO_BORDER for wxCheckBox under GTK2 2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
3ca9491c5f Improve grid editors placing
Remove the code in wxGrid::ShowCellEditControl() which moves grid
editors unnecessarily and also remove workarounds that were required
because of it in the editors SetSize() functions.

This helps to ensure that the editor is placed at the same position the
renderer draws the cell value, so that it doesn't jump around annoyingly
when editing starts (which was especially noticeable for boolean-valued
cells).
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
6a21d6f2e4 Add missing required header to wx/generic/private/grid.h
Make this header self-sufficient, instead of requiring wx/headerctrl.h
to be included before including it.

Remove the now unnecessary wx/headerctrl.h inclusion from
src/generic/grideditors.cpp.
2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
53ffbf6cf5 Allow ignoring margins in wxRendererNative::GetCheckBoxSize()
Add ability to get the size of the checkbox without any margins by
passing wxCONTROL_CELL flag: this can be useful when the checkbox is
part of some "cell", e.g. wxGrid one, and doesn't need any extra margins
around it.

Currently wxCONTROL_CELL is only really used by wxGTK2 implementation.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
4ca327b50a Declare AddTreeviewHeaderButton() only when it's defined
This method of wxGtkStyleContext uses a GTK function only available
since 3.20, and so can't be implemented for the earlier versions, hence
don't even define it in this case.

Note that the caller still needs to test for the run-time version.
2019-11-27 23:23:57 +01:00
Vadim Zeitlin
8997d06397 Fix build with GTK 3 < 3.20
Restore a check removed in d85794e87f as
it's still needed: AddTreeviewHeaderButton() is only defined for 3.20
or later.
2019-11-27 23:21:45 +01:00
Maarten Bent
bfe737e7e7 Fix build with wxUSE_FILE disabled 2019-11-27 21:25:14 +01:00
Maarten Bent
e80be3e3cb Fix unreferenced function warning with wxUSE_DRAG_AND_DROP disabled 2019-11-27 21:25:14 +01:00
Maarten Bent
d068bcfb57 Fix unreferenced parameter warning with wxUSE_ACCEL disabled 2019-11-27 21:25:13 +01:00
Maarten Bent
3d1a8ef54e Fix 'switch label contains default but no case' warning 2019-11-27 21:25:13 +01:00
Maarten Bent
0c212421f5 Fix building wxDebugReport without wxUSE_OWNER_DRAWN
replace wxCheckListBox with wxListBox.
2019-11-27 21:24:33 +01:00
Maarten Bent
5fefe1df11 wxUSE_ACCESSIBILITY requires wxUSE_OLE 2019-11-27 21:24:33 +01:00
Maarten Bent
3d9ee4852a CMake: fix build with wxUSE_OLE disabled
wxDirDialog falls back to using wxGenericDirDialog, add this file to the
sources.
2019-11-27 21:24:33 +01:00
Maarten Bent
b42de093f6 CMake: disable wxUSE_MIMETYPE when wxUSE_TEXTFILE is disabled 2019-11-27 21:24:32 +01:00
Maarten Bent
51fc85f16a CMake: disable options when ole or ActiveX is not available 2019-11-27 21:24:32 +01:00
Vadim Zeitlin
5ad2470504 Avoid disabling -Wcast-function-type when not using gcc 8
The changes of 173f035bc2 resulted in

unknown warning group '-Wcast-function-type', ignored [-Wunknown-warning-option]

diagnostics from clang (even clang-10) and, presumably, also from
versions of gcc earlier than 8, which added this option, so use the
special wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() macro added in
ed01fede2e just for this instead.

No real changes.
2019-11-27 17:39:21 +01:00
Paul Cornett
ae7fcc440c Use C++11 default copy ctor for wxUniCharRef
It's a little simpler, and still suppresses -Wdeprecated-copy warnings
2019-11-25 21:27:09 -08:00
Paul Cornett
4990515aba Avoid clang-cl -Wnon-virtual-dtor warning
Extend the existing workaround to all compilers, not just GCC
2019-11-25 21:16:00 -08:00
Paul Cornett
ef99c2a6db Avoid warning from clang-cl about unrecognized pragma 2019-11-25 21:05:35 -08:00
Paul Cornett
d3ea00b40f Remove an extraneous semicolon 2019-11-25 20:59:21 -08:00
Paul Cornett
173f035bc2 Suppress a GCC -Wcast-function-type warning
We're setting the same event handler GTK uses internally, so the warning isn't helpful
2019-11-25 20:58:16 -08:00
Paul Cornett
d85794e87f Remove some unnecessary GTK preprocessor version checks
The contained code no longer uses anything version-specific
2019-11-25 20:54:51 -08:00
Paul Cornett
0fab5eb071 Allow scrollwheel events when mouse is captured with GTK3, see #18593 2019-11-25 20:52:12 -08:00
Paul Cornett
abaccbc2e2 Fixes for checkbox rendering with GTK3
Size should include border and padding. Margin values seem to be for a checkbox with text
label, so don't include margin. Check mark should be drawn inside border and padding.
2019-11-24 23:31:09 -08:00
Artur Wieczorek
7b86958b25 Fix wxColour::GetAsString called for non-solid colour
Don't return RGB values if colour is not solid
and hence cannot be represented with these values.
Non-solid colour should be reported as an unknown
RGB value, e.g. '??????'.

Closes #18596.
2019-11-24 19:49:59 +01:00
Paul Cornett
fee30940b6 Take wxDC transformations into account when resetting clipping with GTK3
The paint update region is in device coordinates, it needs to be converted to
current logical coordinates to apply correctly. See #18584, #18560
2019-11-23 08:41:31 -08:00
Artur Wieczorek
e763ae96ac Fix wxSystemAppearance::GetName()
'NSApp.effectiveAppearance' is available for macOS
10.14+ not 10.9.

Closes #18595.
2019-11-22 18:41:43 +01:00
Maarten Bent
84edda2ba0 Fix wxSpinCtrl arrow position in RTL layout and High DPI
Just use hardcoded 2px overlap between the text control and the spin
buttons, as it doesn't seem to depend on the DPI and works in both LTR
and RTL modes, unlike the existing code, which claimed to work but
actually didn't.

Closes https://github.com/wxWidgets/wxWidgets/pull/1660
2019-11-22 15:23:07 +01:00
Vadim Zeitlin
a77b8f85bf Merge branch 'display-unique-modes' of https://github.com/MaartenBent/wxWidgets
Return unique modes from wxDisplay::GetModes() and minor improvements to
the display sample.

See https://github.com/wxWidgets/wxWidgets/pull/1659
2019-11-22 15:22:22 +01:00
Vadim Zeitlin
d51a9f9686 Use "wxWidgets application" in the manifests descriptions
We don't use "wxWindows" since many years.
2019-11-22 15:21:15 +01:00
GH Cao
c0c2260944 Add MSW manifests for ARM and ARM64 platforms
Closes https://github.com/wxWidgets/wxWidgets/pull/1657
2019-11-22 15:17:40 +01:00
Vadim Zeitlin
2bc6e50ede Wrap variable initializations after '=' consistently
Replace a few occurrences of

        type var
            = value;

with

        type var =
            value;

which is used much more widely in wx sources for consistency.

Also get rid of a couple of such lines, when it could be done easily.

No real changes.
2019-11-22 00:53:45 +01:00
Maarten Bent
136a43f033 Fix building display sample without wxUSE_DISPLAY 2019-11-21 23:43:04 +01:00
Maarten Bent
c4e54c78fd Select active mode in display sample
Update sample to use SizerFlags.
Set a minimum size to the dialog.
2019-11-21 23:43:02 +01:00
Maarten Bent
44cd0409cd Return unique modes from wxDisplay::GetModes 2019-11-21 23:18:12 +01:00
Vadim Zeitlin
73f0c9dff8 Fix crash with blocking accepting sockets in threads under Unix
Sockets returned by wxSocket::Accept() are non-blocking by default and
the only way to use them safely in worker threads is by switching them
to the blocking mode by calling SetFlags(wxSOCKET_BLOCK).

However this didn't work correctly since at least 2.8 days, as turning
wxSOCKET_BLOCK on didn't unregister the socket from the event loop, with
which it had been registered on creation. Fix this by doing this now,
which ensures that the main thread doesn't get any notifications about
the socket if it's used, in a blocking way, in a worker thread.

Note that making the new socket blocking after accpeting is still pretty
inefficient and pre-creating the socket as blocking and using
AcceptWith() is still preferable, but at least it does work now.

Closes #12886.
2019-11-20 20:21:25 +01:00
Vadim Zeitlin
51ea713826 Extend and rename wxSocketImpl::UnblockAndRegisterWithEventLoop()
In addition to unblocking and registering the socket, also support using
this function to make the socket blocking and unregistering it from the
event loop, if its flags include wxSOCKET_BLOCK.

This was already half-done by wxMSW, which took wxSOCKET_BLOCK presence
into account in its implementation, but not by the Unix implementation.
Now do it under all platforms, as this will be useful for switching a
previously non-blocking socket to blocking mode.

Finally, rename the function to better reflect what it really does.

See #12886.
2019-11-20 18:59:51 +01:00
Vadim Zeitlin
e0102c2396 Allow disabling events for blocking sockets in Unix version
It should still be possible to use DoEnableEvents() to disable events
for blocking sockets and this can be useful if a previously non-blocking
socket became blocking due to a SetFlags(wxSOCKET_BLOCK) call, so adjust
the fix of e18c8fd29a (see #17031) to
avoid calling EnableEvents() for blocking sockets instead of ignoring
them in DoEnableEvents() itself.

Also add an assert checking that we never try enabling events for
blocking sockets as this still doesn't make sense and so shouldn't
happen.

No real changes yet, but this is necessary for the upcoming commits.

See #12886.
2019-11-20 18:47:09 +01:00
Stefan Csomor
59d1cb8756 improving autorelease memory handling
life sample was using up memory when running in a tight loop, because the normal event autorelease pool was never reached
2019-11-20 16:23:52 +01:00