Implement wx-prefixed macros versions of DECLARE_EVENT_TABLE, BEGIN_EVENT_TABLE* and END_EVENT_TABLE macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Implement wx-prefixed macros versions of DECLARE/IMPLEMENT*CLASS macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Correct a recurring error in the docs: IMPLEMENT/DECLARE_CLASS are alias to the DYNAMIC macros, not to the ABSTRACT macros.
Implement wx-prefixed macros versions of DECLARE/IMPLEMENT_APP_* macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Vadim Zeitlin [Wed, 9 Jun 2010 11:13:20 +0000 (11:13 +0000)]
Don't use -kAddToPopUp() gettext hack with Scintilla.
Instead, create a dummy file containing the user-visible strings defined in
Scintilla sources. For now it's manually managed but it might make sense to
automatically generate it in the future.
Move a couple of wxFileName tests from the console sample to the existing FileNameTestCase.
Fix FileNameTestCase::TestGetHumanReadable to check the result against expected strings using the correct decimal point for the locale used on the test machine.
remove some tests from the console sample:
- wxLog already has a better cppunit test class
- wxLocale test in the console sample didn't work on Windows and wasn't very useful
move some tests from the console sample to CppUnit tests:
- wxPathList => PathListTestCase
- wxModule => ModuleTestCase
remove some tests about removed functions of wxMimeTypesManager
Vadim Zeitlin [Sun, 6 Jun 2010 12:41:51 +0000 (12:41 +0000)]
Don't post process events twice but return correct value from ProcessEvent().
This is a further complication to the event handling code which aims to handle
correctly the case of wxScrollHelperEvtHandler which doesn't respect the
request to process events only in it but always passes it to the next handler
in the chain itself while still returning the correct value from
ProcessEvent() itself to avoid breaking code that relies on it, like the
background painting code in wxHtmlWindow.
This replaces the change of r64495 and does return true from DoTryChain() in
wxScrollHelperEvtHandler case but sets the "skipped" flag in the event itself
to indicate that it wasn't really processed and ProcessEvent() now checks it
after calling ProcessEventLocally() and returns the correct value
appropriately.
Jaakko Salli [Sun, 6 Jun 2010 09:35:06 +0000 (09:35 +0000)]
In wxComboCtrlBase::DoShowPopup(), if the popup window is a generic TLW or a 'perfect' wxPopupWindow, then try to set focus to the popup control at the end of show
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:13 +0000 (22:58 +0000)]
Don't send selection events for an already selected item in wxMSW wxListBox.
Remember the last item for which a listbox notification event had been sent
and don't send it again if the user clicks on an already selected item. This
is consistent with wxGTK behaviour and generally makes more sense: why should
we send an event if the selection didn't really change?
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:09 +0000 (22:58 +0000)]
Don't send listbox selection events when mouse wasn't clicked on an item.
Windows sends events even if the mouse is clicked in the area below the items,
filter them out by checking the item under the mouse ourselves.
Also use synchronous GetMessagePos() function to get the mouse position
instead of the asynchronous GetCursorPos() which was wrongly used by the old
code.
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:05 +0000 (22:58 +0000)]
Use mouse position to find the item for selection events in wxMSW listbox.
Using LB_GETCARETINDEX doesn't work when the mouse is used to make selection
because it always returns the index of the last item, even if the mouse is
clicked below it, on an area without any listbox items. So use the mouse
position to find the item in this case but still use LB_GETCARETINDEX to find
the item when the keyboard is used.
This required adding a flag to wxListBox storing the kind of the last input
message that it received as there doesn't seem to be any way to determine how
the message was generated otherwise.
This code will be refactored/improved further in the next two commits.
Vadim Zeitlin [Sat, 5 Jun 2010 22:57:53 +0000 (22:57 +0000)]
Refactor listbox event sending code to avoid duplication.
wxMSW wxListBox implementation contained the same code as the private
LBSendEvent() function in lboxcmn.cpp, so make this function a (protected)
member of wxListBoxBase and reuse it instead.
Also change its and CalcAndSendEvent() return type to bool to be able to
return whether the event was processed or not.
As the result of this refactoring, the "is selected" flag is now set correctly
for the selection events under MSW (it was always off before).
Vadim Zeitlin [Sat, 5 Jun 2010 22:57:48 +0000 (22:57 +0000)]
Don't return true from DoTryChain() if the event wasn't really processed.
Correct the return value when an event handler didn't honour "process only in
this handler" flag: we shouldn't pass the event to the further handlers in
this case but we shouldn't return true neither as the event wasn't really
processed.
This corrects background painting of wxHtmlWindow broken by previous changes.
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:53 +0000 (10:35 +0000)]
Drop the column being dragged at the correct position in wxGrid.
The column was being always dropped after the column at drop position but this
was incorrect and didn't correspond to the visual feedback drawn by
wxHeaderCtrl: if the drop position is over the "near" part of the column, the
column should be dropped before it instead.
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:49 +0000 (10:35 +0000)]
Test for wxPen validity before testing for its style in wxGTK wxDC.
Calling wxPen::GetStyle() on an invalid pen resulted in an assert, breaking
the grid column drawing while reordering them, for example, because the code
in wxGrid uses wxDC::DrawRectangle() after calling SetPen(wxNullPen).
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:41 +0000 (10:35 +0000)]
Assert if an invalid column index is specified when inserting wxListCtrl item.
This also catches the case of inserting an item in a report mode wxListCtrl
without adding any columns to it first. Previously this did result in an
assert but with a less clear error message and, most importantly, still a
crash afterwards. Assert only now, don't crash.
The message could still be improved but hopefully people will be able to
understand that inserting items when no columns are defined is not the right
thing to do.
Move some wxPrintf() tests (taken from glibc) to VsnprintfTestCase. Other tests are more difficult to convert in CppUnit style and not worth the effort (since now we don't use wx's own vsnprintf implementation anymore typically).
Move wxRegConfig tests from console sample to a new wxRegConfigTestCase class.
Remove wxRegKey tests from console sample: on newer Windows they only work when run with admin privileges; also we can expect wx[Reg]ConfigTestCase to already check a good number of wxRegKey features.
Vadim Zeitlin [Wed, 2 Jun 2010 11:58:31 +0000 (11:58 +0000)]
Fix recently broken forwarding of events between event handlers.
After the recent changes to the event processing logic, forwarding an event
from one event handler to another one stopped working correctly because the
per-event "process here only" flag prevented it from following the event
handler chain after forwarding. This notably broke keyboard navigation in
wxComboCtrl under MSW in wx itself and probably quite a few of other things in
user code.
Fix this by replacing the boolean flag with a pointer to the handler to which
the processing of this event should be restricted. This allows the full
processing to still take place if an event is forwarded to another handler.
So wxEvent::ShouldProcessHereOnly() is now called ShouldProcessOnlyIn() and
takes a wxEvtHandler parameter.
This made appear a problem in wxScrollHelperEvtHandler code that was hidden by
the bug above: the events were still processed multiple times in it. To fix
this, also add wxEvent::DidntHonourProcessOnlyIn() and take it into account in
the base class code. Did I mention that wxScrollHelperEvtHandler must die?
Add another unit test checking that forwarding works correctly.
Vadim Zeitlin [Wed, 2 Jun 2010 11:58:21 +0000 (11:58 +0000)]
Don't hard code position of the drawing sample window and increase its size.
Hardcoding position to 50,50 is inconvenient, let the window manager position
the window as configured by user. Also, the vertical size of the sample was
too small to see the contents of most pages, increase it.
disable FTPTestCase by default.
Add a warning for the user when running --list without arguments: not all tests are listed, only those enabled by default (e.g. FTPTestCase doesn't appear there)!
Jaakko Salli [Tue, 1 Jun 2010 15:01:59 +0000 (15:01 +0000)]
In wxComboPopupEvtHandler::OnMouseEvent(), when need to relay event to drop-down button, call HandleButtonMouseEvent() directly, if possible. This is less confusing for the platform-specific wxComboCtrl implementations, and fixes issue where the drop-down button could remain in pressed state after the mouse button was lifted.
Jaakko Salli [Tue, 1 Jun 2010 13:46:14 +0000 (13:46 +0000)]
Refactored wxComboPopupExtraEventHandler::OnMouseEvent(). Now block mouse events from the popup control until mouse button has been seen in 'up' state (ignoring first mouse up). This matches Windows native combo box behavior (fixes #12115).
Vadim Zeitlin [Mon, 31 May 2010 11:55:53 +0000 (11:55 +0000)]
Use C locale for numbers in wx(File)Config.
Using the current locale decimal point in config files results in problems
when moving the files to another machine or even using a different locale on
the same one, so don't do it.
Always write the numbers using C locale and try to read them in C locale too
first, but also try the current locale if we failed for backwards
compatibility and to be tolerant with users who edit their config files by
hand.
Vadim Zeitlin [Mon, 31 May 2010 11:55:48 +0000 (11:55 +0000)]
Add wxString::FromDouble() and FromCDouble().
wxString::FromCDouble() is needed inside wxWidgets itself to format numbers
independently of the current locale. FromDouble() was added for symmetry with
ToDouble/ToCDouble() functions.
Use std::locale for the implementation if available and manual wxLocale-based
fallback otherwise.
Vadim Zeitlin [Mon, 31 May 2010 11:55:41 +0000 (11:55 +0000)]
Make wxString::ToCXXX() methods always available.
We use these methods inside wxWidgets itself and so want to always have them,
even when wxUSE_XLOCALE==0. Provide replacement manual implementations for
this case.
Vadim Zeitlin [Mon, 31 May 2010 11:55:37 +0000 (11:55 +0000)]
No real changes, just avoid an unnecessary heap allocation in a test.
We don't need to allocate the locale object in StringTestCase::ToDouble() on
the heap (and then delete it -- or not, if an assertion fails before the
function end), it's enough and simpler to just create it as a local variable.
Vadim Zeitlin [Sun, 30 May 2010 23:28:59 +0000 (23:28 +0000)]
Fix wxFont::IsFixedWidth() under MSW to always return correct result.
This function worked erratically, returning the correct result or not
depending on the way it was created. Reimplement it using GetTextMetrics() to
get the correct result in any case.
implement * and / operators for wxPoint, not only wxSize.
Add to their documentation a note about the fact that the real operators are not class members but rather global functions.
Vadim Zeitlin [Sun, 30 May 2010 20:05:56 +0000 (20:05 +0000)]
No changes, just rebaked and reran autoconf.
It seems that autoconf_inc.m4 hadn't been regenerated by a previous change as
rerunning bakefile_gen resulted in a lot of changes in it, do it now without
any other changes to ensure that the next commit only contains the changes due
to its modification of files.bkl.
Václav Slavík [Sun, 30 May 2010 12:21:49 +0000 (12:21 +0000)]
Fix Shift+TAB navigation from wxNotebook.
When the focus was on a tab label, Shift+TAB didn't move it out of the
notebook to the preceding control, as it should. Instead, focus moved to
the last control in the current notebook page.
This change fixes it, TAB and Shift-TAB cycling through controls now
behaves identically modulo direction.
Paul Cornett [Sun, 30 May 2010 06:38:28 +0000 (06:38 +0000)]
Remove pizza backing window.
When it is present, no-window widgets sometimes don't get expose events for
reasons I could not determine. And it is dubious that it improved scrolling
performance on modern hardware anyway, and almost certainly doesn't help now
that GTK+ is using "client side windows".
Vadim Zeitlin [Sat, 29 May 2010 10:35:30 +0000 (10:35 +0000)]
Show OLE errors using wxLogDebug() in wxAutomationObject.
Enable the previously commented out ShowException() but use wxLogDebug() in it
instead of wxLogWarning() to avoid confusing the users with errors they don't
care about.
Jaakko Salli [Thu, 27 May 2010 20:03:07 +0000 (20:03 +0000)]
In wxComboPopupExtraEventHandler::OnMouseEvent(): Also include wxEVT_LEFT_UP among the mouse events to be blocked when the cursor is outside the popup area. This fixes wxMSW bug where the popup disappears immediately after mouse button is released (see #12087).
Vadim Zeitlin [Thu, 27 May 2010 17:07:46 +0000 (17:07 +0000)]
Ignore "%*" in the shell command strings in MSW registry.
Apparently "%*" can be used now in addition to the usual "%1" in the MSW shell
command strings. As we don't support passing more than one file to a command
at once anyhow, simply ignore them. At least this avoids errors when trying to
open files with some extensions.
Vadim Zeitlin [Thu, 27 May 2010 17:07:40 +0000 (17:07 +0000)]
Fall back on using tree/list control item text in wxDragImage.
Use the item text instead of its image if it doesn't have any when creating a
wxDragImage from a wxTreeCtrl or wxListCtrl item instead of just failing.
fix incoherency between the wxThread implementation based on MSW threads and pthread: Delete()ing a thread which hasn't started yet must return wxTHREAD_MISC_ERROR
Vadim Zeitlin [Tue, 25 May 2010 21:15:24 +0000 (21:15 +0000)]
Fix setting the fonts for wxMSW wxTextCtrl with wxTE_RICH(2) style.
Using WM_SETFONT seemed to work with rich edit controls but in fact it
doesn't, it only changes the font used by the control initially apparently but
it can be reset later.