Commit Graph

52111 Commits

Author SHA1 Message Date
Vadim Zeitlin
382c4adea6 Fix preprocessor definitions for wxBase build under OS X.
Define __WXOSX__ for non-GUI build under Darwin. Ensure that the rest of the
code compiles correctly when just __WXOSX__ is defined but neither of
__WXOSX_{CARBON,COCOA,IPHONE}__ is. This ensures that wxBase can actually be
built under Mac.

Move OS X symbols definitions in wx/platform.h after wx/setup.h inclusion as
they rely on __DARWIN__ and wxUSE_GUI values which are both define in that
file now. Still keep them before wx/chkconf.h inclusion which relies on
__WXOSX_XXX__ being defined. Yes, it's a mess and should be cleaned up more
permanently some day.

Also remove some redundancy from wx/osx/{carbon,cocoa}/private.h by factoring
out common parts into wx/osx/core/private.h. Also include this header itself
from wx/osx/private.h directly instead of including it thrice from different
sub-ports headers.

Closes #12660.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-09 23:53:42 +00:00
Vadim Zeitlin
947d5ad04c Fix timeval struct initialization in wxSelectDispatcher.
The tv_usec field could overflow its maximal value while tv_sec was always
left 0.

It would be even better to reuse SetTimeValFromMS() from socket.cpp here in
the future.

See #11542.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-09 23:53:33 +00:00
Vadim Zeitlin
bbacbe3980 Fix crash in wxCFEventLoop::AddSourceForFD().
Don't reset CFFileDescriptorRef before passing it to
CFFileDescriptorCreateRunLoopSource(), this resulted in a crash inside this
function.

Closes #11542.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-09 23:53:28 +00:00
Vadim Zeitlin
11ea2e3a84 Remove non-existent functions declarations from wxOSX/Carbon.
wxMacSetupConverters() and wxMacCleanupConverters() don't seem to exist any
more so don't declare them.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-09 23:53:21 +00:00
Vadim Zeitlin
327ac3ec2a Document wxRenameFile() behaviour when destination is a directory.
Document that the source file is moved to the destination if it's a directory,
apparently this is not obvious.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-08 16:28:57 +00:00
Vadim Zeitlin
d97ee1b955 Unload bogus XRC resources in "garbage" unit test.
Leaving invalid XRC entries in wxXmlResource internal list of loaded resources
resulted in failures in the XRC unit test which executed after this one.

It seems that loading an invalid resource shouldn't prevent the other ones
from loading correctly later and this probably should be corrected at
wxXmlResource level but for now work around this problem in the test itself.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-08 16:28:51 +00:00
Vadim Zeitlin
adf1edd924 Fix crash in XRC ID range support code.
Really fix removing the record from the linked list. This code was modified by
r66064 but was still wrong because the wrong pointer was updated.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-08 13:50:46 +00:00
Vadim Zeitlin
e7cad4b7a1 Compilation fix for STL build after ID range changes in XRC.
Fix compilation of the new code which relied on implicit conversion of
wxString to "const char *" which is unavailable when wxUSE_STL==1.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 22:13:55 +00:00
Vadim Zeitlin
d807030e1e Factor our hash function used for XRC ids hash map.
Define the hash function in a separate function instead of duplicating it in
XRCID_Lookup() and RemoveXRCIDEntry().

The hash function is extremely simplistic and inefficient right now, it should
be replaced with wxStringHash::stringHash().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:34:05 +00:00
Vadim Zeitlin
74c99b8552 Fix memory leak of XRC ids introduced by the ID range support patch.
Fix bug in linked list processing in RemoveXRCIDEntry() added in r66059: it
incorrectly overwrote the XRC id table entry with the next element in the list
instead of just updating the pointer used during iteration.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:33:55 +00:00
Vadim Zeitlin
125c2fccdc Reformat long lines in the new part of the xrc sample.
No changes, just break the too long lines.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:33:38 +00:00
Vadim Zeitlin
14f0c8b716 Use Connect() of Bind() in the new part of xrc sample.
Use Connect() for compatibility (notably with VC6 which doesn't support
Bind()). Also connect the event handlers on loading the dialog instead of
waiting until the relevant page is selected, this makes the code slightly
simpler as we don't need to remember whether we connected them or not any
longer.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:33:30 +00:00
Vadim Zeitlin
f7aaef4d53 Test both ChangeSelection() and SetSelection() in notebook sample.
Test wxBookCtrl::SetSelection() too to be able to check that it does generate
events as expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:33:22 +00:00
Vadim Zeitlin
409f747ed9 Don't require skipping "page changed" event in wxMSW wxNotebook.
wxMSW wxNotebook implementation used to handle EVT_NOTEBOOK_PAGE_CHANGED event
to update the currently shown page which meant that page changing was broken
if the user code handled and didn't skip this event.

