Handle deprecated background styles correctly in wxMSW.
Handle wxBG_STYLE_TRANSPARENT as wxBG_STYLE_PAINT and wxBG_STYLE_COLOUR as
wxBG_STYLE_ERASE instead of asserting (and almost surely crashing next, as
this assert is in the code called when the window is repainted and so will be
called again when the assert dialog is shown resulting in reentrant assert).
Due to what seems a compiler bug, MSVC tries to instantiate objects of
abstract wxGridXXXHeaderRenderer classes when compiling operators ?: using
references to them. Add explicit static_cast<>s to help it do the right thing.
Fixes compilation with this compiler broken in r62037.
Mention that Remove() uses binary search for sorted arrays so the item removed
by it is not necessarily the first one. Also correct documentation of Index()
for sorted arrays which was incorrectly the same as for the normal kind.
Exclude binary files from the checks done by the pre-commit hook.
We shouldn't check that binary files are UTF-8 so determine whether the file
is binary by looking at its svn:mime-type and only do the check for the text
files.
Extract default grid header renderers from wxGridCellAttrProvider.
We must be able to use them even when we have no attributes at all
and even when we have no associated table, so use default renderers in wxGrid
implementation of Draw{Row,Column}Label()/DrawBorder() in this case.
As this class has only inline methods it doesn't need to be exported from the
DLL and actually exporting it results in linking problems when using
wxScrolled<wxWindow> (which, unlike wxScrolled<wxPanel>, is not used in wx
itself and so doesn't seem to be instantiated) in DLL client even with VC > 6.
An alternative solution would be to change WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE
macro to explicitly instantiate the template in the DLL even for VC > 6 but
this wouldn't solve the problem for wxScrolled<CustomClass> while removing the
DLL export declaration should.
Also use wxScrolled<wxWindow> in addition to wxScrolled<wxPanel> in the scroll
sample to test that it links correctly.
Call wxApp::ProcessPendingEvents() from wxX11 event loop.
Now that this function is not called from idle time (because it should be
called before, see r61441), the event loop must call explicitly so do it from
wxGUIEventLoop::Dispatch() in wxX11.
A probably better (but more time-consuming) fix would be to make wxX11 use
wxEventLoopManual as there doesn't seem to be any reason not to.
Override DrawLabel() to avoid crossing out disabled labels in mono theme.
DrawButtonLabel() crosses out the buttons to indicate that they are disabled
(for lack of any other options in mono renderer) but this looks really bad for
the labels, so don't do it.
Add a separate wxControlRenderer::DrawButtonLabel() too.
wxControlRenderer::DrawLabel() was used by both wxStaticText and wxButton but
their labels may need to be drawn differently and wxRenderer does have
different DrawLabel() and DrawButtonLabel() to do it. Now also add a separate
method for the buttons to wxControlRenderer.
Now that wxGetActiveWindow() is used when showing modal dialogs, it became
critical to implement it as otherwise an assert happens every time a dialog is
shown and because creating the assert dialog itself results in another (same)
assert, this immediately results in a crash.
So implement it even if in a very trivial (but hopefully not too incorrect)
way.
As some wxUniv classes implement DoGetBestClientSize(), the new code in
wxWindow::DoGetBestSize() implementation calls DoGetBorderSize() which asserts
because it's not implemented, making it impossible to even start the minimal
sample -- fix this.
Define wxSetDetectableAutoRepeat() for X11-based ports only.
This function is not needed in wxGTK2 as GTK+ sets detectable auto-repeat on
its own in gdk_display_open() anyhow, so move its implementation to
src/x11/utilsx.cpp where it can be used by wxX11 and wxMotif which do need it.
Move wxSetDetectableAutoRepeat() to a section compiled in wxCore.
This function was mistakenly defined in a section of utilscmn.cpp compiled as
part of wxBase, so it wasn't correctly exported from the core library and
linking any wxX11 applications failed when using compiler with visibility
support.
Situation with wxBK_XXX vs wxXXB_XXX remains confusing, the comments in the
code suggest that the former is preferred but the latter are documented for
wxListbook and wxChoicebook (although they don't even exist for wxTreebook).
So it seems unwise to not recognize the wxXXB_XXX versions in XRC as people
could easily decide to use them instead of wxBK_XXX values -- and this is also
consisten with wxNotebookXmlHandler which does recognize both wxBK_XXX and
wxNB_XXX already.
Change wxListbookXmlHandler and wxChoicebookXmlHandler to also always
recognize these styles.
The change of the counter to a simple boolean in r61985 broke the code which
called both Initialize() and Shutdown() multiple (but the same number of)
times. As this is the documented correct behaviour, restore the counter to
cater for it even if we don't really need it any longer.
Throwing an exception from worker threads is useless as it is not caught by
our wxUnitTestProtector which only protects the main thread, so abort
immediately to be sure to provide at least some information about the problem
as otherwise nothing may be output at all and the program can end up
deadlocked.
Account for the margins used by Windows around status bar text.
Because Windows uses margins around the text drawn in the status bar, naively
setting a field width to the size of the text didn't work (see previous
commit for an example). As this seems a natural enough thing to do, account
for this margin inside wxStatusBar itself to avoid the user code the trouble
of having to call some special function to do it. Notice that this does mean
that fields not containing text may be slightly larger than needed, but we
consider that this (rarer) case is less important.
Also account correctly for the status bar grip size. And while we still hard
code its size, do it in a clearly named function instead of using completely
mysterious constants here and there.
Modify the status bar sample to use two fields of just the right size for
their contents to confirm that this doesn't work correctly under at least MSW
currently (see #10696).
Notice that we need two fields because the behaviour/problem is different for
the last field and all the other ones.
Simplify the status bar sample by removing wxBitmapButton.
The sample code was complicated by having USE_STATIC_BITMAP and using
wxStaticBitmap or wxBitmapButton depending on it. Neither important for
a wxStatusBar sample so just use wxStaticBitmap always and make the code
simpler and more readable.
No real changes, just:
- Fix code which couldn't compile in USE_MDI_PARENT_FRAME case
- Use wxMenu::AppendCheckItem() instead of Append(..., true)
- Remove unnecessary #ifdef __WXMAC__
- Wrap excessively long lines
Initialize wxMDIParentFrame::m_accelWindowMenu in default ctor.
If wxMDIParentFrame object was created without its Create() ever being called,
it crashed in its dtor trying to delete an uninitialized pointer, so do
initialize it to NULL in all ctors (via a helper Init() method, as usual).
wxSocket::Initialize() and Shutdown() are for main thread only.
Calling Initialize() from another thread could never work before but it wasn't
clear that this was the case so document it in the functions comments and
documentation now and add asserts checking that they are called from the main
thread only.
Also simplify the code as we don't actually need to do any reference-counting
here and a simple boolean flag indicating whether the sockets are initialized
is enough.
Optionally return length from wxLoadUserResource().
Add optional length output parameter and also change the return type to "char
*" from "wxChar *" to which it apparently was blindly changed just to make
this code compile even though this function never returned any strings.
Add wxUSE_RIBBON to wx/setup_inc.h and wx/chkconf.h.
wxUSE_RIBBON was apparently added to the different wx/*/setup.h files manually
instead of being added to wx/setup_inc.h and regenerating the rest, correct it.
Don't query system option in every DrawBitmap() call under MSW.
Doing this had noticeable (and bad) performance implications so cache the
value of the option during the first call. This doesn't allow changing its
value during the program execution so we may want to provide some way to
update its value later if really needed.
It used to return a pointer in wxUSE_STL==0 build and an object in
wxUSE_STL==1 one making checking its return value difficult without provoking
warnings from either MSVC or g++ (see #11038).
Also, all the other occurrences of Member() already returned bool, including
the one in wxStringList so changing it to return bool in wxList itself is more
consistent.
This is more consistent and ensures that all asserts in wxWidgets are
controlled by a single wxDEBUG_LEVEL setting instead of also relying on NDEBUG
as standard assert() macro does.
Allow creating wxSingleInstanceChecker with default name.
This makes it easier to use in common cases: there is no need to come up with
a unique name for the checker any more as sufficiently unique combination of
wxApp::GetAppName() and wxGetUserId() is used if no name was explicitly given.
This is done by calling the new CreateDefault() on demand from
IsAnotherRunning() instead of simply creating the checker with the default
name in the default ctor for compatibility (you had to call Create() after
using the default ctor before and it can only be called once) and because
wxTheApp might not exist yet when wxSingleInstanceChecker is created.
Change wxBoxSizer::AddSpacer() to only add space in sizer direction.
It used to add a spacer with the given size in both directions but this was
counter-intuitive and wasn't expected even by the original author of this code
so change it to behave more reasonably.
The change in r61922 which was supposed to do it somehow forgot the fix itself
and added only a comment explaining why it was needed. Really do name the
struct now.