Paul Cornett [Mon, 19 Aug 2013 17:25:56 +0000 (17:25 +0000)]
Remove DoSetSizeHints() call from Create()
The reason it was added does not seem to be reproducible anymore,
and it interferes with wxRESIZE_BORDER on Ubuntu.
Closes #14870
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:28 +0000 (13:28 +0000)]
Only give capture to wxPopupTransientWindow child if it's the only one.
This removes the arbitrariness of using the first child which didn't make any
sense when the popup had several controls inside it, e.g. in wxRichToolTip
case this resulted in the mouse capture being given to wxStaticBitmap showing
the tooltip icon even though it didn't need it at all.
This probably doesn't really change the observable behaviour but seems more
logical.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:23 +0000 (13:28 +0000)]
Use wxFindWindowAtPoint() for hit testing in wxPopupTransientWindow.
This works even with irregularly shaped windows such as wxRichToolTip unlike
the old naive test using wxRect::Contains() which didn't and resulted in us
believing that the mouse was outside the window when it was still in it and
(somehow, the details are not totally clear) recapturing the mouse again and
again in the same window which resulted in assert failures with the new checks
in wxWindowBase::CaptureMouse() or the capture stack corruption before this.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:19 +0000 (13:28 +0000)]
Return NULL from wxWindow::GetCapture() when the capture is being lost.
Make GetCapture() return NULL during wxEVT_MOUSE_CAPTURE_{LOST,CHANGED} events
processing in wxMSW to help their handlers to avoid calling ReleaseCapture():
this shouldn't be done as the mouse capture is being lost anyhow and results
in reentrancy problems between NotifyCaptureLost() and ReleaseCapture() if
it's called.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:16 +0000 (13:28 +0000)]
Make mouse capture checking asserts stronger and more detailed.
Verify not only that we don't destroy the window having the capture now but
also that this window is not in the mouse capture stack at all, not
necessarily on top. This is important as keeping a dangling pointer in the
capture stack would result in difficult to diagnose bugs later.
Also check that we don't recapture the mouse in the same window as this should
never be necessary.
Finally, give more details in the assert checking that the window does have
capture in ReleaseMouse().
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:13 +0000 (13:28 +0000)]
Don't set even try to set focus to wxPopupWindow itself in wxMSW.
This doesn't work anyhow with our popup window implementation (it's a child of
the desktop and we can't set focus to it) and provokes error messages due to
::SetFocus() failures, so simply don't do this at all.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:06 +0000 (13:28 +0000)]
No changes, just use wxRecursionGuard instead of manual boolean flag.
Use wxRecursionGuard with the flag indicating whether the mouse capture is
changing to ensure that we always reset it correctly and make the code
slightly shorter.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:02 +0000 (13:28 +0000)]
No changes, just move mouse capturing bookkeeping data out of wxWindow.
All mouse capture-related data doesn't have to be declared in wxWindow itself
and can just be global in wincmn.cpp, so move it there, this will facilitate
further changes as they won't require recompiling everything any more.
Paul Cornett [Sat, 17 Aug 2013 16:25:13 +0000 (16:25 +0000)]
Avoid calling gtk_window_get_position() from "configure-event" handler, if possible.
This avoids a round trip to the X server, which is expensive over a remote connection.
Closes #15116
Vadim Zeitlin [Fri, 16 Aug 2013 11:04:39 +0000 (11:04 +0000)]
Replace wxFONTFAMILY_DEFAULT with wxFONTFAMILY_SWISS when comparing fonts.
Otherwise comparison always failed as no existing fonts had
wxFONTFAMILY_DEFAULT as their family in all ports except wxOSX, which does
keep wxFONTFAMILY_DEFAULT.
r72935 introduced code that created a temporary wxComboBox control to
take measurements. This is very expensive in MSW and adds noticeable
delay when creating more than a few controls.
Replace with equivalent wxMSW code that computes the height in the same
way other wxMSW controls do.
The wxGTK version cannot be eliminated in the same way, so at least add
some basic caching there. It's much less of a problem, because GTK+
controls creation is much cheaper than MSW one.
Vadim Zeitlin [Tue, 13 Aug 2013 17:36:47 +0000 (17:36 +0000)]
Don't hide the window in its dtor in wxGTK.
This results in sending an unexpected wxShowEvent to an already half-destroyed
(because the derived class dtor had been already executed) by now object which
could provoke crashes. And it also seems to be completely unnecessary as the
window is going to be destroyed anyhow -- and the other ports don't hide it
before this happens (unless it's a TLW in which case it is already hidden in
wxTopLevelWindowBase::Destroy()).
Vadim Zeitlin [Fri, 9 Aug 2013 20:55:20 +0000 (20:55 +0000)]
Remove never implemented wxDateTime::IsGregorianDate().
This method was declared and even documented but never actually implemented,
and GregorianAdoption enum used by it had many incorrectly defined elements.
Just remove both the method and the enum instead of fixing/implementing them
as they are not that important (as witnessed by the fact that nobody has
complained about the method being missing since almost 15 years).
Václav Slavík [Wed, 7 Aug 2013 17:33:42 +0000 (17:33 +0000)]
Make wxOwnerDrawnComboBox::DoGetBestSize() twice as fast.
Don't call the very expensive wxComboCtrlBase::DoGetBestSize() method
when not needed - it calls wxComboCtrlBase::DoGetSizeFromTextSize(),
which is very expensive.
Also fix the code so that it doesn't apply GetSizeFromTextSize() twice
(once in the base class' DoGetBestSize(), once here).
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:38 +0000 (11:08 +0000)]
Document light grey colour handling in wxMSW wxBitmap::LoadFile().
For historical/compatibility reasons we handle this colour as transparent in
wxMSW when loading the bitmaps from resources, but this is rather not obvious
for the new users, so document it and provide a way of compensating for this
in the documentation as well.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:33 +0000 (11:08 +0000)]
Define __VISUALC__ for ICC under Windows again.
During the refactoring of r74496, the logic of the check for Intel compiler
was slightly altered resulting in not defining __VISUALC__ for it any longer
which broke compilation with it.
Restore this definition now to fix it, even though it could admittedly be
better to explicitly check for __INTELC__ in the places where we currently
only check for __VISUALC__ and reserve the latter only for the case when we
are really using MSVC.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:21 +0000 (11:08 +0000)]
Update Travis configuration to run tests and build more configurations.
Install libcppunit-dev in order to be able to run the unit tests (at least the
non-GUI ones for now).
Also build in several configurations: shared/static, multilib/monolithic and
also STL. This should help to find problems appearing only in some specific
build variants.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:12 +0000 (11:08 +0000)]
Don't use DDEExec registry key in wxMSW wxExecute() if it's empty.
Some file types have DDEExec subkey in the registry but no value for it, don't
use DDE for launching the files of these types in this case as this only
results in errors.
Vadim Zeitlin [Tue, 6 Aug 2013 17:00:00 +0000 (17:00 +0000)]
Don't generate any events from wxSpinCtrl and wxSpinCtrlDouble methods.
After the changes of r53758 wxMSW didn't generate any wxEVT_TEXT events but
this was still the case for the generic version (and hence for
wxSpinCtrlDouble under MSW too) and wasn't documented.
Fix all versions to avoid sending events for programmatic actions, add unit
tests checking this behaviour and document it.
Vadim Zeitlin [Tue, 6 Aug 2013 16:59:54 +0000 (16:59 +0000)]
Add test for absence of events from wxSpinCtrlDouble ctor.
Run the same NoEventsInCtor() test as we already had for wxSpinCtrl for
wxSpinCtrlDouble as well.
Unfortunately currently there is no way to reuse the tests between these two
classes, we should refactor these test cases to use a common
SpinCtrlTestCaseBase<T> base class.
This method allows to get the full width needed by wxPropertyGrid and is
useful for determining the space to allocate for it, e.g. when creating a
popup showing the property grid, as shown by the changes to the sample.
Paul Cornett [Tue, 6 Aug 2013 06:05:38 +0000 (06:05 +0000)]
Rewrite ConvertToGreyscale() and ConvertToDisabled()
They do almost the same thing, so use almost the same code.
Fixes ConvertToDisabled() modifying its own data.
Closes #15389
Václav Slavík [Sat, 27 Jul 2013 19:39:37 +0000 (19:39 +0000)]
Make wxComboCtrlBase::Set*groundColour() methods public.
SetForegroundColour() and SetBackgroundColour() were -- presumably
accidentally -- protected in wxComboCtrlBase, even though they are
documented public virtual methods of wxWindow. This prevented their
use from user code.
Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.
If nothing else, this will make an eventual transition to Git simpler.
Fix duplicate symbol link errors in wxMSW wxTextEntry code.
Don't include <initguid.h> too soon, as this affects the headers included
after it instead of just our own uses of DEFINE_GUID() as intended.
This resulted in link errors because of duplicate definitions of the many
standard GUIDs when using MinGW for which we include, for whatever reason,
shlguid.h.
Since r74585, wxWindow::SetCanFocus() is called from wxStaticBoxBase ctor,
i.e. before the real window is created, and this results in a crash in wxGTK
where SetCanFocus() needs a valid widget.
Fix this simply by doing nothing in SetCanFocus() if the widget is not created
yet as this should result in the same behaviour as before r74585. This doesn't
seem like the right thing to do, however, and we should probably remove this
call from wxStaticBoxBase ctor and do it in wxStaticBox implementation itself
instead.
Fix tab navigation bug with radio boxes without enabled items.
There was a bug similar to the one in the preceding commit with radio boxes
under wxMSW too: if all radio box buttons were disabled (or hidden, although
this should be much more rare in practice, unlike the disabled case which was
deemed to be rare in r74583 commit message but turned out to actually happen),
the radio box still pretended to accept focus but didn't really do it.
Fix this by allowing to override wxWindow::CanBeFocused() and do it in
wxRadioBox to check whether we have any enabled visible items.
Also add a check for CanBeFocused() to wxControlContainer code.
Fix tab navigation bug with static boxes without enabled children.
wxControlContainer::AcceptsFocusFromKeyboard() returned true even if the
control didn't have any currently enabled -- and hence accepting focus --
children. This resulted in strange wxEVT_NAVIGATION_KEY propagation as it
unexpectedly wasn't handled in the control which pretended to accept focus and
instead bubbled up back into the parent, resulting in the focus returning to
the first child of the parent instead of skipping the static box with disabled
children and going to the next enabled child.
Fix this by checking that we have children that can be focused right now and
not only children that are focusable. Notice that this doesn't take care of
calling wxWindow::SetCanFocus() correctly when the children enabled/disabled
state changes so there might still be other problems, notably under wxGTK
where SetCanFocus() does something non-trivial, but it at least improves
things under wxMSW.
Radio boxes refused to take focus from keyboard as their
wxControlContainer::AcceptsFocusFromKeyboard() always returned false because
the base wxStaticBox class disabled setting the focus to the control itself
and wxRadioBox doesn't have any children at wx level in wxMSW.
Fix this by reenabling "self focus" in wxRadioBox to make it possible to
accept focus from keyboard. This is not ideal as it doesn't take into account
e.g. radio boxes without any items or with all items disabled or hidden, but
this should be rare and would require virtualizing all children access at
wxControlContainer level, i.e. would be quite non-trivial so don't do this for
now as this, at least, fixes the navigation in common/normal case.
Also remove the unnecessary AcceptsFocus() override from wxRadioBox as this is
now done at wxControlContainer level.
No real changes, just refactor wxControlContainer code a little.
Extract the call to wxWindow::SetCanFocus() into a separate
UpdateParentCanFocus() function as it can be necessary to do it from places
other than UpdateCanFocusChildren() too.
Rearrange Windows checks in wx/platform.h to be more logical.
Use __WINDOWS__ symbol as the primary symbol indicating Windows instead of
using all of _WIN32, __WIN32__ and __WINDOWS__.
Also automatically define __WINDOWS__ if __WXMSW__ is defined as this port
only can be used under Windows and doing it like this fixes compilation in the
case when the platform ends up being not defined at all, closes #15342.
Finally, don't assume Windows by default but give an error if we can't detect
the platform. This shouldn't happen in practice but seems a safer thing to do
if it ever does happen.