Vadim Zeitlin [Fri, 9 Oct 2009 13:05:38 +0000 (13:05 +0000)]
Define __WXOSX__ and __WXMAC__ on compiler command line.
Although __WXMAC__ and __WXMAC__ were already defined in wx/platform.h if
__WXOSX_XXX__ was defined, they couldn't be used for checks done before
including this header, which was surprising and, in case of __WXMAC__,
backwards incompatible. Define them now on the compiler command line to ensure
that they are always defined.
Vadim Zeitlin [Fri, 9 Oct 2009 13:05:20 +0000 (13:05 +0000)]
Append default extension before showing file save dialog, not after.
Appending the extension after the dialog was hidden is a bad idea as it
misleads the user by using a different file name from the one shown in the
dialog. It is also dangerous as it bypassed wxFD_OVERWRITE_PROMPT check.
So just append the default extension to the initial file name if it doesn't
have any but don't modify the file name once it was accepted by user.
Vadim Zeitlin [Fri, 9 Oct 2009 13:05:10 +0000 (13:05 +0000)]
Don't add default extension in wxDocument::SaveAs().
wxFileSelector() takes care of the default extension itself and if it returned
a file name without one, it means that the user really wants to create a file
without an extension. Adding the default extension here is at best useless and
at worst actively dangerous because it may silently overwrite an existing file
(although this bug is due to a different problem, see #11256 for a scenario in
which this can happen).
Vadim Zeitlin [Fri, 9 Oct 2009 13:04:44 +0000 (13:04 +0000)]
Mention log components in wxLogTrace() documentation.
Using different log components for different logging statements provides a
better (because more general and efficient) way to do the same thing that
wxLogTrace() does, so mention them when describing wxLogTrace().
Julian Smart [Fri, 9 Oct 2009 07:26:54 +0000 (07:26 +0000)]
Revert a workaround for Windows native border side-effect since latter is now fixed
and former causes a positioning problem when the scrollbar is not at the home position and
the grid is resized.
Vadim Zeitlin [Thu, 8 Oct 2009 22:38:03 +0000 (22:38 +0000)]
Add a WX_APPNAME_DATA_DIR hack for wxStandardPaths::GetDataDir().
Applications using wxStandardPaths::GetDataDir() to find their files under
Unix can't be ran without being installed as they look for their data files
under $prefix/share/appname. Make it possible to override this location by
setting WX_APPNAME_DATA_DIR environment variable to allow running them without
installation.
Notice that this shouldn't present any security risk unless the application is
SUID (which would be a very bad idea anyhow).
Jaakko Salli [Thu, 8 Oct 2009 15:33:30 +0000 (15:33 +0000)]
Fixed regression: in wxPropertyGrid::PerformValidation(), wxPGProperty::ValidateValue() was only called when value was variant list, which was exactly the opposite condition under which the function was supposed to be called (fixes #11299).
Vadim Zeitlin [Wed, 7 Oct 2009 10:50:45 +0000 (10:50 +0000)]
Honour COMPILER_PREFIX in wx presets too.
If a non-default COMPILER_PREFIX was specified when building wxWidgets, we
should also be able to use the same prefix when building applications using
this build, so use COMPILER_PREFIX instead of just COMPILER in the project/
makefiles generated using wx presets.
Vadim Zeitlin [Tue, 6 Oct 2009 00:08:15 +0000 (00:08 +0000)]
Create an NSAutoreleasePool in wxMacWakeUp().
An auto-release pool is needed in this function because it can be called from
another thread which has no reason to have a pre-existing pool, but it does
allocate NSEvent object which is auto-released, resulting in warnings if no
pool available.
Vadim Zeitlin [Tue, 6 Oct 2009 00:08:10 +0000 (00:08 +0000)]
Ensure that an event loop exists in ShowViewOrWindowWithEffect().
We may not have an event loop yet if wxWindow::ShowWithEffect() is called
during the application startup, create a temporary event loop instead of
crashing in this case.
Vadim Zeitlin [Mon, 5 Oct 2009 22:58:26 +0000 (22:58 +0000)]
Rebake using pre-release version of bakefile 0.2.7.
They should fix the problem with monolithic build of wx (see #11231).
Notice that trivial changes to VC9 project files are not being committed so
the makefiles are currently not quite consistent but it shouldn't matter as
they will be all regenerated soon when bakefile 0.2.7 is really released.
Vadim Zeitlin [Mon, 5 Oct 2009 22:58:15 +0000 (22:58 +0000)]
Refactor initialization code in wxTopLevelWindowMSW::Create().
No real changes as the old code was, in fact, correct (although Create()
didn't initialize m_parent explicitly, it was still done in AddChild() if the
parent was not NUL) but just make it more explicit and clear.
Add a new helper wxWindowBase::CreateBase() overload for top level windows,
not taking the validator parameter which doesn't apply to them.
Also make CreateBase() protected as it is only meant to be called from derived
classes Create().
Vadim Zeitlin [Mon, 5 Oct 2009 22:58:10 +0000 (22:58 +0000)]
Don't use the current size in DoGetBestSize() by default.
Doing this means that a window which was made initially large because no other
windows were present or shown will refuse to shrink to make space for them
later even if it doesn't need to be that large. The issue was masked under MSW
and GTK because the first size event under these ports is sent so early that
the top level parent window is not realized yet and has default size of 20*20
pixels meaning that its children will cache their initial (very small) size as
their best size, but it was very visible under OS X where the initial layout
is done using the real top level window size and broke wxInfoBar showing in
the dialogs sample, for example.
Vadim Zeitlin [Mon, 5 Oct 2009 22:58:05 +0000 (22:58 +0000)]
Make wxWindow::ShowWithEffect() synchronous under wxOSX/Cocoa.
As explained in the previous commit, while Cocoa support asynchronous
animation, wx API doesn't really, so block in Cocoa implementation of
ShowWithEffect() until the animation terminates for compatibility with
wxMSW and hence expectations of the existing code.
Vadim Zeitlin [Mon, 5 Oct 2009 22:57:59 +0000 (22:57 +0000)]
Implement wxWindow::ShowWithEffect() for wxOSX/Cocoa.
This version animates the window asynchronously and is being checked in just
to preserve it in svn if we later decide to return to this semantics. It will
be replaced by synchronous animation in the next commit.
Vadim Zeitlin [Mon, 5 Oct 2009 22:57:39 +0000 (22:57 +0000)]
Remove the hack with changing the parent background colour in wxInfoBar.
Finding the closest info bar to copy the background colour from only worked
for very simple layouts and failed for more complicated ones with nested
sizers so don't try to change the colour automatically, it's easy enough to do
it manually as shown in the updated dialogs sample.
Vadim Zeitlin [Mon, 5 Oct 2009 22:57:24 +0000 (22:57 +0000)]
Return smaller images for wxART_MENU/BUTTON under OS X.
Requesting images with client id of wxART_MENU/BUTTON used to return the large
32*32 icons because GetNativeSizeHint() wasn't implemented for these client
ids.
Moreover, under Mac some icons (notably message box ones) are created from the
corresponding icon bundle and the code in wxArtProvider::GetBitmap() didn't
resize them correctly in this case, fix this.
Vadim Zeitlin [Mon, 5 Oct 2009 22:57:09 +0000 (22:57 +0000)]
Use wxRendererNative::DrawTitleBarBitmap() for info bar close button.
If supported by the current platform, draw natively-looking close button using
multiple bitmaps for normal, pressed and current stats. Otherwise fall back on
the old wxArtProvider-based bitmap.
Vadim Zeitlin [Mon, 5 Oct 2009 22:57:04 +0000 (22:57 +0000)]
Added wxRendererNative::DrawTitleBarBitmap().
This is currently only implemented for wxMSW as there is no advantage to use a
generic implementation compared to using wxArtProvider directly under the
other ports. But for MSW this allows to have perfectly natively looking
titlebar-like buttons.
Vadim Zeitlin [Mon, 5 Oct 2009 22:56:58 +0000 (22:56 +0000)]
Replaced GraphicsHDC from src/msw/renderer.cpp with wxDC::GetTempHDC().
wxDC::GetTempHDC() method provides a convenient and safe way to retrieve HDC
from a wxDC object, whether it is using GDI or GDI+. It is implemented using
(MSW-specific) virtual functions in wxDC and so doesn't need ugly hacks like
wxDynamicCast which were used in src/msw/renderer.cpp to achieve the same
effect.
Also, we now use GetTempHDC() consistently in all wxMSW rendering methods as
the old GraphicsHDC was only used in some of them meaning that many methods
didn't work at all with wxGCDC.
Vadim Zeitlin [Mon, 5 Oct 2009 22:56:52 +0000 (22:56 +0000)]
Refactor wxRendererXP button drawing methods.
Avoid code duplication in wxRendererXP as well and fix a bug in
DrawRadioBitmap() which incorrectly drew it in hot state when it was disabled
but wxCONTROL_CURRENT was specified.
Vadim Zeitlin [Mon, 5 Oct 2009 22:56:48 +0000 (22:56 +0000)]
Implement wxRenderer::DrawRadioBitmap() for classic MSW renderer.
Clean up the functions added in r57313:
- Versions using wxUxThemeEngine should be in wxRendererXP
- Provide implementation using DrawFrameControl() in wxRendererMSW too
- Refactor the code to avoid triplication in wxRendererMSW
Vadim Zeitlin [Mon, 5 Oct 2009 22:56:22 +0000 (22:56 +0000)]
Don't use themed border for the generic info bar.
Since the switch to deriving from wxControl instead of wxWindow, the info bar
gained a themed border which doesn't look nice for it, especially when it is
shown progressively, as happens under Windows.
Restore the old behaviour by overriding GetDefaultBorder() to return
wxBORDER_NONE for it. This doesn't look perfect neither however, we may want
to draw a separator line between it and the parent window ourselves as even
wxBORDER_SIMPLE looks too heavy for it (and there should be definitely no
border on its sides as it always touches the parent window edges).
Vadim Zeitlin [Mon, 5 Oct 2009 22:56:12 +0000 (22:56 +0000)]
No real changes, just inline wxSuspendStyleEvents.
wxSuspendStyleEvents helper class was used in one place only and the code is
more clear if its ctor and dtor are inlined directly into DoApplyWidgetStyle()
itself instead of being located far away from it.
Also, we only need to suppress the events for top level windows so don't
bother doing anything at all when changing styles for m_widget and not m_wxwindow.
Vadim Zeitlin [Mon, 5 Oct 2009 22:55:53 +0000 (22:55 +0000)]
Added wxART_CLOSE art id.
This id corresponds to the close button bitmap. Currently only wxGTK returns a
natively-looking button from here, MSW and OS X versions will be added later.
Vadim Zeitlin [Mon, 5 Oct 2009 22:55:32 +0000 (22:55 +0000)]
Generate the button clicks in GTK version of wxInfoBar.
Also add an example of handling info bar buttons events to the sample and
mention that this must be done using Connect() or by deriving from wxInfoBar
in the documentation.
Vadim Zeitlin [Mon, 5 Oct 2009 22:55:22 +0000 (22:55 +0000)]
Use event tables instead of Connect() in wxInfoBarGeneric.
This allows to handle events from the info bar buttons in the derived classes
using the event tables while if the base class used Connect(), the derived
classes static event handlers would be never executed.
Vadim Zeitlin [Mon, 5 Oct 2009 22:55:17 +0000 (22:55 +0000)]
Add wxInfoBar::RemoveButton() method.
Also change the GTK implementation to use a separate wxInfoBarGTKImpl to store
its data, this object won't be even allocated if a generic implementation is
used under GTK.
Vadim Zeitlin [Mon, 5 Oct 2009 22:55:10 +0000 (22:55 +0000)]
Added native wxInfoBar implementation for wxGTK.
Straightforward implementation of wxInfoBar using GtkInfoBar widget available
in GTK+ 2.18.
Some side effects of this change:
- Rename wxInfoBar version in wx/generic/infobar.h to wxInfoBarGeneric and
define wxInfoBar in wx/infobar.h.
- Also change default value of flags argument to ShowMessage() to
wxICON_INFORMATION from wxICON_NONE as the default colour for wxICON_NONE
messages is surprisingly ugly in GTK native version.
Vadim Zeitlin [Mon, 5 Oct 2009 22:54:46 +0000 (22:54 +0000)]
Added GTKShouldConnectSizeRequest() to prevent size_request handling.
Don't hard code the exception for GtkFileChooserButton in
wxWindow::PostCreation() in wxGTK, handling size_request signal also breaks
other controls (e.g. upcoming wxInfoBar native implementation). Instead,
define a virtual function which may be overridden to return false if
size_request shouldn't be connected.