Vadim Zeitlin [Tue, 11 Oct 2011 17:07:43 +0000 (17:07 +0000)]
Move SetBackgroundBitmap() from wxPanel to new wxCustomBackgroundWindow.
wxCustomBackgroundWindow is a new class allowing to set a custom bitmap for
the background of any window. The relevant code was mostly moved from wxPanel
to which it was added only recently (before 2.9.2) making it unnecessary to
preserve compatibility.
Vadim Zeitlin [Mon, 10 Oct 2011 10:53:23 +0000 (10:53 +0000)]
Move wxTopLevelWindow::SetShape() down to wxNonOwnedWindow.
Also add wxNonOwnedWindow for wxMSW (which previously simply typedef'd it to
wxWindow) and document this class now that it provides some user-visible
functionality.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:29 +0000 (22:07 +0000)]
Allow creating wxGraphicsFont without using wxFont.
This is mostly important to allow using wxImage-based wxGraphicsContext
without requiring X server connection under Unix: as wxFont can't be used
without X server, we needed another way to create wxGraphicsFont in this case.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:18 +0000 (22:07 +0000)]
Refactor wxGDIPlusFontData ctor to allow using it without wxGDIPlusContext.
wxGDIPlusFontData only needs wxGDIPlusContext to get the font unit to use, so
pass the font unit directly to the ctor to allow also using it when there is
no context at hand.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:16 +0000 (22:07 +0000)]
Simplify and rationalize wxGDIPlusContext class constructors.
Remove the now unnecessary default ctor from wxGDIPlusContext and
wxGDIPlusMeasuringContext and add a ctor taking just wxGraphicsRenderer that
can be useful to the derived classes instead.
Merge Init() and SetDefaults() and initialize everything at once in the new
Init() now.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:13 +0000 (22:07 +0000)]
Don't make private wxGraphicsContext-derived classes dynamically creatable.
This doesn't make any sense because classes such as wxGDIPlusContext,
wxGDIPlusMeasuringContext and wxMacCoreGraphicsContext are private and don't
need to be creatable by name (only renderers potentially need to be) and was
inconsistent with Unix/Cairo backend in which these classes were not dynamic.
So remove wxRTTI macros from them in wxMSW/wxOSX as well as this allows us to
get rid of unnecessary default ctors.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:10 +0000 (22:07 +0000)]
Fixed non-existent wxCairoContext default ctor.
wxCairoContext class declared default ctor which wasn't implemented and even
couldn't be implemented because its base class didn't have any default ctor
neither.
Fix this by providing a ctor taking wxGraphicsRenderer* and implement it.
Vadim Zeitlin [Sun, 9 Oct 2011 22:07:04 +0000 (22:07 +0000)]
No changes, just refactor wxCairoBitmapData ctor.
Extract the code for buffer and surface creation into separate helper
functions so that they could be reused by other constructors (to be added in
the next commits).
Also use cairo_format_stride_for_width(), if available, to compute the stride
for the surfaces we create instead of hard coding 4*width.
Vadim Zeitlin [Sun, 9 Oct 2011 22:02:05 +0000 (22:02 +0000)]
Implement EVT_MOUSE_CAPTURE_LOST handling for wxPopupTransientWindow.
Handle mouse capture lost events instead of polling for the mouse status in
EVT_IDLE handler. This is not only more efficient but also catches the cases
when the capture was lost before OnIdle() could be executed which could result
in assertion failures and, before the previous commit, even crashes.
The idle-time code is still used for wxOSX/Carbon because it doesn't seem to
generate mouse capture loss events currently -- but should be removed as soon
as support for these events is added.
Vadim Zeitlin [Sun, 9 Oct 2011 22:02:02 +0000 (22:02 +0000)]
Implement delayed destruction for wxPopupTransientWindow.
Windows of this class can be destroyed at any moment, even while some events
are still being processed, so delay the real destruction until we can be sure
that it's safe to delete the window.
This fixes problems (crashes due to dangling pointers) when the object is
deleted from the overridden OnDismiss(), for example.
Vadim Zeitlin [Sun, 9 Oct 2011 22:01:57 +0000 (22:01 +0000)]
Fix inheriting parent background colour in wxPanel in wxMSW.
wxPanel didn't inherit the background colour set for its parent any more in
wxMSW because its HasTransparentBackground() didn't return true unless the
panel was a child of wxNotebook. This was wrong because not only themed
notebook background should be inherited but also any solid background
explicitly set for a panel parent.
Fix this by returning true from MSWHasInheritableBackground(), which is used
by wxPanel::HasTransparentBackground() under MSW, if the window has an
explicitly set and inheritable background colour.
Václav Slavík [Sun, 9 Oct 2011 13:07:10 +0000 (13:07 +0000)]
Return true from wxDataViewMainWindow::ItemDeleted().
Presumably, 'false' indicates failure, but there's no failure here: if
an item is not visible, because its parent wasn't expanded yet, it's
perfectly OK that we don't need to do anything.
Václav Slavík [Fri, 7 Oct 2011 15:03:02 +0000 (15:03 +0000)]
Add columns focus and keyboard navigation to generic wxDataViewCtrl.
The UI tries to mimic Windows 7's Explorer's approach as much as
possible, taking inspiration in the GTK+ implementation when
appropriate. In particular, as long as the user doesn't use horizontal
navigation keys, everything looks as before and the user isn't bothered
with the existence of per-cell focus.
Vadim Zeitlin [Sun, 2 Oct 2011 13:15:19 +0000 (13:15 +0000)]
Fix current field highlighting in generic wxTimePickerCtrl under wxGTK.
In wxGTK, calling HighlightCurrentField() from EVT_SET_FOCUS handler was not
enough as the highlighting was overwritten by the default behaviour of
selecting the entire text control contents on focus gain.
Fix this by calling SetFocus() from HighlightCurrentField() before updating
the selection. This ensures that the correct field is always highlighted.
Vadim Zeitlin [Sun, 2 Oct 2011 12:58:48 +0000 (12:58 +0000)]
Use wxSP_WRAP for generic wxTimePicker spin button.
This ensures that the spin button arrows are always enabled, as they should
be, even under wxGTK where wxSpinButton disables its arrows on its own if its
value reaches the end of its range and wxSP_WRAP is not used.
Vadim Zeitlin [Sun, 2 Oct 2011 11:28:54 +0000 (11:28 +0000)]
Fix setting tooltips for wxSearchCtrl and other composite controls.
Propagate SetToolTip() call on wxCompositeWindow to all subwindows to ensure
that the tooltip is shown for all parts of the window.
Notice that this is still not ideal as the tooltip temporarily disappears when
mouse moves from one subwindow to another, instead of staying in place as it
does with "monolithic" windows and ideally we should find a way to avoid it
(should be possible at least under MSW with TTM_RELAYEVENT) but for now this
is already much better than nothing.
Vadim Zeitlin [Sun, 2 Oct 2011 11:28:40 +0000 (11:28 +0000)]
Restore correct wxSearchCtrl size in wxMSW after wxTextCtrl changes.
The code in generic wxSearchCtrl implementation was broken by the changes of
r69066 which deccreased the best height of border-less text controls.
Ideally we should probably change wxSearchCtrl::LayoutControls() to not be
sensitive at all to the exact value returned from wxTextCtrl::GetBestSize()
and just always centre everything vertically but this doesn't look simple to
do with the current code so just override wxSearchTextCtrl::DoGetBestSize() to
return the same size as wxTextCtrl used to return before to fix this for now.
Steve Lamerton [Sun, 2 Oct 2011 10:29:00 +0000 (10:29 +0000)]
Derive wxAuiNotebook from wxBookCtrlBase. Document wxAuiNotebookEvent which now derives from wxBookCtrlEvent. Update the notebook sample to add wxAuiNotebook as an option.
Robin Dunn [Fri, 30 Sep 2011 23:40:02 +0000 (23:40 +0000)]
Use wxAlphaPixelData if the source bitmap depth is 32 or if on wxGTK and there is a mask. Add a separate pass on MSW if there is a mask to adjust the cairo surface's alpha to match the mask.
This library includes some wx headers and so setup.h must be available when
it's being compiled but there was no rule to copy it in its projects, so add
it now.
Implement wxTimePickerCtrl natively for MSW and add a generic implementation
(very loosely based on the original class by Paul Breen) for the other
platforms.
Also update the calendar sample to show the new control.
Refactor wxDatePickerCtrl to derive from wxDateTimePickerCtrl.
No real changes, just refactor wxMSW wxDatePickerCtrl to allow sharing code
with the upcoming wxTimePickerCtrl class. Even less changes for the other
platforms where wxDateTimePickerCtrl is trivial.
For some reason comparing wxTreeListItem with its associated Type doesn't work
when using VC6 ("error C2593: 'operator ==' is ambiguous") so help the compiler
to do it.
Also remove the unnecessary (and unsupported by VC6) return from void function.
Robin Dunn [Thu, 29 Sep 2011 07:28:04 +0000 (07:28 +0000)]
Don't always use the Cairo context for wxGCDC(wxMemoryDC). If a Cairo context is wanted then the wxGCDC(wxGraphicsContext*) ctor should be used instead. (I thought I had removed this code with my last commit of this file...)
Always give all the remaining space to the first wxTreeListCtrl column.
Under GTK the columns of wxDataViewCtrl (and hence wxTreeListCtrl) are always
resized to cover the entire control width. For consistency, also do it under
the other platforms and give the remaining space to the first column and not
to the last one as GTK does by default, as the first column is more important.
Do this even if this results in reducing the size of the column: presumably,
if the entire control itself can be resized, the user wouldn't bother resizing
the columns and, on the contrary, if the user did resize the columns, the
entire control size is unlikely to change, so in practice we don't risk
overriding the user preferences and reducing as well as increasing the first
column width works much better by default as it doesn't leave the other
columns invisible after making the control wider and than reverting it back to
its initial, more narrow, state again.
Fix scrolling in small wxVListBox with tall items.
Scrolling in a small wxVListBox with tall items (i.e. taller than the height
of wxVListBox itself) behaved wrongly: wrong item was being scrolled into view
and Page Up/Down didn't scroll as much as they should.
Fix both of these problems by checking for these corner cases explicitly.
Send EVT_DATAVIEW_ITEM_CONTEXT_MENU events even when not clicking on an item.
Always send this event, even if the user right clicked outside of the client
area. This is useful for showing item-independent commands in the context
menu.
Allow the user to sort the control contents by clicking on the columns with
wxCOL_SORTABLE flag and also provide SetSortColumn() method to sort the
control programmatically.
Also add wxTreeListItemComparator class and SetItemComparator() method to
allow customizing the way the items are compared.
Update the sample to show how to define a custom comparator.
Reset previous sort column in generic wxDataViewColumn::SetSortOrder().
The sort indicator on the column previously used for sorting was only reset
when the user clicked on the column header (by wxDataViewHeaderWindow code
that explicitly called wxDataViewCtrl::SetSortingColumnIndex()) but not when
wxDataViewCtrl::SetSortOrder() was called directly.
Fix this and take care of updating everything in SetSortOrder() itself. This
makes the code simpler and also means that calling SetSortOrder() from the
program now works as expected (it resulted in having sort indicators in two
columns at once before).
Remove wxHeaderColumn::SetAsSortKey() and only use SetSortOrder().
The two member functions, SetAsSortKey() and SetSortOrder(), were doing almost
the same thing but differently and the former was only used in the generic
wxDataViewCtrl implementation and not implemented in the native GTK/OS X one.
Remove SetAsSortKey() entirely and only keep UnsetAsSortKey() which is still
needed by generic/MSW wxDataViewCtrl. But only SetSortOrder() should now be
called to indicate that the column is used for sorting.
It can be useful to have access to the window used to actually show the items
by wxTreeListCtrl, provide two accessors for m_view: a wxDataViewCtrl-specific
one and a generic one returning just a wxWindow that can be used to keep the
code isolated from wxDataViewCtrl.
Don't limit window size to (0, 0) in wxSizer if getting display size failed.
It's possible that wxDisplay::GetClientArea() returns (0, 0) size indicating
that it failed. Don't set the maximal window size to (0, 0) in this case as
this prevents the user from seeing the window at all and just don't do
anything instead.
Refresh wxDisplay when a monitor is added to or removed from the system.
If a monitor was attached or detached while a wx program was running, the
monitor handles stored in wxDisplayFactoryMSW became invalid and all display
operations (e.g. getting display size) failed from this moment onwards
requiring a program restart to work again.
Fix this by updating the monitor handles when we get WM_SETTINGCHANGE as it is
sent when a monitor is added or removed (while it's also sent in quite a few
other cases re-enumerating the monitors shouldn't take very long so just do it
always).
Add GetExpanderColumnOrFirstOne() to avoid code duplication in generic wxDVC.
There were two strictly identical code snippets setting the expander column to
be the first one if it hadn't been set before, replace both of them with a
call to GetExpanderColumnOrFirstOne() function.
Also use this function instead of just GetExpanderColumn() (which might return
NULL) in a couple of places.
Notice that there are still a lot of places in the code where the column 0 is
hard coded as being the expander column, this would need to be fixed to really
support non-first expander column.