Vadim Zeitlin [Sat, 9 Mar 2013 15:08:31 +0000 (15:08 +0000)]
Use generic spin control itself as parent for its children.
This fixes a problem with using wxSpinCtrlGeneric in toolbars under wxOSX,
using the toolbar itself (i.e. the parent of the spin control) as parent for
the children didn't work there and no windows were visible at all.
Also use wxNavigationEnabled as base class of wxSpinCtrlGeneric to fix
keyboard navigation.
And override SetBackgroundColour() to set it for the text control part of the
spin control only.
Vadim Zeitlin [Sat, 9 Mar 2013 15:08:13 +0000 (15:08 +0000)]
Fix compilation for MinGW with wxUSE_IPV6==1.
MinGW doesn't provide wspiapi.h header, so only include it when using MSVC and
include ws2tcpip.h which directly declares the functions used for the other
compilers.
This doesn't have quite the same semantics but it's better than failing to
compile at all.
Vadim Zeitlin [Sat, 9 Mar 2013 15:08:09 +0000 (15:08 +0000)]
Don't cache HDC used by wxPaintDCEx in wxMSW.
This avoids the problem with mistakenly using wrong HDC in wxBitmapComboBox
code which was due to assuming that we can only ever have one paint HDC for
the given window -- while in wxBitmapComboBox case we are passed different
HDCs for the same window via WM_DRAWITEM.
Instead of fixing the cache, just don't use it at all for wxPaintDCEx as we
don't gain anything from doing it anyhow.
Vadim Zeitlin [Sat, 9 Mar 2013 15:08:00 +0000 (15:08 +0000)]
Don't set cell value in wxDataViewEvent in one place only.
We should either set the cell value in the event object everywhere or not do
it anywhere and as currently the native GTK and OS X versions don't do it at
all and the generic version only does it for ITEM_CONTEXT_MENU events, it's
easier to not do it at all.
This method couldn't be overridden by the classes deriving from wxLogWindow
because it was called (indirectly) from wxLogWindow ctor itself and so was
completely useless. Just remove it to avoid confusion.
Vadim Zeitlin [Mon, 4 Mar 2013 18:19:41 +0000 (18:19 +0000)]
Unselect all wxDataViewCtrl items when clicking outside of the item area.
This is consistent with Windows behaviour and as the generic wxDataViewCtrl is
mostly used under Windows, it makes sense to follow Windows convention in it.
Vadim Zeitlin [Sun, 3 Mar 2013 22:44:17 +0000 (22:44 +0000)]
Fix handling of wxST_NO_AUTORESIZE in wxOSX.
We do need to set the size of wxStaticText initially even when this style is
specified, it only tells us to not update it later. Otherwise even the initial
label was never shown in full.
Vadim Zeitlin [Sat, 2 Mar 2013 12:11:53 +0000 (12:11 +0000)]
Reset accelerator table after removing last accelerator in wxMSW wxMenuBar.
We didn't update the accelerator table if no more accelerators were left in it
but we still need to do it to stop handling the previously active accelerators.
Vadim Zeitlin [Sat, 2 Mar 2013 12:11:40 +0000 (12:11 +0000)]
Don't give error message for non-existent paths in wxFileSystemWatcher.
The file we're trying to watch might have been just deleted, this is an
unavoidable (and not only in theory but also in practice when watching busy
directories) race condition so don't give an error message if this does happen
but simply return false from Add().
Vadim Zeitlin [Thu, 28 Feb 2013 20:41:14 +0000 (20:41 +0000)]
Use thread ID and not thread handle in the error messages in wxMSW.
The ID is in general more useful than the handle and this also fixes an assert
failure due to mismatch between the HANLDE type and "%x" format specifier.
Václav Slavík [Thu, 28 Feb 2013 16:29:05 +0000 (16:29 +0000)]
Add wxPreferencesEditor class.
Implements native UI for preferences editing. In particular, the API
handles the differences between modal (Windows) and non-modal (OS X) preferences windows and provides platform's native look.
Currently implemented natively for wxOSX/Cocoa, wxGTK and Windows (the latter is used as a fallback generic implementation as well).
Václav Slavík [Thu, 28 Feb 2013 13:31:58 +0000 (13:31 +0000)]
Don't include Common-Controls manifest in wxBase apps.
If only the non-GUI portions of wxWidgets are used, the dependency on
Microsoft.Windows.Common-Controls assembly shouldn't be automatically
added to Visual C++. Only do it when compiling GUI code.
Vadim Zeitlin [Sun, 24 Feb 2013 13:48:57 +0000 (13:48 +0000)]
Fix, or at least make less common, deadlock in the thread sample.
Don't always deadlock when "Stop the last spawned thread" menu command is
selected. There is still a problem with a race condition which could result in
a crash when dereferencing an invalid pointer, but at least this doesn't
happen all the time, unlike the current bug.
Of course, the real solution would be to properly rewrite the sample to show
how thread deletion should be handled correctly...
Vadim Zeitlin [Thu, 21 Feb 2013 14:32:04 +0000 (14:32 +0000)]
Fix crash when drawing bitmaps with mask in wxGTK with GTK+ < 2.20.
r73386 introduced a crash in wxGTK drawing code when using old GTK+ versions
by releasing the mask pixmap prematurely. Apparently GTK+ itself was fixed at
some time in 2.19.x time frame but work around the bug for the sake of older
GTK+ versions in wxGTK itself by simply releasing the pixmap at the end of
DoDrawBitmap(), as pre-r73386 code did.
Vadim Zeitlin [Thu, 21 Feb 2013 13:22:31 +0000 (13:22 +0000)]
No real changes, just suppress a harmless warning.
g++ warned about possibly uninitialized variable, so initialize it in its
declaration even if it was actually already always initialized in the branches
where it could be used.
Vadim Zeitlin [Fri, 15 Feb 2013 12:40:13 +0000 (12:40 +0000)]
Don't connect to the same signal multiple times in wxGTK wxClipboard.
We called g_signal_connect("selection_get") in wxClipboard code each time its
AddData() method was called. This resulted in progressive but noticeable
slowdown as the handler was called more and more times.
Vadim Zeitlin [Sun, 10 Feb 2013 16:14:03 +0000 (16:14 +0000)]
Account for scrolling when setting the background brush origin in wxMSW.
We must use physical coordinates for the brush origin to account for the
coordinates offset in scrolled windows, so add MSWAdjustBrushOrg() and call it
from MSWGetBgBrushForChild().
Vadim Zeitlin [Sun, 10 Feb 2013 16:13:53 +0000 (16:13 +0000)]
Erase the entire virtual area of the window in the erase sample.
Just clearing the DC is not enough when the window is scrolled, so clear the
entire virtual area. We should be able to optimize it by clearing just the
rectangle currently scrolled into view but this is at least correct, i.e.
doesn't result in corrupted display, even if it's suboptimal.
Vadim Zeitlin [Sun, 10 Feb 2013 16:13:50 +0000 (16:13 +0000)]
Compilation fix for !wxHAS_MSW_BACKGROUND_ERASE_HOOK case.
This doesn't actually change anything as wxHAS_MSW_BACKGROUND_ERASE_HOOK is
always defined, except under WinCE where this file is not used anyhow, but do
test it here for completeness.
Vadim Zeitlin [Sun, 10 Feb 2013 16:13:46 +0000 (16:13 +0000)]
Create wxCURSOR_RIGHT_ARROW on the fly from normal arrow cursor under MSW.
This allows to avoid having another cursor resource and also makes this cursor
nicer as rightarr.cur looks rather out of place under modern Windows systems.
Vadim Zeitlin [Sat, 9 Feb 2013 11:11:53 +0000 (11:11 +0000)]
Don't call ::GetLayout() in wxMSW code directly.
Use wxMSW::GetLayout() wrapper to avoid directly binding to a function not
present in old Windows versions and also to fix linking errors with MinGW
after the changes of r73484.
Vadim Zeitlin [Sat, 9 Feb 2013 00:36:02 +0000 (00:36 +0000)]
Fix infinite loop in wxGrid::PosToEdgeOfLine().
Return -1 from wxGridRowOperations::GetLineBefore(0) to ensure that we exit
the loop in wxGrid::PosToEdgeOfLine(). Doing this is the logical thing to do
as wxGridColumnOperations::GetLineBefore() already behaved like this and this
was is more expected than returning 0, as the function previously did for some
reason.
Vadim Zeitlin [Sat, 9 Feb 2013 00:35:58 +0000 (00:35 +0000)]
Fix pulsing of bitmaps in focused buttons under Windows 7.
It turns out that the actual bitmap shown in this case varies between the
bitmaps at PBS_DEFAULTED and PBS_STYLUSHOT, so that it's invisible half of the
time if we don't specify the value for the latter. Do it now to fix unwanted
pulsing of the bitmap in the focused button.
Vadim Zeitlin [Sat, 9 Feb 2013 00:35:54 +0000 (00:35 +0000)]
Refresh wxMSW wxStaticBitmap when its size changes.
As MSW native control centers the image, it must be entirely redrawn when the
area in which the image is centered changes, but it doesn't happen by default,
so do it ourselves explicitly.
Also explain that this centering behaviour is platform-specific and shouldn't
be relied upon.
Vadim Zeitlin [Sat, 9 Feb 2013 00:35:49 +0000 (00:35 +0000)]
Fix drawing of bitmaps with masks in mirrored wxDC.
The mask must be mirrored in the same way as the main bitmap itself (currently
it's not mirrored at all but this could change in the future), so create the
temporary memory HDC with the same layout as is used by the main HDC.
Vadim Zeitlin [Sat, 9 Feb 2013 00:35:46 +0000 (00:35 +0000)]
Don't include the manifest in wx/msw/wx.rc by default for MSVC compiler.
The later versions of this compiler don't need it any more, so make it easier
to set up the projects for them at the expense of MSVC 6 and 7 users who will
now need to explicitly define wxUSE_RC_MANIFEST=1 and predefine the
architecture macro (or setup their resource compiler include path to get
wx/msw/rcdefs.h under the lib directory but predefining the architecture is
clearly simpler).
Do generate manifest when using gcc as it predefines the architecture macros
allowing us to avoid requiring using the generated rcdefs.h.
The other compilers will be dealt with as needed if anybody is still using
them.
Vadim Zeitlin [Wed, 6 Feb 2013 12:48:12 +0000 (12:48 +0000)]
Don't recurse into top level children when validating recursively.
Even with wxWS_EX_VALIDATE_RECURSIVELY flag, we should never validate the top
level children (e.g. dialogs) when validating the parent window. This is never
useful and can be completely unexpected.
Vadim Zeitlin [Wed, 6 Feb 2013 12:48:09 +0000 (12:48 +0000)]
Refactor children traversal in wxWindow::TransferData{To,From}Window().
No real changes, just factor out the logic for children traversal into a
helper template class and reuse it in Validate() and both TransferData()
methods to avoid triplicating it.
Vadim Zeitlin [Tue, 5 Feb 2013 20:47:02 +0000 (20:47 +0000)]
Add benchmarks for wxImage and raw bitmap access to the graphics test.
Compare the speed of drawing the bitmaps by synthesizing wxImage and
converting it to wxBitmap and directly modifying wxBitmap bits using raw
bitmap access.