Commit Graph

17922 Commits

Author SHA1 Message Date
Vadim Zeitlin
48faeb65b3 Fix copy ctor in numeric validators classes
wxFloatingPointValidator and wxIntegerValidator copy ctor didn't copy
the associated window, so it was lost when the validator was Clone()'d.

Fix this by correctly using wxValidator copy ctor, instead of the
default one, in the copy ctor of the common wxNumValidatorBase base
class.
2018-01-04 21:39:57 +01:00
Vadim Zeitlin
f83d16aa46 Undefine min and max before using them in wx/valnum.h
Avoid problems when using this header in code also include <windows.h>
(and not doing it via wx/msw/wrapwin.h) by ensuring that min and max
used here are not defined as macros.
2017-12-26 04:29:42 +01:00
Vadim Zeitlin
5a949efc5c Fix sending wxEVT_TEXT_ENTER when using auto-completion in wxMSW
We need to explicitly generate this event from the char hook handler as
we don't get the normal WM_CHAR for it, it is apparently intercepted by
the window proc installed by the auto-completing code, so check if
wxTE_PROCESS_ENTER is used for the text entry and call a special new
MSWProcessSpecialKey() method to do the right thing if it is.

Similarly, handle Tab presses correctly if wxTE_PROCESS_TAB is used.

Closes #12613.
2017-12-25 19:29:25 +01:00
Vadim Zeitlin
fdf47e8e12 Fix colours and fonts of wxStaticBox label window in wxMSW
Inherit from wxCompositeWindowSettersOnly<> to make sure all the usual
setters, such as SetForegroundColour() and SetFont(), called on
wxStaticBox are propagated to the label window too.

However also prevent SetBackgroundColour() from being propagated
unnecessarily -- because the checkbox already inherits the parent
background colour by default in wxMSW anyhow -- and still override
SetFont() to adjust the label window position after the font change,
otherwise it could be truncated after increasing the font size, for
example.

Because of these issues, wxCompositeWindowSettersOnly is not ideally
suited for its use here, but on balance it still seems to be better to
use it rather than reimplement parts of its functionality here.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
329af399eb Factor out wxCompositeWindowSettersOnly class
Extract this class from wxCompositeWindow, as sometimes it can be
convenient to just define the setter functions to do the right thing for
a window containing sub-windows, but without dealing with focus too.

This will be used in wxMSW wxStaticBox in the next commit.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
687192d86a Add support for arbitrary window labels in wxStaticBox to wxMSW
Just reparent the label window and position it accordingly and, also,
avoid painting over it in MSW-specific code.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
59ca9b93a0 Make wxCompositeWindow ctor protected
As this class is only supposed to be used as a base class, its ctor
doesn't need to be, and hence ought not to be, public.

Also update an outdated comment stating that the ctor didn't do anything
when it, in fact, does perform an important task.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
598c62a267 Don't change wxCompositeWindow size from SetLayoutDirection()
Remove wxSIZE_AUTO from the SetSize() call, this was completely
unnecessary and unexpectedly (and wrongly) resized composite windows
managed by sizers as SetLayoutDirection() side-effect.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
91875045ac Don't make wxStaticBoxBase::GetBordersForSizer() inline
Move the function definition to the source file, there doesn't seem to
be any reason to keep it in the header.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
8c06a24da4 Move m_labelWin to wxStaticBoxBase itself
It will be reused by all platforms and is not specific to wxGTK.

This also means WXDestroyWithoutChildren() doesn't need to be virtual
any longer.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
7c849276f8 Add support for using arbitrary windows as wxStaticBox labels
This commit implements the new feature in wxGTK and updates the sample
and the documentation.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
29bd25b757 Add GTKDoApplyWidgetStyle() helper
This allows to call the protected wxWindowGTK::DoApplyWidgetStyle()
method when it's really necessary, e.g. when forwarding to it from
DoApplyWidgetStyle() implementation for another window.
2017-12-24 22:35:45 +01:00
Vadim Zeitlin
aa47c15abd Add WXDestroyWithoutChildren() and use it from wxStaticBoxSizer
Factor out the code from wxStaticBoxSizer dtor into a wxStaticBox method
to improve encapsulation: the static box knows better than another class
how to detach its children from it before destroying it.

