Vadim Zeitlin [Mon, 7 Dec 2009 13:37:01 +0000 (13:37 +0000)]
Generate erase background events for native controls too under MSW.
Remove the test which prevented the generation of erase background events from
wxMSW::wxWindow::HandleEraseBkgnd(). Although it is true that native controls
mostly erase background on their own, there are exceptions: we must erase the
background of wxToolBar ourselves, for example. More importantly, there is no
reason to prevent the user code from defining wxEVT_ERASE_BACKGROUND handlers
for the native controls as this works just fine under MSW (although it doesn't
under GTK nor probably other ports...). So also add a test erase background
handler to the toolbar sample to verify that this does work.
Vadim Zeitlin [Mon, 7 Dec 2009 05:01:14 +0000 (05:01 +0000)]
Move wxMSW wxTextCtrl::GetDefaultAttributes() to wxTextCtrlBase.
This commit doesn't introduce any changes in the control behaviour, it simply
moves the existing method to the base class because it is not MSW-specific.
Also implement wxTextCtrlBase::GetClassDefaultAttributes() because if a class
implements GetDefaultAttributes() it should implement it as well.
Vadim Zeitlin [Mon, 7 Dec 2009 03:04:39 +0000 (03:04 +0000)]
Define MY_DLL_BUILDING symbol for dll sample DLL build.
This is necessary to properly define MY_DLL_DECL as either WXIMPORT or
WXEXPORT depending on whether my_dll.h is included from DLL itself or from
outside it. Without this, MSVC generated warnings about inconsistent dll
linkage.
Vadim Zeitlin [Sun, 6 Dec 2009 02:29:56 +0000 (02:29 +0000)]
Minor corrections to ToWChar() comment.
Don't refer to the non-existent outputBuf parameter and don't imply that the
value of dstLen matters to decide whether we really convert or not -- only
whether dst pointer itself is NULL or not does.
Václav Slavík [Sat, 5 Dec 2009 18:54:40 +0000 (18:54 +0000)]
Added samples/dll for showing how to use wxWidgets to implement
a DLL that is used from another application written with a different
toolkit (or different wx version).
Vadim Zeitlin [Sat, 5 Dec 2009 17:30:53 +0000 (17:30 +0000)]
Don't lock global mutex when deleting wxThread to avoid deadlocks.
Calling out the user-defined wxThread dtor while holding gs_mutexDeleteThread
lock is a bad idea as it may result in deadlocks if the dtor deletes another
thread. Only lock the mutex directly before manipulating the data it protects.
Vadim Zeitlin [Sat, 5 Dec 2009 01:32:45 +0000 (01:32 +0000)]
Fix wxLogChain (and wxLogWindow deriving from it) broken by wxLog changes.
wxLogChain::DoLogRecord() only called DoLogRecord() on the old logger but not
the new one when the new logger was the same object as wxLogChain itself as is
always the case for wxLogWindow. The result was that nothing was logged into
the window.
Vadim Zeitlin [Thu, 3 Dec 2009 16:26:25 +0000 (16:26 +0000)]
Suppress errors from static bitmap page of widgets sample.
Don't fail loudly if the image file is not found (which can happen under Unix
if the image sample wasn't built yet or if we're not running the sample from
its own directory) but just don't create the bitmap.
Vadim Zeitlin [Thu, 3 Dec 2009 16:26:15 +0000 (16:26 +0000)]
Don't assert if the path is not absolute in wxFileDialog::SetPath().
Remove the assert added in r62101 (see #10917), it was wrong as the other
ports do not assert in this case. Instead, just ensure that the path we use
with the GTK+ native chooser is absolute.
Vadim Zeitlin [Tue, 1 Dec 2009 00:42:19 +0000 (00:42 +0000)]
Define _CRT_SECURE_NO_WARNINGS when building 3rd party libs with MSVC.
Avoid dozens of warnings about "unsafe" use of the standard C library
functions in 3rd party code which are harmless and which we don't care about
in any case.
partially revert changes of r58531 as wxCollapsiblePane currently doesn't work with GTK+ 2.18.3 (altough it does work with GTK+ 2.12.2); all following changes (r58632,58718,61109) should have been preserved
Vadim Zeitlin [Sat, 28 Nov 2009 14:37:03 +0000 (14:37 +0000)]
Allow calling wxStrchr() with a narrow string and wide character.
Calls to wxStrchr(char-string, wide-char) would previously fail if wide
character couldn't be converted to a single character in the current locale
encoding. Change it to simply return NULL in this case as it's a safe and
useful generalization: a narrow string will never contain a wide character not
representable in the current locale.
Add wxUniChar::GetAsChar() to help with implementing this.
Vadim Zeitlin [Sat, 28 Nov 2009 03:37:41 +0000 (03:37 +0000)]
Define INVALID_FILE_ATTRIBUTES in filename.cpp too.
Fix VC6 compilation: INVALID_FILE_ATTRIBUTES is not defined in its headers so
we need to do it ourselves (this was done in filefn.cpp before but part of the
code using this constant was moved to filename.cpp in r62735 so now we need to
define it here too).
Vadim Zeitlin [Sat, 28 Nov 2009 02:40:08 +0000 (02:40 +0000)]
Implement wx{File,Dir}Exists() in terms of wxFileName methods.
Use wxFileName from the global functions instead of using global functions in
wxFileName methods as wxFileName is the preferred API for all these
operations.
Vadim Zeitlin [Sat, 28 Nov 2009 02:29:08 +0000 (02:29 +0000)]
Don't override msw.remap system option value in wxToolbook.
Introducing a system option for all toolbars and then ignoring it inside wx
itself is ridiculous and just goes to prove that this option itself was a
mistake. But as we have it, we should respect whatever value it's set to
(which should hopefully be 0 anyhow for most modern systems) instead of
overriding it forcefully making the mockery of the whole "option" concept.
Vadim Zeitlin [Sat, 28 Nov 2009 02:28:57 +0000 (02:28 +0000)]
Use OUTLINETEXTMETRIC::otmpFamilyName to get wxFont face name from MSW.
In spite of the name, we need to use otmpFamilyName member of
OUTLINETEXTMETRIC struct and not otmpFaceName to get the font face name: the
latter may contain (locale-dependent, so the changes of r62708 didn't work for
non-English versions of Windows) "Italic" or "Bold" suffix while the former
does not and is what we want.
This should really fix the unit test failures, even in French locale.
Vadim Zeitlin [Fri, 27 Nov 2009 21:06:03 +0000 (21:06 +0000)]
Define wxUSE_CAIRO in wx/chkconf.h to ensure that it's always defined.
wxUSE_CAIRO used to be defined only in wx/cairo.h but this header wasn't
included by src/common/dcgraph.cpp so the code there was compiled as if we
were not using Cairo even when we were (thanks g++ for the warning).
Define it in wx/chkconf.h (included from wx/defs.h, i.e. always) now to ensure
that not only this bug is fixed but also that it can't happen any more.
Vadim Zeitlin [Fri, 27 Nov 2009 01:47:38 +0000 (01:47 +0000)]
Allow changing horizontal alignment of numeric cells in wxGrid.
wxGridCellAttr didn't provide any way to query its alignment attributes
without falling back to the (always defined) default alignment so the code in
wxGridCellNumberRenderer and similar classes simply always used right
alignment,
Add a new wxGridCellAttr::GetNonDefaultAlignment() function which allows to
retrieve the alignment defined in the attribute and use it to use right
alignment by default but allow overriding it.
Add a test to the sample showing a non right-aligned numeric cell.
Incidentally fix a long-standing bug in wxGridCell{DateTime,Enum}Renderers
which used wxRIGHT instead of wxALIGN_RIGHT and so were not aligned properly
even by default.
Vadim Zeitlin [Fri, 27 Nov 2009 01:47:30 +0000 (01:47 +0000)]
Add symbolic constant wxALIGN_INVALID and use it instead of -1 in wxGrid.
wxGridCellAttr was using literal -1 to indicate "no alignment" which wasn't
immediately obvious, use a new wxALIGN_INVALID (which has the same value)
instead.
Kevin Ollivier [Thu, 26 Nov 2009 23:11:27 +0000 (23:11 +0000)]
Allow OS X Cocoa (or any OS X port) to override GetBestSize and provide a native OS X Cocoa impl. Also, fix the line ending check under OS X Cocoa, and a sanity check for SetStyle.
Vadim Zeitlin [Thu, 26 Nov 2009 16:17:00 +0000 (16:17 +0000)]
Make wxFileDialog::Set/SetPath() behave consistently.
wxFileDialog::GetPath() didn't return the value set by a previous call to
SetPath() in wxMSW version. Fix this and also implement SetPath() and
SetDirectory() methods in the generic versions in the same way as
SetFilename().
Vadim Zeitlin [Thu, 26 Nov 2009 15:59:27 +0000 (15:59 +0000)]
Don't set wxTextAttr font family to invalid value.
wxTextAttr::HasFontFamily() shouldn't return true if there is no valid font
family in this attribute but this could happen if it was constructed from a
font which didn't know its own family.
This fixes asserts on the startup of the text sample in wxMSW due to passing
wxFONTFAMILY_UNKNOWN to wxFont::SetFamily() when trying to use such invalid
attribute later.
Vadim Zeitlin [Thu, 26 Nov 2009 15:59:20 +0000 (15:59 +0000)]
Use wxTE_RICH style for the log window in the text sample.
This makes it have nicer colour (white instead of grey by default) under MSW
and wxTE_RICH was already in the code, just commented out -- it seems it's
better to enable it (as it also allows more text to be shown in the control
under old Windows versions) than to remove it.
Vadim Zeitlin [Thu, 26 Nov 2009 03:29:27 +0000 (03:29 +0000)]
Explicitly set the cursor when showing popup menu on text control in wxMSW.
Without this, an I-beam cursor is used when a menu is shown by a rich text
control. Set the arrow cursor explicitly to work around this apparent bug in
the native control.
Vadim Zeitlin [Thu, 26 Nov 2009 02:34:01 +0000 (02:34 +0000)]
No changes, just avoid overriding GetNativeFontInfoDesc() in wxMSW wxFont.
wxFont::GetNativeFontInfoDesc() and GetNativeFontInfoUserDesc() were
overridden just to ensure that the font is realized but it makes sense to do
it in wxFontRefData::GetNativeFontInfo() itself as detecting the face name
won't work if the font is not realized anyhow. And then we don't need these
functions at all as the only thing they do is checking that the font is valid
when they are called but this can be done in the base class itself as this
should happen in all ports (document that this is the case).
Vadim Zeitlin [Tue, 24 Nov 2009 00:02:05 +0000 (00:02 +0000)]
Don't return italic/bold suffix from wxFont::GetFaceName() in wxMSW.
These suffixes don't make part of the face name in wx API but the native MSW
API which we use since r62675 does return them. This made the unit test fail
in SettingsTestCase::GlobalFonts() as a face name with such suffix wasn't
recognized as a valid face name any more, so simply remove them.
Vadim Zeitlin [Tue, 24 Nov 2009 00:01:25 +0000 (00:01 +0000)]
Don't change file access time implicitly when setting it explicitly.
wxFileHandle helper class used in wxFileName::SetTimes() under MSW modified
the file access time by setting it to the current time because it opened the
file in a wrong mode.
Vadim Zeitlin [Sun, 22 Nov 2009 11:24:09 +0000 (11:24 +0000)]
Define wxNO_RTTI if RTTI support is disabled for g++ or MSVC.
For g++ it could have been possible to define wxNO_RTTI in configure itself
but it seems better/simpler/more maintainable to do it in C++ code. As for
MSVC, we already define wxNO_RTTI correctly if build/msw/makefile.vc is used
but not if (modified or rebaked) project files are used and detecting RTTI
support in the code is the only way to fix it.
Jaakko Salli [Sat, 21 Nov 2009 11:39:32 +0000 (11:39 +0000)]
Added a new documentation overview section 'Caveats When Not Using C++ RTTI', describing possible problems with Bind() and wxAny when C++ RTTI is disabled.
Jaakko Salli [Thu, 19 Nov 2009 19:27:24 +0000 (19:27 +0000)]
Added typeinfo.h which implements wxTypeId, using C++ RTTI if available. wxAny and Unbind<>() code are updated to use it. Added and updated related unit tests.
Vadim Zeitlin [Thu, 19 Nov 2009 01:36:54 +0000 (01:36 +0000)]
Compilation fix for wxUSE_STL build: another missing _str().
Use utf8_str() to convert wxString to GTK+ string instead of relying on
implicit conversion which doesn't exist when wxUSE_STL==1 (and also when using
wchar_t-based Unicode build).