Vadim Zeitlin [Sun, 20 May 2012 20:29:56 +0000 (20:29 +0000)]
Fix 62 harmless but annoying Clang warnings in wxOSX build.
Clang warns about using letters and digits in a switch on wxKeyCode enum which
doesn't include them as elements. This is generally useful but really annoying
in this case, especially due to the sheer number of warnings, so disable it
using Clang-specific pragma.
Vadim Zeitlin [Sun, 20 May 2012 20:29:50 +0000 (20:29 +0000)]
Use wxObjCID instead of "struct objc_object*" to fix clang build.
Clang doesn't accept "struct objc_object*" as synonym for "id" in Objective-C
code, so use the real "id" for it while still using the struct pointer for C++
code where "id" is not defined.
Vadim Zeitlin [Sun, 20 May 2012 20:29:35 +0000 (20:29 +0000)]
Improve check for OS X version in Cocoa wxFileDialog implementation.
A library using wxWidgets linked with 10.6 SDK might be loaded into an
application loading 10.5 version of AppKit in which case 10.6-specific
functions shouldn't be used. Check for the AppKit version effectively in use
instead of just checking for the system version.
Vadim Zeitlin [Sun, 20 May 2012 20:29:29 +0000 (20:29 +0000)]
Reset wxDialog::m_modality sooner in wxOSX.
Change the internal flag to wxDIALOG_MODALITY_NONE before sending
wxEVT_WINDOW_MODAL_DIALOG_CLOSED event. This ensures that if the dialog is
shown again from this event handler it works correctly.
Julian Smart [Sun, 20 May 2012 12:25:22 +0000 (12:25 +0000)]
Added pixel size capability to wxTextAttr and wxRichTextCtrl.
Fixed composite object positioning in centred and right-aligned
paragraphs.
Added field example to sample, and enabled pixel font size selection.
Added custom text and dimension scaling.
Vadim Zeitlin [Thu, 17 May 2012 16:10:19 +0000 (16:10 +0000)]
Fix wrong format specifiers in the samples.
Use "%ld" instead of "%d" to format long values, using "%d" results in an
assert failure under LP64 systems as int and long have different sizes there.
Paul Cornett [Thu, 17 May 2012 15:29:50 +0000 (15:29 +0000)]
Remove use of "size-request" signal for wxWindow sizing.
This signal has been removed from GTK3. Instead have wxPizza keep track of child
size, and use gtk_widget_set_size_request() for wxWindows in native containers.
Vadim Zeitlin [Wed, 16 May 2012 15:10:05 +0000 (15:10 +0000)]
Make variable containing port number an ushort in the sockets sample.
A port number is an unsigned short, not long, so don't make it long just
because wxCmdLineParser doesn't provide a convenient way to get the value of
an unsigned short option (it would be nice if it did...).
This fixes the problem with using "%d" format specifier with a long variable
as this resulted in an assert under LP64 systems.
Vadim Zeitlin [Wed, 16 May 2012 15:10:01 +0000 (15:10 +0000)]
Fix wxWakeUpIdle() in Unix console application broken by r71089.
Initialize m_pipeIsEmpty to true as we don't have anything in the pipe
initially and if this variable was false, nothing was ever written to the wake
up pipe and it was never set to true as nothing was read from it neither.
Vadim Zeitlin [Tue, 15 May 2012 10:04:01 +0000 (10:04 +0000)]
Enable variadic macros for VC9 and later.
VC9 and 10 support variadic macros so define HAVE_VARIADIC_MACROS for them
too. This currently only affects wxLog{Debug,Trace} definitions in wx/log.h.
Vadim Zeitlin [Tue, 15 May 2012 10:03:57 +0000 (10:03 +0000)]
Fix keyboard navigation in wx{List,Choice,Tree,Tool}book controls.
Inherit from wxNavigationEnabled<wxBookCtrlBase> instead of just
wxBookCtrlBase to ensure that the keyboard navigation works correctly for
these controls.
The toolbar in wxToolbook still doesn't accept focus from keyboard but at
least the pages can be TAB-bed too and from. And the rest of the controls
are now fully accessible using only the keyboard.
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.