Don't try to process any remaining pending events in ProcessEvents() itself as
this was inconsistent: we only processed low-level toolkit pending events in
the main event loop itself if the loop was exited from a normal event handler
but only processed the wxApp-level pending events if it was exited from a
pending event handler. It also required more code than the new version that
simply processes all the remaining pending events, of both kinds, after the
main event loop termination.
This corrects changes of r71304 and replaces those of r71329.
Vadim Zeitlin [Sun, 13 May 2012 21:37:25 +0000 (21:37 +0000)]
Don't return a dangling pointer from wxDateTime::ParseXXX(wxCStrData).
We don't have any sufficiently long-lived pointer to return from this
overload, so don't return anything from it -- it's better to break the
compilation of the existing code rather than make it crash during run-time.
Vadim Zeitlin [Sun, 13 May 2012 21:37:23 +0000 (21:37 +0000)]
No changes, just simplify the code using wx2stc() a little.
Assign wx2stc() return value to a suitably const variable instead of using
ugly casts to get rid of constness.
Also use wxCharBuffer/char* explicitly inside explicit wxUSE_UNICODE checks,
using wxWX2MBbuf here doesn't gain us anything and just confuses the reader of
this code.
Vadim Zeitlin [Sun, 13 May 2012 21:37:18 +0000 (21:37 +0000)]
Fix wxStyledTextCtrl compilation in non-Unicode build.
The value returned by wx2stc() in non-Unicode build is a simple "char*" and we
can't call length() method on it, add a helper wx2stclen() function to get the
length from the original wxString itself in this case.
Vadim Zeitlin [Sun, 13 May 2012 21:37:16 +0000 (21:37 +0000)]
Don't assert if no icon is specified for a wxDataViewCtrl item.
An item in a column using wxDataViewIconTextRenderer might not have any valid
icon associated with it, don't assert in case it doesn't in the native GTK
version.
Notice that the generic wxDataViewCtrl implementation already supports this
but not perfectly: no space is reserved for the icon in the images without
one, so giving the image to only some of them looks ugly. The GTK version
aligns both the items with and without icon properly and simply leaves the
image part blank and it would be better to modify the generic version to do
the same thing in the future.
Vadim Zeitlin [Sun, 13 May 2012 21:37:13 +0000 (21:37 +0000)]
Minor change to wxString pretty-printer for gdb.
Calling string() explicitly isn't necessary, at least not with gdb 7.2, and is
actually harmful when using Python 2.5 (which doesn't support UTF-32) with
wide strings.
Vadim Zeitlin [Sun, 13 May 2012 21:37:10 +0000 (21:37 +0000)]
Don't handle branches specially when sorting items in wxDataViewCtrl.
The generic version of wxDataViewCtrl tried to put all branches before the
leaves when sorting. This had a couple of problems: first, it didn't do it
correctly and actually placed the branches after the leaves which didn't make
any sense. Second, this was only done in the generic version and not the
native GTK one making the behaviour inconsistent between platforms. Finally,
this behaviour just doesn't make sense in general (i.e. when items don't
necessarily represent anything in the file system and maybe even sometimes
when they do) and there doesn't seem any good reason to do it by default.
So stop doing it, partially reverting the changes of r47562.
Vadim Zeitlin [Sun, 13 May 2012 13:17:22 +0000 (13:17 +0000)]
Remove wxDECLARE_APP() from wxIMPLEMENT_APP_NO_MAIN().
There is no need for a separate declaration inside wxIMPLEMENT_APP() as
wxGetApp() is defined by it and redeclaring it immediately after definition
results in a warning with some compilers/environments (Eclipse CDT).
The move of wxGetApp() to the beginning of the macro is only to ensure that a
semicolon is still required after wxIMPLEMENT_APP_NO_MAIN() and the other
macros terminating with it, such as wxIMPLEMENT_APP() itself.
Vadim Zeitlin [Fri, 11 May 2012 22:10:25 +0000 (22:10 +0000)]
Fix extra event sent by wxTextEntry::ChangeValue() since r71308.
The changes of r71308 sent the event unconditionally in case the text didn't
really change but no events should be sent if the flags don't include
SetValue_SendEvent, add a check for it.
Vadim Zeitlin [Wed, 9 May 2012 14:24:51 +0000 (14:24 +0000)]
Unconditionally define IID_IShellItem in wxMSW sources.
This GUID may not be defined in uuid.lib even when
__IShellItem_INTERFACE_DEFINED__ is defined in the headers, so just define it
always to avoid any problems.
Use GetBest{Height,Width}() in wxBookCtrlBase to compute the controller
control size height/width from its known (from wxBookCtrlBase size itself)
width/height. This will allow to correctly compute the size of wxListCtrl used
by wxListbook once it provides the necessary support for width-from-height and
height-from-width calculations.
Vadim Zeitlin [Wed, 9 May 2012 14:24:37 +0000 (14:24 +0000)]
Add wxWindow::GetBest{Height,Width}().
These functions will be used when it is necessary to determine the best size
of the control if one of its size components is fixed. Currently none of the
classes implements DoGetBestClient{Height,Width}() yet but wxListCtrl will do
it soon, see #13898.
Vadim Zeitlin [Wed, 9 May 2012 14:24:30 +0000 (14:24 +0000)]
Mention wxFoobookEvent change from classes to #defines in the change log.
These classes can't be forward-declared any more as they're not really classes
any longer but just compatibility #defines and can't be made classes again as
this would break the existing code using wxBookCtrlEvent in 2.9.
Vadim Zeitlin [Wed, 9 May 2012 14:24:27 +0000 (14:24 +0000)]
Allow entering more digits in wxSpinCtrl in wxMSW than fits into it.
Scroll the control automatically if there is not enough space. This is
consistent with (single line) wxTextCtrl and wxSpinCtrl under the other
platforms.
Vadim Zeitlin [Wed, 9 May 2012 14:24:16 +0000 (14:24 +0000)]
Remove assert checking bitmap size in wxMenuItem drawing code in wxMSW.
This assert was fatal, as usual when asserting from a WM_PAINT handler, as the
function was reentered resulting in nested asserts and program abort, so
remove it to at least let the program continue to run even if there is not
enough space for the bitmap in the menu.
There is, of course, still something wrong with the menu geometry calculations
if this happens but I can't even reproduce this any more so not sure what
exactly.
Vadim Zeitlin [Wed, 9 May 2012 14:24:12 +0000 (14:24 +0000)]
Fix creation of wxBitmap from wxIcon in wxMSW: premultiply the pixels.
wxBitmap in wxMSW is supposed to store its data in alpha-premultiplied format
but didn't do it when it was created from an icon (or a cursor), resulting in
wrong display of wxIcons with alpha channel when they were used for e.g. menu
items.
Fix this by ensuring that the data is always premultiplied. This is not the
best solution as in some cases (e.g. if this wxBitmap is added to wxImageList
later) we could need to undo this premultiplication later which is quite
inefficient but at least it's simple and straightforward.
Vadim Zeitlin [Wed, 9 May 2012 14:24:10 +0000 (14:24 +0000)]
Fix wxString unit test when not using UTF-8.
Restrict the tests added in r70987 to run when using UTF-8 strings only, they
test for something that is simply not true (and for a bug that can't happen)
with non-multibyte encodings.
Vadim Zeitlin [Wed, 9 May 2012 14:24:03 +0000 (14:24 +0000)]
Use better face names first in wxGTK wxNativeFontInfo::SetFamily().
Try better matches and not the most widespread ones first when building a list
of face names to try for the given family. This gives better results when
these better fonts are indeed available and doesn't change anything if they
are not.
Vadim Zeitlin [Wed, 9 May 2012 14:24:01 +0000 (14:24 +0000)]
Check that item ID is initialized when inserting it in wxListCtrl.
Using uninitialized ID happened to work by accident with 2.8 but it doesn't
work any more, try to detect this as early as possible and give a clear
explanation of why it doesn't to help fixing the broken code that used to
accidentally work.
Vadim Zeitlin [Mon, 7 May 2012 13:12:23 +0000 (13:12 +0000)]
Use XkbKeycodeToKeysym() instead of deprecated XKeycodeToKeysym().
XKeycodeToKeysym() is deprecated in new X11 headers because it doesn't work
correctly with all symbols (https://bugs.freedesktop.org/show_bug.cgi?id=5349).
Use XkbKeycodeToKeysym() instead, this should help with some keys and also
avoids deprecation warnings during compilation.
Vadim Zeitlin [Mon, 7 May 2012 13:12:20 +0000 (13:12 +0000)]
Create a wrapper file for X11/XKBlib.h header.
We need some hacks for the older systems before including this header, extract
them from src/x11/utilsx.cpp into a new private header to be able to reuse it
from wxGTK in the next commit.
Václav Slavík [Sun, 6 May 2012 13:10:34 +0000 (13:10 +0000)]
Fix wxOwnerDrawnComboBox background on with classic theme.
In wxMSW, if the classic theme was used, read-only wxOwnerDrawnComboBox
had gray background, but native look should be the same for both
editable and read-only combo boxes: white text entry-like rectangle.
Apparently, a similar problem existed with non-classic themes too
before, as there was a workaround in place. Fixed by moving the
workaround into code used by both themed and classic rendering.
Vadim Zeitlin [Sat, 5 May 2012 11:22:09 +0000 (11:22 +0000)]
Update the field widths on demand in wxStatusBarGeneric.
This ensures that the value returned from GetFieldRect() is always up to date,
even when this method is called from the user-defined wxEVT_SIZE handler, i.e.
before our own OnSize() could run.
Also remove the now unneeded hack with calling the base class OnSize() from
the statbar sample.
Stefan Csomor [Sat, 5 May 2012 05:32:19 +0000 (05:32 +0000)]
fixes crashes with embedded controls in toolbars after toolbar destruction, code was moved in r62988, but apparently Destroy doesn't have to be called, so do a last check, fixes #14258
Vadim Zeitlin [Fri, 4 May 2012 22:20:55 +0000 (22:20 +0000)]
Derive wxGenericFileCtrl from wxControl.
wxFileCtrl -- which can be #define'd as wxGenericFileCtrl -- is documented to
inherit from wxControl and does derive from it in the native GTK version, so
do it for the generic version too.
Vadim Zeitlin [Fri, 4 May 2012 20:35:31 +0000 (20:35 +0000)]
Add wxDir::GetNameWithSep() and use it to avoid consecutive slashes.
It is wrong to use dir.GetName()+"/" to obtain a slash-terminated directory
name as this results in (usually harmless but at best ugly) double slashes at
at the beginning of the string for the root directory. Add GetNameWithSep() to
obtain the correct result in all cases.
Vadim Zeitlin [Thu, 3 May 2012 10:17:15 +0000 (10:17 +0000)]
No changes, just remove duplicate flags checks in wxUniv wxTLW.
For some reason (rename of the old wxTHICK_FRAME to wxRESIZE_BORDER?) we
tested for wxRESIZE_BORDER twice in a couple of places. Don't do it for
clarity.
Fixed parts of toolbar background not being drawn with older comctl32.dll.
When using comctl32.dll versions older than 6.0 toolbar icons would not have their background drawn. Fix this in a rough way by always completely erasing the background like was done before. Regression since r62971.
Václav Slavík [Mon, 30 Apr 2012 09:33:30 +0000 (09:33 +0000)]
wxDataViewCtrl: always update the header when col best width changes.
Have an explicit per-column dirty flag and use that to determine whether
we need to call wxHeaderCtrl::UpdateColumn(). Previously, the lack of
computed best width was used as an indicator, but this didn't work
correctly if some code called GetWidth() after invalidation but before
wxDataViewCtrl::UpdateColWidths() was called at idle time. This resulted
in header's column widths getting out of sync with the control itself.
Václav Slavík [Mon, 30 Apr 2012 09:33:25 +0000 (09:33 +0000)]
Invalidate wxDataViewCtrl bests widths on expand/collapse.
The best column widths are computed from "realized" items that are
available as rows in wxDataViewCtrl. This information changes when a
previously collapsed node is expanded and new items become available for
column width calculation.
Work around the problem with not exiting event loop under MSW.
Changes of r71304 broke the event loop termination under MSW, limit them to
only the case in which they were really needed, i.e. when loop is really
exited by a pending event handler.
This is only a temporary solution, we need something better in longer term.
Use PCH in the tests in all Windows ports and not only when using wxMSW.
This change doesn't actually change anything for the "normal" ports as it only
affects wxGTK/MSW which is not officially supported yet, so the make/project
files are unchanged by it.
Set the data size in wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE in wxGTK.
Allow wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE handler to examine the data
being dragged by setting not only the pointer to it but also its size, as
otherwise it's impossible to do anything with it.
Remove internal only methods from wxDataViewEvent documentation.
SetDataXXX() methods are only meant to be used by wxDataViewCtrl itself, so
don't document them as part of public API. Their documentation was pretty
useless anyhow as it didn't say anything not already contained in the method
name.
Restore 2.8 stock labels for wxID_PREVIEW inadvertently changed in 2.9.
The wxID_PREVIEW labels were accidentally removed in r68641 and added back
with a wrong/different label later. Restore the same one (or almost, just add
an ellipsis at the end) that was used in 2.8.
Add a hack to prevent the test suite from aborting after Grid test case.
There is a problem with the native header control still having the mouse
capture when the grid is destroyed in wxGTK and this resulted in asserts when
destroying the grid, nested asserts due to an exception being thrown from a
dtor and finally abort that prevented the rest of the tests from running.
As I failed to find the real reason for this problem, just forcefully ensure
that we don't have the mouse capture when destroying the grid. This at least
allows the complete test suite to run.
Improve error reporting for nested asserts failures in the test suite.
If an assert occurred while handling an exception generated by a previous
assert handler, the information about the original assert was lost even if
though it was more important than the secondary assert. Do preserve and show
the original assert message in this case now.
Work around wxDateTime::ParseFormat() problem in generic wxDateTimePickerCtrl.
Due to a bug in wxDateTime::ParseFormat(), calling it with wxString::c_str()
currently just crashes, so don't do this in generic wxDateTimePickerCtrl code.
The real fix is, of course, to correct the bug in wxDateTime itself but for
now this at least prevents the crash when executing the test suite. And using
c_str() here is unnecessary anyhow.
Enable wxComboBox::SetString() test in the widgets sample.
It was disabled because it wasn't implemented for wxGTK at some time in the
past -- but it is implemented now, so there is no reason to not allow testing
it.
Václav Slavík [Sun, 29 Apr 2012 09:36:44 +0000 (09:36 +0000)]
Don't use ancient -no-cpp-precomp flag on OS X.
See http://trac.wxwidgets.org/ticket/14029 for a discussion of the
problems it causes when using non-Apple compiler. Even for Apple's GCC,
it does nothing these days and we no longer support OS X 10.3, so
there's no point in continuing to use it.
Make wxGTK code returning correct focus in popup menu presence more robust.
Replace the changes of r69938 with an alternative and simpler solution:
instead of playing games with gs_pendingFocus, which could break down if its
old value became invalid while the menu was shown as happened if one of the
menu commands resulted in this window being destroyed, just take the currently
shown popup menu into account in DoFindFocus() itself.
This should be safer as there is no danger of any dangling pointers here and
is also simpler and more obviously correct.
Add missing "flags" argument to wxNotificationMessage ctor in wxMSW.
It was impossible to specify the flags when creating wxNotificationMessage in
wxMSW, cotrary to the other ports and the documentation.
Fix this by adding the missing argument to the ctor and simply passing it to
the base class one, we don't have to do anything else as the existing code
already calls GetFlags() later so it should respect these flags without any
more changes.
Fix crash in wxFileConfig when deleting last entry of the root group.
This resulted in keeping a dangling pointer to the group line in
wxFileConfigGroup and any attempt to use it after this resulted in a crash.
Fix this by explicitly resetting the last line in this case.
Make it possible to forward declare wx{Choice,Tool,Tree}bookEvent again.
Don't use typedef for these classes as it makes it impossible to
forward-declare them, just use #define instead as we already do for
wxListbookEvent and wxNotebookEvent. This allows forward declaration and is
also more consistent.
The native GTK implementation is not used in wxUniv/GTK, so don't exclude the
generic one as well.
Notice that the same should be done for wxMSW and wxOSX too but we currently
seem to use the native version even in wxUniv there. It would be better to
consistently use the generic version in all wxUniv ports.