No real changes yet.
2017-12-24 22:35:45 +01:00
Vadim Zeitlin
87afebd6f2 Inline wxStaticBox ctors in wxGTK
No real changes, just make the trivial ctors of this class inline for
consistency with the new ctor about to be added.
2017-12-24 22:35:45 +01:00
jonkraber
2a8c290e0d Restore previous clipping box in wxDCClipper
Remember the clipping box of the previously active clipping region in
wxDCClipper ctor and restore it in its dtor.

See #13834.
2017-12-24 15:46:57 +01:00
Paul Cornett
b573315e7f Add wx_is_at_least_gtk3() helper 2017-12-19 09:41:26 -08:00
Paul Cornett
b2ea617145 Avoid deprecated gtk_text_iter_begins_tag() 2017-12-17 21:51:36 -08:00
Paul Cornett
ba4da9fdf9 Use "new" GDK keysym names
Old names are no longer available with GTK+4
2017-12-17 21:51:16 -08:00
kathoum
f1dfb27cb1 Use the same ABI version string for MSVS 2017 as for MSVS 2015
MSVS 2017 (which uses _MSC_VER from 1910 to 1912 currently) is
ABI-compatible with MSVS 2015 (_MSC_VER 1900), so do allow linking code
compiled with one of them with the library built by the other one.

Closes #18024.
2017-12-16 15:57:02 +01:00
Vadim Zeitlin
ed23de08c7 Minor clean up of wxPersistentDataViewCtrl
Add another helper function, make variables const when possible, fix
some small style problems.

No real changes.
2017-12-15 15:26:32 +01:00
Vadim Zeitlin
e5b12b5bc8 Merge branch 'dvc-persist' from iwbnwif
See https://github.com/wxWidgets/wxWidgets/pull/541
2017-12-15 14:10:01 +01:00
Vadim Zeitlin
6c7e5a9200 Allow attaching a wxWindow to CWnd later in wxMFCWnd
When using two-step creation, as when loading from resources, for
example, it can be convenient to create wxMFCWnd as part of the (parent)
wxWindow object, but only attach it to the real HWND later, once it
becomes available.
2017-12-12 18:46:29 +01:00
Vadim Zeitlin
44c31d2700 Destroy MFC main window when its wx counterpart is destroyed
This avoids using m_pMainWnd after its HWND becomes invalid, as this
resulted in assert failures from CWnd::WalkPreTranslateTree() called
with this HWND as its hWndStop argument from PreTranslateMessage() which
was used to pre-translate a WM_NULL message the application sometimes
received while closing down.
2017-12-12 17:20:36 +01:00
Vadim Zeitlin
636219bd35 Always pre-process messages for wx windows in mixed wx/MFC apps
Still use the active event loop if there is one, just in case it
customizes messages pre-processing, but fall back on the standard
pre-processing code even if there is no active wx event loop and we're
only running the MFC one, as without doing this there are just too many
things that don't work (e.g. menu accelerators didn't work at all in
mixed wx/MFC applications previously).
2017-12-11 22:06:13 +01:00
Vadim Zeitlin
3960e630f1 Make it possible to use an existing base class for wxMFCWinApp
When porting an existing MFC codebase to wxWidgets, it may be useful to
continue using the existing CWinApp-derived application class, so allow
deriving wxMFCApp from it instead of always deriving it from CWinApp
itself.
2017-12-11 21:03:18 +01:00
Vadim Zeitlin
042d922e88 Allow predefining wxUSE_UNICODE_WINDOWS_H in wxMSW builds
This can be used in order to use normal Unicode build of wxWidgets with
an application that needs to use ANSI versions of Win32 functions, e.g.
because it doesn't compile with UNICODE defined.
2017-12-11 21:03:18 +01:00
Vadim Zeitlin
9dd83933f3 Remove redundant sections from wx/msw/winundef.h
Somehow we redefined GetFirstChild() and GetNextSibling() twice in a row
for the last ~18 years.
2017-12-11 21:03:17 +01:00
Vadim Zeitlin
acf53800fc Extract reusable part of the MFC sample in a header
Allow reusing this functionality from outside the library, it can he
useful if an MFC window needs to be embedded into a wx application (or
vice versa).

