Commit Graph

63242 Commits

Author SHA1 Message Date
Paul Cornett
cd1c3fab0c Use static linkage for various local names 2017-09-24 09:29:26 -07:00
Paul Cornett
925a1c0734 Avoid assert when deleting last item from wxListCtrl
See #17959
2017-09-24 08:51:48 -07:00
Artur Wieczorek
086793ceef Fix sending SPIN_UP/DOWN events when value wraps around (wxGTK)
SPIN_UP/DOWN events should represent the arrow being pressed,
not a direction in which the value changed (see documentation).

Closes #17957.
2017-09-23 19:08:29 +02:00
Paul Cornett
fd33fcf191 Use static linkage for various local names 2017-09-22 10:45:56 -07:00
Paul Cornett
18edcfab00 Fix memory leak when wxDataViewCtrl is deleted (wxGTK)
Need to delete wxGtkTreeModelNode structure
2017-09-22 10:29:52 -07:00
Artur Wieczorek
3b0a539045 Ensure that new value sent in EVT_SPIN_UP/DOWN is never out the range (wxMSW)
The new value sent in the event cannot be just set to the current value +/- 1. Wrapping and actual limits has to be taken into account.

See #17957.
2017-09-22 15:39:16 +02:00
Artur Wieczorek
a9843a7492 Send EVT_SPIN_UP/DOWN events also when wxSpinButton value wraps around (wxOSX)
EVT_SPIN events should be sent at every value change, not only if it's changed by +/- 1.

See #17957.
2017-09-22 15:28:12 +02:00
Artur Wieczorek
3d5e84b229 Update transparency flag for wxBitmap created from wxIcon
Just created wxBitmap has "hasAlpha" flag set to false so it needs to be modified if source wxIcon contains transparency values.

Closes #17953.
2017-09-22 09:44:10 +02:00
Vadim Zeitlin
4d388e351c Fix Direct2D graphics context after wxPenInfo changes
At least in wxMSW wxPen::GetStipple() returns a non-null (but invalid)
bitmap even when pen style is not wxPENSTYLE_STIPPLE, so don't test for
this bitmap when creating a wxGraphicsPen from a wxPen but for the style
directly.

This avoids using this invalid bitmap later in D2D code, where it
resulted in assert failures.

Also add a similar style test before calling wxPen::GetDashes() for
consistency, even if it doesn't seem to be strictly necessary.

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

Closes #17958.
2017-09-21 18:04:24 +02:00
Václav Slavík
c515c43fd5 Fix wxDataViewCtrl::ClearColumns() crash on macOS 10.13
When replacing m_OutlineView with a new one in ClearColumns(), we must
explicitly remove the old one from its superview to ensure that no more
drawing operations are pending for it. Without this change, Cocoa
drawing code would occasionally crash on attempting to message the
now-zombie m_OutlineView instance. This happened in older macOS
versions too, but became much more frequent in 10.13 High Sierra.
2017-09-21 14:02:41 +02:00
Václav Slavík
03e93b277e Fix wxCommandLinkButton explicit initial size 2017-09-21 14:02:41 +02:00
Artur Wieczorek
e2bfba21fe Fix sending EVT_SPIN_DOWN/UP events in Cocoa implementation of wxSpinButton
To determine which wxSpinButton arrow was clicked, in the action handler there is compared current NSStepper value (after the actual change) with the value before the change. This former value is fetched in the internal mouse click event handler which is invoked before the action handler. This method of determining a delta works fine as long as the current value remains unchanged between the execution of the internal mouse click event handler and the action handler. But if the current value is explicitly changed (by calls to SetValue(), SetRange()) in some handler(s) invoked between these two (like e.g. bound EVT_LEFT_DOWN handler), calculated delta can be invalid and therefore wrong EVT_SPIN_DOWN/UP events can be sent.
To get correct delta value we should to keep track of all explicit changes made to the current value starting from the mouse click and up to the entry to the action handler.

