Vadim Zeitlin [Sun, 22 Aug 2010 22:15:17 +0000 (22:15 +0000)]
Don't send event from wxMSW::wxListCtrl::DeleteAllItems() if it did nothing.
wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS should only be sent if the control hadn't
been empty before. Document this behaviour and adjust wxMSW to match the
other platforms.
Vadim Zeitlin [Sat, 21 Aug 2010 23:33:40 +0000 (23:33 +0000)]
Don't report spurious errors from wxSocket in "no wait" mode.
In wxSOCKET_NOWAIT mode wxSOCKET_WOULDBLOCK is not a real error as it's
expected and should be just discarded. Failing to do this could result in the
following scenario:
1. Try to read a big buffer with wxSOCKET_NOWAIT (setting wxSocket error to
wxSOCKET_WOULDBLOCK).
2. Process small part of it.
3. Read more data from wxSocket -- which now goes to the data containing
already cached data without going to the socket itself and this without
resetting the error.
4. Check wxSocket::Error() which turns out to be (still) true.
And this was exactly what happened in mysteriously failing unit test case
reading wxImage contents from a socket: the failure was difficult to reproduce
because it depended on how much data exactly did we read from the socket in
one go.
Fix this by resetting the error properly and reenable the unit test which was
previously disabled for the build bot, it should pass now.
Vadim Zeitlin [Thu, 19 Aug 2010 15:41:18 +0000 (15:41 +0000)]
Make the main message of wxGenericMessageDialog stand out.
Use larger bold font for the main message in wxGenericMessageDialog if the
extended message is also given to make it stand out similarly to how it
happens in the native GTK and MSW dialogs.
Vadim Zeitlin [Wed, 18 Aug 2010 22:49:02 +0000 (22:49 +0000)]
Use task dialog for wxProgressDialog implementation in wxMSW.
If available, the task dialog is now used for the wxProgressDialog under
Windows. This provides a much more native looking dialog which doesn't look
out of place under modern Windows versions, unlike the generic implementation.
The internals of the code had to be significantly changed as the task dialog
can only be shown modally so, to emulate wxProgressDialog modeless nature, a
separate thread is used for the progress dialog management.
Vadim Zeitlin [Wed, 18 Aug 2010 22:48:41 +0000 (22:48 +0000)]
Add wxRichMessageDialog class.
This is a generalization of wxMessageDialog based on the native task dialog
under recent (Vista and later) Windows versions and implemented generically
for the other ports for now.
It provides the possibility to use additional controls in the message boxes
(checkbox useful for the "Don't ask me again" kind of dialogs and collapsible
detailed explanations field) and better look and feel under Windows.
Vadim Zeitlin [Wed, 18 Aug 2010 22:48:28 +0000 (22:48 +0000)]
Provide a task-dialog based wxMSW wxMessageDialog implementation.
Use the task dialog instead of the legacy message box for wxMessageDialog
implementation under wxMSW on recent (Vista and later) Windows versions.
As part of this change, remove wxMessageDialogWithCustomLabels and integrate
its functionality in wxMessageDialogBase itself as it's now used by all
platforms.
Vadim Zeitlin [Wed, 18 Aug 2010 22:48:15 +0000 (22:48 +0000)]
Fix Yes/No/Cancel buttons order in wxGTK wxStdDialogButtonSizer.
"Yes" and "No" buttons should be positioned next to each other for consistency
with the native message box instead of separating them with the "Cancel"
button.
Robert Roebling [Mon, 16 Aug 2010 17:48:28 +0000 (17:48 +0000)]
Ignore non-existant string selection in wxComboBox::SetValue() in read-only mode, as per the very exact docs, fixes #12329: wxComboBox can set non-existing string in read only mode
Vadim Zeitlin [Sun, 15 Aug 2010 21:14:06 +0000 (21:14 +0000)]
Fix wxMSW compilation in wxUSE_STL==1 case.
A wxDECLARE_NO_ASSIGN_CLASS() was recently added to ClassRegInfo but storing
it in a vector requires it to be "Assignable" so this broke compilation in STL
case (wxVector<> doesn't enforce this requirement currently).
Vadim Zeitlin [Wed, 11 Aug 2010 16:04:00 +0000 (16:04 +0000)]
Handle wxDefaultSize correctly in wxNonOwnedWindow under wxOSX.
Creating a wxNonOwnedWindow with default size created tiny, practically
invisible windows because the default size was only taken care of at
wxTopLevelWindow level but not in wxNonOwnedWindow itself. In particular, this
broke creation of wxMDIChildFrames with the default size as this class only
derived from wxNonOwnedWindow and not from wxTopLevelWindow under OS X. It
also probably wasn't intentional as the code did use {Width,Height}Default()
functions but they were wxWindow methods and not the wxTopLevelWindow
(confusingly and error-pronely) named the same.
Fix this, remove the now redundant checks for the default size in
wxTopLevelWindow itself and also rationalize and condense the checks for the
default position and size components in wxNonOwnedWindow::Create().
Vadim Zeitlin [Wed, 11 Aug 2010 16:03:55 +0000 (16:03 +0000)]
Make wxTopLevelWindow::GetDefaultSize() public and document it.
This method is/will be needed by wxNonOwnedWindow in wxOSX but couldn't be
used as long as it was protected, so make it public. And as it seems that it
might be useful outside of wx itself, document it as well.
Vadim Zeitlin [Wed, 11 Aug 2010 16:03:46 +0000 (16:03 +0000)]
Fix handling of help buttons with non-empty label under OS X.
Creating a button with wxID_HELP and a non-empty label used to always show
this label, even if it was just a standard "Help" or "&Help". This didn't work
at all as the help buttons under OS X are too small to show any label.
To fix this, use normal buttons, not help ones, if a really custom label is
used to ensure that it can be seen. And to still use the correct help buttons
in as many cases as possible, ignore the standard "Help" label and its
variants and don't show it at all.
Vadim Zeitlin [Tue, 10 Aug 2010 22:39:04 +0000 (22:39 +0000)]
Fix line indices translation in wxGrid::DoEndDragResizeLine().
We used the translation in wrong direction, i.e. interpreted x coordinates as
rows and y coordinates as columns. This could result in passing invalid cell
indices to GetCellSize() and was generally completely wrong.
Vadim Zeitlin [Tue, 10 Aug 2010 22:38:54 +0000 (22:38 +0000)]
Don't set Unicode key code in key events to non-Unicode values in wxGTK.
Only assign the wx key code wxKeyEvent::m_uniChar if it's a key corresponding
to an ASCII symbol, don't do it for the values outside of ASCII range such as
all the special WXK_ constants. It doesn't make sense to generate Unicode key
codes for e.g. cursor key presses.
Vadim Zeitlin [Tue, 10 Aug 2010 21:48:22 +0000 (21:48 +0000)]
Use wxPanel as controls parent in wrapsizer sample.
Follow our own advice about never creating controls directly on the frame and
using an intermediate wxPanel in our own sample. This is better style and
makes it look better under Windows.
Vadim Zeitlin [Tue, 10 Aug 2010 21:48:17 +0000 (21:48 +0000)]
Inherit notebook background recursively under wxMSW.
With MSWSetTransparentBackground() hack only the panel which was the immediate
child of wxNotebook (i.e. its page) inherited the notebook background but not
its children. This resulted in jarring background discontinuities when nested
panels were used.
Fix this by inheriting notebook background in all child panels by testing for
the return value of the parents MSWHasInheritableBackground() method in
wxPanel::HasTransparentBackground() recursively.
Vadim Zeitlin [Tue, 10 Aug 2010 18:58:06 +0000 (18:58 +0000)]
Fix wxBitmapButton initial best size determination in wxMSW.
This was broken during wxButton/wxBitmapButton merge and wxBitmapButton was
not created with the correct initial size if the default size was specified
when creating it any longer. Fix this by calling SetInitialSize() once again
after setting the bitmap.
Vadim Zeitlin [Tue, 10 Aug 2010 18:58:02 +0000 (18:58 +0000)]
Keep the button bitmap centered if the button has no label in wxMSW.
We should only honour the bitmap alignment if the button shows both the bitmap
and the label. If only the bitmap is shown (e.g. when wxBitmapButton is used),
it should always be centered as it used to be done in 2.8.
Vadim Zeitlin [Tue, 10 Aug 2010 18:57:47 +0000 (18:57 +0000)]
Don't use bitmap still selected in wxMemoryDC in image sample.
The bitmap must be deselected from wxMemoryDC before being used in any other
way but the sample didn't do this. Fix this by simply destroying the DC as
soon as we don't need it, this makes bitmap available for other use as well.
Vadim Zeitlin [Tue, 10 Aug 2010 18:57:42 +0000 (18:57 +0000)]
Use window position in screen coordinates in wxDisplay::GetFromWindow().
To determine the display to which the window belongs we must use the window
position in screen coordinates returned by wxWindow::GetScreenRect() and not
the positioned returned by GetRect() which is the same only for the top level
windows but not for the child ones.
Vadim Zeitlin [Tue, 10 Aug 2010 12:53:03 +0000 (12:53 +0000)]
Add wxDataViewCtrl::{Set,Get}CurrentItem().
Current item is the same as the selected item in single selection mode but in
multiple selection mode there was no way to neither get this item nor change
it before so add the new functions to allow doing this now.
The new methods are implemented for the generic, GTK and OS X/Cocoa versions
but only stubs are provided for OS X/Carbon.
Vadim Zeitlin [Mon, 9 Aug 2010 21:17:51 +0000 (21:17 +0000)]
Don't lose selection in wxDataViewCtrl::Select() under Mac.
Calling Select() for an item should not deselect the other selected items in
multiple selection mode. This is consistent with the GTK and generic versions
behaviour and also just makes more sense but also document that this is indeed
the desired behaviour just in case.
Jaakko Salli [Sun, 8 Aug 2010 12:22:08 +0000 (12:22 +0000)]
Moved wxPGProperty::SetFlag() to protected API since it does not have any side-effects that are usually desired in the user code. Added wxPGProperty::SetAutoUnspecified() since wxPG_PROP_AUTO_UNSPECIFIED can no longer be set (conveniently) with SetFlag().
Vadim Zeitlin [Sun, 8 Aug 2010 11:37:57 +0000 (11:37 +0000)]
Add name argument to wxDataViewCtrl ctor for consistency.
As all the other wxWidgets controls take the parameter in their ctor/Create()
it's unexpected that wxDataViewCtrl does not. Add the name parameter and pass
it to wxWindowBase::CreateBase() as usual.
wxDataViewCtrlInternal is a private class used only inside wxWidgets itself
and doesn't need to be exported from the shared library, so remove the
unnecessary WXDLLIMPEXP_ADV from its declaration.
Vadim Zeitlin [Sun, 8 Aug 2010 11:37:41 +0000 (11:37 +0000)]
Use helper class instead of manually calling gtk_tree_path_free().
No real changes, just simplify the code and make it more obviously correct by
ensuring that all temporary tree paths are always destroyed because they are
assigned to a wxGtkTreePath object which does it in its dtor instead of
calling gtk_tree_path_free() manually every time.
Vadim Zeitlin [Sun, 8 Aug 2010 11:37:37 +0000 (11:37 +0000)]
Add wxDataViewCtrl::GTKPathToItem() function and use it.
No real changes, just refactor the code to use a function mapping GtkTreeIter
to our wxDataViewItem and use it instead of duplicating its code everywhere.
Vadim Zeitlin [Sun, 8 Aug 2010 11:35:55 +0000 (11:35 +0000)]
Include wx/defs.h before testing for wxUSE_CHECKLISTBOX.
We need to include wx/defs.h that (indirectly) defines wxUSE_CHECKLISTBOX
before testing for it in wx/checklst.h, otherwise the test may fail if the
latter header is the first wx header included by the user code.
Václav Slavík [Fri, 6 Aug 2010 16:28:46 +0000 (16:28 +0000)]
Fix DnD in generic wxDataViewCtrl when scrolled.
wxDataViewMainWindow drag and drop code incorrectly used Y coordinate
where X axis should be used to check whether the mouse is inside columns
area. This manifested itself as refusing to accept drops once the
control was sufficiently scrolled down.
Václav Slavík [Thu, 29 Jul 2010 20:54:00 +0000 (20:54 +0000)]
Fix wxDataViewCtrl to omit expander space for all kinds of lists.
List-only models don't have expanders and so the control shouldn't
reserve any space for them; the notion of expander column doesn't make
sense here.
Previously, this was done correctly only for wxDataViewVirtualListModel;
"ordinary" list models, such as the one used by wxDataViewListCtrl, were
treated as generic tree models and 0th column had ugly empty space
reserved for (never used) expander.
This patch fixes it by adding IsListModel() helper function in
addition to existing IsVirtualListModel(). Some of the
IsVirtualListModel() tests were changed into IsListModel() checks as
appropriate.
Add association between wxOSX wxTextWidgetImpl and wxTextEntry.
This allows to always find the correct wxTextEntry to use in the
implementation of text-related widgets without using any casts. Notably, the
wrong up-cast of wxWindow to wxTextCtrl in wxNSTextFieldControl::controlAction()
which resulted in a crash when the window was actually a wxComboBox can now be
fixed.