Commit Graph

18349 Commits

Author SHA1 Message Date
Vadim Zeitlin
be53b3fb20 Fix infinite recursion if wxGrid is modified from event handler
Calling wxGrid::{Insert,Delete}{Rows,Cols}() from wxEVT_GRID_CELL_CHANGE
event handler resulted in infinite recursion because it tried to hide
the grid editor control again, which resulted in another CELL_CHANGE
event being generated and so on.

Break this infinite recursion in the usual way, i.e. by updating the
state of wxGrid before invoking the user-defined event handler.

This required separating SaveEditControlValue() in 2 functions, the main
one retaining IsCellEditControlEnabled() check for compatibility, and
the new DoSaveEditControlValue() that can be called even after disabling
the editor.

Closes #2287.

Closes https://github.com/wxWidgets/wxWidgets/pull/1540
2019-09-12 00:53:21 +02:00
Ilya Sinitsyn
e2bd6ec8f7 Fix clearing selection in a grid with reordered columns
Since the changes of 04f7f1fd32 (frozen
rows/columns implementation), RefreshBlock() could call GetColPos() with
an invalid index. This didn't matter most of the time as the function
simply returned the same index as long as the columns were using their
natural order, but resulted in a crash due to an out of bound access to
m_colAt array as soon as they were reordered.

Fix this by avoiding using invalid indices in RefreshBlock() and, more
generally, improving its precondition check and making the assumptions
about the input parameters more clear. Also add a defensive check to
GetColPos() itself.

Finally, add a unit test exercising this code.

Closes https://github.com/wxWidgets/wxWidgets/pull/1536
2019-09-10 19:41:45 +02:00
Kvaz1r
16b08c6ef9 Allow updating wxBusyInfo text while it's shown
Add UpdateText() and UpdateLabel() updating the text (i.e. possibly
containing markup) or the label (just plain text) shown in the window.

Closes #14743.

Closes https://github.com/Kvaz1r/wxWidgets.git BusyInfoUpdateText14743
2019-09-08 23:13:00 +02:00
Vadim Zeitlin
7811d1a833 Merge branch 'per-monitor-dpi-aware-controls-1' of https://github.com/MaartenBent/wxWidgets
Update the font of some buddy controls when the DPI changes. Fix the
position of the statusbar after a DPI change. Add some changes that were
suggested in https://github.com/wxWidgets/wxWidgets/pull/1499 but left
out from it.

Some sizes are cached to improve the speed of the library. These sizes
become incorrect when the DPI changes. And are incorrect when a window
is created on a display with a different DPI. Fix this by checking if
the current DPI is the same as the DPI that was used when calculating
the size, otherwise recalculate the size.

Closes https://github.com/wxWidgets/wxWidgets/pull/1530
2019-09-07 14:57:54 +02:00
Maarten Bent
462f2a4686 Add optional wxWindow parameter to wxButtonBase::GetDefaultSize()
When per-monitor DPI is used, the default button size depends on the DPI of the
display. Use the window to determine this DPI.
2019-09-06 20:59:59 +02:00
Maarten Bent
fa2242a0a6 Reset static sizes when DPI changes 2019-09-06 20:59:59 +02:00
Maarten Bent
e312569b94 Fix wxStatusBar font and position after DPI changes
Update the font of the associated wxDC so ellipsization uses the correct font
size.
2019-09-06 20:59:56 +02:00
Vadim Zeitlin
c12b0e8509 Merge branch 'grid-fixes'
Fixes for wxGrid when using native header control.

Closes https://github.com/wxWidgets/wxWidgets/pull/1529
2019-09-05 23:36:50 +02:00
Maarten Bent
4713301cf5 Fix font and thumb size of wxSlider after DPI change 2019-09-05 23:14:25 +02:00
Maarten Bent
587f894f96 Fix font of wxRadioBox after DPI change 2019-09-05 23:14:25 +02:00
Maarten Bent
13cb9d41d8 Require wxWindow parameter for wxNativeFontInfo constructor in MSW
Use the DPI of the window to determine the correct font pointSize.

To not break user code, add a default argument when not building the library.
2019-09-05 23:14:25 +02:00
Ilya Sinitsyn
120b33746a Implement scrolling for MSW wxHeaderCtrl correctly
Due to lack of support for horizontal scrolling in the native control,
scrolling it was implementing by offsetting the entire control window.
However this didn't work correctly when the window was not positioned
at the leftmost border of its parent window, as the part of it that was
scrolled off could still be visible in this case, and this is exactly
what happened when the native header was used in wxGrid: scrolling it
overwrote the corner part of wxGrid.

Fix this by embedding the actual native control inside an outer wxWindow,
to ensure that the scrolled off part is clipped by the parent window.

Note that this commit is best viewed with "git show --color-moved" as
most of the code was just moved from the header into the implementation
file and is not really new.
2019-09-05 20:11:09 +02:00
Ilya Sinitsyn
e5d59c6b7f Respect minimum grid column width when using native header too
Override wxHeaderColumn::GetMinWidth() to return the actual minimum
width instead of just returning 0.

