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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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