Apparently there is no native API to retrieve such information in a simple
way so all calculations have to be done with raw text stored in
the corresponding control(s).
Closes#4146.
See #17811.
wxPropertyGrid::ExpandEscapeSequences() function should convert all valid
escape sequences (\r, \n, \t, \\) to the corresponding single characters
(CR, LF, TAB, backslash, accordingly) and
wxPropertyGrid::CreateEscapeSequences() function should do the reverse
operation and convert these raw characters to the corresponding escape
sequences.
Closes#17896.
Ensure that the restored size is at least equal to the best size of the
window to avoid cutting off parts of it in (a common) case when a newer
version of the program adds new UI elements, thus increasing the window
best size and possibly making the previously stored size too small.
Creating a font with wxFONTSTYLE_SLANT results in a font whose
GetStyle() returned wxFONTSTYLE_ITALIC, so it was never found in the
cache, resulting in, effectively, leaking memory and GDI handles because
each new call to wxFontList::FindOrCreateFont(...wxFONTSTYLE_SLANT)
created a new font.
Fix this by just hardcoding that wxFONTSTYLE_SLANT is wxFONTSTYLE_ITALIC
under MSW, this is ugly but avoids backwards incompatible (and not
obviously correct) change of making wxFont::GetStyle() return
wxFONTSTYLE_SLANT if the font was created using this style.
Notice that wxFont::GetStyle() does behave like this in wxOSX currently,
so there is an inconsistency between ports here. It would arguably be
better to make wxOSX behave like wxMSW because the actual font is really
italic and not slant/oblique and if we do this, the preprocessor
condition in this commit should be extended to cover wxOSX too.
Closes#17903.
The logic in wxButton::{Set,Unset}TmpDefault() didn't work at all when
the temporary button was the same as the permanent default button as the
code made the same button non-default immediately after making it
default (or vice versa). In particular, this ensured that default button
was never highlighted correctly (at least after the first focus change)
in dialogs containing a single button only.
Fix this by simply skipping modification of the old default button if it
was the same one as the new default button.
This feature to show/hide alpha values and opacity selector (slider) is
already implemented under wxGTK and for generic wxColourDialog.
For the sake of backward compatibility, this feature is enabled here by
default (through the corresponding property of wxColourData).
Currently region given in device coordinates is decomposed into the stripes which are next transformed to the logical coordinates required by underlying wxGraphicsContext::Clip() function. Some of these stripes given in device coordinates can have 1-pixel height what after transformation to logical coordinates can give zero-height stripes (after rounding). This can lead to the situation that in the region transformed to logical coordinates some stripes can disappear and final transformed region shape is different from the source shape (it has gaps).
To fix this issue device coordinates of the region are not manually transformed to the logical coordinates but instead wxGraphicsContext's is temporarily set to the state where its logical coordinates are equivalent to device coordinates and thus clipping region can be applied directly.
Solution for wxMSW, wxGTK is implemented in ea8cb7a24a.
Closes#17609.
Transformation settings already applied to the source objects (CGContext, wxWindow) and inherited by wxGraphicsContext should be considered as a baseline transformation matrix for wxGC and shouldn't be exposed through e.g. GetTransform() function (like it's done in Cairo or Direct2D). To report only transformations explicitly applied to wxGC by calls to the corresponding wxGC functions, we need to store initial CTM (in a dedicated variable) and "subtract" it from the actual transformation settings.
See #17609.
Member data containing clipping box have to be updated not only when the clipping region is explicitly changed by SetClippingRegion()/DestroyClippingRegion() but also when existing wxGraphicsContext is associated with wxGCDC using SetGraphicsContext() or when wxGCDC coordinates are transformed with SetDeviceOrigin(), SetLogicalOrigin(), SetUserScale() or SetLogicalScale().
When any of these functions is called then clipping box data are marked as invalid and retrieved from underlying graphics context using wxGraphicsContext::GetClipBox() at nearest call to GetClippingBox().
Solution for wxMSW, wxGTK was implemented in 98714ea452.
See #17646.
Rename relatively new enum value wxTASKBAR_JUMP_LIST_DESTIONATION to
wxTASKBAR_JUMP_LIST_DESTINATION as well as a private function containing
the same typo.
Even though this function was private and not available in the default build
(in which wxUSE_OLE==1, while this function was only defined with
wxUSE_OLE==0), still mention its removal for completeness.
Handle "bitmap" and "bitmapposition" attributes in wxToggleButton XRC handler,
just as it's already done for wxBitmap and wxBitmapToggleButton.
Closes#17850.
This option didn't do anything for the last 14 years, ever since the switch to
bakefile-generated makefiles in fe0895cf82, so
remove it from configure and stop mentioning it in documentation.
Use --disable-dependency-tracking to do what this option used to be doing 15
years ago.
When using -jN, setup_h needs to be created first to avoid a bug due to
missing dependencies in the current makefiles which breaks the build
otherwise.
Dedicated wxDataObject::SetData() function can be used to import raw
clipboard data to the corresponding instances of wxDataObject and hence
there is no need to duplicate data retrieval code.
When CF_DIB object is placed to the clipboard, a handle to the memory
object containing a BITMAPINFO structure followed by the bitmap bits should
be passed to SetClipboardData(), not a handle to a DIB section.
Also, wxClipboard is the owner of the wxDataObject being added, so it
should release passed object.
Not all applications recognize properly 0RGB bitmap format so for the sake
of interoperability bitmaps in such format should be converted to plain
24 bpp RGB format prior to being copied to the clipboard.
Closes#17640.
In wxRearrangeList implementations (like wxMSW) where DoInsertItemsInLoop()
and DoInsertOneItem() are not used to insert multiple items, DoInsertItems()
has to be overriden to do this insertion.
See #17836.
Labels containing mnemonic prefixes (&) and literal underscore characters
have to be converted to the proper GTK labels where underscore
characters act as mnemonic markers. If label contains mnemonic then
dedicated function gtk_radio_button_new_with_mnemonic() should be used
to create radio button item.
Closes#17419.
Use wxPrintf() and remove the c_str() call which is redundant with it instead
of using printf() which can't be used with non-POD objects like wxCStrData
returned by c_str() in wx 3.0+.
Don't apply at best unnecessary, and actually harmful, as it uses a wrong
conversion, fn_str() when calling wxRmDir() which takes wxString.
Update unit tests to check that wxRmdir() now works with non-ASCII filenames
too.
Closes#17644.
Assert and return false instead, this is more developer-friendly.
Add unit tests to check that these functions really work as expected when
called on a closed file.
Closes#17828.
Draw pie, not arc, if current brush is not transparent.
Also simplify the code by invoking PostScript 'arc' operator only once if pie is drawn.
Closes#17805.
PostScript code to register (and re-encode) given font should be emitted only once. Once registered, the font is available in the entire document and there is no need to register it again.
Add wxCMD_LINE_HIDDEN wxCmdLineParser flag allowing to hide options and/or
parameters.
A hidden/unlisted argument is processed as usual, but not shown in the output
given by Usage(). A use case for such could be diagnostics switches that
should exist but are not useful to the end user.
Closes https://github.com/wxWidgets/wxWidgets/pull/390
EVT_STC_KEY and EVT_STC_URIDROPPED events are never generated so there is no need to reference them in the code and documentation. For backwards compatibility reasons their declarations are not entirely removed but marked as deprecated.
Closes#17688.
While we have to keep these conversions enabled by default, they are very
dangerous as they can result in silent data loss on any system not using a
locale with UTF-8 encoding, i.e. always under MSW.
Allow mitigating this by defining wxNO_UNSAFE_WXSTRING_CONV when compiling the
application code using the library, which makes these conversions invisible to
the user code, and so can be used without recompiling the library.
Also add wxUSE_UNSAFE_WXSTRING_CONV which can be set to 0 when compiling the
library to disable these conversions globally for all applications using it.
Closes#11830.
Although WXWIN_COMPATIBILITY_x_y macros were mentioned in the backwards
compatibility overview, it seems appropriate to also document them with all
the other macros on the page dedicated to them.
Draw underline relatively to the baseline and obtain line parameters using 'stringwidth' operator instead of calculating them manually based on the parameters returned by DoGetTextExtent(), which are not always accurate (e.g. if no AFM files are available).
Closes#17788.
Legacy API cairo_win32_surface_create() can create only 24 bpp RGB surfaces but new API cairo_win32_surface_create_with_format() introduced in 1.15.4 supports creating also 32 bpp ARGB surfaces.
So, this new API can be used to create ARGB surface directly from ARGB bitmap (HDC), superseding current implementation based on the access to the bitmap data with cairo_image_surface_create_for_data().
Unfortunately, 0RGB bitmaps are not supported by cairo_win32_surface_create_with_format() and for such bitmaps surface has to be still created from bitmap data.
VC++ compilers (at least up to VS 2015) seem to generate incorrect code for the dithering code taken from libjpeg (pass2_fs_dither() function), where it is known to create problems too.
Refactor the code to avoid invalid optimization in this function and turn optimization on.
Closes#17764.
Using "%20c" in scanf() doesn't work unless we really have exactly 20
characters, so use "%20[^)]" to take up to 20 characters until the closing
parenthesis instead.
Closes#17739.
Using Bind() with a method of the class deriving from wxEvtHandler
non-publicly used to result in a compile-time error, but at least with C++11
we can detect this case and allow the code to compile.
Closes#17623.
The native EDIT control doesn't handle this key combination, but RICHEDIT does
and people just expect it to work, so handle it at wxMSW level.
Closes https://github.com/wxWidgets/wxWidgets/pull/300
For some reason known only to Apple, NSSecureTextField allows pasting text
into it using its standard context menu, but not using the standard Cmd+V
keyboard shortcut. Moreover, apparently the control does something special to
disable it because pressing Cmd+V does result in a call to
-[NSSecureTextField control:textView:doCommandBySelector:], but with a dummy
"noop:" selector.
Detect this specific situation and check if we're called while handling Cmd+V
event and, if this is indeed the case, do paste the text into the control.
While it could be argued that this changes the platform behaviour, it seems
very hard, if not impossible, to imagine a situation in which this would be a
problem while not being able to easily paste into password fields is
definitely a real usability bug.
Don't make the controls with wxTE_DONTWRAP (a.k.a. wxHSCROLL) style
"infinitely" wide, but just "very" wide to allow alignment still work in it.
See #17529.
Disabled controls are not supposed to accept any input, so don't send any
mouse events to them.
This fixes the behaviour of wxSlider which could be moved (and generated the
corresponding events) even when it was disabled.
Closes#17194.
Don't unconditionally use wxWidgets' implementation of IAccessible for
all windows when wxUSE_ACCESSIBILITY is 1, because it is inferior to the
system provided one: it often lacks appropriate labels, doesn't fully
support navigation and wxIAccessible isn't fully implemented.
The approach, when using MSAA, recommended by Microsoft documentation is
to customize accessibility for custom controls only, by proxying to the
standard and overriding what is necessary. By making this change, user
code is still allowed to customize accessibility if needed, without
negatively impacting standard controls that don't need any custom code.
See also https://github.com/wxWidgets/wxWidgets/pull/340
The purpose of this method is to provide a textual description of the renderer's content to the class implementing accessibility framework in wxDVC (wxDataViewCtrlAccessible).
It is exposed if wxUSE_ACCESSIBILITY is set to 1.
By default double dashes are converted to en-dashes in the output (and triple
ones -- to em-dashes), but this is undesirable when double dashes are used not
as a punctuation mark but in command line options or as C++ decrement
operator, so escape them to avoid such conversion in this case.
Allow the user to customize smart quotes and dashes substutions on OS X
and also provide the OSXDisableAllSmartSubstitutions() method for
disabling them all at once.
This reverts ill-advised commits
c07523734f and
8d42890df4 that disabled native OS X
behavior of substituting dashes and quotes with typographically correct
characters if the user has this feature enabled.
This was a bad idea for two reasons:
1. It made wx applications behave non-natively, and thus be worse, in a
highly noticeable area.
2. It made it impossible for applications that want to behave correctly
to restore the native behavior, because once
setAutomaticDashSubstitutionEnabled or
setAutomaticQuoteSubstitutionEnabled is called (as wxTextCtrl
constructor does), it's no longer possible to obtain its original,
default setting.
It's not better to disable native functionality by default, it's better to
be native and make customizations possible. wxWindow API exposes access
to the native control and if an application desires to disable
substitution behavior, it can easily do so from user code.
See also #186 and #241.
wxIAccessible should return a NULL BSTR to the accessibility framework if strings returned from wxIAccessible::get_accName() and get_accValue() are empty because this convention is already applied to the other methods returning string values, like get_accHelp(), get_accDescription().
Because query for item rectangle is executed in the context of wxDataViewCtrl so coordinates of retrieved rectangle should be specified in wxDataViewCtrl client coordinates (not in wxDataViewMainWindow coordinates).
To return correct coordinates it is necessary to convert rectangle coordinates retrieved by wxDataViewMainWindow::GetItemRect() from wxDataViewMainWindow client coordinates to wxDataViewCtrl client coordinates (they can different due to the presence of the header in wxDataViewCtrl client area).
Point coordinates passed from wxDataViewCtrl::HitTest() to wxDataViewMainWindow::HitTest()
should be converted from wxDataViewCtrl client coordinates to wxDataViewMainWindow client coordinates because they can different due to the presence of the header in wxDataViewCtrl client area.
Since accessibility framework supports signaling E_INVALIDARG error, it would be good to have a corresponding flag indicating this error in wxAccessible functions.
In response to wxACC_INVALID_ARG returned by wxAccessible functions, wxIAccessible should return E_INVALIDARG to the framework.
Bounding box coordinates have to be calculated and stored internally in device units to be independent on changes of logical coordinates between calls to wxDC::CalcBoundingBox.
These stored coordinates are converted to the logical units on demand when they are retrieved with call to wxDC::MinX, MinY, MaxX or MaxY.
Closes#17667.
Don't bother with checking for some really obsolete compilers and just assume
that C++98 keywords "explicit", "{static,const,dynamic}_cast" and support for
partial template specialization is always available.
Closes#17655.