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.
Vadim Zeitlin [Sat, 27 Oct 2012 12:28:00 +0000 (12:28 +0000)]
Allow using wxTextMeasure::GetLargestStringExtent() with wxArrayString.
Change the signature of this method to take the number of strings and the
pointer to the first of them instead of wxVector<wxString> as this allows it
to be used with all of wxVector<wxString>, wxArrayString and raw arrays of
wxStrings.
Also return the computed size from it instead of filling output parameters.
Vadim Zeitlin [Sat, 27 Oct 2012 00:46:58 +0000 (00:46 +0000)]
Break implicit dependency of "core" on "adv" via wxXmlResourceHandlerImplBase.
wxXmlResourceHandlerImplBase::GetAnimation() returned wxAnimation by value
which created references to wxAnimationCtrlNameStr and wxNullAnimation
symbols, defined in the "adv" library, in "core" when using Sun CC even though
they were not referenced directly.
Fix this by returning wxAnimation by pointer to keep it opaque for "core" code.
Vadim Zeitlin [Thu, 25 Oct 2012 23:26:36 +0000 (23:26 +0000)]
Store the selected directory in wxGTK wxDirDialog.
This should help with the selected directory not being remembered since
GTK+ 2.24.11 as apparently gtk_file_chooser_get_filename() doesn't work any
more now after hiding the dialog -- so call it before doing this and save the
result.
Also get rid of the ugly and apparently completely unnecessary OnFakeOk().
Vadim Zeitlin [Thu, 25 Oct 2012 23:26:32 +0000 (23:26 +0000)]
Prevent pasting too much text into limited length wxTextCtrl in wxGTK.
Improve insert-text signal handler to block pasting text into the control,
which may overflow the specified max length in one action, and not only
entering individual characters.
Vadim Zeitlin [Thu, 25 Oct 2012 22:30:43 +0000 (22:30 +0000)]
Make wxFILE_EXISTS_SYMLINK work on its own, without wxFILE_EXISTS_NO_FOLLOW.
Include the wxFILE_EXISTS_NO_FOLLOW bit in wxFILE_EXISTS_SYMLINK definition to
allow using just wxFileName::Exists(wxFILE_EXISTS_SYMLINK) which used to never
work because the link was followed.
Vadim Zeitlin [Thu, 25 Oct 2012 22:19:20 +0000 (22:19 +0000)]
Include wx/xml/xml.h from the XRC handlers that need it.
Including this header from wx/xrc/xmlres.h itself only when WXMAKINGDLL_XRC is
defined doesn't work when we're building a static library and not a shared/DLL
one and we don't have any symbol defined in this case, so just don't try to be
smart and include this header from the files that need it.