Vadim Zeitlin [Sun, 30 Oct 2011 19:48:50 +0000 (19:48 +0000)]
Avoid too many sash position changed events when splitter is resized.
We could call SetSashPositionAndNotify() twice in a row which was probably
unexpected and possibly wasteful, if the user code did anything non trivial in
response to this event.
Just call it once after we're certain which sash position do we want to set.
Vadim Zeitlin [Sun, 30 Oct 2011 19:48:48 +0000 (19:48 +0000)]
Fix the check for second window becoming too small in wxSplitterWindow.
There was a strange check for the second pane size in OnSize() which hardcoded
5 pixels as minimal pane size in the check and 40 pixels as the minimal size
to set. This resulted in strange behaviour when the second pane size would
decrease to 6 pixels smoothly and then jump back to 40 pixels when the
splitter window was resized and also was ugly at the code level.
Get rid of this code and simply call AdjustSashPosition() to ensure that the
sash position remains valid as the splitter is resized.
Vadim Zeitlin [Sun, 30 Oct 2011 19:48:44 +0000 (19:48 +0000)]
Make the initial sash position work in splitter sample.
The initial splitter size must be set correctly when using gravity with
wxSplitterWindow as otherwise the sash would jump on first resize -- which was
exactly what happened in the splitter sample.
Add a SetSize() call to the sample with the comment explaining why is it
needed and also actually make it stick as the cached last size was not updated
before the splitter was split before.
This variable seemed to be redundant with m_requestedSashPosition being set to
INT_MAX so harmonise the code to always check for the latter and get rid of
the former.
There should be no observable changes in behaviour.
Vadim Zeitlin [Sun, 30 Oct 2011 19:48:34 +0000 (19:48 +0000)]
No changes, just remove wxSplitterWindow::{Set,Get}NeedUpdating().
GetNeedUpdating() was never used at all while SetNeedUpdating() was used only
once while m_needUpdating variable was being changed directly in other places
making the code difficult to follow.
Just use the member variable directly and remove the accessors.
Julian Smart [Sun, 30 Oct 2011 17:28:03 +0000 (17:28 +0000)]
Fixed problem with the size of paragraphs not needing layout not being taken into account when calculating overall box size.
Should fix the problem with lines becoming insensitive to mouse clicks after adding a couple of shorter lines.
Vadim Zeitlin [Sun, 30 Oct 2011 16:41:34 +0000 (16:41 +0000)]
Fix splitting message into title in body in MSW wxProgressDialog.
If the message doesn't contain any new lines, it should be used as the body,
not the title as having title without body doesn't make sense and looks
strange.
Vadim Zeitlin [Sun, 30 Oct 2011 16:22:30 +0000 (16:22 +0000)]
Don't replace non default wxMessageDialog labels with default translations.
The code translating the button labels of wxMessageBox to the application
language was overeager and replaced even the custom labels with the
translations of the default ones.
This shouldn't be done, of course, so simply check that no custom labels had
been set before translating.
This dtor doesn't seem to do anything useful as the base class dtor already
destroys all window children anyhow and removing it is reported to fix some
crashes in wxAUI (which is surprising and probably hides some other bug...).
Vadim Zeitlin [Sun, 30 Oct 2011 14:19:47 +0000 (14:19 +0000)]
Fix assert in generic wxListCtrl icon view when using images.
Don't assume that the item image is a valid index in m_small_image_list as we
may be in icon view which doesn't use small images at all.
For now restrict this code to the report view mode as apparently the cached
line height is not supposed to be used in other modes even though it's not
clear whether this is really the case and so, perhaps, this code should also
be used when in small icons view mode.
Vadim Zeitlin [Sun, 30 Oct 2011 10:08:18 +0000 (10:08 +0000)]
Allow customization of the locations where persistent settings are stored.
Make it possible to set a non-default wxPersistenceManager to use and allow
overriding of GetConfig() and GetKey() methods by making them virtual and
documenting them.
This can be notably used to allow porting of the existing code to use
wxPersistenceManager while keeping compatibility with the old settings.
Vadim Zeitlin [Thu, 27 Oct 2011 22:26:10 +0000 (22:26 +0000)]
Add _PTR WX_DECLARE_HASH_SET variants to fix warnings about operator->().
Macros from WX_DECLARE_HASH_SET family could declare an operator->() which
could never be called because it returned a pointer to a non-object (e.g. a
pointer or a primitive type).
Fix this in the same way as for WX_DECLARE_ARRAY macros by adding (badly but
consistently) named _PTR variants of the macros to allow defining the versions
without operator->().
This fixes tons of warnings when building wx with Sun CC.
Vadim Zeitlin [Thu, 27 Oct 2011 21:10:51 +0000 (21:10 +0000)]
Use WX_XXX_ARRAY_PTR macro variants for arrays of pointers.
Arrays of pointers must not overload operator->() as it is not used with them
and is, in fact, unusable, provoking a warning from Sun CC every time such
array is declared. Use the special _PTR-suffixed versions to avoid this.
Vadim Zeitlin [Thu, 27 Oct 2011 21:10:48 +0000 (21:10 +0000)]
Don't make wxQsort() extern "C" nor use any special convention for it.
It doesn't make sense to require passing C functions to wxQsort() that we
define in a C++ library. We also don't need any special calling convention
here.
Notice that the only existing uses of wxQsort() inside wxWidgets itself were
not actually extern "C" and one of them didn't even use the correct calling
convention.
Also avoid using non-wx-prefixed CMPFUNCDATA identifier in a public header,
rename it to wxSortCallback instead.
Finally make wxQsort() documentation slightly more useful.
Vadim Zeitlin [Thu, 27 Oct 2011 21:10:43 +0000 (21:10 +0000)]
Explicitly declare environ variable.
While POSIX and SUS both mandate this variable existence, they don't say that
it needs to be declared anywhere and it actually doesn't seem to be declared
under Solaris when using Sun CC and so using it resulted in compilation errors.
Vadim Zeitlin [Thu, 27 Oct 2011 21:10:40 +0000 (21:10 +0000)]
Always include locale.h to get LC_ALL declaration.
For some reason locale.h was only included in !wxUSE_STD_STRING case but we
actually always need it as we use LC_ALL in this file and at least in Sun CC
build it wasn't included from anywhere else so include it from here to fix the
build.
Vadim Zeitlin [Thu, 27 Oct 2011 21:10:33 +0000 (21:10 +0000)]
Replace remaining occurrences of _T() with wxT().
Use wxT() everywhere for consistency and to fix compilation with Sun CC for
which _T() is not defined as it clashes with a symbol with the same name in
standard headers.
Václav Slavík [Wed, 26 Oct 2011 17:10:27 +0000 (17:10 +0000)]
Fix incorrect handling of ItemsAdded() in wxDataViewCtrl.
When adding items to the model in bulk and then calling ItemsAdded(),
internal representation in both the generic and GTK+ versions wasn't
updated correctly if the order of the notifications was such that an
item would be inserted after other new, but not yet inserted, items.
Paul Cornett [Tue, 25 Oct 2011 05:12:14 +0000 (05:12 +0000)]
avoid GTK3 warning "GtkNotebook %p is mapped but visible child wxPizza %p is not mapped"
whatever problem this hack was supposed to solve, this was not the way to fix it
It doesn't make sense to return anything other than true here, as
failure from one of several notifiers cannot be handled sanely, so just
document that.
Vadim Zeitlin [Thu, 20 Oct 2011 16:45:48 +0000 (16:45 +0000)]
Dirty hack to allow generic wxDatePickerCtrl to compile under MSW.
Don't make wxDateTimePickerCtrl methods pure virtual in its MSW-specific
version as the generic wx{Date,Time}PickerCtrl implementations not using these
methods also inherit from it currently. This is wrong and would need to be
fixed properly later but for now this hack at least allows the generic classes
to compile and, apparently, work under MSW again.
Remove the equally dirty hack used in the generic wxTimePickerCtrl to allow it
to compile which is not needed any more because this one replaces it.
Robin Dunn [Thu, 20 Oct 2011 04:49:12 +0000 (04:49 +0000)]
Delegate wxGraphicsBitmap::ConvertToImage to the renderer so we do not end up with more than one definition of the method when building with both the GDI+ GC and the Cairo GC enabled at the same time.
Václav Slavík [Wed, 19 Oct 2011 16:20:17 +0000 (16:20 +0000)]
Cleanup of wxDataViewCtrl cell activation code.
Fix confusion of what cell activation is and inconsistence with native
handling in GTK+. Document the distinction between activating (~
editing) a cell and activating (double-clicking) the whole item.
Deprecate wxDataViewCustomRenderer::LeftClick() and Activate() methods,
replace them with single ActivateCell() that is called for both kinds of
activation.
Fix implementations so that ActivateCell() is not called on
double-click, when it shouldn't, and vice versa: don't send
wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED for cell activation.
Partially reverts r67099 -- restores old 2.9 signatures of compatibility
LeftClick() and Activate() methods.
Václav Slavík [Wed, 19 Oct 2011 16:20:01 +0000 (16:20 +0000)]
Allow using wxCompositeWindow<T> as wxDataViewCtrl inline editor.
wxDVC inline editing code attaches some event handlers to the editor
control; most importantly, it watches for Enter key and for focus
changes. If the editor control is a composite window, these events occur
in a sub control and never reach wxDVC code.
Fix this by forwarding events to the main window of the composite
control. Only events required by wxDVC are implemented for now.
Václav Slavík [Wed, 19 Oct 2011 16:19:58 +0000 (16:19 +0000)]
Fix NULL window argument to wxEVT_KILL_FOCUS when creating a TLW.
wxTopLevelWindowMSW::CreateDialog first moved and resized the newly
created window and only then called SubclassWin(). Because native focus
change occurred when moving the window, HWND->wxWindow association
wasn't yet filled in and wxFindWinFromHandle() would return NULL.
Václav Slavík [Wed, 19 Oct 2011 16:19:52 +0000 (16:19 +0000)]
Set wxFocusEvent's window value for wxEVT_KILL_FOCUS in wxGTK.
Note that it is still not set for wxEVT_SET_FOCUS, because it's not
immediately obvious how to obtain the previously focused window from
there. It's still better than always having the window NULL.
Vadim Zeitlin [Tue, 18 Oct 2011 21:57:02 +0000 (21:57 +0000)]
Added wxRichToolTip class.
It can be used to show more customizable tooltips than the native wxToolTip
but at the price of using generic implementation in some cases (actually
almost always now, with the exceptions of text control tooltips under MSW).
Extra features include:
- The balloon-like tooltip form.
- Possibility to show an icon.
- Title display in a different form.
More customization could be added later. It should be also possible to fully
implement this class natively under MSW.
Update the dialogs sample to show the rich tooltips in action.
Vadim Zeitlin [Tue, 18 Oct 2011 21:56:48 +0000 (21:56 +0000)]
Document and test behaviour of wxRegion methods when it is invalid.
Document which wxRegion methods can and can't be used when the region itself
is invalid.
Apply the minor changes to wxGTK (Xor() didn't do the right thing, Offset()
didn't assert) and wxOSX (Offset() crashed) to make their behaviour consistent
with wxMSW.
Add a (trivial, so far, but to be extended later) wxRegion unit test checking
that the methods do indeed behave as documented.
Vadim Zeitlin [Tue, 18 Oct 2011 21:56:42 +0000 (21:56 +0000)]
Fix SetShape() in wxOSX/Cocoa.
Explicitly erase the part of the window outside of its shape with a
transparent colour to ensure that it is indeed transparent and not just has
the default solid background.
Vadim Zeitlin [Tue, 18 Oct 2011 21:56:40 +0000 (21:56 +0000)]
Don't create a valid wxRegion when using default ctor in wxOSX.
Default constructing a wxRegion created an object that unexpectedly passed
IsOk() test in wxOSX. This was completely unexpected so don't do this and
leave default constructed wxRegion invalid, as in the other ports.
Update DoCombine() to be able to deal with the case of an invalid source
region in a way consistent with the other ports.
Vadim Zeitlin [Tue, 18 Oct 2011 21:56:36 +0000 (21:56 +0000)]
Don't interpret '&' specially in wxTextWrapper.
wxTextWrapper is used for the multiline text for which it doesn't make sense
to use mnemonics so don't interpret '&' specially in the text used with it.
Doing this also allows to remove the hack used in wxDialog::CreateTextSizer()
to deal with it that was used so far.
Vadim Zeitlin [Tue, 18 Oct 2011 21:56:34 +0000 (21:56 +0000)]
Use wxWindow::GetClientAreaOrigin() instead of MSW functions.
::AdjustWindowRectEx() doesn't seem to work correctly for wxPopupWindow and
still offsets the coordinates by the title bar height even if these windows
don't have WS_CAPTION style. Rather than try to work around this, simply use
wxWindow method instead of the Windows function as shape wxRegion offset.
Vadim Zeitlin [Tue, 18 Oct 2011 21:54:53 +0000 (21:54 +0000)]
Correct the direction passed to wxDataObject in wxGTK clipboard code.
We should quert for IsSupportedFormat(format, Set) before calling SetData()
with this format, not for IsSupportedFormat(Get) which is the default and was
used by the code.
Vadim Zeitlin [Mon, 17 Oct 2011 22:26:13 +0000 (22:26 +0000)]
Explicitly use _stati64() with MinGW-W64.
Although this compiler provides underscore-less versions of all POSIX
functions, this one only exists in a version with underscore, so use it to fix
compilation with it in ANSI build.