Vadim Zeitlin [Sat, 20 Mar 2010 13:03:05 +0000 (13:03 +0000)]
Rename wxWindow::GetMainWindow() to X11GetMainWindow() in wxX11.
This avoids conflicts with GetMainWindow() defined in other wxWindow-derived
classes (such as wxDataViewCtrl and potentially user-defined classes as well).
Vadim Zeitlin [Sat, 20 Mar 2010 12:45:28 +0000 (12:45 +0000)]
Always include sys/time.h and sys/select.h from selectdispatcher.h.
fd_set used by this header is supposed to be defined in sys/select.h and not
including this header resulted in compilation problems under QNX. And
including sys/time.h shouldn't hurt and is needed by select() under many
systems anyhow.
Vadim Zeitlin [Sat, 20 Mar 2010 12:45:23 +0000 (12:45 +0000)]
Define wxGraphicsRenderer::GetDefaultRenderer() for all non-{MSW,Mac} ports.
wxGraphicsRenderer::GetDefaultRenderer() was only defined for wxGTK for some
reason but it needs to be defined in terms of GetCairoRenderer() for all ports
without native renderer implementation, i.e. everything but wxMSW and wxMac.
Vadim Zeitlin [Sat, 20 Mar 2010 12:45:19 +0000 (12:45 +0000)]
Remove duplicate variable definition.
The splitterX variable in wxPropertyGrid::HandleMouseMove() was defined twice
with the same value, remove the second definition to avoid warnings about
shadowing the variable in outer scope from some compilers.
Vadim Zeitlin [Thu, 18 Mar 2010 15:51:19 +0000 (15:51 +0000)]
Return exit code as signed integer from wxExecute(wxEXEC_SYNC).
The caller expects the function to return -1 if the child process exited with
-1 error code and not 255 that was returned before. The function is also
documented as returning -1 if the execution fails which wasn't true neither.
Fix this by explicitly handling the exit code as signed.
Vadim Zeitlin [Thu, 18 Mar 2010 15:07:39 +0000 (15:07 +0000)]
Ensure that setting wxChoice height to its default value does set it.
Setting wxChoice height to its default value didn't change the height even if
the current height was different from the default. This resulted in problems
when a wxChoice was used inside a wxAuiToolBar because AUI temporarily reduces
the toolbar size to (1, 1) when docking it (thus ensuring that the height of
wxChoice is changed too) and generally didn't make sense.
Fix this by resetting the height to the default value if the value passed to
wxChoice::SetSize() is what it considers to be its default height.
Add a unit test for this bug and also add a wxChoice to AUI sample to allow
testing for wxChoice behaviour inside a wxAuiToolBar being [un]docked.
Vadim Zeitlin [Thu, 18 Mar 2010 15:07:32 +0000 (15:07 +0000)]
Remove wxAuiProportionalBoxSizer hack and replace it with wxBoxSizer.
The temporary workaround due to wxBoxSizer changes in 2.9.0 is not needed any
more, revert r59889 and use wxBoxSizer instead of custom
wxAuiProportionalBoxSizer again.
Vadim Zeitlin [Thu, 18 Mar 2010 15:07:24 +0000 (15:07 +0000)]
Fix box sizer layout algorithm to respect both proportions and min sizes.
The new version of the algorithm tries to distribute the entire space
allocated to the sizer among its children, just as the version in 2.8 did,
while still respecting minimal children sizes first and foremost. This means
that the space allocated to the item will always be at least its minimal size
if the total space is at least equal to the sum of minimal sizes of the
children but that if there is enough space, the proportions will be respected
too.
Extended the unit test to check that laying out various combinations of three
elements results in the expected results.
Vadim Zeitlin [Thu, 18 Mar 2010 15:07:19 +0000 (15:07 +0000)]
Ensure that size in the minor direction of box sizer doesn't exceed the total.
This is similar to the previous commit but for the transversal direction of a
box sizer: we could give an item size larger than the size of the sizer itself
making only part of its window visible (and thus potentially making the window
unusable e.g. because the scrollbar wasn't visible at all).
Fix this by always restricting the item size in the minor direction to the
total size available and add a unit test which failed previously and passes
now.
Vadim Zeitlin [Thu, 18 Mar 2010 15:07:14 +0000 (15:07 +0000)]
Ensure that size in the major direction of box sizer doesn't exceed the total.
After fixing the problem with "growing items by negative proportion" in r56010
(which still was the correct thing to do as it fixed such indefensibly broken
behaviour as shrinking items with larger proportion by more than "smaller"
items when there was not enough space) the items in a box sizer could become
larger than the total space allocated to the sizer resulting in only parts of
them being visible.
Fix this by truncating the items to the (remaining) total size even if this
means making them less than their minimal sizes -- because there is nothing
else we can do when the total space is smaller than the sum of minimal sizes
anyhow.
Jaakko Salli [Wed, 17 Mar 2010 18:17:19 +0000 (18:17 +0000)]
Use explicit wxPGPropertyFlags enum type with wxPGProperty::SetFlag() and similar member functions (thus preventing use of incorrect set of flags). Also now document wxPGProperty flags.
Vadim Zeitlin [Tue, 16 Mar 2010 14:48:02 +0000 (14:48 +0000)]
Add white outline to bulls eye cursor used under MSW.
The cursor used black circles only making it perfectly invisible on black
background. Add a white outline as well to ensure that it can be seen in this
case too, similarly to how it's done for magnifying glass cursor and the same
bulls eye cursor in GTK+.
Vadim Zeitlin [Tue, 16 Mar 2010 00:23:57 +0000 (00:23 +0000)]
Initialize picker style in native GTK file/dir pickers.
This fixes the styles used in the native wxGTK version after changes in
r63654: we must initialize base class m_pickerStyle now and the code didn't do
this before resulting in various asserts and incorrect behaviour.
Vadim Zeitlin [Sun, 14 Mar 2010 14:47:11 +0000 (14:47 +0000)]
Fix test for compilers not supporting \u escapes in strings (such as VC6).
Also reformat the code to follow wx style and explicitly use UTF-8 for the
test strings encoding instead of assuming the encoding of the current locale
was UTF-8 (which is never the case under Windows).
Vadim Zeitlin [Sun, 14 Mar 2010 14:15:49 +0000 (14:15 +0000)]
Use an appropriate icon automatically in wxMSW wxMessageDialog.
wxMessageBox() functions uses wxICON_QUESTION or wxICON_INFORMATION
automatically if no other icon style (including wxICON_NONE) is specified but
wxMessageDialog under MSW didn't do this, unlike under e.g. wxGTK.
Fix this by also determining the appropriate icon automatically in
wxMessageDialog itself in wxMSW.
Ideally we'd do this in all ports wxMessageDialog implementations and remove
the code doing it from wxMessageBox() but right now it's still needed for the
platforms other than wxMSW and wxGTK.
Vadim Zeitlin [Fri, 12 Mar 2010 09:36:37 +0000 (09:36 +0000)]
Revert unneeded fix for list control headers from r63177.
The call to SetItemMinSize() shouldn't be needed and the latest OS X version
does work correctly without it. Apparently the real bug was fixed somewhere
else in the meanwhile.
Vadim Zeitlin [Fri, 12 Mar 2010 09:27:10 +0000 (09:27 +0000)]
Correct query for formats supported by wxDataObject in wxGTK wxClipboard.
We wrongly asked wxDataObject for the formats it could provide on output
instead of those it accepted as input in wxClipboard::GetData() in wxGTK.
This could result in clipboard not working for "asymmetrical" data objects.
Fix function wxControlBase::DoEllipsizeSingleLine to really make sure that the ellipsized string takes less pixels than maxFinalWidthPx.
Add comments to explain in more details what the function does and in particular the valid ranges of all internal variables; fix in that regard both the code of both wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE and wxELLIPSIZE_END.
Add more asserts to check the valid ranges and turn a couple of time-expensive checks in level-2 asserts.
Add a test unit for the wxControl::Ellipsize function.
Fix minor details in the docs of wxControl::Ellipsize.
Closes #11567.
no real changes, just rename the variables to make the code more readable and to prepare everything for the next commit:
- add postfix "Px" to all variables containing numbers of pixels
- add postfix "ToRemove" to initialChar and nChars vars to make it clear what they are for
Vadim Zeitlin [Mon, 8 Mar 2010 19:37:08 +0000 (19:37 +0000)]
Use correct style for the dialog shown by generic file/dir pickers.
The picker styles don't make sense for the button so we don't use them when
creating the button but we do need to somehow use the style the picker was
created with to create an appropriate dialog when it's clicked.
Fix the problem by simply storing the style in a member variable and using it
instead of wxWindow::m_windowStyle.
Provide more details about the major and minor version numbers returned by wxGetOsVersion() under linux,mac,windows.
Document that wxOS_UNIX, wxOS_MAC and wxOS_WINDOWS enum values are combinations of other values (unfortunately doxygen does not show the definition of those symbols in the HTML docs so we need to explicitely state that).
Vadim Zeitlin [Fri, 5 Mar 2010 23:56:47 +0000 (23:56 +0000)]
Don't stop dragging in the grid when the mouse leaves the window.
Unexpected/unaccounted for mouse leaving and entering events stopped the drag
operation currently in progress in wxGrid. And while it was resumed later,
this resulted in the mouse being captured only twice but released only once.
Fix this by ignoring the leaving and entering events and checking that we
don't capture the mouse again.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:19 +0000 (23:55 +0000)]
Implement wxBookCtrlBase::CalcSizeFromPage() in the base class.
The definition of this method was needlessly duplicated in all of
wx{Choice,List,Tool,Tree}book and in all of them except the first one it
didn't account correctly for the case when the size of the controller was
greater than the size of the page.
Avoid the duplication and fix the best size determination in such case by
providing a single, correct version of the function in the base class itself.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:09 +0000 (23:55 +0000)]
No changes, just remove redundant GetControllerSize() definitions.
For some reasons wxBookCtrlBase::GetControllerSize() was redefined in several
derived classes even though it did exactly the same thing in all of them.
Leave only the base class version and remove the other ones.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:04 +0000 (23:55 +0000)]
Correct controller size determination in wxToolbook.
The old code used the current toolbar size instead of determining its best
size for some strange reason and this resulted in toolbar remaining of tiny (1
pixel) height at least under wxGTK.
Fix this by simply using the best size of the toolbar.
Vadim Zeitlin [Wed, 3 Mar 2010 14:19:29 +0000 (14:19 +0000)]
Allow using version-specific vc prefix in msvc/wx/setup.h.
We still use just "vc" by default for compatibility but allow the user to
predefine either wxMSVC_VERSION or wxMSVC_VERSION_AUTO to use the specified or
version-dependent prefix instead. This is very convenient when using multiple
MSVC versions.
add 64bit support to those formats which I could test and which support 64bit build modes (msvc, msvs2005prj and msvs2008prj) by adding a TARGET_CPU option similar to what wxWidgets bakefiles do (note the absence of the WX_ prefix since it does not make sense to have a wx-specific architecture); this additional feature allows correct inclusion of the vc_[amd64|ia64]_[lib|dll] path when building a wx-based project on Windows.
Vadim Zeitlin [Tue, 2 Mar 2010 20:46:18 +0000 (20:46 +0000)]
Use user locale with Latin-1 as fallback for command line arguments.
Command line arguments can contain characters outside of 7 bit ASCII range.
Assume that they use the default user encoding but fall back to Latin-1 if
conversion failed.
Vadim Zeitlin [Mon, 1 Mar 2010 23:45:22 +0000 (23:45 +0000)]
Fix crash when accessing clipboard before entering the main loop.
Check that we have an event loop running before yielding to it.
Notice that we really do need an event loop in wxClipboardSync as events must
be dispatched for the clipboard code to work so while not using the event loop
if it doesn't exist would have fixed a crash as well, it wouldn't allow to use
the clipboard in e.g. wxApp-derived class OnInit().
Vadim Zeitlin [Sun, 28 Feb 2010 11:30:55 +0000 (11:30 +0000)]
Simplify and correct bugs in wxMSW wxScrollBar message handling.
For some reason we computed scroll increment from the native message and not
the new position directly which is actually simpler and probably would have
never resulted in a bug which exchanged the meanings of SB_TOP and SB_BOTTOM.
Get rid of nScrollInc and just update the position variable directly.
Vadim Zeitlin [Sun, 28 Feb 2010 11:09:26 +0000 (11:09 +0000)]
Make it possible to use wxCharBuffer during program initialization.
wxCharBuffer might be used during static initialization, even if only
implicitly. E.g. it is used by wxString::Format() which can be used to
initialize a global string. But it uses the global s_untypedNullData variable
might not be initialized yet resulting in mysterious failures.
Fix this in the usual way by wrapping access to the variable via a function.