Commit Graph

64812 Commits

Author SHA1 Message Date
Vadim Zeitlin
43ce00b5bd Call base class version from overridden DestroyClippingRegion()
No real changes, just call wxDCImpl::DestroyClippingRegion() from
the overridden versions in the derived classes instead of calling
ResetClipping(): this makes the code more clear as it follows the usual
pattern of the derived class doing something first and then forwarding
to the base class.

Also, as ResetClipping() is not really useful, add a comment documenting
that it shouldn't be used in the new code.
2018-06-19 00:17:43 +02:00
Vadim Zeitlin
110ace680b Remove unnecessary calls from wxDCImpl ctor
There is no need to call neither ResetBoundingBox() nor ResetClipping()
when the variables they reset had just been initialized to the same
values in the ctor initializer list.
2018-06-19 00:17:43 +02:00
Vadim Zeitlin
070336470f Make wxSVGFileDC::GetClippingBox() actually work
wxSVGFileDCImpl class uses the default, i.e. inherited from wxDCImpl,
implementation of this method, but for it to work, the clipping box
coordinates stored in wxDCImpl need to be updated when the clipping
region changes or is destroyed and this wasn't done before.

Fix this now and add a unit test verifying that this indeed works.
2018-06-18 17:11:16 +02:00
Vadim Zeitlin
6a442d2723 Remove unnecessary clipping virtual methods from wxSVGFileDCImpl
These methods seem to be useless as they're never called, only the
corresponding DoXXX() methods are used by wxDC.
2018-06-18 17:07:14 +02:00
Vadim Zeitlin
350867939a Add bool return value for wxDC::GetClippingBox()
Determining whether there is an actual clipping region or not is not
that simple, as shown by the recent problems in wxDCClipper code, so
return a boolean value indicating this from GetClippingBox() directly,
instead of requiring the caller to find it out on their own.

This simplifies wxDCClipper code, as well as any other code calling
GetClippingBox(), at the price of some extra complexity in wxDCImpl
itself, which seems to be worth it.
2018-06-18 14:39:11 +02:00
Vadim Zeitlin
e13904308f Add convenient tags for clipping box unit tests
No real changes, just replace the old CppUnit test registration macros
with wxREGISTER_UNIT_TEST_WITH_TAGS() which allows to specify the tags
explicitly and use "clip" as the tag for all the tests here to allow
running all of them (and just them) by specifying "[clip]" on the test
program command line.
2018-06-18 10:54:26 +02:00
Vadim Zeitlin
119dce5eb8 Fix check for existing clipping region in wxDCClipper
wxDC::GetClippingBox() is actually supposed to return a rectangle equal
to the total wxDC area and not an empty rectangle if there is no
clipping box at all, so avoid restoring the old clipping region
unnecessarily in this case too: even if it should be harmless, it's
still unnecessarily inefficient and, in practice, this is not really
harmless neither as wxPdfDC (from the third party wxPdfDocument library)
doesn't handle having a clipping region set when adding a new page
correctly and so using wxDCClipper broke PDF generation.

This fixes another fallout from 2a8c290e0d

See #13834.
2018-06-18 10:21:59 +02:00
Vadim Zeitlin
fe0f9fefe4 Refactor wxDCClipper ctors to use a common Init() method
No changes, this is just a pure refactoring to facilitate the upcoming
change which won't have to be done in all these ctors any more.
2018-06-18 10:18:34 +02:00
Stefan Csomor
805db8baa8 Dark Mode for wxRenderer for HeaderButtons and Sashes
see #18146
2018-06-17 18:39:01 +02:00
Stefan Csomor
d2aafff4a2 Second part of support for Dark Mode for wxRibbon, use flat appearance starting from 10.10
see #18146
2018-06-17 17:32:11 +02:00
Stefan Csomor
12f8e4b5c3 First part of support for Dark Mode for wxRibbon
see #18146
2018-06-16 10:44:27 +02:00
Stefan Csomor
60c1a4be8b Fixing implementation of wxSYS_COLOUR_INACTIVECAPTIONTEXT 2018-06-16 10:36:46 +02:00
Stefan Csomor
caa2fde425 added missing override 2018-06-15 10:06:17 +02:00
Vadim Zeitlin
7da13b273c Fix wxOSX compilation problem due to missing wx/settings.h
Include the header required by the code using wxSystemSettings added in
5091d87825

