Vadim Zeitlin [Tue, 12 Jun 2012 22:15:38 +0000 (22:15 +0000)]
Slightly improve best size calculation for wxListCtrl with wxLC_NO_HEADER.
Use some arbitrary but relatively large width and height instead of falling
back to wxControlBase best size computation which, at least in wxGTK, simply
returns (1, 1) resulting in list control of unusably small size.
This is, of course, still far from ideal and we should really use the items to
calculate the best width but it at least allow the list control in the generic
log dialog to be shown correctly in wxGTK.
Vadim Zeitlin [Tue, 12 Jun 2012 21:57:02 +0000 (21:57 +0000)]
No real changes, just add a wxCHECK to GetDlgUnitBase().
Verify that we do have a valid TLW parent: even though this normally should be
always the case, it might not be when the window is being created or destroyed,
see #14355.
Vadim Zeitlin [Tue, 12 Jun 2012 21:56:58 +0000 (21:56 +0000)]
Fix crash in wxStaticBox::HandleEraseBkgnd() in wxMSW on closing.
Don't process WM_ERASEBKGND if we're being destroyed. This is at best useful
and at worst harmful as we currently crash in wxStaticBox::GetClientSize() if
there is no valid TLW parent.
Vadim Zeitlin [Tue, 12 Jun 2012 21:42:02 +0000 (21:42 +0000)]
Remove another unneeded TOOLKIT test from the bakefiles.
Don't check the toolkit unnecessarily, this doesn't really change anything
right now but will not break wxGTK build under MSW when support for it is
added.
Vadim Zeitlin [Tue, 12 Jun 2012 21:41:50 +0000 (21:41 +0000)]
Don't use generic wxListCtrl style for wxListMainWindow.
This resulted in double border around wxListCtrl contents in wxOSX and almost
certainly other ports except wxGTK for which we already had an explicit
preprocessor check in the generic list control code. Remove it and simply
don't use any wxListCtrl-specific styles, including borders, for its main
window as it doesn't make any sense.
Vadim Zeitlin [Tue, 12 Jun 2012 21:41:40 +0000 (21:41 +0000)]
Make wxMSW tree item unlocking reentrant.
Handle creating nested TreeItemUnlocker objects correctly. This fixes the
problem when a wxTreeCtrl method unlocking some item is called with another
item is already unlocked, e.g. from a selection changed event handler.
Vadim Zeitlin [Sun, 10 Jun 2012 11:57:20 +0000 (11:57 +0000)]
Fix wxHTMLDataObject compilation and memory leaks.
Use wxString::FromUTF8() and utf8_str() instead of directly using wxConvUTF8
as this is simpler and also works correctly in non-Unicode build (and more
efficiently in UTF-8 build as no conversion is done there).
Do not allocate -- and leak -- buffer in wxHTMLDataObject::GetDataHere(),
we're supposed to be putting data into the caller-provided buffer instead of
using our own.
Robin Dunn [Fri, 8 Jun 2012 19:26:19 +0000 (19:26 +0000)]
Keep track of the area intended to be buffered, and use that in UnMask instead of defaulting to the buffer size. Only clip to the DC size if wxBUFFER_VIRTUAL_AREA is not set. This fixes the issue where buffering the full virtual area in a wxScrolledWindow would only draw an area the physical size of the window. Fixes #11612.
Vadim Zeitlin [Fri, 8 Jun 2012 18:44:18 +0000 (18:44 +0000)]
Fix wxWindow::IsDescendant() to work with argument equal to this window.
Passing the window itself as IsDescendant() argument for a top level window
resulted in a NULL pointer dereference. Fix this and also simplify the
function code by not using the parent window before checking it's !NULL.
Vadim Zeitlin [Fri, 8 Jun 2012 18:44:14 +0000 (18:44 +0000)]
Use wxString::Clone() instead of c_str() in wxThreadEvent copy ctor.
Creating a new wxString from c_str() of the old one resulted in dropping all
string data after the first embedded NUL. Fix this by using Clone() method
that exists specifically for this purpose. It also makes the code more clear.
Vadim Zeitlin [Fri, 8 Jun 2012 18:44:10 +0000 (18:44 +0000)]
Use PLATFORM checks in bakefiles instead of TOOLKIT checks.
No real changes as the output is currently the same for all supported
PLATFORM/TOOLKIT combinations anyhow but prefer checking for PLATFORM to
prepare for the support of GTK toolkit under MSW platform.
Paul Cornett [Tue, 5 Jun 2012 16:49:28 +0000 (16:49 +0000)]
Workaround for Ubuntu 12.04 run time warning
"LIBDBUSMENU-GLIB-WARNING **: Trying to remove a child that doesn't believe we're it's parent."
Avoid calling gtk_widget_destroy() on a wxMenuBar attached to a frame
Fixes #14292
Paul Cornett [Mon, 4 Jun 2012 17:36:51 +0000 (17:36 +0000)]
Fix layout of wxStaticText, and possibly other controls.
GtkLabel perversely does not use its actual size to do layout, but will use its
size request. So restore calling gtk_widget_set_size_request() for all widgets,
which was removed in r71465. See #14374
Vadim Zeitlin [Sun, 3 Jun 2012 19:16:59 +0000 (19:16 +0000)]
Use wxString::t_str() in calls to Windows API functions in wxMSW.
Use t_str() instead of wx_str() to make the code work correctly in UTF-8 build
in which wx_str() returns a pointer to UTF-8 buffer while we need a wchar_t
pointer for Windows.
Steve Lamerton [Sun, 3 Jun 2012 17:41:32 +0000 (17:41 +0000)]
Use wxCOMPtr throughout wxWebViewIE to simplify the code and reduce the chance of memory leaks. Also mark PPV_ARGS_CHECK as inline so it can be used from multiple libraries.
Vadim Zeitlin [Fri, 1 Jun 2012 22:34:17 +0000 (22:34 +0000)]
Clear old selection when wxListBox becomes empty.
When UpdateOldSelections() is called from wxListBox::DoClear(), it must clear
the old selections array even for single selection list boxes, but it didn't
do this under non-MSW platforms.
Specifically check for the case of an empty listbox now and just forget the
old selections then. This fixes the problem of keeping stale old selections
and is also more efficient as we avoid the unnecessary GetSelections() call.
Vadim Zeitlin [Fri, 1 Jun 2012 16:21:08 +0000 (16:21 +0000)]
Disable wxUIActionSimulator wxGrid tests using mouse under wxGTK.
Something is seriously wrong with simulated mouse events and wxGrid under
wxGTK, they seem to simply disappear sometimes. This results in unit tests
suite failure, so disable these tests for the next release as I just don't
understand how to fix them.
Vadim Zeitlin [Fri, 1 Jun 2012 16:21:03 +0000 (16:21 +0000)]
Use printf() instead of wxPrintf() in cppunit details listener.
Wide char output from wxPrintf() didn't appear at all under Linux because
stdout was switched into narrow stream mode by GNU libc due to initial use of
cout in the test.
Use printf() instead of wxPrintf() as we are only printing ASCII strings
anyhow. Of course, this is not a real fix but at least we can see the tests
results like this.
Vadim Zeitlin [Fri, 1 Jun 2012 11:01:34 +0000 (11:01 +0000)]
Use float instead of double division in wxHashMap code.
We don't need double precision for determining the hash table fill rate and
using double constant also results in float-to-double promotion warnings from
gcc 4.7.
Vadim Zeitlin [Fri, 1 Jun 2012 11:01:28 +0000 (11:01 +0000)]
Update old selections after clearing wxListBox in wxGTK.
Don't keep stale selected item indices in m_oldSelections after clearing the
listbox, call UpdateOldSelections() from DoClear() in wxGTK just as we do in
the other ports.
Vadim Zeitlin [Fri, 1 Jun 2012 11:01:18 +0000 (11:01 +0000)]
Use wxDynamicCast() instead of IsKindOf() checks.
wxDynamicCast() is less verbose (due to the absence of "CLASSINFO") and more
compatible with the standard dynamic_cast<>, so prefer to use it when possible.
Vadim Zeitlin [Fri, 1 Jun 2012 11:01:09 +0000 (11:01 +0000)]
Remove unnecessary dynamic cast in wxComboPopupWindow.
Objects of this type are either always of wxPopupTransientWindow type, in
which case just a static_cast<> is enough and we don't need a dynamic one, or
is never of its type in which case this code shouldn't be compiled and if it
is, then static_cast<> will correctly fail preventing it from compiling.
Vadim Zeitlin [Fri, 1 Jun 2012 11:01:05 +0000 (11:01 +0000)]
Don't reset previous window event handler in PopEventHandler().
This is harmless but also useless as the previous event handler of a wxWindow
is always NULL anyhow, so simply don't do this. This is consistent with
PushEventHandler() which doesn't call SetPreviousHandler() for the window
itself neither.
Robin Dunn [Wed, 30 May 2012 03:13:35 +0000 (03:13 +0000)]
Adjust the client area origin and the client size of the MSW wxStaticBox according to the guidelines on http://msdn.microsoft.com/en-us/library/aa511279.aspx. This is so widgets that are children of the static box will not overlap the label or box borders.
Vadim Zeitlin [Sun, 27 May 2012 13:00:04 +0000 (13:00 +0000)]
Fix memory leaks in wxAutomationObject::Invoke().
Use wxVector<>, wxBasicString and wxOleVariantArg instead of raw arrays, BSTR
and VARIANT to ensure that different objects allocated by this function are
always freed when it exits.
Vadim Zeitlin [Sat, 26 May 2012 12:29:54 +0000 (12:29 +0000)]
Fix bug with unloading wxPluginLibrary objects in "wrong" order.
wxPluginLibrary objects had to be unloaded in exactly the reverse order to
which they were loaded in. This was not documented and was a serious
limitation for any realistic use of plugins anyhow, so fix it and allow
unloading them in any order now.
Instead of keeping a pointer to the last wxClassInfo not created by this
plugin, now keep a pointer to the first wxClassInfo that was created by it.
This makes the code slightly more complex but this pointer, unlike the old
one, remains valid even if another plugin was unloaded.
Vadim Zeitlin [Sat, 26 May 2012 12:29:46 +0000 (12:29 +0000)]
Fix DrawChoice() behaviour in wxRendererXP.
The implementation of wxRendererXP::DrawChoice() inadvertently used
wxRendererMSW::DrawComboBoxDropButton() and so drew the button in the classic
and not themed style.
Fix this by defining DrawChoice() in the base wxRendererMSWBase class and
reusing it in wxRendererXP via inheritance and not composition.