Set the menu itself as event object for EVT_MENU_{OPEN,CLOSED} in wxMSW.
Make wxMSW consistent with the other ports and set the menu itself, not the
window it is attached to, as the event object for the menu open/close events.
Reuse wxMenu::SendEvent() from wxFrameBase::ProcessCommand().
Not only this avoids code duplication but it also fixes wrong code in
wxFrameBase version as it set the event object incorrectly to the frame itself
instead of setting it to the menu.
Added event object check to the menu events unit test.
Add a very simple unit test checking for menu events.
Just verify that an event with the expected id was generated. The test will be
extended later to test for other event fields such as its source object,
see #1595.
Use wxFrame::FindItemInMenuBar() in ProcessCommand().
Don't duplicate FindItemInMenuBar() code in ProcessCommand() and, more
importantly, use the overridden version of FindItemInMenuBar() in MDI parent
frame in wxMSW to allow using ids corresponding to the active child frame menu
items.
Don't change the icon when editing wxDataViewIconText cells in generic version.
wxDataViewIconTextRenderer changed the icon to that of the last item drawn by
it when editing a cell. Fix this by getting the original icon directly from
the model instead of from the last item.
Hide combobox popup when it is hidden itself in wxMSW.
It was possible to hide the main part of a combobox control but keep its popup
shown and this notably happened in wxGrid when TAB was pressed while a
wxChoice cell editor was dropped down.
Avoid this Cheshire combobox syndrome by explicitly dismissing the popup when
a combobox is hidden.
Fix handling of the main window of composite controls in wxMSW wxToolTip.
The main window itself should be added using DoAddHWND() and not
AddOtherWindow() as it is not, precisely, "other". This fixes removing and
updating it twice unnecessarily.
No real changes, just use clearer names for wxMSW wxToolTip methods.
Rename wxToolTip::DoAddOtherWindow() to DoAddHWND() as it should be used for
adding any window associated with the tooltip, either the main or an auxiliary
one. And rename wxToolTip::Add() to AddOtherWindow() because it shouldn't be
used for the main window.
Really fix source coordinates handling in wxDC::Blit() in wxMSW.
It turns out that the changes r71028 were unnecessary (and actually harmful)
in most cases, they're only needed when a DIB is used as a source DC. So move
the manual coordinates adjustments to the branch of code using StretchDIBits()
and don't do it anywhere else.
Also don't list this as an incompatible change as wxMSW actually already
worked as the other ports in the majority of cases and list it as a simple bug
fix instead.
Fix wxRadioButtons without explicit wxRB_GROUP styles in wxGTK.
If two radio buttons are created consecutively, they should be part of the
same radio group, even if wxRB_GROUP hadn't been explicitly used for the first
of them.
Do this is for consistency with wxMSW and also because the alternative
behaviour doesn't make much sense.
Also stop iterating too far backwards when searching for the group to be used
for a new radio button and add comments explaining what's going on here.
Remove obsolete header used only with CodeWarrior MetroWerks compiler.
This compiler doesn't exist for modern OS X systems, no need to have the
headers used only with it as they just clatter the include directory and
confuse various tools parsing wx headers.
Avoid overflowing the wake up when handling events in Unix console apps.
Generating many wake ups from the worker threads could result in overflowing
the buffer of the pipe used to communicate with the main thread which, in
turn, resulted in other serious problems (deadlocks...).
Avoid this by only writing to the pipe if it is empty.
Don't link with QuickTime framework in 64 bit wxOSX builds.
This framework doesn't exist in 64 bits and so using it results in a warning
when building 64 bit libraries. Avoid this by omitting it if we are sure that
we target 64 bits only.
Vadim Zeitlin [Thu, 29 Mar 2012 23:43:46 +0000 (23:43 +0000)]
Remove nonsensical custom comparison code from wxDataViewIndexListModel.
This model was comparing its items by their positions in the list instead of
their values for some reason. This broke sorting in wxDataViewListCtrl using
this model and simply didn't make any sense.
Just remove the comparison code from wxDataViewIndexListModel entirely, the
base class version works just fine for it.
Vadim Zeitlin [Thu, 29 Mar 2012 23:43:43 +0000 (23:43 +0000)]
Restore the correct brush in wxGCDC::GradientFill() methods.
Both GradientFillLinear() and GradientFillConcentric() changed the brush on
the underlying wxGraphicsContext but didn't restore the default brush back.
Vadim Zeitlin [Thu, 29 Mar 2012 23:17:26 +0000 (23:17 +0000)]
Remove setup0.h files from the list of headers in bakefile.
These headers don't exist in official distributions as they're renamed to
setup.h in them. Moreover, they don't need to be installed anyhow when using
configure as the real setup.h is installed specially, so there is no real need
to have them in the list of headers.
Vadim Zeitlin [Thu, 29 Mar 2012 12:08:05 +0000 (12:08 +0000)]
Allow closing wxAuiTabCtrl pages without switching to them.
Clicking on the page "x" close button switched to the page before doing
anything else which was unusual as other tabbed controls don't behave like
this.
Handle clicks on the close button specially and avoid switching to the page
which is about to be closed anyhow.
Vadim Zeitlin [Thu, 29 Mar 2012 00:10:53 +0000 (00:10 +0000)]
Fix focus handling logic in generic wxListCtrl.
Don't override SetFocus() to set the focus to the main window, this isn't
enough as we can be given the focus by the underlying toolkit itself, without
our SetFocus() being called -- this happened in wxGTK when focus was changed
from the keyboard using TAB and in this case it didn't get to the main window
but remaining on the wxListCtrl itself meaning that keyboard input wasn't
processed at all.
Use wxNavigationEnabled<> now to ensure that OnSetFocus() and related methods
do the right thing instead now.
Also get rid of OnSetFocus() in wxListHeaderWindow, it's better to override
AcceptsFocus() to return false to avoid getting focus in the first place.
Steve Lamerton [Tue, 27 Mar 2012 19:33:59 +0000 (19:33 +0000)]
Correctly use QueryInterface in GetDocument to ensure that we only return an IHTMLDocument2 pointer if one is available. Check GetDocument being NULL when used. This fixes the displaying of non-html documents such as pdfs.
Vadim Zeitlin [Tue, 27 Mar 2012 11:58:09 +0000 (11:58 +0000)]
Set wxTextAreaBase::m_filename in the methods of this class itself.
m_filename member was declared in wxTextAreaBase but set only in the
overridden wxTextCtrlBase methods. This meant that it wasn't updated correctly
in wxStyledTextCtrl which also derives from wxTextAreaBase and so saving
SaveFile() with empty file name didn't work there even when the control had
been originally loaded from a file.
Move the code updating m_filename to wxTextAreaBase itself to fix this. This
also simplifies the code as it's now not necessary to override
Do{Load,Save}File() in wxTextCtrlBase at all.
Vadim Zeitlin [Tue, 27 Mar 2012 11:58:05 +0000 (11:58 +0000)]
Use IsDescendant() in wxTopLevelWindow::IsActive() implementation.
Avoid wxGetTopLevelParent() which doesn't work for the strange TLWs which
override IsTopLevel() to return false, as wxMDIChildFrame does in wxMSW.
Using IsDescendant() works in any case and also is arguably more clear.
Vadim Zeitlin [Sun, 25 Mar 2012 23:17:04 +0000 (23:17 +0000)]
Fix generic wxTimePickerCtrl on DST change dates.
Do not use the date when DST changes as the date part of wxDateTime object
used by wxTimePickerGeneric internally as this introduces problems with times
that can't be represented at all -- and so can't be entered into the control.
Use arbitrary date on which DST does not change to avoid this.
Vadim Zeitlin [Sun, 25 Mar 2012 23:17:01 +0000 (23:17 +0000)]
Added wxTimePickerCtrl::GetTime() and SetTime().
These methods, taking broken down time representation, avoid the problems
arising due to DST complications when using wxDateTime to represent the time
as special care needs to be taken in this case to avoid using the date part
corresponding to a DST change date at which time is discontinuous.
Document the problem with the old functions and use the new ones in the
sample.
Vadim Zeitlin [Sun, 25 Mar 2012 17:55:59 +0000 (17:55 +0000)]
Refactor wxAUI: extract wxAuiTabArt in a separate file.
No real changes, just extract wxAuiTabArt into its own file. Also rename
wxAuiDefaultTabArt to wxAuiSimpleTabArt in preparation for having other tab
art classes as the default one.
Vadim Zeitlin [Sun, 25 Mar 2012 17:55:52 +0000 (17:55 +0000)]
Explicitly include wx/aui/dockart.h from the file needing it.
src/aui/tabmdi.cpp needs wxAuiDockArt declaration as it uses it, don't rely on
wx/aui/dockart.h being included from other wxAUI headers and include it from
here explicitly.
Vadim Zeitlin [Sun, 25 Mar 2012 17:55:42 +0000 (17:55 +0000)]
Include <wx/textctrl.h> from <wx/combobox.h> for compatibility.
The wxComboBox header itself doesn't need <wx/textctrl.h> but there exists
code using wxComboBox with wxTextCtrl styles and events that doesn't include
<wx/textctrl.h> explicitly because it wasn't necessary in 2.8. So include it
from wx/combobox.h to avoid breaking this code after an upgrade to 2.9.
Vadim Zeitlin [Sun, 25 Mar 2012 16:45:53 +0000 (16:45 +0000)]
Return valid pointers from wxDateTime::ParseXXX() with non-wxString strings.
The pointer returned by wxDateTime::ParseXXX() methods could point into a
buffer of a temporary wxString created to wrap a char* or wchar_t* argument so
dereferencing it was illegal.
Fix this by defining separate overloads for char*/wchar_t* arguments returning
pointers into the original string.
Vadim Zeitlin [Sun, 25 Mar 2012 16:45:50 +0000 (16:45 +0000)]
Add helper wxString::IterOffsetInMBStr() method.
This method can be used to recover the pointer in char* buffer containing
multi-byte string representation corresponding to the given iterator which is
useful for implementing backwards-compatible functions that must be able to
return such pointers.
Vadim Zeitlin [Sun, 25 Mar 2012 00:31:47 +0000 (00:31 +0000)]
Fix bug with parsing time formats during DST periods.
wxDateTime::ParseFormat() used todays date as fall back when parsing all
formats, including those involving times, which meant that its results
depended on whether DST was active at the time of the parsing which was
clearly wrong.
Fix this by using a fixed date on which DST is known not to be active as fall
back date.
This fixes unit test failures in DateTimeTestCase::TestTimeFormat() when it
was ran on a DST transition date.
Vadim Zeitlin [Sat, 24 Mar 2012 18:24:19 +0000 (18:24 +0000)]
Allow hiding rows in wxGrid with HideRow().
HideRow() was simply ignored as SetRowSize(row, 0) didn't do anything. Check
for the special value of 0 and allow it, just as it was done for the columns
since r57336.
Vadim Zeitlin [Fri, 23 Mar 2012 15:13:16 +0000 (15:13 +0000)]
Don't cache incorrect length in wxString::DoUngetWriteBuf().
The length here is the size of the buffer in bytes and is not necessarily the
string length in code points (notably not for non-ASCII strings in UTF-8
build).
Vadim Zeitlin [Fri, 23 Mar 2012 15:13:13 +0000 (15:13 +0000)]
Don't cache incorrect length in wxString::assign(char*, size_t).
The length of the string here is specified in bytes and is not the same as the
string length for non-ASCII UTF-8 strings, so don't cache it as the string
length.
Just invalidate the cached length instead as we simply don't know what the
real length of the string is going to be.
Vadim Zeitlin [Fri, 23 Mar 2012 15:13:08 +0000 (15:13 +0000)]
Fix caching wrong length in wxString(str, len) ctor in UTF-8 build.
A length greater than that of the source string could be passed to this ctor.
This worked correctly, i.e. created a string which was a copy of the source
one but cached a wrong length for it.
Avoid this by explicitly checking the length before caching it in
wxString::assign(str, len).
Vadim Zeitlin [Wed, 21 Mar 2012 00:11:12 +0000 (00:11 +0000)]
Fix display of "const" methods in wxGTK assert dialog.
Don't separate the function name and its arguments types in 2 different
columns in the assert dialog, this doesn't really work with const methods as
"const" can't be separated from the function like this. The old code just
didn't take "const" into account at all and mangled all the const methods by
showing ") cons" (no typo) at the end.
Just show everything in one column to avoid the problem and also simplify the
code.
Vadim Zeitlin [Tue, 20 Mar 2012 23:31:25 +0000 (23:31 +0000)]
Remove empty and unnecessary wxFontDialogBase destructor.
This fixes build with wxUSE_FONTMAP==0 as this dtor was only defined inside
"#if wxUSE_FONTMAP" section. Instead of fixing this, just get rid of this dtor
entirely as it was unnecessary anyhow.
Robin Dunn [Tue, 20 Mar 2012 20:53:15 +0000 (20:53 +0000)]
Document steps needed to update to newer Scintilla. (From memory, will need to be reviewed while actually doing an update to find other things that should be done.)
Vadim Zeitlin [Mon, 19 Mar 2012 12:53:32 +0000 (12:53 +0000)]
Define wxUSE_TASKBARICON_BALLOONS as 1 for wxMSW builds using configure.
Defining it as 1 is better than not allowing to set it at all and this setting
is not important enough to warrant its own command-line configure option.