Closes #17955.
2017-09-21 13:45:13 +02:00
Anil Kumar
22a4feea53 Update current item in generic wxDataViewCtrl::SetSelections()
SetSelections was clearing the previous selection, invalidating the
current item, but didn't set it after selecting the new items.

This was causing issues in keyboard selection, e.g. pressing Shift+click
didn't select all the items between the selected and the clicked ones.

Fix this by making the last item of the new selection current, which is
the expected behaviour considering that SetSelections() should be
equivalent to calling SetSelection() with all items one by one.

Signed-off-by: Anil Kumar <anilkumar8753@gmail.com>

Closes https://github.com/wxWidgets/wxWidgets/pull/557
2017-09-19 22:32:21 +02:00
Vadim Zeitlin
78fdea89b1 Fix wxGetWinVersion() description in a comment
No real changes, just update the comment after the changes of commit
dcf95e1cdc to avoid saying that
wxWinVersion_Unknown is 0.
2017-09-18 17:51:25 +02:00
Vadim Zeitlin
5db73ec9b1 Use wxScopedArray<> instead of wxScopeGuard in wxTGAHandler
Using smart array class is better than using ad hoc scope guards for
freeing memory in any case, but in this particular case it also helps to
avoid g++ 7 -Wnoexcept-type warnings due to type of free() changing to
become "void(*)() noexcept" in C++17.
2017-09-17 18:17:58 +02:00
Vadim Zeitlin
dcf95e1cdc Change MSW version checks to work for yet unreleased versions
wxGetWinVersion() will return wxWinVersion_Unknown for any MSW version
not recognized by the version of wxWidgets used when building the
application, so it makes sense to use a value higher than all currently
known ones for this constant, so that the checks comparing the result of
wxGetWinVersion() with any known version would still work correctly.

E.g. comparisons like wxGetWinVersion() >= wxWinVersion_Vista will now
continue to work for binaries built using the current wxWidgets even
under some future Windows 11 OS version, unlike before.
2017-09-17 13:16:14 +02:00
Gian-Carlo Pascutto
a8b33bf08e Make the private.h header compatible with Clang.
The include/wx/msw/private.h header contains a violation of the C++
standards that MSVC tolerates but Clang/LLVM does not.

WinBase.h contains the definition:
    #define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)

Which wxWidgets uses in:
    template <wxUIntPtr INVALID_VALUE =
        (wxUIntPtr)INVALID_HANDLE_VALUE>

The (effective) reinterpret_cast-ing of INVALID_HANDLE_VALUE in
WinBase.h means that the define isn't actually usable as a constant
expression for the template parameter.

Clang has indicated they have no intention of adding an MSVC
compatibility workaround for this problem. See LLVM bug 12116:
https://bugs.llvm.org/show_bug.cgi?id=12116

Given this, rework the wxWidgets header to remove the default
template parameter value (it is not used anywhere).
With this change, it's possible to compile wxWidgets applications
using Clang/LLVM (5.0) under MSVC.
2017-09-17 13:12:30 +02:00
New Pagodi
33ad8063d6 Add Scintilla FineTicker methods to wxSTC
Starting with version 3.5, Scintilla implemented a newer method for
handling timers and used this method in its Windows, GTK+, Cocoa, and Qt
ports. This patch attempts to bring the timer handling for wxSTC in line
with those other ports.

Closes #17949.
2017-09-17 11:12:34 +02:00
Artur Sochirca
6c01707627 Don't use wxTreeCtrl item insertion workaround under modern MSW
Don't refresh the control unnecessarily after inserting the first child
node when using modern (i.e. post-XP) MSW version, this just slows down
inserting of the first child item in big trees.

Closes https://github.com/wxWidgets/wxWidgets/pull/555
2017-09-13 17:32:25 +02:00
Vadim Zeitlin
81d9952dfe Really fix spurious asserts in wxGTK wxDataViewCtrl::EditItem()
This replaces the changes of 24c0401e81
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

