Commit Graph

51968 Commits

Author SHA1 Message Date
Václav Slavík
86755098f5 Account for text attrs in generic wxDataViewCtrl's renderers.
When determining cell content's size, GetSize() measured the text using
wxDataViewCtrl's font, even though it could be renderer in bold or
italics.

Corrected by setting the attributes - and not only the value - prior to
GetSize() calls, and by using the right font in GetTextExtent() calls.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-30 15:57:49 +00:00
Václav Slavík
d0154e3a5a Add optional columns autosizing to wxDataViewCtrl.
Only implemented in the generic and GTK+ versions at the moment, OS X
support will be added later.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-30 15:57:41 +00:00
Václav Slavík
9aebcb5e44 Add wxRenderer::GetHeaderButtonMargin().
Used for best size calculations of column width.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-30 15:57:32 +00:00
Paul Cornett
34d2ab14c1 fix iconize event detection, logical operators don't work for testing bits
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 16:41:29 +00:00
Vadim Zeitlin
d176b30156 Use floating point arithmetic in wxDC::GradientFillConcentric().
Use doubles to avoid accumulated rounding errors from using integers in the
generic implementation of wxDC::GradientFillConcentric(). This results in
smoother gradient.

Also avoid using the expensive pow() function inside the inner loop when we
just need to calculate a square.

Closes #12337.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 14:23:18 +00:00
Vadim Zeitlin
7825e32171 Fix generic implementation of wxDC::GradientFillConcentric().
The selected colour was not used as the code simply changed the value of
m_pen but didn't call SetPen() to actually use it. This resulted in always
using the default (black) colour when drawing concentric gradients.

Fix this by calling SetPen().

See #12337.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 14:23:14 +00:00
Vadim Zeitlin
3a61f5db2c Relax validation of wxCheckBox flags.
Changes of r65824 resulted in asserts when creating wxCheckBox with just
wxBORDER_NONE style. This is useless but used to be harmless so continue to
allow this.

Closes #12628.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 14:23:09 +00:00
Vadim Zeitlin
ce0ee9aec1 Improve positioning of wxSlider min/max labels in wxMSW.
Put the min/max labels on the sides or a horizontal slider or above/below a
vertical one to make them visually more distinct from the current value label.

See #11427.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 13:52:50 +00:00
Vadim Zeitlin
4ea1bb9d09 wxOSX/Carbon compilation fix after wxListBoxBase changes.
Making wxListBoxBase::CalcAndSendEvent() broke wxOSX/Carbon build, fix it by
making the class which needs to call it friend of wxListBox in this port.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 10:27:32 +00:00
Vadim Zeitlin
486fa39656 Don't crash when waiting for thread termination in wxMSW.
The changes of r65882 adding wxThread::On{Delete,Kill}() introduced a bug
which made normal wxThread::Wait() crash.

Fix it by calling OnDelete() only if we're really deleting a thread.

Closed #12627, see #9046.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-28 10:27:26 +00:00
Vadim Zeitlin
24d7c81c32 Fix list box unit test under wxGTK.
Select an item initially to prevent GTK from doing it automatically as soon as
the listbox is clicked anywhere (even outside of the items area).

This makes all GUI tests finally pass under wxGTK.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 23:22:11 +00:00
Vadim Zeitlin
00d45d0452 No changes, just use wxGtkObject<> instead of g_object_unref().
Use smart pointer class instead of manually writing g_object_unref(). This
makes code shorter and less error-prone.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 23:22:05 +00:00
Vadim Zeitlin
09e744f552 Don't duplicate event sending code in wxGTK wxListBox.
Reuse wxListBoxBase::SetEvent() instead of duplicating its code in wxGTK.

Also get rid of the code checking for selection of the item with index -1:
this can't happen any more since r65865 which changed GTK_SELECTION_SINGLE to
GTK_SELECTION_BROWSE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 23:22:00 +00:00
Vadim Zeitlin
24ee1bef74 Don't send SELECTED events for an already selected item in wxGTK wxListBox.
Bring wxGTK in line with wxMSW behaviour and avoid sending the
wxEVT_COMMAND_LISTBOX_SELECTED events when the user clicks on an already
selected item.

Refactor wxMSW code to extract the logic to avoid such events into a reusable
in other ports wxListBoxBase::DoChangeSingleSelection() function. Also add
wxListBox::GTKOnSelectionChanged() to wxGTK to avoid having to make the new
function public just so that it could be called by GTK callback and make the
previously existing CalcAndSendEvent() protected as well.

This fixes a unit test failure in ListBoxTestCase::ClickEvents() under wxGTK.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 23:21:55 +00:00
Vadim Zeitlin
af0b20630c wxOSX compilation fix: remove just added extra semicolon.
r65931 forgot to remove a now extra semicolon from wx/osx/notebook.h, fix it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 21:41:55 +00:00
Vadim Zeitlin
2a0ca9dbaf Fix warnings about signed/unsigned comparisons inside wxMax() and friends.
wxMax, wxMin and wxClip work correctly when called with a mix of signed and
unsigned arguments but give warnings about comparing them when compiled with
g++.

