Commit Graph

64480 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
97684a9267 Replace object array macros with template class too
Put the code implementing object arrays, i.e. arrays owning pointers to
the objects, into wxBaseObjectArray<> instead of _WX_DECLARE_OBJARRAY
macro.

Also simplify WX_DEFINE_OBJARRAY() by leaving only the definitions of
functions creating and destroying the objects in it (they have to be
there and not in the template itself to allow using template with
incomplete classes).
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
aaa9c80d66 Replace most of _WX_DEFINE_SORTED_TYPEARRAY_2 with template too
Add wxBaseSortedArray<> template instead of putting all the code inside
_WX_DEFINE_SORTED_TYPEARRAY_2 macro.

There should be no changes, but the code is now easier to read and
modify.
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
06f554775c Add unit test for wxTextCtrl::HitTest() for single line controls
Note that the control needs to be created with a reasonable size for
HitTest() to work correctly (at least under MSW, but probably not only),
so change the test set up function to use some fixed size for all kinds
of controls instead of doing it only for the multi-line ones.
2018-06-03 17:05:11 +02:00
Vadim Zeitlin
690b95646b Implement wxTextCtrl::HitTest() for single line controls in wxGTK
Use Pango API to find the character at the given position.

Closes #18144.
2018-06-03 17:05:11 +02:00
Vadim Zeitlin
085e4c354a Show HitTest() result on left click in "Text" widgets sample page
Right clicking didn't work under wxGTK where it just showed the context
menu, so use left click handler instead and check whether "Alt" is
pressed.

Also add a note to make this test more discoverable.
2018-06-03 16:36:03 +02:00
Vadim Zeitlin
b0d6b11ebe Always use wxVector<> for dynamic arrays implementation
Dramatically simplify dynamic array macros by keeping only the
implementation previously used in wxUSE_STD_CONTAINERS case and dropping
the other one, as we can use the std::vector-based implementation on top
of our own wxVector<>, which is available whether wxUSE_STD_CONTAINERS
is 0 or 1.

This allows to get rid of tons of ugly macro-based code without breaking
compatibility.
2018-06-02 13:56:06 +02:00
Vadim Zeitlin
950b1a9d51 Merge branch 'replace-connect-bind'
Replace almost all occurrences of wxEvtHandler::Connect() with Bind().

See https://github.com/wxWidgets/wxWidgets/pull/820
2018-06-01 18:31:59 +02:00
Vadim Zeitlin
356c93dc3c Merge branch 'staging' of https://github.com/stahta01/wxWidgets_PR
Better documentation for __WXGTKXXX__ constants.

Closes https://github.com/wxWidgets/wxWidgets/pull/825
2018-06-01 18:20:27 +02:00
Tim S
f295dfdd0c Add (2.6) to "GTK+ 2.0 or higher" 2018-06-01 09:03:39 -04:00
Tim S
60b7bc037f Replace use of __WXGTK24__ with __WXGTK20__
Corrected the change to WXGTK by using WXGTK20 instead
2018-06-01 08:49:48 -04:00
Václav Slavík
dcac98d7e8 Fix cursor flicker after popup menu in rich wxTextCtrl
After bd650ec and cad2b9c, showing a popup menu in wxTextCtrl with
wxTE_RICH2 and then dismissing it without choosing a command would
result in the cursor flickering between arrow and beam cursors until
another context menu was shown.

See https://github.com/vslavik/poedit/issues/483

Fixed by checking if the popup menu is still valid (and so shown) in
the cursor handling code.
2018-06-01 10:10:43 +02:00
Vadim Zeitlin
9042a3fb16 Use shrink_to_fit() to implement Shrink() in C++11 build
If std::vector<> has shrink_to_fit() method, just use it instead of
using the swap-with-a-temporary hack.
2018-06-01 01:47:40 +02:00
Tim S
e3a9643d2a Replace use of __WXGTK24__ with __WXGTK__ 2018-05-31 19:30:53 -04:00
Tim S
cce9fc7f15 Update wxGTK defines to match code 2018-05-31 19:30:53 -04:00
Vadim Zeitlin
f9721266ae Replace 90% of _WX_DECLARE_BASEARRAY_2 with a template class
Use template class instead of a macro to make it easier to read and
modify this code.