Closes #17946.
2017-09-13 17:25:48 +02:00
Vadim Zeitlin
e48676cf4a Fix input buffer overflow in wxZip code
Don't crash when reading malformed ZIP files with incorrect field
lengths for the extra fields.

Closes #17947.
2017-09-13 14:46:11 +02:00
Vadim Zeitlin
d25d2400fc Fix crash in wxGraphicsPen::CreatePen() after wxPenInfo changes
Don't unconditionally dereference the result of wxPen::GetStipple()
which can (and often is) null.

This fixes crash introduced in 40f8403f5d.
2017-09-13 14:02:45 +02:00
Paul Cornett
85ea9c180d Use ctor-initializer for non-trivial members 2017-09-12 09:51:53 -07:00
Paul Cornett
a357fefaf4 Use const_cast in new code 2017-09-12 09:47:55 -07:00
Vadim Zeitlin
97dcc02db5 Fix wxQt compilation after first week day changes
Fix typo in its version of wxCalendarCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-11 19:48:09 +02:00
Vadim Zeitlin
40f8403f5d Merge branch 'peninfo'
Add wxPenInfo and wxGraphicsPenInfo which allows to specify fractional
pen widths when using wxGraphicsContext.

Closes #17087.

Closes https://github.com/wxWidgets/wxWidgets/pull/472
2017-09-10 21:45:47 +02:00
Vadim Zeitlin
f19012c62c Merge branch 'firstweekday' of https://github.com/lanurmi/wxWidgets
Add API for determining the first day of the week and use it in
wxCalendarCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-10 21:41:36 +02:00
Vadim Zeitlin
2bb6ac7051 Refactor all wxPen ctors to use wxPenRefData(wxPenInfo) ctor
Centralize all pen creation logic in a single place (in each port) in
the new wxPenRefData ctor taking wxPenInfo.
2017-09-10 15:48:31 +02:00
Vadim Zeitlin
8bad0e494f Get rid of wxGraphicsPenInfo::CreateFromPen()
This is a helper method used only in wxWidgets itself and only once, so
just inline it at the point of use to avoid exporting an unnecessary
function in the public API.
2017-09-10 01:53:02 +02:00
Vadim Zeitlin
76fd05b147 Leave only wxGraphicsRenderer::CreatePen(wxGraphicsPenInfo) overload
It doesn't make much sense to require all the graphics backends to
create wxGraphicsPen from either wxPen or wxGraphicsPenInfo when the
former can be handled just once in the common code.

So do just this, leaving CreatePen() overload taking wxGraphicsPenInfo
where the real pen construction takes place and implementing
wxGraphicsPen creation from wxPen in the common wxGraphicsContext code.

This is not 100% backwards-compatible as any code inheriting from
wxGraphicsRenderer and overriding its CreatePen() will now be broken,
however this should be extremely rare (there is no good reason to
inherit from this class in the user code) and result in compile errors
if it does happen.
2017-09-10 01:48:30 +02:00
Vadim Zeitlin
af3581758b Don't mention wxPenInfoBase in the documentation
This is an implementation detail, don't confuse the user with this
template class which isn't supposed to be used in the user code.

