add a detailed description to wxMenuItem::SetItemLabel() partially moving docs from wxMenu::Append; add usage examples; organize wxMenuItem functions in 3 sections (getters, setters, checkers) to make it easier to browse the docs; use @onlyfor tag where necessary instead of the (Windows only) text
Vadim Zeitlin [Sat, 19 Dec 2009 12:00:16 +0000 (12:00 +0000)]
Document wxSpinCtrlDouble in correct header file.
The public header for this class is wx/spinctrl.h, but it was documented in
wx/generic/spinctrg.h which didn't even correspond to an existing real header
file (which is called spinctlg.h). Move the documentation to wx/spinctrl.h and
remove the old file.
Vadim Zeitlin [Sat, 19 Dec 2009 11:17:32 +0000 (11:17 +0000)]
Always draw standard-sized checkboxes in generic wxDataViewToggleRenderer.
The checkbox should be always shown in its normal size, otherwise it looks
strange. And this also fixes the overflow of the checkbox in the next column
which happened if the size passed to Render() had negative width before.
Jaakko Salli [Sat, 19 Dec 2009 11:13:03 +0000 (11:13 +0000)]
In wxPropertyGrid::HandleCustomEditorEvent(), also filter out excess wxEVT_COMMAND_TEXT_UPDATED events that originated from wxComboCtrl-derived editors.
Vadim Zeitlin [Fri, 18 Dec 2009 22:31:54 +0000 (22:31 +0000)]
Don't create labels with wxST_NO_AUTORESIZE flag with empty size by default.
Since r57627 wxStaticText objects with wxST_NO_AUTORESIZE flag created with
wxDefaultSize were created with zero width. This accounted for the
disappearance of the labels for the toolbar controls (as could be seen in the
toolbar sample where the combobox label was not shown any more).
Fix this by explicitly setting the correct initial size after the correct
label is set.
Vadim Zeitlin [Fri, 18 Dec 2009 22:31:48 +0000 (22:31 +0000)]
Don't draw over dummy separators in MSW toolbar, just don't draw them at all.
Prevent the native toolbar from drawing the separators which we use simply as
placeholders by excluding them from the update region when handling WM_PAINT.
This reduces flicker by not redrawing the areas occupied by these separators
twice and also prevents them from ever being shown (you could see them briefly
appear before being erased before).
The other toolbar tools still flicker though, there doesn't seem to be any
simple way to prevent the control from entirely invalidating itself whenever
it is resized.
Vadim Zeitlin [Fri, 18 Dec 2009 20:49:29 +0000 (20:49 +0000)]
Don't explicitly set the background colour for wxChoice.
This is unnecessary and results in flicker when the control is resized because
we explicitly erase its background ourselves and then it does it itself.
Vadim Zeitlin [Fri, 18 Dec 2009 20:49:23 +0000 (20:49 +0000)]
No real changes, just change type of MSWGetBgBrush() argument.
Pass wxWindow instead of HWND to it as in most cases we already have wxWindow
for the HWND we have and calling wxFindWinFromHandle() once more is
unnecessary.
This also makes the code of MSWGetBgBrushForChild() slightly simpler.
Vadim Zeitlin [Fri, 18 Dec 2009 20:49:15 +0000 (20:49 +0000)]
Don't force themed background for wxToolBar under MSW, just use the default.
Native toolbars don't have themed background under Vista/7 and don't look good
with rebar background (which is the same one as used for the menus) as
toolbars don't appear on the top of the window.
Erasing background ourselves also results in flicker and display problems and
makes the code much more complicated. Simply don't do this to avoid all the
problems.
Vadim Zeitlin [Fri, 18 Dec 2009 14:47:18 +0000 (14:47 +0000)]
Only call GetTextMetrics() in wxDC::GetTextExtent() if necessary.
A micro-optimization: avoid ::GetTextMetrics() call if we don't use its
results (as is the case if neither descent nor external leading were
requested).
Vadim Zeitlin [Fri, 18 Dec 2009 14:47:08 +0000 (14:47 +0000)]
Call SymCleanup() in wxStackWalker to fix problem with next call to it.
Calling SymInitialize() second and subsequent times failed (and hence so did
wxStackWalker::WalkFrom() and other methods) as we didn't call SymCleanup()
because of some problems with old versions of debughlp.dll. These problems
don't seem to exist any more so do call SymCleanup() so that we can walk the
stack more than once.
Vadim Zeitlin [Fri, 18 Dec 2009 14:46:38 +0000 (14:46 +0000)]
Restore the use of the correct brush for toolbar background erasing.
The call to SetBrush() was mistakenly removed in r62850 but it is needed
because wxClientDC only inherits background colour but not the brush used by
DrawRectangle() call in wxToolBar::MSWEraseRect(), so the wrong colour was
used under systems < Vista.
Vadim Zeitlin [Thu, 17 Dec 2009 17:51:12 +0000 (17:51 +0000)]
Correct wxDateTime::GetWeekOfMonth() for days in the beginning of January.
This function was implemented in terms of GetWeekOfYear() which made it tricky
to get it right as GetWeekOfYear() can, correctly, return week number for the
previous year for the first days of January (and also from the next one for
the last days of December).
Replace this implementation with a simple one directly counting the number of
weeks since the first of the month, this seems to be much simpler and does
pass the new unit test case which the old version failed.
Also make the unit test failures more informative by using
WX_ASSERT_EQUAL_MESSAGE() instead of CPPUNIT_ASSERT_EQUAL().
Vadim Zeitlin [Thu, 17 Dec 2009 16:44:09 +0000 (16:44 +0000)]
Always use FVIRTKEY for the accelerators under MSW.
Not using FVIRTKEY results in problems in non-US keyboard layouts and, in
fact, we were already always using it because wxCharCodeWXToMSW() returned
true in its output IsVirtual argument most of the time.
Just do it always now and also remove IsVirtual parameter with badly (if at
all...) defined meaning from wxCharCodeWXToMSW() as it's not used anywhere any
longer.
Vadim Zeitlin [Tue, 15 Dec 2009 22:44:54 +0000 (22:44 +0000)]
Avoid GTK+ errors when using AUI wxPseudoTransparentFrame hack.
wxPseudoTransparentFrame is not a top level window at all and the code in
wxGTK wxTopLevelWindow::DoSetSizeHints() fails for it when it is called from
wxWindowBase::CreateBase() because of it and spits GTK+ errors as it calls
gtk_window_set_geometry_hints() with NULL widget.
Fix this by simply skipping wxTopLevelWindow implementation of this method in
wxPseudoTransparentFrame. A better fix would be to get rid of this hack
completely, of course.
Vadim Zeitlin [Tue, 15 Dec 2009 21:12:06 +0000 (21:12 +0000)]
Remove asserts in wxChoicebook::Get/SetPageImage().
It's better to silently return an error code than assert when these methods
are called as their failure is relatively harmless and the user code may call
them via base class pointer without caring if it works with a control which
supports images or not.
Vadim Zeitlin [Mon, 14 Dec 2009 19:17:12 +0000 (19:17 +0000)]
Avoid painting generic wxDataViewCtrl if it has no columns.
The code in wxDataViewMainWindow::OnPaint() relied on having at least the
first column and didn't work for a completely empty control. Just don't paint
it at all in this case as it's unnecessary anyhow.
TOOLKIT is never set to "MAC" at all (it is one of OSX_{CARBON,COCOA,IPHONE})
so it is not necessary to test for it. And for the other cases the special
logic for OS X ports was the same as the general case so it seems to be
unnecessary as well.
Vadim Zeitlin [Sun, 13 Dec 2009 12:52:47 +0000 (12:52 +0000)]
Test for sw_vers availability before calling it in configure.
There is no sw_vers when cross-compiling, just assume 10.4 system in this
case and point the user to --with-macosx-version-min which can be used to
override this.
Vadim Zeitlin [Sun, 13 Dec 2009 12:52:42 +0000 (12:52 +0000)]
Rename --with-cocoa configure switch to --with-old_cocoa to avoid confusion.
Change --with-cocoa to be synonym for --with-osx_cocoa, add --with-carbon as a
synonym for --with-osx_carbon for consistency and --with-osx as a synonym for
--with-mac.
Vadim Zeitlin [Thu, 10 Dec 2009 03:04:19 +0000 (03:04 +0000)]
Add support for stretchable spaces to wxToolBar.
Stretchable spaces consume all extra toolbar space not allocated to the fixed
size items. They can in particular be used to right-align (some) toolbar tools.
Add and document the new API, change the sample to show it and implement it
for MSW, GTK and OS X/Cocoa.
Also refactor MSW background erasing/repainting code to avoid duplicated calls
to DrawThemeBackground(), call it from a new helper MSWEraseRect() function.
Note that we may want to add support for "invisible" separators, IOW
non-stretchable spaces. This could be easily done for MSW after the changes in
this commit and is supported natively by GTK+ and Cocoa so implementing this
would be trivial if there is any interest.
Vadim Zeitlin [Thu, 10 Dec 2009 03:04:07 +0000 (03:04 +0000)]
Rename gtk{,1}/tbargtk.{h,cpp} to toolbar.{h,cpp}.
We don't use crptknm$port.cpp naming convention even for MSW any more and
there is really no reason to continue to do it for just this one file in
wxGTK.
Vadim Zeitlin [Thu, 10 Dec 2009 02:59:16 +0000 (02:59 +0000)]
Set correct toolbar width in wxMSW wxFrame.
The hack introduced in r22410 artificially set wrong size for toolbar under
MSW. This completely breaks any calculations that can be done using it (e.g.
to find the space available for the stretchable part of the toolbar) and is
completely and utterly unexpected.
Revert it, toolbar flicker must be dealt in another way if it is still a
problem.
Vadim Zeitlin [Thu, 10 Dec 2009 02:59:02 +0000 (02:59 +0000)]
No changes, just slightly simplify the tool insertion code.
Added a helper DoInsertNewTool() function to avoid code duplication and ensure
that we never forget to delete a new tool if inserting it into the toolbar
failed.
Also explicitly document that the tool passed to the public InsertTool() is
not owned by the toolbar and so must be deleted by the caller if its insertion
failed.
Peter Cawley [Wed, 9 Dec 2009 18:48:41 +0000 (18:48 +0000)]
Rewrote wxRibbonPage realisation and layout code to avoid setting the position and size of panels multiple times.
Fixed memory leak in wxRibbonToolBar::Realize().
Vadim Zeitlin [Wed, 9 Dec 2009 14:59:26 +0000 (14:59 +0000)]
Avoid outputting the assert message twice in non-GUI code.
As we always log the assert message in ::ShowAssertDialog() itself there is no
need to log it again in wxAppTraitsBase::ShowAssertDialog().
Also show the "please wait while generating stack trace information" in
wxAppTraitsBase::GetAssertStackTrace() itself instead of doing it in both
places which call it.
Vadim Zeitlin [Wed, 9 Dec 2009 14:59:13 +0000 (14:59 +0000)]
Don't limit the number of stack frames in GTK assert dialog to 20.
This dialog uses a scrollbar to keep its vertical size reasonable in any case
so there is absolutely no danger of making it too tall even if we show more
frames in it.
Vadim Zeitlin [Wed, 9 Dec 2009 14:59:08 +0000 (14:59 +0000)]
Better handling for asserts in non-main threads.
Don't call wxTrap() when an assert in a non-main thread fails. As asserts are
now always enabled by default, this is not a good idea. Instead just show the
full details about the assert failure using wxMessageOutputDebug under the
platforms without MT-safe message box function (i.e. everything but MSW
currently).
Add a possibility to test an assert happening in non-main thread to the except
sample.
Vadim Zeitlin [Wed, 9 Dec 2009 14:59:01 +0000 (14:59 +0000)]
No real changes, just remove __WXDEBUG__ tests.
These tests are unnecessary now because asserts are almost always enabled. We
could test for wxDEBUG_LEVEL but the code still compiles even if it's defined
as 0 so there doesn't seem to be any need for it.
Vadim Zeitlin [Tue, 8 Dec 2009 15:56:14 +0000 (15:56 +0000)]
Implement wxWindow::DoGetBorderSize() in the trivial case of wxBORDER_NONE.
This fixes an assert in wxGenericStaticText which overrode
DoGetBestClientSize() but not DoGetBorderSize().
It would still be useful to implement DoGetBorderSize() in wxGTK (and other
ports) in general too as using wxGenericStaticText with non-default border
still doesn't work.
Vadim Zeitlin [Tue, 8 Dec 2009 15:36:51 +0000 (15:36 +0000)]
Fix event object in wxSysColourChangedEvent.
The handler for this event in the base class incorrectly changed the event
object of the original event instead of setting it for the event being sent to
the window children as it was supposed to.
Vadim Zeitlin [Tue, 8 Dec 2009 15:24:59 +0000 (15:24 +0000)]
Don't set the initial size as minimal size for top level windows.
Correct the change of r62814: only call SetMinSize() for non-top-level windows
as the user should be able to resize the top-level ones to be smaller than
their initial size.
This also fixes the GTK+ warning resulting from calling wxTLW::SetMinSize()
from the ctor, before the window is realized.
Vadim Zeitlin [Mon, 7 Dec 2009 23:37:36 +0000 (23:37 +0000)]
Set initial window size as its minimal size.
The change of r62306 broke the code which relied on the window created with a
given initial size to never become smaller than this size. This was to be
expected because the best size of such window is now (1, 1) and not its
initial size but we still need to preserve the old behaviour for compatibility
and also because it usually does make sense to avoid shrinking the window with
an explicitly specified initial size beneath this value.
So call SetMinSize() with the initial size explicitly now in wxWindowBase
ctor.