Cast both arguments to the result type, which is defined consistently with
standard C rules for implicit promotion, before comparing them to avoid this.

Also add more tests to check that using these functions in this case doesn't
provoke warnings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 20:23:55 +00:00
Robert Roebling
f0f0542da6 Use window-state-event to send ICONIZE events under GTK+, probably fixes #10973: Iconize event triggered when switching workspaces with Ctrl+Alt+[Arrow Key]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 19:42:38 +00:00
Vadim Zeitlin
681be2ef80 Refactor: use wxBookCtrlBase::m_selection in all derived classes.
All book control classes with the exception of wxGTK wxNotebook stored the
currently selected page in m_selection or m_nSelection (or, in wxUniv
wxNotebook case, m_sel) variable. Remove all of them and add m_selection
directly to the base class itself so that it can be reused everywhere.

Closes #12622.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 16:54:36 +00:00
Vadim Zeitlin
7e837615b9 No real changes, just replace -1 with wxNOT_FOUND in wxBookCtrl code.
Make the code consistently use wxNOT_FOUND instead of -1 everywhere.

See #12622.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 16:54:24 +00:00
Vadim Zeitlin
ef0fdf3914 Don't dispatch messages while waiting in worker thread in wxMSW.
We only want to continue dispatching messages while waiting for another thread
to terminate if we are waiting in the main thread.

Closes #12618.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-26 15:11:06 +00:00
Vadim Zeitlin
bd63e363c2 Compilation fix for wxUSE_UNICODE_WCHAR && !wxUSE_STL_BASED_WXSTRING.
Construct wxScopedWCharBuffer using CreateNonOwned() in
wxString::ToStdWstring() in this case, creating it directly from wc_str()
doesn't work (intentionally, as this doesn't tell if the buffer owns the
string or not).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-26 15:11:00 +00:00
Vadim Zeitlin
d72177fd4d Better document wxAutomationObject::GetDispatchPtr() return value.
This function returns IDispatch pointer as a void one, mention that the user
code needs to upcast it itself.

Closes #12617.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-26 15:10:54 +00:00
Vadim Zeitlin
7ec75d3e9f Rebake to add wx/meta/implicitconversion.h to the makefiles.
Rebake after the addition of a new public header in r65920.

Closes #12616.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65926 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-26 15:10:48 +00:00
Vadim Zeitlin
cc721f7dd2 Mention that resource forks are deprecated under Mac in wxCursor docs.
See #12614.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 21:52:19 +00:00
Vadim Zeitlin
86646f2aef Use the correct accelerator for the "Preferences" Apple menu item.
Use the standard Command-, accelerator for the standard "Preferences" item in
the Apple menu.

Closes #12121.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 20:46:18 +00:00
Vadim Zeitlin
c8bef6e379 Use the application name in the "About" item of the Apple menu.
To conform to Apple UI guidelines the application name should be included in
the "About" menu item label in the Apple menu.

See #12121.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 20:46:11 +00:00
Václav Slavík
fd7c5da65e Add wxImplicitConversionType tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 09:43:04 +00:00
Václav Slavík
a52475807e Make wxMin, wxMax and wxClip template functions.
Previously used macro's arguments were evaluated twice, but there were
many occurences of their use in our code that didn't account for this
and used expensive-to-evaluate arguments as if they were functions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 09:43:00 +00:00
Vadim Zeitlin
1f4c7e791b Compilation fix: don't use "environ" under OS X.
The global environ variable is not directly accessible under OS X, use
_NSGetEnviron() instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 09:22:19 +00:00
Vadim Zeitlin
b2e04188bd Make wxUString compilable with VC6.
Provide replacements for std::basic_string functionality missing from this
compiler standard library.

Closes #12357.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 23:06:11 +00:00
Vadim Zeitlin
f73785b104 Fix typo in wxFILTER_NUMERIC documentation.
Replace wxFILTER_SIMPLE_NUMBER with wxFILTER_DIGITS.

Closes #12341.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 23:03:43 +00:00
Vadim Zeitlin
a70d268a1b Add wxDocManager::FindTemplate() method.
This allows to find the template corresponding to the document of the given
class.

Closes #12170.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 23:03:38 +00:00
Vadim Zeitlin
35f82b01cf Don't handle RPC_E_CHANGED_MODE return of OleInitialize() as an error.
This error means that OLE had already been initialized so from our point of
view it counts as a success.

Closes #12516.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 23:03:31 +00:00
Vadim Zeitlin
71f5b0e7da Do nothing in wxMemoryDC::SelectObject() if the bitmap is already selected.
It doesn't make sense to make a copy of the bitmap in order to select it into
wxMemoryDC if it's already selected into it.

See #11640.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:46 +00:00
Vadim Zeitlin
648c1af93d Always create new OLE objects with reference count of 1, not 0.
There are no real changes but ensure that the new objects of classes using
DECLARE_OLE_UNKNOWN() macro are created with valid reference count of 1
instead of being created in phantom state with reference count of 0.

Remove the now unnecessary AddRef() and add the now required DecRef() calls.