See #18146.
2018-06-14 22:33:53 +02:00
Stefan Csomor
56d125041f Use built-in conversion to CGColorRef where available 2018-06-14 20:11:26 +02:00
Stefan Csomor
5091d87825 Support Dark Mode for Status Bar
see #18146
2018-06-14 20:09:37 +02:00
Paul Cornett
016a506eee add GtkWidgetPath wrapper class 2018-06-14 10:41:27 -07:00
Naser Buhamad
1adc3ba4ee Fix menu bar background colour in wxQt
wxMenuBar is a native, not generic, window, so pass "false" to
PostCreation() to use the correct colours for it.
2018-06-13 23:53:58 +02:00
Stefan Csomor
9cef8282ab Supporting Appearance Mode change under macOS 10.14
The system color functions depend on the current appearance, this is not automatically set to the effective appearance (that can be changed during runtime via the system preferences), added a helper class to make sure the correct version is used for retrieval.
2018-06-13 23:02:50 +02:00
Stefan Csomor
ebe70d2af0 Adding macOS 10.14 constant 2018-06-13 18:58:05 +02:00
Stefan Csomor
2acda98337 Fixing NSColor value for wxSYS_COLOUR_WINDOW
controlBackgroundColor should be used as a background for large controls like lists etc. this corresponds to the usage of wxSYS_COLOUR_WINDOW, thanks to dkulp
2018-06-12 23:14:44 +02:00
Václav Slavík
cd02c548f4 Implement wxEVT_SYS_COLOUR_CHANGED in wxOSX (#832)
Starting with macOS 10.14 Mojave, system colors can change dynamically
when the user switches between light and dark modes. Detect this by
observing the effectiveAppearance property and emit
wxSysColourChangedEvent accordingly.

See #18146.
2018-06-12 20:27:50 +02:00
Vadim Zeitlin
f4d4545873 Explicitly disable all warnings from windows.h for MSVC
While Windows headers compile without warnings at maximal warning level,
they still contain some warnings which are disabled by default, but can
be enabled explicitly, such as C4668.

Make life simpler for the user code doing this by avoiding giving these
warnings from the Platform SDK headers as it doesn't cost much to do
this from wxMSW itself, while doing it from the user code is nontrivial.
2018-06-12 19:52:26 +02:00
Stefan Csomor
71bb680a93 Using NSColor System Colours
Removing the old HITheme Constants for the last two wx system colours, first step for Dark Mode support, see https://trac.wxwidgets.org/ticket/18146
2018-06-11 22:38:05 +02:00
Vadim Zeitlin
93edcaef20 Fix wrong function pointer casts in dynamic arrays code
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.

To fix this, overload wxBaseArray::Sort() to accept either the "legacy"
sort function compatible with qsort() or a function compatible with
std::sort(), as it seems both variants could be used before. Also make
the type of the latter function customizable via a new optional Sorter
template parameter in wxBaseArray in order to allow wxSortedArrayString
to specify its own variant of it, taking (const) references instead of
values.

This complicates things, but should preserve compatibility while being
type-safe and, also, allows to simplify _WX_DEFINE_SORTED_TYPEARRAY_2 by
not passing the sort function signature to it any more.
2018-06-10 23:51:13 +02:00
Vadim Zeitlin
6294511a4e Merge branch 'gcc8-msw-warns'
Fix tons of warnings given by default by gcc 8, potentially fixing some
real problems in Win64 build in the process.

See https://github.com/wxWidgets/wxWidgets/pull/822
2018-06-10 23:41:05 +02:00
Vadim Zeitlin
0d176db96d Merge branch 'array-less-macros'
Use templates to implement the legacy dynamic array classes as much as
possible instead of doing it in macros.

This makes the code much more maintainable and readable as well as
easier to debug.

It also allows to avoid casts between function pointers of incompatible
types, which triggered many -Wcast-function-type warnings from g++ 8.
2018-06-10 22:56:03 +02:00
Vadim Zeitlin
96d9616201 Merge branch 'html-print-cleanup'
Simplify wxHTML pagination code and make it easier to reuse from
applications.

See https://github.com/wxWidgets/wxWidgets/pull/817
2018-06-10 14:56:33 +02:00
Vadim Zeitlin
64fc4dc6cd Merge branch 'aui-docview'
Make it possible to easily use AUI classes instead of the standard MDI
docview frames.

Also fix a few old and dirty hacks in AUI code.

See https://github.com/wxWidgets/wxWidgets/pull/808
2018-06-10 14:53:39 +02:00
Maarten
ce903da798 Fix glitch in AUI frame with standard wxToolbar
When the height of the AUI toolbar pane is higher than the wxToolbar, the extra
area shows a glitch. This happens because the paint handler never draws on this
area. Clearing the DC of the frame with the AUI background colour fixes this.

See https://github.com/wxWidgets/wxWidgets/pull/829

Closes #18138
2018-06-08 19:17:22 +02:00
Paul Cornett
b839388c82 Avoid GLib warning "couldn't find weak ref" with wxBitmapComboBox
Should have been part of c391cfd617
2018-06-06 09:09:12 -07:00
Paul Cornett
102be6a3cc Add GtkStyleContext helper class
Manages ownership of GtkStyleContext and GtkWidgetPath, provides functions
for creating and querying style contexts.
2018-06-05 09:21:25 -07:00
Vadim Zeitlin
c8f563f269 Merge branch 'master' of https://github.com/mmmaisel/wxWidgets
Make wxRibbonButtonBar buttons more customizable.

See https://github.com/wxWidgets/wxWidgets/pull/762
2018-06-04 23:03:24 +02:00
Tim S
bc92ed9d85 Replace wxUSE_GENERICDATAVIEWCTRL with wxHAS_GENERIC_DATAVIEWCTRL
The former symbol is inconsistent with all the other wxUSE_XXX ones and
hence confusing and kept only for compatibility reasons.

Closes https://github.com/wxWidgets/wxWidgets/pull/827
2018-06-04 18:26:34 +02:00
Vadim Zeitlin
546604ab55 Fix wrong function pointer casts in dynamic arrays code
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.

Use normal, taking elements by value, sort function for in wxBaseArray
methods used by the sorted arrays only and provide Sort() overloads for
both this sort function variant and the compatible with qsort() one
taking pointers to the elements.
2018-06-03 23:27:38 +02:00
Vadim Zeitlin
bec3cf6387 Work around gcc 8 -Wcast-function-type in event table macros
Suppress the warnings about formally incorrect but working in practice
cast from an event handler taking an object of a class derived from
wxEvent to wxEventFunction, i.e. a handler taking just wxEvent itself.
2018-06-03 22:47:50 +02:00
Vadim Zeitlin
1abdac6566 Work around gcc 8 -Wcast-function-type in wxMSW wxGLContext
Casts between incompatible function types seem to be unavoidable here,
as wglGetProcAddress() always returns generic PROC type, so just
suppress the warnings temporarily.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
ed01fede2e Add helper macros for suppressing gcc 8 -Wcast-function-type
These warnings are unavoidable in a few places, and testing for gcc
version and suppressing them is too verbose, so define helper macros
making it a bit less painful.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
cc56eed564 Avoid gcc8 -Wcast-function-type in hash map macros in Win64 build
BucketFromNode typedef must be defined as a function returning size_t,
as GetBucketForNode() method in the classes generated by hash map macros
does, to avoid warnings about bad function pointer casts in Win64 build,
where size_t is not the same thing as "unsigned long".
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
a17a8f667f Use wxZeroMemory() rather than memset() for clearing struct fields
This does the same thing but avoids gcc 8 -Wclass-memaccess warning
(harmless in this case, but potentially useful elsewhere, so it seems
better to work around rather than disable it).
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
2ec97b7bc6 Remove useless border style check from wxVListBox::Create()
The comparison could never be true as wxDEFAULT is not one of
wxBORDER_XXX values and so is not included in wxBORDER_MASK and so was
useless -- and just results in -Wtautological-compare from gcc 8.

Simply remove this check, a047aff270 added
it apparently to use themed border by default for wxVListBox, but this
was done in a better way in 28319afe55.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
89b7c500ff Use the same definitions of wx{Get,Set}WindowXXX() in Win{32,64}
By now all compilers/SDKs should hopefully have {Get,Set}WindowLongPtr()
and GWLP_XXX constants, so there is no reason to keep separate, and
differing by return type in wxGetWindowProc() case (oversight?),
versions of these functions for Win32 and Win64 builds.

Combine them in a single version appropriate for both cases.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
f75bee21ec Use correct function type pointers in wxQTMediaBackend code
This avoids gcc 8 -Wcast-function-type warnings while not being
obviously less (nor more...) correct than the old version.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
ef26c969cb Use correct DLGPROC callback signature in Win64 build
The callback used with CreateDialogIndirect() must return INT_PTR, which
is 64 bits under Win64, not LONG, which is still 32 bits.

This fixes a gcc8 -Wcast-function-type warning and might fix a real bug
in Win64 build too.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
4d1145787b Fix wxKeyboardHook() callback signature in Win64 build
The callback must return LRESULT, which is 64 bits under Win64, not
int, which is still 32 bits.

This fixes a gcc8 -Wcast-function-type warning and might fix a real bug
in Win64 build too.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
4230cb24de Add WXWNDPROC typedef and use it in wxMSW instead of WXFARPROC
WNDPROC and FARPROC are not the same thing in MSW and it's wrong to use
WXFARPROC as the type of different window procedures we use.

Introduce WXWNDPROC which is more clear and correct and use it instead.

Also get rid of a few casts which are not necessary any longer.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
7624e31a95 Stop passing WNDPROC argument to wxCheckWindowWndProc()
This parameter wasn't used anyhow and casting wxWndProc or m_oldWndProc
to WXFARPROC just resulted in gcc8 -Wcast-function-type warnings.

Get rid of them by not passing the window proc to this function at all.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
004af0b963 Use correct DDE callback signature in Win64 build
Don't use the deprecated since Win16 (!) and doing nothing
MakeProcInstance() and fix the signature of DDECallback() which was
actually wrong in Win64 build but the problem was hidden due to the
casts done inside and outside MakeProcInstance() before.

Remove this macro and fix the signature to actually conform to the real
callback one.

This also fixes another gcc8 -Wcast-function-type warning.
2018-06-03 22:47:04 +02:00
Vadim Zeitlin
0cda7c2f13 Mention that dynamic array classes are obsolete more clearly
Update the documentation of the classes themselves and the containers
overview.
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
0e99ab2c49 Use template functions instead of WX_XXX_ARRAY() macros
Trivially rewrite macros as functions.

No real changes.
2018-06-03 17:12:12 +02:00