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.
Vadim Zeitlin [Thu, 1 Nov 2012 17:14:54 +0000 (17:14 +0000)]
Deal correctly with wx directory being a symlink in docs generation script.
The script calling Doxygen is smart enough to strip the path of the wxWidgets
directory from the paths of the files, but it didn't do it correctly if this
directory was a symlink.
Fix this by using readlink, if available, to get the canonical name.
Vadim Zeitlin [Wed, 31 Oct 2012 00:17:17 +0000 (00:17 +0000)]
Define wxSOCKET_XXX flags as wxSOCKET_XXX_READ|wxSOCKET_XXX_WRITE.
The recently introduced (in r72591) wxSOCKET_{WAITALL,NOWAIT}_{READ,WRITE}
flags weere for some reason completely different and unrelated to the existing
bidirectional wxSOCKET_{WAITALL,NOWAIT} ones. Change this by defining the
bidirectional version simply as the sum of the two others. This makes much
more sense than testing for either wxSOCKET_XXX or wxSOCKET_XXX_READ or
wxSOCKET_XXX_WRITE being specified.
And it also fixes an assert in wxSocketWaitModeChanger where a sanity check
failed when this class was used with wxSOCKET_WAITALL|wxSOCKET_WAITALL_READ.
Vadim Zeitlin [Mon, 29 Oct 2012 14:50:42 +0000 (14:50 +0000)]
Get rid of wxAuiToolBar::m_style and just use base class m_windowStyle.
This fixes an assert exposed by the addition of wxAuiToolBar::Create() in
r72785: as m_style was not initialized before, calling GetWindowStyle() from
wxControl::Create() returned wrong flags.
Fix this by just removing m_style completely, there doesn't seem to be any
need for it nor for overriding GetWindowStyleFlag().
Vadim Zeitlin [Mon, 29 Oct 2012 01:20:21 +0000 (01:20 +0000)]
Avoid double destruction of wxTipWindow under wxOSX.
Hiding the window results in wxEVT_KILL_FOCUS under OS X and this destroys it
already, so when we call Destroy() from wxTipWindow::Close() later, it
triggers assert about destroying it twice.
Avoid doing this under OS X for now, even though the real problem is probably
the discrepancy in wxEVT_KILL_FOCUS event generation under different platforms.