No real changes.
2018-05-31 23:39:39 +02:00
Paul Cornett
74904281e4 Free widget path, should have been part of 900752b152 2018-05-31 11:11:21 -07:00
Vadim Zeitlin
724409a10c Simplify wxSortedArray_SortFunction used in STL build
There is no need to pass the function type as the template parameter as
it's determined by the type of the objects being compared anyhow.
2018-05-31 19:47:08 +02:00
Paul Cornett
900752b152 Implement wxSYS_VSCROLL_X/wxSYS_HSCROLL_Y metric for wxGTK 2018-05-31 10:08:20 -07:00
Vadim Zeitlin
5f7a6bd15b Replace Connect() with Bind() in all samples and utils too
Still use Connect() in unit tests which were written explicitly for it
and in EventConnector, which can't use Bind() as it uses a variable for
the event type.

No real changes, just use the newer and more convenient function.
2018-05-31 16:19:23 +02:00
Vadim Zeitlin
3d9d46b754 Don't send "page changed" events from wxNotebook dtor with GTK+ 3
These events are unexpected and inconsistent with the other platforms,
including GTK+ 2, so make sure we don't send them during the
destruction.

Closes https://github.com/wxWidgets/wxWidgets/pull/821
2018-05-31 11:42:11 +02:00
Vadim Zeitlin
a69cbd3d0c Merge branch 'wrap-gtk.h'
Add a wrapper for gtk/gtk.h allowing to avoid gcc 8 warnings when
including the GTK+ header directly.

See https://github.com/wxWidgets/wxWidgets/pull/814
2018-05-31 01:28:40 +02:00
Vadim Zeitlin
e11a187f7b Merge branch 'msvc-setup_h-monolithic'
Add support for auto-linking monolithic library when using MSVC too.

Closes https://github.com/wxWidgets/wxWidgets/pull/806
2018-05-31 01:23:59 +02:00
Vadim Zeitlin
30c2bbf081 Factor out WXUSINGDLL check in MSVC-specific wx/setup.h
Don't repeat the same check for !defined(WXUSINGDLL) many times.

No real changes, this is just a simplification (which should be viewed
with "git diff -w --color-words" to see how little has really changed).
2018-05-31 01:21:20 +02:00
PB
46ba9ca2f9 Fix automatic linking with MSVC for monolithic builds
MSVC users can simplify their projects by prepending
$(WXWIN)\include\msvc to the compiler include directories, which results
in automatic including the build-specific setup.h and linking all
required wxWidgets and system libraries.

This worked only for the default multilib builds but not for monolithic
builds where wxWidgets libraries are created and named differently.

This patch allows the users (by defining wxMONOLITHIC=1 in their
project) to use it also for monolithic builds.
2018-05-31 01:13:16 +02:00
Vadim Zeitlin
d4f380e16e Use Bind() instead of Connect() in wxWidgets code
Use more modern function which allows to avoid wxXXXEventHandler()
macros use.

No real changes.
2018-05-30 13:06:20 +02:00
Vadim Zeitlin
8c8ff2c24d Merge branch 'tar-memset-warn'
Fix a bunch of -Wclass-memaccess in tar streams code.

See https://github.com/wxWidgets/wxWidgets/pull/813
2018-05-27 23:10:46 +02:00
Vadim Zeitlin
424f64f27d Fix invalid cast in wxMSW AutoHANDLE::InvalidHandle()
Somehow this compiled with the previous gcc versions (as well as MSVS),
but a static_cast from an integer wxUIntPtr type to a pointer HANDLE
type is obviously invalid and a reinterpret_cast is needed here.

This fixes compilation with g++ 8.
2018-05-27 22:56:05 +02:00
Vadim Zeitlin
b55578e40c Fix HTML pagination test for high DPI values
The standard margins, expressed in millimeters, could result in the
usable page space being much smaller than 1000px used for the DC size
when using higher DPIs, which means that the test checking that a 2400px
image took only 3 pages could fail, as it could require 4 of them in
this case.

Fix this by getting rid of the margins, as this should ensure that the
page height is exactly 1000px now, independently of the actual DPI.
2018-05-27 22:43:28 +02:00
Vadim Zeitlin
8dffab0556 Add another page-break-before test to pagination unit test
Check that the nested elements with this style are handled as expected.
2018-05-27 22:28:33 +02:00
Vadim Zeitlin
adfde70054 Remove redundant wxHtmlDCRenderer::m_NumPages
The actual number of pages is given by the number of elements in
m_PageBreaks vector after CountPages() is shown and is unknown until
then, so m_NumPages is completely unnecessary and can be just removed.
2018-05-25 01:35:34 +02:00
Vadim Zeitlin
bf9712978a Document wxHtmlDCRenderer::FindNextPageBreak()
This is a useful (even if mostly trivial) function, so document it and
mention it in Render() documentation too.
2018-05-25 01:32:31 +02:00
Vadim Zeitlin
8d7601295b Make wxHtmlDCRenderer::FindNextPageBreak() const
It doesn't modify the renderer.
2018-05-25 01:31:54 +02:00