Also use a better wxEntryStart() overload as a side effect, this should,
in particular, fix the problem with command line arguments processing in
mixed MFC/wx applications pointed out in a comment in the sample
previously.
2017-12-11 21:03:17 +01:00
Maarten Bent
6168e44846 Remove unused defines from private wxMSW header 2017-12-10 23:23:30 +01:00
Maarten Bent
f696d035a6 Remove unused variables from wxRadioBox
These variables never got assigned a value.
2017-12-10 23:23:29 +01:00
Maarten Bent
febd929f0f Improve wxRadioBox width on wxMSW
Do not use 'RADIO_SIZE 20' as the fixed width of the radio button, but use the actual width as returned by wxRendererNative.
wxRendererNative has no GetRadioButtonSize, so for now use GetCheckBoxSize. It returns the same sizes.
Also add a half character width to account for the space between the button and the label.
There is no need to add extra width to the label of the static box.

Closes #18010.
2017-12-10 23:22:13 +01:00
Vadim Zeitlin
b5d0a291a5 Merge branch 'msw-double-buffer'
Improve double-buffering support in wxMSW wxListCtrl and optionally use
it in wxTreeCtrl too.

Closes https://github.com/wxWidgets/wxWidgets/pull/636
2017-12-10 17:47:31 +01:00
Steve Browne
ef91e5ecbe Implement wxTreeCtrl::SetDoubleBuffered() in MSW wxTreeCtrl
Also don't erase background when the control is double-buffered because
it's not necessary and can cause flicker.

See https://github.com/wxWidgets/wxWidgets/pull/374
2017-12-10 17:47:26 +01:00
Vadim Zeitlin
17105cfd07 Simplify changing window styles in wxMSW code
Add wxMSWWinStyleUpdater and wxMSWWinExStyleUpdater helper classes which
allow writing code changing GWL_STYLE and GWL_EXSTYLE bits,
respectively, in a shorter and more clear way.

There should be no real changes in behaviour.
2017-12-10 17:47:16 +01:00
Vadim Zeitlin
588ae3744c Move fallback BS_TYPEMASK definition to wx/msw/missing.h
It can be useful in source files other than src/msw/control.cpp too.
2017-12-10 17:47:11 +01:00
Vadim Zeitlin
badf6bc300 Disable scrollbars for frozen wxTreeCtrl in MSW
Replace the hack with resizing the control to the minimal possible size
while it's frozen with just disabling its scrollbars in the frozen
state. This should also fix the original problem (of scrollbar jumping
around wildly as the items are added), but without different problems
due to the control being resized unexpectedly.

