Paul Cornett [Fri, 16 Nov 2012 07:24:29 +0000 (07:24 +0000)]
Remove code that has no effect
Adjusting the wxEVT_ENTER_WINDOW mouse position is pointless, execution won't reach that far if
gdk_event->window != gtk_widget_get_window(widget), and GetClientAreaOrigin() always returns (0,0).
Vadim Zeitlin [Wed, 14 Nov 2012 13:48:23 +0000 (13:48 +0000)]
Implement wxComboCtrl::GetSizeFromTextSize().
Improve calculation of wxComboCtrl best size which doesn't work correctly for
non-default fonts as shown by r72935. It is still not perfect but better now.
Vadim Zeitlin [Wed, 14 Nov 2012 13:46:50 +0000 (13:46 +0000)]
Don't call setlocale("") on startup by default any longer.
This undoes the changes of r44773 because calling setlocale() resulted in C
locale being set differently from C++ locale which was confusing and led to
huge slowdowns in any code using std::stream with at least MinGW. And setting
the C++ locale to be the same, as r72719 tried to do, doesn't seem to be
practical as it results in immediate crashes under OS X and MinGW when used
under XP.
Do provide wxApp::SetCLocale() helper to explicitly do what was previously
done implicitly, even though currently it is a trivial wrapper for setlocale()
and we don't even need to call gtk_set_locale() as it has never done anything
else and is deprecated since GTK+ 2.24.
Václav Slavík [Tue, 13 Nov 2012 12:36:32 +0000 (12:36 +0000)]
Fix wxGTK's wxFileDialog:Get/SetFilename() to be in sync.
The m_fileName and m_dir variables, managed by the base class, were out
of sync when the dialog wasn't shown yet, because the wxGTK
implementation didn't always set them. GetFilename() following
SetFilename(x) could return something other than x. Fixed by calling the
base class version.
Vadim Zeitlin [Sat, 10 Nov 2012 12:40:47 +0000 (12:40 +0000)]
Disallow drop downs on AUI check buttons.
This doesn't make much sense and disallowing it makes check items consistent
with radio ones as previously you could set up a dropdown for the former but
not for the latter.
Also update the documentation of the relevant methods.
Vadim Zeitlin [Sat, 10 Nov 2012 12:22:32 +0000 (12:22 +0000)]
Fix crashes after using "wildcard" wxEvtHandler::Disconnect().
When not specifying the function to disconnect, the associated event sink was
destroyed too early resulting in crashes later. Fix this and add unit tests
verifying that things work as expected and at least don't crash.
Vadim Zeitlin [Sat, 10 Nov 2012 00:53:17 +0000 (00:53 +0000)]
Simplify wxEVT_PAINT handling in wxScrollHelperBase.
Just always call the virtual OnDraw() if wxEVT_PAINT wasn't handled. This is
much simpler than connecting our own special handler just to set a flag saying
whether the event was processed which was very complicated and didn't work
anyhow for the statically connected wxEVT_PAINT handlers.
Vadim Zeitlin [Sat, 10 Nov 2012 00:52:54 +0000 (00:52 +0000)]
Cache HDC used for painting for the entire duration of WM_PAINT processing.
This fixes a long standing problem with 2 wxPaintDC created one after another
(and not with nested lifetimes, which was handled by the caching mechanism
previously used) not working correctly. And as this was exactly what happened
when handling wxEVT_PAINT for wxScrolled, it also fixes drawing artefacts when
using scrolled windows.
Vadim Zeitlin [Tue, 6 Nov 2012 23:57:06 +0000 (23:57 +0000)]
Don't leave orphan taskbar icon window alive if setting it up fails.
This fixes a rare bug which happens when we fail to install the task bar icon
under MSW for whatever reason (the only known way to reproduce it is to try to
do it very quickly after resume from suspend but there might be other
situations in which this happens). In this case we must delete the icon as we
are not going to get any timeout expiration notifications for it and so if we
don't delete it immediately, it would remain alive forever, preventing the
application from exiting as it counts as a top level window.
Vadim Zeitlin [Tue, 6 Nov 2012 23:54:47 +0000 (23:54 +0000)]
Fix regression with wxAuiToolBar gripper and overflow members initialization.
The changes of r72785 moved m_gripperVisible and m_overflowVisible
initialization to Init() but this was too early as these fields depend on the
window style only set when it's really created, so re-initialize them to their
proper values in Create().
Vadim Zeitlin [Tue, 6 Nov 2012 23:53:17 +0000 (23:53 +0000)]
Add wxUSE_{BASE,GUI} checks to interface headers.
This allows to define just one of them to run some tool, e.g. SWIG, on only
the classes defined in the base or in the core library (both are defined by
default for Doxygen itself).
Vadim Zeitlin [Tue, 6 Nov 2012 16:50:56 +0000 (16:50 +0000)]
Never collapse invisible root item in generic wxDataViewCtrl.
Since the changes of r72325, the root item could be collapsed and marked as
not having any children but this was wrong because no items could be added to
it after this.
Vadim Zeitlin [Sun, 4 Nov 2012 23:55:22 +0000 (23:55 +0000)]
Slightly improve the date/time dialogs in the calendar sample.
Use CreateStdDialogButtonSizer() instead of constructing
wxStdDialogButtonSizer directly, not only this is shorter but it also makes
the "OK" button default correctly.
Also initialize the labels instead of leaving them initially empty.
Vadim Zeitlin [Sun, 4 Nov 2012 23:54:37 +0000 (23:54 +0000)]
Make hack for button creation in wxOSX more robust.
Don't crash when creating a plain wxButton with wxBU_NOTEXT style. This
happened because we skipped creating the peer (real implementation) in this
case entirely on the assumption that we were creating a wxBitmapButton, but
this is not necessarily the case. So now test that the creation of the peer is
really disabled before skipping it (this required adding ShouldCreatePeer()
accessor).
Merging wxWidgetImpl::CreateButton() and CreateBitmapButton() (and the same
thing for toggle buttons) would still be a better solution but while it's
trivial to do for Cocoa, it isn't for Carbon. And we can't use a single
function for Cocoa but different functions for Carbon, so for now just
continue to use this hack.
Vadim Zeitlin [Sun, 4 Nov 2012 23:54:15 +0000 (23:54 +0000)]
Ensure that paths used inside wxOSX are always in NFC form.
OSX uses NFKD but this is unexpected for wx applications, so normalize the
string to use the composed form whenever we receive a file system path from OS
X.
Vadim Zeitlin [Sun, 4 Nov 2012 23:53:06 +0000 (23:53 +0000)]
Implement setting default wxTextCtrl style in wxOSX.
Use NSTextView setTypingAttributes to change the attributes used for the new
text by default as setting them for the selected region didn't do anything
useful under OS X (and did nothing at all when there was no selection).
Vadim Zeitlin [Sun, 4 Nov 2012 23:52:21 +0000 (23:52 +0000)]
Suppress warnings about NSText not responding to setAllowsUndo.
Cast NSText to NSTextView when sending this message to it. Hopefully it
doesn't change the run-time behaviour but just fixes several lines of warnings
that were given without this cast.
Vadim Zeitlin [Sun, 4 Nov 2012 23:51:58 +0000 (23:51 +0000)]
No changes, just make it easier to tweak splitter sample.
The sample contains disabled code for using other type of windows than
MyCanvas for the splitter children but it didn't compile any more because the
variables were declared as wxScrolledWindow. Fix this by using just wxWindow
for them.
Vadim Zeitlin [Sun, 4 Nov 2012 23:50:50 +0000 (23:50 +0000)]
Update the button bezel to account for multi-line labels in wxOSX.
If a button was created using a normal single-line label (including empty one)
and then its label was changed to something multi-line later, its size stayed
wrong in wxOSX as it still used the fixed size bezel used by normal buttons.
Adjust the bezel after each bezel change now to update the size of the button
if necessary.
Vadim Zeitlin [Sun, 4 Nov 2012 23:50:05 +0000 (23:50 +0000)]
No real change, just make bezel setting code in wxOSX more clear.
Avoid code duplication between SetAcceleratorFromLabel() and
wxWidgetImpl::CreateButton(), generalize the former to handle the special
cases taken into account only in the latter previously.
Also use a switch on border flags instead of series of nested ifs as this
seems to be more clear.
Vadim Zeitlin [Sun, 4 Nov 2012 23:49:42 +0000 (23:49 +0000)]
Revert "Fix the pages range in the print dialog in wxOSX."
This reverts r72805 (leaving only the changes to printdlg.cpp which seem
harmless and potentially useful) as it resulted in crashes when using
wxHtmlEasyPrinting because we called wxPrintout::OnPreparePrinting() before
setting the DC to be used, which was wrong.
In fact it's not clear how can we get the correct range of pages at all
because we need a DC to paginate properly (i.e. taking into account its size)
but we need to show a dialog, in which we already want to show the pages
range, before choosing the DC. Perhaps we could create a dummy DC for
pagination purposes but how could this work with printers using different page
sizes?
The best would probably be to avoid setting any limits on the page range as
showing 9999 looks ugly but anything else would be wrong.
Vadim Zeitlin [Sun, 4 Nov 2012 23:49:19 +0000 (23:49 +0000)]
Update tree control layout in EditLabel() for wxOSX too.
A special preprocessor check for OS X prevented the control from being relaid
out correctly in EditLabel() there, which resulted in problems when trying to
edit a just added item.
Simply remove this check for OS X (and also MSW but this is less important as
this version of the control is almost never used there anyhow) to fix it.
Vadim Zeitlin [Sun, 4 Nov 2012 12:44:51 +0000 (12:44 +0000)]
Don't use "readlink -e" in docs generation script, it's not portable.
"readlink" command also exists under OS X but with a completely different
syntax than under Linux, so just use "pwd -P" to get the physical path name
instead, this should hopefully work everywhere as it's POSIX.
Václav Slavík [Thu, 1 Nov 2012 18:25:07 +0000 (18:25 +0000)]
wxCALL_FOR_EACH compilation fix for VC++.
VC++ has a bug where __VA_ARGS__ is incorrectly expanded as a single
token, contrary to C99. The solution is to pass the arguments to another
macro as a single token inside parenthesis.
See http://stackoverflow.com/questions/9183993/msvc-variadic-macro-expansion
for the gory details.
Vadim Zeitlin [Thu, 1 Nov 2012 17:15:19 +0000 (17:15 +0000)]
Always set the font to use in wxMSW wxTextMeasure when using a window.
The default window HDC font is not the same as the wxWindow font, so we need
to always set the font explicitly in this case (when using a wxDC, its HDC
does have the current wxDC font already selected into it, so doing it once
again would be unnecessarily wasteful).
Vadim Zeitlin [Thu, 1 Nov 2012 17:15:15 +0000 (17:15 +0000)]
Allow constructing wxGTK wxTextMeasure with NULL font.
The font is explicitly documented as being possibly NULL in the base class and
wxMSW handles NULL font just fine, so also handle it in the GTK version.