Add a unit test verifying that this works as intended.
2019-09-05 20:11:09 +02:00
Paul Cornett
92cbb02e9f Fix erroneous header click event after double click
See #18490
2019-09-04 11:41:28 -07:00
Vadim Zeitlin
417eff2bf8 Add missing wxUSE_MENUS checks to generic MDI classes
Make mdig.cpp compile with wxUSE_MENUS==0, as it already had many
wxUSE_MENUS checks and only missed a few more of them.

See #9626.
2019-08-28 20:11:23 +02:00
Paul Cornett
df450566dd Avoid including X11 headers from <wx/glcanvas.h>
It's generally wxWidgets policy not to include platform-specific headers from our own
to avoid namespace pollution issues, in this case with names like "None" and "Window".
2019-08-28 09:37:49 -07:00
Vadim Zeitlin
20b9964007 Avoid warnings about deprecated wxPG_XXX when building wx itself
Getting the warnings about deprecated macros when building the library
itself is not useful, as it must continue to use them as long as
WXWIN_COMPATIBILITY_3_0 exists.

Closes https://github.com/wxWidgets/wxWidgets/pull/1510
2019-08-27 22:21:01 +02:00
Vadim Zeitlin
6596f5a98d Merge branch 'accel_key_compat' of https://github.com/imciner2/wxWidgets
Give warnings for accelerator keys not supported by GTK under all
platforms instead of using asserts fin wxGTK only.

See https://github.com/wxWidgets/wxWidgets/pull/1505
2019-08-27 13:11:07 +02:00
Vadim Zeitlin
5873ee7e4a Merge branch 'tlw-layout'
Make wxTLW::Layout() do the right thing and resize the only child to fit
the entire TLW client area.

See https://github.com/wxWidgets/wxWidgets/pull/1496
2019-08-27 13:08:47 +02:00
Vadim Zeitlin
b225d78187 Merge branch 'per-monitor-dpi-aware-framework' of https://github.com/MaartenBent/wxWidgets
Add preliminary support for per-monitor DPI awareness to wxMSW.

Individual controls still need to be fixed, so this support is still
experimental/unfinished for now.

See https://github.com/wxWidgets/wxWidgets/pull/1499
2019-08-27 12:59:56 +02:00
Paul Cornett
536025791a Avoid converting empty strings to NULL pointers in non-Unicode build
...when using utf8_str() or wxGTK_CONV as argument to const char* function parameter
2019-08-25 23:08:59 -07:00
Paul Cornett
fca4ef0458 Use wxDC rather than wxClientDC for parameter type 2019-08-25 20:53:33 -07:00
Paul Cornett
3b54720b3a Move wxKeyEvent assignment operator out of header
It causes a warning with MSVC code analysis:
"warning C26437: Do not slice (es.63)"
It's unclear if this function even needs to exist, but at least
move it out of line so the warning does not occur for user code.
2019-08-25 18:11:01 -07:00
Maarten Bent
219fa3fa89 Add function to get font pointSize from lfHeight at specific DPI 2019-08-25 22:01:33 +02:00
Vadim Zeitlin
e563d4858a Adjust the font size when DPI of window changes 2019-08-25 22:01:14 +02:00
Maarten Bent
e3d3a0b7e8 Generate wxDPIChangedEvent when DPI changes 2019-08-25 22:01:11 +02:00
Ian McInerney
e961307043 Add compatibility warning for invalid GTK accelerator keys 2019-08-25 15:26:13 +02:00
Tomay
050ca4ce3a Add wxRegEx::QuoteMeta() helper
Quote all characters special for wxRegEx in the given string: this can
be useful when searching for a literal string using wxRegEx.

Closes https://github.com/wxWidgets/wxWidgets/pull/1489
2019-08-25 12:32:51 +02:00
oneeyeman1
14bcf09924 Move URL<->filename conversion functions to wxFileName
This ensures that they are always available and can be used in
wxLaunchDefaultBrowser() in all build variants, whereas before this
function didn't handle file:// URLs correctly when the library was built
with wxUSE_FILESYSTEM==0.

Closes https://github.com/wxWidgets/wxWidgets/pull/1469

Closes #10414.
2019-08-25 00:48:39 +02:00
oneeyeman1
5e7b515349 Avoid showing 2 tooltips simultaneously in wxMSW wxListCtrl
Only show the built-in control tooltips if we're not showing any custom
ones.

Closes https://github.com/wxWidgets/wxWidgets/pull/1500

Closes #10492.
2019-08-25 00:40:08 +02:00
Maarten Bent
137713e0c8 Add framework for Per-Monitor DPI Awareness on Windows
React to the WM_DPICHANGED event and update the size of the  child windows and
the top-level window. Scale the minimum and maximum window size to the new DPI.

Only react to WM_DPICHANGED when DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 is
used.
2019-08-24 22:30:11 +02:00
Artur Wieczorek
70e9dbd756 Make wxComboCtrl a wxCompositeWindow
wxComboCtrl consists of several controls (text entry, button, popup) and therefore should be implemented as a wxCompositeWindow to prevent problems with generating spurious events when e.g. focus is transferred between the sub-controls.