Unfortunately we don't have a reproducer for the original problem, which
the commits 6754c300cf ("Freeze wxTreeCtrl
in wxMSW by hiding it") and 4e1e8dc51b
("Change wxMSW wxTreeCtrl::DoFreeze() to not hide the tree any more" --
but resize it instead) tried to fix, so it's difficult to be sure that
it really doesn't exist any more, but it does seem like it ought to be
as the comment added back then spoke of the problem with scrollbar
updating and this really shouldn't happen if scrollbars are completely
disabled.

See https://github.com/wxWidgets/wxWidgets/pull/375
2017-12-10 17:47:06 +01:00
Vadim Zeitlin
f4af243e5c Enable wxUSE_GRAPHICS_CONTEXT for MinGW >= 4.8
It seems that MinGW-w32 started distributing GDI+ headers since this
version and MinGW-w64 might have supported them for even longer, but
it's difficult to test for the MinGW distribution used in this header,
as it is included before wx/msw/gccpriv.h which defines
__MINGW32_TOOLCHAIN__ and __MINGW64_TOOLCHAIN__ symbols and changing
this is tricky due to relative order of defining UNICODE and
wxUSE_UNICODE and including MinGW headers, which can only be included
once UNICODE is set properly.

But while the fully correct solution is difficult, just checking for the
compiler version should solve the problem in 99.99% of the cases in
practice as there should be vanishingly few people using MinGW-w64 with
gcc < 4.8 currently, so this simple solution is good enough.

Closes #17973.
2017-12-08 19:42:21 +01:00
pavelxdd
504c22a512 Fix wxURLDataObject comment and documentation for wxGTK
Fix a copy-and-pasto in the header and also mention that wxURLDataObject
derives from wxDataObjectComposite, and not wxTextDataObject, in wxGTK
too.

Also add a note about the exact base class being an implementation
detail.

Closes https://github.com/wxWidgets/wxWidgets/pull/624
2017-12-08 13:14:19 +01:00
Vadim Zeitlin
140d6fea88 Add wxString ctor from wxScopedCharBuffer and wxMBConv
This is more convenient and less error prone than using the existing
ctor taking char pointer and length as the buffer contains both.

Also add the corresponding assign() overload for consistency.

See #16490.
2017-12-06 03:41:25 +01:00
Vadim Zeitlin
6e678e3a85 Improve output of test failures for unprintable characters
Show non-printable characters when comparing strings more clearly if the
comparison fails, this is notably useful for strings containing NULs as
they were previously completely lost.
2017-12-06 03:23:26 +01:00
Paul Cornett
696a5ba3dd Fix for modified state not set after next change following a ChangeValue()
See #17540
2017-12-05 06:41:08 -08:00
Paul Cornett
a671974bab Fix ribbon page layout wrong when scroll button is shown or hidden due to a scroll operation
See #17454
2017-12-03 10:04:23 -08:00
Vadim Zeitlin
3e0adbf541 Merge branch 'gesture-events'
Integrate GSoC 2017 work by Prashant Kumar implementing support for
gesture events.

Closes https://github.com/wxWidgets/wxWidgets/pull/551

Closes https://github.com/wxWidgets/wxWidgets/pull/565
2017-12-02 18:46:53 +01:00
Vadim Zeitlin
d83cd91d13 Merge branch 'tz-fixes'
Miscellaneous fixes for time zones and DST handling in wxDateTime.

This still leaves 2 big problems:

1. We have no support for using the correct time zone offset at the
   given date and always use the current time zone offset, which may,
   and often is, wrong.

2. Our code for converting to/from broken down representation doesn't
   handle DST at all, so support for DST is non-existent for the dates
   before 1970-01-01 or after 2038-01-01 (i.e. roughly outside of the
   32 bit time_t range).

See #10445 and the other tickets linked from there.
2017-12-02 16:28:05 +01:00
Vadim Zeitlin
543c522cb8 Explicitly disambiguate local time zone from UTC
Don't rely on time zone offset to check whether it is local as this
doesn't, and can't, work for the local time zone in Great Britain which
uses the same offset as UTC, but does use DST, unlike the latter.

Add a unit test (albeit disabled by default) checking that the code that
previously didn't work correctly in BST does work now (run the tests
using "TZ=Europe/London ./test wxDateTime-BST-bugs" under Unix to test).

Closes #14317, #17220.

See #10445.
2017-11-29 23:02:22 +01:00
Vadim Zeitlin
7728c3a86d Fix linking code using wxDataViewCheckIconText under Unix
The class needs to use WXDLLIMPEXP_ADV in order for its (default,
compiler-generated) dtor to be generated inside the library, otherwise
this doesn't happen and linking code using this class inside a shared
library fails with errors due to the dtor being undefined.
2017-11-29 15:27:10 +01:00
Vadim Zeitlin
39dc254bf4 Don't call time() from wxLogRecordInfo ctor
This is a tiny optimization (or maybe not so tiny on platforms other
than Linux where time() might not as fast as just reading a memory
location), but mostly is done to work around faketime bug[*] which
prevented it from being used for testing programs using wxWidgets, such
as our own unit tests because time() was called from wxLogTrace() in
wxCSConv::DoCreate() called when creating global conversion objects
during the library initialization.

Arguably, it might be better to avoid calling wxLogTrace() during the
initialization, but this can't be done as simply and this change might
have a small performance benefit too.

[*] https://github.com/wolfcw/libfaketime/issues/132
2017-11-29 02:22:16 +01:00
Vadim Zeitlin
310c45a5e2 Merge branch 'deprecated' of https://github.com/MaartenBent/wxWidgets
Fixes for deprecation and other warnings in samples and demos.

See https://github.com/wxWidgets/wxWidgets/pull/617
2017-11-26 17:30:49 +01:00
Vadim Zeitlin
302fc5190a Merge branch 'gtk2-version-checks'
Simplify GTK+ 2 version checks with a helper function.

See https://github.com/wxWidgets/wxWidgets/pull/614
2017-11-25 22:18:31 +01:00
Paul Cornett
23e3323655 Add non-const overload for GetToolByPos()
See #16763
2017-11-25 10:57:23 -08:00