See #11566.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:41 +00:00
Vadim Zeitlin
e0b5dc3d63 Fix problems with reference counting in wxActiveXContainer.
Ensure that the IFrameSite object is created with valid (i.e. non-zero)
reference count by calling AddRef() on it immediately after creation and
remove the weird QueryInterface() call which was used to work around this bug.

Closes #11566.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:36 +00:00
Vadim Zeitlin
21e5aa164e Don't consider lack of connection points an error in wxActiveXContainer.
Handle CONNECT_E_NOCONNECTION return value from IConnectionPointContainer::
FindConnectionPoint() as an expected error and don't complain about it.

See #11566.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:29 +00:00
Vadim Zeitlin
58331be29a Don't activate the window when updating its styles in wxMSW.
Add SWP_NOACTIVATE to the flags used by wxWindow::MSWUpdateStyle(). This
allows to change the style of a window without necessarily activating it.

Closes #11560.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:24 +00:00
Vadim Zeitlin
6969b18cc7 Fix wrong wxLogDebug() call in fswatcher sample.
Replace wxLogDebug() with wxLogTrace() as was probably intended. This fixes
the assert which happened when running the sample because of the wrong number
of parameters passed to wxLogDebug().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:18 +00:00
Vadim Zeitlin
5fc3e6d448 Allow specifying the directory to watch on command line of fswatcher sample.
This makes it more convenient to run the sample repeatedly as the directory to
watch can be specified only once instead of having to choose it interactively
after the sample startup every time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:13 +00:00
Vadim Zeitlin
942f40ca24 Avoid duplicate wxEVT_COMMAND_TREE_SEL_CHANG{ING,ED} events in wxMSW.
When changing the selected item programmatically 2 CHANGING and CHANGED events
were sent because the assumption that comctl32.dll didn't send these events
itself was not correct any more, it does send them at least since XP. However
to avoid the tests for its exact version it's simpler to just ignore the
events it generates and continue sending our own ones.

Closes #11274.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:08 +00:00
Vadim Zeitlin
1da2783c33 Don't grab focus when calling wxTreeCtrl::SelectItem().
The workaround for the unexpected events order introduced in r49588 should
only apply to the situation when the user selects an item in the tree, not
when it's done programmatically as this results in unexpected focus changes
(see #11274).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:41:03 +00:00
Vadim Zeitlin
e4545e0183 Allow to use space to toggle spinning of the cube in OpenGL sample.
Small enhancement to the cube OpenGL sample.

Closes #11545.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:58 +00:00
Vadim Zeitlin
22993989b4 Don't send wxEVT_COMMAND_TREE_ITEM_MENU event without valid item in wxMSW.
The generic wxTreeCtrl version only sends this event when the mouse is right
clicked on a valid item so do the same in wxMSW version too for consistency.

This is also consistent with wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK event and
avoids strange problems with unexpected wxEVT_COMMAND_TREE_ITEM_MENU events
generated on right double click.

Finally, replace the checks for item validity in the event handler in the
sample with asserts which should loudly complain if it happens to be invalid.

Closes #11226.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:52 +00:00
Vadim Zeitlin
0bb84570ce No real changes, just cleanup week days handling in wxGenericCalendarCtrl.
Use helper GetWeek{Start,End}() functions instead of repeating tests for
wxCAL_MONDAY_FIRST over and over again.

Also replace some occurrences of GetWindowStyle() with shorter and more clear
HasFlag().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:47 +00:00
Vadim Zeitlin
3c9863aca7 Keep displayed month and year in sync in wxGenericCalendarCtrl.
When the date was constrained to a range in wxGenericCalendarCtrl, the display
of the month in the month combobox could get out of sync with its real value.

Ensure that the correct month is always displayed and also simplify the code
by removing the apparently unnecessarily complex logic in ChangeYear() and
ChangeMonth() functions.

Closes #11060.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:41 +00:00
Vadim Zeitlin
69060f4f0c No real changes, just inline wxDIB::Create().
After removing wxDIB::m_hasAlpha in the previous commit, this method became
completely trivial so put it inline in the header.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:34 +00:00
Vadim Zeitlin
20af6fd5d3 Remove wxDIB::m_hasAlpha from wxMSW.
This field can't be set reliably as we don't know if LoadImage() Windows
function loaded an 0RGB or an RGB bitmap so remove it completely to avoid the
risk of using it wrongly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:27 +00:00
Vadim Zeitlin
254f9b4c3c Fix conversion of 32 bit ARGB bitmaps to wxImage in wxMSW.
wxDIB::m_hasAlpha can't be trusted when the DIB was loaded from a file so
don't rely on it in wxDIB::ConvertToImage(). Instead, suppose that 32 bpp
bitmaps do have alpha channel and only get rid of it at the end of conversion
if it turns out that all alpha values were 0.

Closes #10133.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:22 +00:00
Vadim Zeitlin
c8ecb454c6 Don't hard code "open" verb in wxMSW wxLaunchDefaultApplication().
Don't choose the verb explicitly and let ShellExecuteEx() choose the default
one. In the vast majority of cases this will do the same thing but if some
file type doesn't have an "open" verb the new version will still open it
correctly using its default verb while the old version failed.

See #10707.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-24 22:40:17 +00:00