As the other ports don't require the user code to skip this event, don't do
this in wxMSW neither and always update the selected page unconditionally.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 19:33:10 +00:00
Vadim Zeitlin
0526c8cc07 Add support for id ranges to XRC.
Allow to declare ranges of consecutive IDs in XRC by using the "id[n]" syntax.
Show this functionality in the xrc sample and test it in the new unit test.

Also show and test the "object reference" XRC functionality.

Closes #11431.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 14:00:59 +00:00
Vadim Zeitlin
1f6ea93556 Make wxXmlResource::ReportError() wxXmlNode parameter const.
This function (and the related DoReportError()) doesn't need to modify its
"context" argument so take a const-pointer in it.

See #11431.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 14:00:43 +00:00
Vadim Zeitlin
62d3301bf9 Mention the GUI test in the unit test tech note.
Update the tech note to mention the (relatively) new GUI test program too.

See #11431.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 14:00:31 +00:00
Vadim Zeitlin
5fcef18409 Update and reorganize XRC overview to make it more useful.
Emphasize the parts most useful for the new users instead of more advanced
concepts and generally make the text more readable.

Closes #12661.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 14:00:19 +00:00
Peter Cawley
955bad410e Add support for toggle buttons to wxRibbonButtonBar.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 13:44:22 +00:00
Vadim Zeitlin
258593354e Fix build with Borland C++ compiler.
Disable some parts of the code that this compiler had problems with. Add
parentheses to work around its bugs elsewhere.

Closes #12558.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 13:16:20 +00:00
Vadim Zeitlin
0ce0f1e9eb Update all windows associated with the tooltip when it changes in wxMSW.
Although the tooltip was initially correctly set for all windows associated
with it, it was only updated for the main one if its text changed later. This
resulted in leaving the old tooltip for the composite controls such as
wxComboBox or controls with sub-windows such as wxRadioBox.

Fix this by storing all windows associated with the tooltip (for space
efficiency, only allocate the array if necessary however as it will be empty
in the majority of cases) and apply SetTip() to all of them, not just the main
one.

