Commit Graph

49857 Commits

Author SHA1 Message Date
Paul Cornett
e33253d15c non-PCH build fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-06 03:42:55 +00:00
Vadim Zeitlin
3c7eea2563 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62310 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-06 00:08:15 +00:00
Vadim Zeitlin
dc72e2adfa 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-06 00:08:10 +00:00
Vadim Zeitlin
8ea1300ff5 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:58:26 +00:00
Vadim Zeitlin
2973301f6f 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().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:58:15 +00:00
Vadim Zeitlin
7ccc497b9c 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:58:10 +00:00
Vadim Zeitlin
f2be067844 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:58:05 +00:00
Vadim Zeitlin
ab9a0b84de 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:59 +00:00
Vadim Zeitlin
ff6893d2c2 Added a virtual wxWindow::OSXGetViewOrWindow() method.
This can be used to retrieve either an NSView for child windows or NSWindow
for non-owned ones without resorting to dynamic casts.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:50 +00:00
Vadim Zeitlin
3996b21a7f Determine the appropriate show effect automatically in wxInfoBar.
Slide the info bar from top or bottom of the parent window depending on its
location.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:45 +00:00
Vadim Zeitlin
15ea6e205b 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:39 +00:00
Vadim Zeitlin
ec20a753b9 Implement DrawTitleBarBitmap() for OS X using hard coded PNG images.
Use a simple implementation working under all OS X versions, including 10.4
which doesn't have standard system images for the close button.

Added the images themselves under art/osx and png2c.py helper script to
convert them to a form used in C++ code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:32 +00:00
Vadim Zeitlin
1d3dfc57e7 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:24 +00:00
Vadim Zeitlin
5c67a53d87 Use wxART_BUTTON instead of wxART_MENU for info bar icons.
wxART_BUTTON seems to be more appropriate, although in practice this doesn't
make any difference.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62298 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:20 +00:00
Vadim Zeitlin
bccb042c2a Make info bar buttons smaller.
This looks better under Mac OS X (and currently has no effect under the other
platforms).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:15 +00:00
Vadim Zeitlin
cc2608047b 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:09 +00:00
Vadim Zeitlin
b50d93d1da 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:57:04 +00:00
Vadim Zeitlin
942d5e2d72 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:58 +00:00
Vadim Zeitlin
6c9aaf7d0c 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:52 +00:00
Vadim Zeitlin
081b33427e 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

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:48 +00:00
Vadim Zeitlin
8c9d15339b Add demonstration of flags to the render sample.
Allow to select the flags to pass to DrawXXX() functions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:43 +00:00
Vadim Zeitlin
737e53350c Add demonstration of a few more wxRenderer methods.
Also show the effect of calling several more DrawXXX() methods in the sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:36 +00:00
Vadim Zeitlin
34456d33dc Correct custom renderer method override example in the sample.
The implementation of DrawHeaderButton() in MyRenderer should restore the
text foreground colour and brush to avoid messing up drawing done after it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:31 +00:00
Vadim Zeitlin
1641cb376d Don't use possibly uninitialized pen in wxMSWDCImpl.
Check that m_pen is valid before checking if it is transparent in
DoDrawRoundedRectangle() too (this was already done in DoDrawRectangle() in
r53150).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:27 +00:00
Vadim Zeitlin
5cdd380565 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).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62287 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:22 +00:00
Vadim Zeitlin
4026acf137 Ensure that info bar message uses the set font/colours in wxGTK.
Propagate the font and colours set on wxInfoBar window itself to its label in
the native GTK implementation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:17 +00:00
Vadim Zeitlin
0d013e46a0 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:12 +00:00
Vadim Zeitlin
0b1add25fd Added wxInfoBar::Dismiss().
Add a method to conveniently hide the info bar and update the parent layout.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:56:07 +00:00
Vadim Zeitlin
bc061c8ede Use more native appearance in the generic wxInfoBar implementation.
Use default font for the text and left align it instead of centering.
Also use smaller bitmaps for the icon and the button.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:57 +00:00
Vadim Zeitlin
b9727751aa 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:53 +00:00
Vadim Zeitlin
39f6b6ba78 Added wxArtProvider::GetMessageBoxIconId().
This function translates between wxICON_XXX constants and wxART_YYY values. It
was extracted from the existing GetMessageBoxIcon().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62281 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:46 +00:00
Vadim Zeitlin
6a3f8b4f1f Only show the default close button in wxInfoBar if there are no others.
Assume that user-added buttons can be already used to close the message so
don't show the default close button if any were added.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:40 +00:00
Vadim Zeitlin
c0945eb234 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:32 +00:00
Vadim Zeitlin
cc7033c2f5 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:22 +00:00
Vadim Zeitlin
e6b2aae1b8 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:17 +00:00
Vadim Zeitlin
ed8efd46d9 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:10 +00:00
Vadim Zeitlin
a0c8bb73f2 Add wxWindowGTK::GTKConnectWidget() helper.
This trivial wrapper function allows to omit "m_widget" and "this" arguments
when calling g_signal_connect().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:55:01 +00:00
Vadim Zeitlin
bb8afd6543 Small code cleanup in wxWindowGTK::PostCreation().
No real changes, just check for 2.8.0 GTK+ version once instead of doing it
twice in a row.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:55 +00:00
Vadim Zeitlin
92153555cf 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.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:46 +00:00
Vadim Zeitlin
dcd18dd300 No real changes, just removed unnecessary SetInitialSize() call.
wxControl::PostCreation() already calls SetInitialSize() so there is no need
to call it explicitly in wxHyperlinkCtrl::Create().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62272 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:41 +00:00
Vadim Zeitlin
ce668f297b Extract conversion from wx to GtkMessageType in a separate file.
Add wxGTKImpl::ConvertMessageTypeFromWX() function to convert from wxICON_XXX
styles to GTK_MESSAGE_XXX values.

This will be reused by wxInfoBar in the next commits.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:36 +00:00
Vadim Zeitlin
374ae80f2c Added wxInfoBar::AddButton().
Allow adding custom buttons to wxInfoBar and show this in the sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:31 +00:00
Vadim Zeitlin
df8c364bf4 Made wxInfoBar::SetFont() change the text message font.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:24 +00:00
Vadim Zeitlin
a92b5dfe8c Initial wxInfoBar implementation.
Add generic implementation, documentation and examples showing the use of the
new class in the samples.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:54:13 +00:00
Vadim Zeitlin
ffa50e7361 Added wxSHOW_EFFECT_NONE.
Calling Show/HideWithEffect() with this effect is the same as calling just the normal Show/Hide().

This is convenient as it allows to use the same API, whether with effects or without them.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:57 +00:00
Vadim Zeitlin
2e61f76aac Added wxICON_NONE to wxICON_MASK.
Absence of icon is also an icon flag.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62266 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:48 +00:00
Vadim Zeitlin
3406ebd4ea Store canvas attributes in the canvas itself in the dialogs sample.
Simplify the code by not transferring font and colours between canvas and
wxTheApp but use canvas font and colours directly instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:44 +00:00
Vadim Zeitlin
5b05ce47a4 Minor cleanup and copyright updates in the dialogs sample.
No real changes otherwise.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:37 +00:00
Vadim Zeitlin
87a1867991 Use member variable instead of a global in the dialogs sample.
Made MyCanvas member of MyFrame instead of using a global variable which was
put inside the frame by wxApp.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62263 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:32 +00:00
Vadim Zeitlin
e9ee227022 Partially implement wxTextCtrl::GetStyle() in wxGTK.
Support retrieving the (both foreground and background) colours for the given
position.

Closes #11281.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-05 22:53:26 +00:00