Robert Roebling [Fri, 21 May 2010 20:13:49 +0000 (20:13 +0000)]
Second try to get wxDataViewChoiceByIndex and its name right, hopefully fixes #11970: wxDataViewChoiceRenderer set/get methods should use the current selection
index not a string
Vadim Zeitlin [Fri, 21 May 2010 13:17:30 +0000 (13:17 +0000)]
Erase the column label background in wxGrid to avoid display artefacts.
Apparently the column label text is not always drawn correctly when double
buffering is used, so erase the background completely before drawing the text.
Unfortunately this might result in flicker but presumably correct display is
more important.
Vadim Zeitlin [Fri, 21 May 2010 12:52:12 +0000 (12:52 +0000)]
Always define SIZEOF_WCHAR_T if it's not defined under Windows.
The assumption that SIZEOF_EVERYTHING_ELSE is defined when SIZEOF_INT is is
wrong. While wxWidgets configure does define all SIZEOF_XXX at once,
SIZEOF_INT could also be defined in some third party headers (e.g. Python.h)
and we still need to define the other ones.
In particular, doing this fixes the problem with SIZEOF_WCHAR_T not being
defined during wxPython build.
Vadim Zeitlin [Fri, 21 May 2010 12:51:20 +0000 (12:51 +0000)]
Simplify and correct MSW selection of background brush for children painting.
Check for the transparency of the window background in MSWGetBgBrush() itself
and let MSWGetBgBrushForChild() just return the brush to be used.
This required adding a MSW-specific hack to wxPanel to allow inheriting
background of wxNotebook by its children which is slightly ugly but is exactly
what we need to do in this case and makes the rest of the code much simpler.
Also add a possibility to set the background of the page containing the
control being tested to the widgets sample to test for background inheritance.
This shows problems with wxSlider and wxRadioBox backgrounds but they're not
new with this patch.
Vadim Zeitlin [Fri, 21 May 2010 12:07:45 +0000 (12:07 +0000)]
Yet another fix to event propagation in scrolled windows.
Calling ProcessEventLocally() didn't work because the command events were not
propagated to the parent window any more, breaking a lot of things including
wxDataViewCtrl event generation in the generic version. So do restore
ProcessEvent() call but use it on the next handler (i.e. the window itself)
and not this one now. This still results in some duplicate calls but at least
the events should be passed everywhere where they are expected to arrive.
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.