Also improve the example in the documentation, the old one (using pen of
width 0 but with a colour) didn't make much sense.
2017-09-10 01:29:39 +02:00
Vadim Zeitlin
a156d5fa40 Extract wxPenInfoBase in a separate header
This allows to avoid dependency of wx/graphics.h on wx/pen.h.
2017-09-10 01:24:16 +02:00
Vadim Zeitlin
cc14a80501 Make wxPenInfoBase constructor protected
This class is never supposed to be created directly.
2017-09-10 01:11:25 +02:00
Vadim Zeitlin
cc91a7d6d4 Minor formatting and style changes in wxPenInfo code
Use more standard formatting, wrap some overlong lines.
2017-09-10 01:11:06 +02:00
Adrien Tétar
999c750ca7 Review feedback 2017-09-10 01:02:21 +02:00
Adrien Tétar
2305604565 Introduce wxGraphicsPenInfo class 2017-09-10 01:02:20 +02:00
Adrien Tétar
bc562289c6 Introduce wxPenInfo class 2017-09-10 01:02:06 +02:00
Stefan Csomor
f045323934 Adding native macos Cocoa implementation for overlays into build files 2017-09-09 23:34:50 +02:00
Stefan Csomor
a0f924191e Fixing vertical mirrored drawing for overlay on macos 2017-09-09 19:32:18 +02:00
Artur Wieczorek
abfd27db91 Fix PCH-less build
Add missing includes for compiling without WX_PRECOMP after 4d8c1fc890.
2017-09-09 16:29:42 +02:00
Stefan Csomor
8ad0039b71 Further implementation of native overlay on Cocoa
Should work for Caret,  still has a problem with the transformation matrix otherwise, too many things have changed there for me to find a quick solutions.
2017-09-09 11:44:43 +02:00
Stefan Csomor
4d8c1fc890 Using another API for popup menus on modal dialogs
Using popupMenuPositioningItem leads to several problems on modal dialogs - the validation and action callbacks are not used, thefore we revert in this situation to using the older API, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-08 14:35:49 +02:00
Stefan Csomor
102edb544d Fixing Popup Menu with Submenus
Submenus have to turn off autoenablind as well, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-07 20:27:49 +02:00
Stefan Csomor
37191f6f16 Only set font color if explicitly set
Otherwise eg the default button doesn't get its white font color.
2017-09-07 19:00:43 +02:00
Stefan Csomor
41d042516d Exposing Colour Flags, adding Synonym UseBackgroundColour for UseBgCol
No abbreviations in method name, include new methods in docs
2017-09-07 11:30:10 +02:00
Artur Wieczorek
627870be90 Restore wxButton's feature to use focus bitmap for hover state (wxMSW)
Prior to 2.9.2, if the focus bitmap was specified but current one wasn't, the focus bitmap was used for hovering as well.
This feature was entirely discarded in b4354db179 (see wxBitmapButton::DoSetBitmap) but it is still described in the documentation of wxButton's states and images. It seems it was removed unintentionally, so let's restore it.
2017-09-06 14:10:46 +02:00
Artur Wieczorek
52d6b0ae85 Don't discard all current input processing flags in response to WM_GETDLGCODE
Some current input processing flags, like DLGC_HASSETSEL, should be retained because they are in use (in wxWindowMSW::SetFocusFromKbd() for instance).

Closes #17945.
2017-09-06 12:34:20 +02:00
Stefan Csomor
51e7994cff Adding Borders and Multi-Line calculations also when native best size is available
Otherwise wxTE_MULTILINE are getting a tiny one-line minimal size, and the border as to be added as well.
2017-09-06 09:54:35 +02:00
Gavin Kinsey
d24ffcf749 Fix wxHTML parse bug in non-unicode, ? characters are not displayed.
GetEntitiesParser()->GetCharForCode(NBSP_UNICODE_VALUE) in the non-unicode
build returns the value '?' as it doesn't find a match for that value.  The
parser then proceeds to replace all '?' characters in the HTML document with
NBSP.

Change the type of the #define to be unsigned int rather than wxChar for
non-unicode to fix this.

Closes #17692.
2017-09-05 21:57:52 +02:00
Roberto Perpuly
361d7b4938 Fix popup menu items being always disabled in Mac OS X (#549)
Menus on Mac use automatic menu enabling, meaning that the system will enable
menu items only if the app responds to the menu item action. If I understand
correctly, the responder chain for menus in popup dialogs stop at the dialog
window, so the system thinks that the app does not handle the menu items.

This fix should not affect existing code since the wxWidgets user-facing API
dictates that apps specifically disable menu items.

Fix #17459

See Apple docs on automatic menu enabling at

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-BAJBFGED
2017-09-05 20:28:45 +02:00