Closes #12659.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66053 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 13:12:16 +00:00
Stefan Csomor
2d64bab703 disable code because of OS bug, fixes #12478, fixes #12554
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 11:54:09 +00:00
Peter Cawley
32eb560338 Improve behaviour of scrolling through a ribbon gallery.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-06 23:46:25 +00:00
Stefan Csomor
76b1a2c26e routing the tab, return events for single line fields back to standard wx handler (doesn't work for secure fields unfortunately), fixes #12386 and partly #12392
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-06 15:48:48 +00:00
Stefan Csomor
3f30bd1a8d implementing turning off of default button as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-06 15:37:12 +00:00
Vadim Zeitlin
b895954d3f Minor cosmetic fix to generic check tools appearance in wxOSX.
Use rounded rectangle to indicate the selected tool instead of a plain one.

Closes #12409.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:43:33 +00:00
Vadim Zeitlin
5e9897b4be Fix check toolbar items behaviour in non-native toolbars in wxOSX.
Update the button state when the tool is toggled. Also use NSToggleButton for
this tool and not NSOnOffButton as the latter doesn't use the alternative
(toggled) image.

Closes #12408.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:43:28 +00:00
Vadim Zeitlin
c71096a055 Avoid using wx GDI classes from non-main thread in wxOSX/Cocoa.
OS X uses a background thread for pulsing the default button and we intercept
the draw requests from it. As our drawing code is not MT-safe, executing it
from the non-main thread can result in crashes.

Avoid this by simply not doing anything fancy when called from a background
thread and simply deferring to the superclass instead.

Closes #12407.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:43:18 +00:00
Vadim Zeitlin
ed310c35b4 Really update tooltip when wxToolBar::SetShortHelp() is called.
Changing a toolbar tool tooltip didn't work in wxOSX/Cocoa because the new
value was never propagated to the native control.

See #12362.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:43:13 +00:00
Vadim Zeitlin
0b79709d3c Remove trailing comma from an enum.
Comma after last enum element is not allowed in C++98 and some compilers will
warn about it.

Closes #12591.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:43:07 +00:00
Vadim Zeitlin
f58438058b Show the first, not the last, inserted item in wxListBox in wxOSX.
The listbox showed its last, not first, item after creation in wxOSX which was
inconsistent with the other ports and generally inconvenient.

Fix this by ensuring that the first item being inserted is shown, and not the
last one as was (implicitly) the case before. A better fix would be to avoid
scrolling entirely but I don't know how to do this with NSClipView.

Closes #12365.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66038 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:42:49 +00:00
Vadim Zeitlin
b2b6121609 Use CGFloat instead of float for mouse wheel event parameters.
This fixes mouse wheel handling in 64 bits where CGFloat has size different
from float.

Closes #12168.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:42:28 +00:00
Vadim Zeitlin
247bb51058 Fix showing the frames full screen under OS X.
Don't leave space for the title bar when showing the frame full screen.

Closes #11701.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:41:56 +00:00
Vadim Zeitlin
0d65f8d20f Improve default position for new TLWs in wxOSX.
Put the new windows in the upper left corner of the screen but not at (0, 0)
as before, this was rather inconvenient and too different from the normal
application behaviour under OS X.

Closes #11926.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:40:30 +00:00
Vadim Zeitlin
8244507f68 Ensure that strings returned by wxMBConv_cf are in NFC form.
Normalize all Unicode strings used internally even though the Darwin kernel
gives them to us in decomposed (NFD) form.

Closes #11730.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:40:09 +00:00
Vadim Zeitlin
dc36b43adf Remove duplicate wxEVT_COMMAND_TEXT_ENTER generation from wxOSX/Cocoa.
The code in -[wxNSTextField control:textView:doCommandBySelector:] generated a
second copy of this event as it was also generated from
wxNSTextFieldControl::controlAction() for single line text controls.

Closes #11691.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:39:49 +00:00
Vadim Zeitlin
209a9f5822 Don't update scrollbars when the window is being destroyed in wxOSX.
Updating scrollbars for a window that is being destroyed anyhow is useless and
resulted in crashes in the htlbox sample because it used client-to-screen
coordinates conversion which asserted because the TLW was invalid any more and
this unexpected assert during window destruction led to a crash.

Simply don't do it at all to avoid the problem.

Closes #11776.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:39:29 +00:00
Vadim Zeitlin
df7d93f67b Fix crash in wxColour ctor from NSColor in wxOSX/Cocoa.
wxColour ctor from NSColor added by Kevin Ollivier in r62525 never worked as
it passed NULL pointer to NSColor:getComponents and so always crashed. This
resulted in a crash in the rich text editor of the text sample, for example.

Fix this by passing a valid array containing colour components instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:39:09 +00:00
Vadim Zeitlin
3721dc6efe Remove unnecessary wxOSX_USE_COCOA guards in Cocoa-only file.
The #if wxOSX_USE_COCOA seems unnecessary in a file that is used in
wxOSX/Cocoa only so simply remove it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:38:49 +00:00
Vadim Zeitlin
b7db378853 Assume sizeof(wchar_t) is always 4 under OS X.
wchar_t used to be 2 bytes in Mach-O builds but they're not supported any
longer so remove the code checking for sizeof(wchar_t) and just assume it's
always 4.

Closes #10442.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:38:25 +00:00
Vadim Zeitlin
f40377bedc Add another test for the insertion point position after SetValue().
Verify that setting the value of a previously not empty control resets
the insertion point to its beginning.

See #10051.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:37:54 +00:00
Vadim Zeitlin
4a695c4689 Disable keyboard unit test with wxUIActionSimulator under OS X.
The test doesn't work because the test window never get any events. This might
be a bug in the test or in wxUIActionSimulator itself but for now I just have
no idea about how to fix it, so disable the test to let the rest of the test
suite run.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 21:37:27 +00:00
Chris Elliott
2dea359953 add execmon to CE exclude (no console)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 16:05:38 +00:00
Chris Elliott
b45054eaaf missing namespace
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 15:45:51 +00:00
Chris Elliott
bbaf9672e6 missing namespace
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 15:24:27 +00:00
Vadim Zeitlin
4ded4e1910 Remove test code accidentally committed as part of r66015.
Don't call wxMenuItem::Set{Background,Text}Colour() in the menu sample, this
was for testing only.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 12:53:44 +00:00
Jouk Jansen
0ea0feb82f Update OpenVMS makefiles
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-05 06:55:31 +00:00
Vadim Zeitlin
85898d8b4d Correct a trivial typo in wxLog documentation.
Just remove an extra word.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66016 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-04 16:13:27 +00:00
Vadim Zeitlin
e801524514 Use explicit menu item background if it's given under MSW.
An explicit item background colour specified in user code should override the
default theme background.

Closes #12652.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-04 10:57:19 +00:00
Vadim Zeitlin
b146648622 No changes, just use RAII-based classes in MSW owner drawn menu code.
Add helper HDC{TextCol,BgCol,BgMode}Changer classes which ensure that the
corresponding HDC attribute is reset on scope exit instead of manually calling
the corresponding MSW functions to set and reset it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-04 10:57:13 +00:00