Vadim Zeitlin [Thu, 20 May 2010 17:33:26 +0000 (17:33 +0000)]
Fix wxScrollHelperEvtHandler broken by recent changes to event processing.
Use ProcessEventLocally() added in r64261 (which was probably the one to break
this) to forward event to the window itself instead of ProcessEvent() in
wxScrollHelperEvtHandler::ProcessEvent() implementation. Calling ProcessEvent()
didn't work any more in a case when another event handler was pushed on a
wxScrolledWindow: in this case the EVT_SIZE and EVT_PAINT handlers defined in
the window itself were not called at all any more.
Add a unit test checking for the even more tortuous than usual event
processing path in this particular case.
Robert Roebling [Sun, 16 May 2010 15:52:35 +0000 (15:52 +0000)]
Added quick implementation of wxDataViewChoiceByIndexRenderer, closes #11970 (wxDataViewChoiceRenderer set/get methods should use the current selection index
move TestUtf8() and TestEncodingConverter() functions to UnicodeTestCase. Disable some code which does not run clean and mark it with FIXME comments (needs revision).
Robert Roebling [Sun, 16 May 2010 14:44:58 +0000 (14:44 +0000)]
Don't call super class explicitly so overriding is possible, closes #12025 (wxDataViewVirtualListModel calls super-class' version of certain virtual methods).
Václav Slavík [Sun, 16 May 2010 13:21:03 +0000 (13:21 +0000)]
Fix incorrect painting of backgrounds inside notebook.
Children without transparent background (e.g. wxListBox) were still
pained using notebook's background brush. They shouldn't, it should
apply only to transparent-bg controls.
Vadim Zeitlin [Sat, 15 May 2010 11:15:09 +0000 (11:15 +0000)]
Clip drawing in wxRendererGeneric::DrawHeaderButtonContents().
Clip drawing of the icon and bitmap to the header rectangle.
Don't clip the text because we already ellipsize it to avoid overflowing but
do the ellipsization correctly, using wxControl::Ellipsize() instead of the
simple (and wrong) duplicated version here.
Also correct and simplify the alignment calculations.
Vadim Zeitlin [Sat, 15 May 2010 10:47:28 +0000 (10:47 +0000)]
Remove wxGTK-specific text shift in wxRenderer::DrawHeaderButtonContents().
This was probably related to the code removed by r63947 and doesn't seem to be
needed here neither (and could presumably result in the same problems as in
the ticket #11780).
Vadim Zeitlin [Thu, 13 May 2010 15:31:35 +0000 (15:31 +0000)]
Never enable wxSpinCtrlGenericBase window itself at underlying toolkit level.
We create wxSpinCtrlGenericBase window disabled at underlying toolkit level
(but enabled at the level of wxWidgets API, of course), but calling Disable()
and Enable() on it re-enabled it resulting in loss of mouse events under
Windows.
Don't re-enable it (again, at the low-level toolkit level only) in its
Enable() any more but keep this window itself always disabled.
Vadim Zeitlin [Thu, 13 May 2010 15:31:30 +0000 (15:31 +0000)]
Use GetWidgets() in the widgets samples instead of GetWidget2().
Add a function which can be overridden to return an arbitrary number of
widgets instead of having just GetWidget() and GetWidget2(): spin control page
already uses 3 widgets (and defines GetWidget3() which is never called) and we
could have even more in the future. Just use a generic solution which will
always work.
The practical consequence of this is that the "Enable/Disable" menu item now
also enables and disables the wxSpinCtrlDouble in the spin page, see #12045.
Vadim Zeitlin [Thu, 13 May 2010 14:37:00 +0000 (14:37 +0000)]
Document wxDocument::DeleteContents().
This method purpose was not quite clear as it was only mentioned in passing in
documentation of OnCloseDocument() but not really documented itself.
Also don't call it from wxDocument dtor as this is useless: the user-defined
overridden version will never be called from here and the base class version
does nothing.
Vadim Zeitlin [Wed, 12 May 2010 14:34:18 +0000 (14:34 +0000)]
Refactor wxDocParentFrame and wxDocMDIParentFrame to share common base class.
Use the same approach as for the child frames: add a base template class which
allows wxDocParentFrame to inherit from wxFrame and wxDocMDIParentFrame from
wxMDIParentFrame while still allowing to reuse the common code.
This reduces code duplication and should make implementing parent AUI document
frame easier as well, see #8945.
Vadim Zeitlin [Mon, 10 May 2010 21:10:03 +0000 (21:10 +0000)]
Change wxDIALOG_NO_PARENT value to avoid clashing with wxCENTRE.
Use a bit freed by removing wxTINY_CAPTION_HORIZ for wxDIALOG_NO_PARENT. This
allows to move it out from the lower byte of the style word to avoid conflicts
with the button selection flags which can be commonly combined with the dialog
styles.
More precisely, wxDIALOG_NO_PARENT used to clash with wxCENTRE, meaning that
wxSingleChoiceDialog, for example, was always created without parent because
its default style included wxCENTRE. This commit fixes this particular bug and
probably more similar ones.
Vadim Zeitlin [Mon, 10 May 2010 21:02:30 +0000 (21:02 +0000)]
Don't use wxWindow::ClearBackground() in the image sample and explain why.
Painting on both wxPaintDC and wxClientDC simultaneously doesn't work well,
e.g. under Windows the client DC can be actually erased after we finished
painting the window contents, overwriting it.
Simply use wxDC::Clear() instead of wxWindow::ClearBackground() to avoid this
and document the danger of using ClearBackground() from EVT_PAINT handler.
Vadim Zeitlin [Sun, 9 May 2010 14:55:46 +0000 (14:55 +0000)]
Replace public wxEvtHandler::ProcessEventHere() with private TryHere().
ProcessEventHere() doesn't have to be public any more now that we have
ProcessEventLocally() which is safe to call from the outside (i.e. doesn't
forget about the chained event handlers and validators).
Still keep this function because it makes the code more modular and also
because we might want to make it virtual for consistency with TryBefore() and
TryAfter() later. Also rename it to TryHere() to make the symmetry with these
functions more manifest.
Vadim Zeitlin [Sun, 9 May 2010 14:55:41 +0000 (14:55 +0000)]
Use ProcessEventLocally() instead of ProcessEventHere() in docview code.
Use wxEvtHandler::ProcessEventLocally() instead of ProcessEventHere() when
forwarding events in the docview code. This ensures that any event handlers
chained with the objects involved (document manager, document, view) will be
used.
Incidentally the old code didn't work at all as ProcessEventHere() didn't even
call TryBefore() where the (further) forwarding was implemented.
Vadim Zeitlin [Sun, 9 May 2010 14:55:33 +0000 (14:55 +0000)]
Add wxWindow::ProcessWindowEventLocally() and use it in wxMSW MDI code.
Add ProcessWindowEventLocally() which wraps ProcessEventLocally() in the same
way as ProcessWindowEvent() wraps ProcessEvent(). I.e. it allows to process
the event in this window only, without propagating it upwards, but taking into
account any event handlers associated with it.
Use the new method in wxMDIParentFrame code in wxMSW to ensure that event
handlers pushed on MDI children frames are taken into account. Add a test for
this to the MDI sample.
Vadim Zeitlin [Sun, 9 May 2010 14:55:28 +0000 (14:55 +0000)]
Refactor the event processing code to add ProcessEventLocally().
This new method can be used to only process the event in this handler or any
handlers connected to it (unlike ProcessEventHere() which doesn't follow the
chain at all), without propagating the event upwards (unlike ProcessEvent()).
Unfortunately implementing this required a field to wxEvent but there doesn't
seem to be any other way to do what we need.
There should be no user-visible changes after this commit, it just paves the
way for the upcoming fixes.
Vadim Zeitlin [Sun, 9 May 2010 14:55:21 +0000 (14:55 +0000)]
Call wxEvtHandler::TryBefore() only once from ProcessEvent().
The event pre-processing hooks associated with the window should be called
only once during the event processing, we don't need to call TryBefore() for
each and every event handler associated with the window too.
This makes the code slightly simpler and faster and shouldn't change the
behaviour of any existing code.
Václav Slavík [Sun, 9 May 2010 10:27:35 +0000 (10:27 +0000)]
Fixed popup menu's title to be bold regardless of method used.
Popup menus with title set via SetTitle() had bold font, but menus
created by passing title as ctor argument used normal font. Fixed this
by using the same code (SetTitle) in both cases, instead of having two
independent (and out of sync) implementations of the same functionality.
Vadim Zeitlin [Sat, 8 May 2010 10:28:01 +0000 (10:28 +0000)]
Invalidate wxListBox best size immediately without waiting for idle time.
Since r53743 the listbox best size was only invalidated during idle time but
this meant that it could be laid out using incorrect old best size. So while
we still defer (expensive) horizontal extent calculation until later, do
invalidate the best size immediately to ensure the listbox is laid out
correctly.
Vadim Zeitlin [Fri, 7 May 2010 23:38:31 +0000 (23:38 +0000)]
Fix crash in wxCommandProcessor of capacity N when N-1 commands were undone.
Performing N commands (where N is the maximal number of commands stored by
wxCommandProcessor), undoing N-1 of them and performing another command
resulted in a crash because a dangling pointer was left.
Vadim Zeitlin [Fri, 7 May 2010 23:38:21 +0000 (23:38 +0000)]
Fix bugs related to two phase creation of wxRibbon classes.
Add missing wxRibbonControl::Create() method. Ensure that member variables are
always initialized by the ctor. Check that we're fully initialized in EVT_SIZE
handler.
Václav Slavík [Fri, 7 May 2010 06:45:48 +0000 (06:45 +0000)]
Integrate with GNOME's Recent Documents menu.
GTK+ provides GtkRecentManager for this purpose since 2.10. Use it in
wxFileHistory if available. Integration is simple, we just add a file to
GtkRecentManager in addition to normal wxFileHistory handling.
A well-behaved GNOME application would use GtkRecentManager as the
primary store for recent files, so that it reflects when the user works
with supported files in another editor(s) too. But for now, this is much
better than no support at all.
Jaakko Salli [Thu, 6 May 2010 17:21:50 +0000 (17:21 +0000)]
Modify float/double wxAny testing to use CPPUNIT_ASSERT_EQUAL() instead of CPPUNIT_ASSERT_DOUBLES_EQUAL(), so that we know the retrieved values are truly identical.
Vadim Zeitlin [Thu, 6 May 2010 12:58:27 +0000 (12:58 +0000)]
Always update the value of generic spin control when leaving it.
We could be left with an invalid value in the control when leaving it. E.g. in
the widgets sample whose double spin control has range from 0 to 10, 123 could
be entered in it and was not replaced by 10 when the control lost focus. This
happened because the code didn't bother to update the text control if its
contents already corresponded to the internally stored value -- but this was
wrong as it could have a different representation.
Just always update the text unconditionally when synchronizing it with the
internal value.
Vadim Zeitlin [Thu, 6 May 2010 12:58:22 +0000 (12:58 +0000)]
Make keyboard navigation in generic wxTreeCtrl more Mac-like under OS X.
In the native OS X tree control right cursor arrow expands the current item
and the left one collapses it if it's expanded, make the generic control work
like this too under Mac.
Vadim Zeitlin [Thu, 6 May 2010 12:40:18 +0000 (12:40 +0000)]
Check that menu ids are limited to MSW-supported range.
We already check that positive (i.e. specified by user and not generated by
wx) window ids are in 0..SHRT_MAX range. Now do the same for the menu ids as
ids outside of this range suffer from the same problem under MSW: they get
wrapped and become negative when we receive events for them.
Václav Slavík [Thu, 6 May 2010 12:12:53 +0000 (12:12 +0000)]
Refactor wxTranslationsLoader API.
Instead of calling back into wxTranslations to actually load the data,
return wxMsgCatalog instance from
wxTranslationsLoader::LoadCatalog(). This requires making wxMsgCatalog
public.