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.
Václav Slavík [Wed, 5 May 2010 13:50:15 +0000 (13:50 +0000)]
Fix incorrect assumptions about locales codes.
wx incorrectly assumes that Unix locale codes have the form of xx_YY,
where both xx and yy are two characters long. This is wrong, xx is
ISO 639 code, which can often have 3 characters ("ast", "gez" etc.);
future ISO 639-6 will have up to 4 chars. Similarly, ISO 3166 has
alpha-3 variant of country codes too (even though they aren't used in
this context today).
For parsing needs, we can just look for '_' in the code. The only place
where a check for xx_YY code was performed was GetSystemLanguage().
Instead of bothering with correct check (or a heuristic), let's simply
assume locale is xx_YY code and only do alternative handling if that
assumption fails. According to the comments, this alternative handling
was for cases such as LANG=german environment on SuSE, but it's safe to
say that no modern systems do that anymore, so it's OK that this patch
is marginally less efficient on such legacy systems.
Vadim Zeitlin [Wed, 5 May 2010 12:20:15 +0000 (12:20 +0000)]
Notify user less intrusively about overflow when previewing HTML printouts.
We used to show a modal dialog if the page didn't fit horizontally but this
was too intrusive when the user was just previewing the output and not really
printing it. Moreover, the question of the message box ("Print" or "Cancel")
simply didn't make sense in this case.
Fix both problems by not showing this dialog at all when previewing. Instead,
notify the user with a much less intrusive info bar in the preview window.
Vadim Zeitlin [Wed, 5 May 2010 12:19:59 +0000 (12:19 +0000)]
Replace wxPrintout::SetIsPreview() with SetPreview().
Unlike the old function just indicating whether a printout is being used for
previewing, the new one associates the preview object with it. This can be
useful if we need to access the window used for the preview, for example.
Also remove a bunch of apparently unnecessary SetIsPreview(false) calls as
printing (and not previewing) is already the default.
Vadim Zeitlin [Tue, 4 May 2010 21:59:17 +0000 (21:59 +0000)]
Ignore time component of SYSTEMTIME in wxCalendarCtrl.
Native month calendar functions doesn't always return correct values in the
time part of SYSTEMTIME so ignore it and use just the date component.
To simplify doing it, add helper (MSW-specific) SetFromMSWSysDate() and
GetAsMSWSysDate() functions which convert between wxDateTime and SYSTEMTIME
but take only date component into account.
This commit partially replaces changes of r63560 and closes #11276.