Closes #18394.
2019-08-23 22:55:05 +02:00
Vadim Zeitlin
773f8f86e3 Merge branch 'svg-misc' of https://github.com/MaartenBent/wxWidgets
Miscellaneous improvements to wxSVGFileDC, notably add gradient fill
support and shape rendering mode.

See https://github.com/wxWidgets/wxWidgets/pull/1493
2019-08-22 17:21:00 +02:00
Vadim Zeitlin
3241e7a850 Make wxTopLevelWindow::Layout() do the expected thing
It makes sense for explicit calls to Layout() to use the same logic as
is implicitly used when a TLW is resized, so override it to use
TLW-specific logic instead of using a separate DoLayout() for this.

Note that DoLayout() still has to be preserved because Debian code
search finds at least a couple of examples of its use outside the
library, meaning that there are probably quite a few more of them in the
wild.

Also, wxTopLevelWindow still needs its own wxEVT_SIZE handler because
the base class only calls Layout() if GetAutoLayout() is true, while we
want it to be always called. This might be worked around by just calling
SetAutoLayout(true) in wxTopLevelWindow ctor, but it seems safer, from
compatibility point of view, to keep wxTopLevelWindow::OnSize() instead.

See #18472.
2019-08-22 14:01:34 +02:00
Vadim Zeitlin
ea965327eb Add wxString::shrink_to_fit() as synonym for Shrink()
Provide C++11 std::string-compatible method name too.
2019-08-22 00:01:36 +02:00
Vadim Zeitlin
2dbdbe1927 Merge branch 'mac-opengl-resize'
Really fix Mac wxGLCanvas resize under macOS 10.14.5.

See https://github.com/wxWidgets/wxWidgets/pull/1492

Closes #18402.
2019-08-21 23:53:27 +02:00
Maarten Bent
bee6168076 Make wxSVGFileDC function parameter names consistent with wxDC 2019-08-21 22:33:36 +02:00
Maarten Bent
0b728d1bea Use base version of DrawCheckMark directly in wxSVGFileDC 2019-08-21 22:33:36 +02:00
Maarten Bent
75486529e3 Process review comments in wxSVGFileDC 2019-08-21 22:33:35 +02:00
Maarten Bent
9c193e1774 Add wxWindow::GetDPI()
This is simpler to use than wxDisplay(window).GetPPI() which was used
instead of it so far in all ports and can be implemented more
efficiently for wxMSW.

Remove wxGetWinTLW, GetDPI already tries to get the top window.
2019-08-21 19:30:07 +02:00
Maarten Bent
dfe76430cc Implement GradientFillLinear and GradientFillConcentric for wxSVGFileDC 2019-08-20 20:21:05 +02:00
Maarten Bent
26b273bef9 Fix RTTI class declarations of wxSVGFileDC
wxIMPLEMENT_DYNAMIC_CLASS requires a default constructor (no filename). Check
if m_outfile is initialized with a valid filename before using it.
2019-08-20 20:21:05 +02:00
Maarten Bent
a41a8ded79 Allow to set wxSVGFileDC shape rendering mode 2019-08-20 20:21:05 +02:00
Vadim Zeitlin
4b227835ac Merge branch 'svg-drawtext' of https://github.com/MaartenBent/wxWidgets
Fixes and improvements to wxSVGFileDC::Draw[Rotated]Text().

See https://github.com/wxWidgets/wxWidgets/pull/1466
2019-08-20 13:27:26 +02:00
Vadim Zeitlin
ffd424debb Merge branch 'mswdc-draw-point-checkbox' of https://github.com/MaartenBent/wxWidgets
Draw the same shape in wxDC::DrawCheckMark() under all platforms and
provide wxRenderer::DrawCheckMark() for drawing the platform-specific
shape.

Also fix wxGCDC::DrawPoint() to use the default one point wide pen.

See https://github.com/wxWidgets/wxWidgets/pull/1471
2019-08-20 13:25:28 +02:00
Vadim Zeitlin
c2e6b86786 Add WX_IS_MACOS_AVAILABLE_FULL availability check macro
We could change WX_IS_MACOS_AVAILABLE itself to be a variadic macro, but
this would be significantly more complex and doesn't seem warranted.
2019-08-20 11:14:10 +02:00
Vadim Zeitlin
1d63c8b11d Fix typo in a comment
No real changes.
2019-08-20 11:10:57 +02:00
Paul Cornett
b200c661ed Fix wxPropertyGrid headers so they can be compiled independently
See #18465
2019-08-15 17:27:07 -07:00
Maarten Bent
2874dab7f0 Add DrawCheckMark and GetCheckMarkSize to wxRendererNative
Show its use in the render sample. Also use the recently added GetExpanderSize
for the size of DrawTreeItemButton.
2019-08-10 13:42:04 +02:00
georgp24
8e41677989 Fix wxX11 build with --disable-graphics_ctx build option.
Add missing #if wxUSE_CAIRO checks.

Closes https://github.com/wxWidgets/wxWidgets/pull/1472
2019-08-10 00:00:18 +02:00