Fix harmless unused parameter warnings in wxDEBUG_LEVEL==0 build.
These warnings were harmless as they concerned the parameters used inside
wxASSERTs only but there were hundreds if not thousands of them in
wx/strvararg.h alone so all the rest of build output was completely lost in
them.
Make --disable-debug[_flag] configure option really work.
We never defined wxDEBUG_LEVEL as 0 meaning that debugging code in wxWidgets
was always enabled, even if --disable-debug_flag or --disable-debug (which
implies it) was given.
Fix this now by adding -DwxDEBUG_LEVEL=0 to CPPFLAGS if necessary.
Add wxItemContainer::DetachClientObject() and use it in wxRearrangeList.
Add a method to detach the item from an item control without deleting it and
use it in wxRearrangeList to correctly swap object client data without
deleting the pointers in the process.
LPARAM is a 64 bit type in Win64 and doesn't match the size expected by "%l"
printf format specifier. Instead of showing it as a 32 bit number in 32 bit
build and 64 bit in 64 bits, just truncate it to the lower 32 bits in any case
for now, this should be enough for the diagnostic messages.
Ensure that validators work even in presence of pushed event handlers.
Call pre-processing hooks for each of the handlers in the chain and not only
the first one. This ensures that a validator (which is invoked during the
pre-processing stage) of a window is used even if a window has an event
handler pushed on top of it.
Don't reuse the same event object for multiple events in wxGTK.
The old code simply called SetEventType() to change the type of the event and
called HandleWindowEvent() again with it. This was incorrect as the event was
modified after being processed the first time, notably its WasProcessed() flag
was set and so wxApp::FilterEvent() wasn't called when it was being processed
the second time. In practice this meant that FilterEvent() was never called
for wxEVT_CHAR events -- for which it's nevertheless very useful to have as it
allows to implement application-wide keyboard processing.
Also refactor the code to avoid duplication, exactly the same event sending
code was used in gtk_window_key_press_callback() and gtk_wxwindow_commit_cb().
Extract it now in a private SendCharHookAndCharEvents() function.
Add scripts to make releases from a git-svn repository.
This can't replace the official release script yet as not everybody uses git
but they are much more convenient to use than the old ones for me and also
faster so I'm adding them to svn in case they can be useful to others.
Remove dllexport declaration from a nested struct.
Try a blind fix for VC6 linking problems in DLL build related to
wxFileTypeInfo ctor. This is unlikely to fix it but DLL-exporting a nested
struct which, moreover, has only inline methods, seems unnecessary and it just
might help too.
Don't use wxRendererNative::DrawFocusRect() under Mac.
This function doesn't do the right thing there, it draws the focus border as
it's drawn around controls such as buttons. This border overflows the item
rectangle and results in garbage remaining on screen when selection changes.
Use correct format specifiers in wxOSX/Carbon font caching code.
The specifiers used didn't match the actual argument types resulting in the
asserts from the new wxPrintf() code. Correct them to match the real types.
Generate key events in generic wxDataViewCtrl implementation.
Forward wxEVT_CHAR events from wxDataViewMainWindow to the parent window so
that they could be processed at wxDataViewCtrl level.
Call DisableKeyboardScrolling() to ensure that cursor movement keys are not
always eaten by the parent window but can be used for the navigation in the
control if they're not processed by user.
Add a test keyboard handler to the dataview sample to check that handling keys
in wxDataViewCtrl does work.
wxMenu::CreateMenu() parameter called "index" was mistakenly wrapped in
WXUNUSED() making it invisible inside the function body and the (BSD string
function) index() was used instead. This somehow compiled before but not with
g++ 4.4. In any case, the code was wrong even when it did compile.
Remove WXUNUSED() from the parameter and also rename it to avoid clashes with
(semi-)standard function which can also be defined as macro on some systems.
Revert the wxDataObjectComposite checks added by r58549.
The checks for data format duplication in wxDataObjectComposite::Add() added
by this revision were broken and didn't actually check anything. It also
doesn't seem clear why do we need them at all so simply remove them. See #10437
for more details.
This also closes #12113 as a side effect because the messages are not present
any more.
Disable test of format string with "%n" for MSVC 8+.
MSVC 8 and later disables support for "%n" in printf() by default. And
although it provides a function to re-enable support for it, it doesn't seem
to work for the functions we use.
Just disable the test which results in CRT assert when using this compiler.
Don't use dangling pointers in wxWindowMSW::HandleMenuChar().
We used a pointer into the result of wx_str() for a temporary string which was
clearly wrong. Store the string we're manipulating to ensure that this doesn't
happen.
This in particular fixes keyboard navigation in the menus with owner-drawn
items.
Remove scroll units duplication in wxGrid to fix setting them.
For some unknown reason wxGrid decided to store its scroll units in its own
m_scrollLine[XY] variables instead of just using the base wxScrollWindow class
m_[xy]ScrollPixelsPerLine ones. And, of course, the two could get out of sync
because wxGrid didn't update the base class version correctly.
Just don't duplicate these values at all and use the base class fields. This
makes the code simpler and also fixes changing the size of the scroll units.
Fix text updated event generation in wxGTK wxComboBox.
The changes (cosmetic renaming, no less) in r64436 broke unit tests checking
for wxComboBox event generation because the extra text updated events were not
suppressed correctly any longer because wrong {Enable,Disable}Events() were
called instead of the correct GTK{Enable,Disable}Events().
Fix and slightly improve the code by disabling the events in overridden
EnableTextChangedEvents() itself and reuse its code from GTK-specific event
enabling functions.
Fix wxToggleButtonXmlHandler compilation with wxUniv.
Remove nonsensical code involving operator ?: with wxString and wxBitmap
operands. No idea what was the intention behind it but it failed to even
compile in wxX11 build so the new version (which does compile) can't be worse.
Jaakko Salli [Sun, 11 Jul 2010 16:06:03 +0000 (16:06 +0000)]
Have the new incarnation of wxPGArrayEditorDialog support the old-style 'custom button' event as something that happens when the wxEditableListBox's 'New Item' button is pressed
Optionally set the window name in wxPersistentRegisterAndRestore().
In practice names are not often used so typically whenever you want to make a
window settings persistent you also need to set its name and the it's
convenient to let a single function do both tasks, so add an overload taking
the name string (this is a separate function instead of optional parameter to
avoid compilation errors if this is ever used with non-wxWindow-derived
objects which don't have SetName() method).
Also expand the documentation slightly and add @since tags.
Set the string to search for in wxSearchCtrl events.
It's more convenient to have the string to search for directly in the event
object than to retrieve it from wxSearchCtrl itself as it had to be done
before.
Don't use uninitialized variables in wxGrid::AutoSize().
The code in wxGrid::AutoSizeColOrRow() was using uninitialized col/row
variable if the grid had no rows/columns, resulting in assertion failures when
trying to automatically size the columns of an empty grid.
Do initialize them now and also remove duplicate assignments to the variables
which never change inside the loop.
Account for largest item in wxGenericListCtrl::GetBestSize().
Don't just return a hard-coded value but at least return something big
enough to show the largest item in the control in non-report mode.
This fixes the appearance of wxListbook which simply truncated its items
before if they didn't fit in 80 pixels horizontally.
Also switch to implementing DoGetBestClientSize() instead of DoGetBestSize()
as this method doesn't account for the control borders (it does account for
the scrollbars however).
Add wxSize::IncBy() and DecBy() overloads taking wxPoint.
It seems to make at least as much sense to extend a wxSize by wxPoint than by
another wxSize (which doesn't make much size to me...) so add Inc/DecBy()
overloads doing this.
We might also add operator+=() overloads taking wxPoint for consistency but
for now don't add more operator overloads unnecessarily, let's wait if anybody
asks about this first.
Ensure that wxGenericListCtrl always has wx[HV]SCROLL styles.
Although these styles are unconditionally added when creating the window they
could be reset by calling SetWindowStyleFlag() later and this in fact happened
when changing control mode from wxListbook.
As it doesn't make sense to have wxListCtrl without these styles, also add
them unconditionally in overridden SetWindowStyleFlag() as well.
Don't set negative size when using constraints for layout.
Passing negative size to GTK+ results in error messages and in the future
wxWindow::SetSize() itself might assert if passed negative size so just avoid
setting it in the first place even if there is not enough space for
everything.
Implement wxWindow::DoGetBorderSize() for all ports.
Implement DoGetBorderSize() properly for wxGTK and use the difference between
the full window size and the client size for all the ports not implementing
this method. The latter is incorrect in the presence of the scrollbars but is
the best we can do in general.
Fix item selection/focus drawing in generic wxListCtrl.
Item focus rectangle was not drawn at all under wxGTK as the code doing it was
disabled with a comment saying that it was drawn elsewhere -- but this wasn't
the case.
So remove #ifdefs for wxGTK/Mac from generic wxListCtrl code and do use
wxRendererNative methods for all platforms. This fixes the appearance of the
control under GTK and if it introduces any problems under Mac, they should be
fixed in its wxRendererNative implementation and not by adding #ifdefs here.
Don't use tree style to draw focus in DrawItemSelectionRect() in wxGTK.
Using gtk_paint_focus() with a tree widget style did a clearly wrong thing
with Clearlooks theme: instead of drawing a focus rectangle it drew a
background with a shadow overflowing the specified rectangle. This resulted in
junk being left when the selection was changing in wx{List,Tree}Ctrl.
Just use the widgets own style instead as this seems to work just fine. After
this change the code for focus drawing in DrawItemSelectionRect() became
identical to the code of DrawFocusRect() so just call the latter from the
former instead of duplicating its code.
Allow user code to override key events in generic wxListCtrl.
The changes of r58323 ("Restore keyboard navi") fixed the handling of cursor
keys in the generic wxListCtrl implementation but at the price of not sending
keyboard events for the cursor keys to wxListCtrl itself any more. This made
it impossible to override their handling in user code, something that used to
work in previous wx versions and still works in wxMSW.
Revert the changes of this revision now and fix the original code by simply
disabling the handling of the cursor keys in wxScrollHelperBase using a newly
added DisableKeyboardScrolling() method. This ensures that the keyboard events
for cursor keys are not used to scroll the window when they are forwarded to
wxListCtrl from wxListMainWindow.
The fix is conceptually ugly as it would be better to avoid the need for such
ad hoc functions as DisableKeyboardScrolling() but it is very simple and there
just doesn't seem to be any sane way to do it otherwise with wxScrollHelperBase.
The alignment was ignored unless a wxST_ELLIPSIZE_XXX style was already used.
Apparently calling gtk_label_set_ellipsize(PANGO_ELLIPSIZE_NONE) resets the
alignment, so set the alignment after setting the ellipsization style, not
before.
Another possible solution would be to avoid calling gtk_label_set_ellipsize()
completely if no ellipsization styles are given but maybe the original code
didn't do this for some (unknown and undocumented) reason so keep it this way.
Use -miphoneos-version-min if compiling for iPhone and --with-macosx-version-min was specified.
Otherwise .mm files may not compile correctly with some iPhone SDKs.