Commit Graph

344 Commits

Author SHA1 Message Date
Vadim Zeitlin
1422991602 Add wxWindow::GetDPIScaleFactor()
This function replaces some uses of GetContentScaleFactor(), where a
factor greater than 1 must be used even under the platforms not doing
any logical/physical pixel mapping, such as MSW.

For now GetContentScaleFactor() is still unchanged, but it will return 1
for such platforms in the future and adding GetDPIScaleFactor() allows
to avoid changing the behaviour of the code which relied on its current
behaviour.
2020-07-18 23:42:44 +02:00
Artur Wieczorek
c4f5fd3581 Move duplicated code to rescale the bitmap to the shared function 2020-04-10 20:45:34 +02:00
Artur Wieczorek
f95d6463d3 Fix sizing wxBitmapButton used as wxPropertyGrid editor button
Since wxBitmapButton doesn't rescale embedded bitmap we need
to do this on our own to display entire bitmap even the button
is small.

Closes #18715.
2020-04-10 20:33:16 +02:00
Artur Wieczorek
c7b789d351 Increase wxPropertyGrid line height under wxGTK3
Line height calculation based on the font size is not right for wxGTK3
because native buttons (used as in-line editor buttons) don't scale down
well and they are not displayed properly within the line.
Minimal button size when the label is displayed properly is 35 so this
has to be minimal line height under wxGTK3.

Closes #18715.
2020-04-04 18:02:40 +02:00
Artur Wieczorek
5bc020e844 Implement getters for members of wxPGWindowList
There is no reason to expose wxPGWindowList member variables. They should
be set in ctors and retrieved with getters.
2020-02-12 17:09:25 +01:00
Artur Wieczorek
489cc1cb36 Fix drawing empty wxPropertyGrid
If wxPG doesn't contain any visible items it's entire area should
be erased so we need to return -1 as a last drawn line index to ensure
that painted area will be clared from 0 y-coordinate.

Closes #18666.
2020-02-12 17:03:58 +01:00
Paul Cornett
948ddc6e0f Eliminate -Wcast-qual warnings with GCC and Clang
Use const_cast, mutable, and various other changes to avoid -Wcast-qual
2020-02-02 22:50:32 -08:00
Artur Wieczorek
652e6fbadb Ignore focus events within composite editor control in wxPropertyGrid
Internal focused events of the subcontrols of the composite editor control should not be processed.

Closes #18555.
2019-11-08 18:52:27 +01:00
Maarten Bent
a1c3fa0468 Fix wxPropertyGrid row height on DPI change
Fix collapse button size of wxPropertyGrid in High DPI.
2019-10-07 00:54:59 +02:00
Paul Cornett
453999737f Simplification to avoid unreachable code 2019-08-25 21:03:21 -07:00
Vadim Zeitlin
7db13c7b93 Merge branch 'pm-dpi-aware-1-systemmetric' of https://github.com/MaartenBent/wxWidgets
Make GetSystemMetrics() and wxSystemParametersInfo DPI-aware in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/1407
2019-07-15 13:21:16 +02:00
Maarten Bent
f74d756ca5 Use DPI Aware wxGetSystemMetrics
If no wxWindow is known, use wxTheApp->GetTopWindow().
Also use a wxWindow for all wxSystemSettings::GetMetric calls.
2019-07-15 00:00:18 +02:00
Artur Wieczorek
a1dac5aa38 Show wxPGProperty editor dialog only in response to clicking main editor button
Properties with editor dialog (like those derived from wxEditorDialogProperty) should show it only in response to clicking the main editor button.
2019-07-14 21:32:38 +02:00
Artur Wieczorek
b064608c2a Use const_cast to change the constness 2019-06-16 19:50:08 +02:00
Artur Wieczorek
d404ff02a1 Support tooltips in wxPropertyGrid if support for tooltips enabled is globally 2019-06-16 19:45:40 +02:00
Artur Wieczorek
8c187ffc7a Get rid of commented out and unused macro definitions 2019-06-16 19:45:39 +02:00
Artur Wieczorek
6abf507923 Get rid of unused variables 2019-06-16 19:45:12 +02:00
Artur Wieczorek
a93713f7f8 Use long int literals to represent long constants 2019-05-26 18:51:37 +02:00
Artur Wieczorek
549acf6e80 Implement wxPropertyGrid as wxScrolled
Scrolling operations and related calculations are simpler when wxPG is implemented as wxScrolled instead of wxScrollHelper.
2019-05-26 17:57:31 +02:00
Artur Wieczorek
ca712c59fe Remove redundant assignment
This assignment to the temporary variable is not necessary.
2019-05-12 20:24:53 +02:00
Artur Wieczorek
92d2be5842 Resolve ambiguity in calling overloaded wxPropertyGrid::SendEvent()
The right overloaded SendEvent() function can be determined by explicitly
casting second argument of the call to (wxPGProperty*) type.
2019-04-28 18:34:36 +02:00
Artur Wieczorek
bdc9d8f772 Remove redundant assignments
These assignments to the temporary variables are not necessary.
2019-04-28 17:11:56 +02:00
Artur Wieczorek
9df9e32a70 Get rid of unnecessary casts to wxPGProperty*
These casts are unnecessary and can be removed.
2019-04-28 17:04:07 +02:00
Artur Wieczorek
f39e70be15 Use dedicated event type to notify header about column width changes
Notification about changes of column widths needs to be sent locally from wxPropertyGrid to  wxPropertyGridManager (to update the header) so it would be good to use a dedicated non-public event type for these purposes.
2019-04-28 15:31:10 +02:00
Paul Cornett
90ce6a4334 Remove unused variables 2019-04-04 10:40:45 -07:00
Artur Wieczorek
47bba8764a Fix drawing invalid wxPGProperty
Invalid wxPGProperty needs to be redrawn after setting wxPG_FL_CELL_OVERRIDES_SEL because this flag
is used to select proper colors to mark property as invalid.
This order of operations is important under e.g. wxMSW when redrawing with DrawItemAndChildren() is done immediately.

Closes #18351.
2019-03-09 18:57:11 +01:00
Paul Cornett
9ea2ac92ef Fix wxCriticalSectionLocker usage
A temporary object will not hold the lock
2019-02-17 17:24:36 -08:00
Artur Wieczorek
a005391413 Use wxEventType instead of int
This parameter identifies the type of the event so it should be of type wxEventType.
2019-01-11 19:22:50 +01:00
Artur Wieczorek
eb40eb4b84 Fix horizontal scrolling of wxPropertyGrid header
wxPropertyGridHeader associated with wxPropertyGrid has to be notified about every horizontal scroll of the grid.
New position is sent with dedicated wxEVT_PG_HSCROLL event being handled by wxPropertyGridManager which in turn scrolls the header accordingly.

See #18313.
2019-01-11 19:22:34 +01:00
Artur Wieczorek
b235987a69 Use dedicated functions to covert between physical and logical coordinates of the scrolled wxPropertyGrid 2019-01-04 21:32:08 +01:00
Artur Wieczorek
42b1cca8f2 Fix repositioning editors for horizontally scrolled grid
New method of calculating of the new position/size of the editor (introduced in 95461c566d) doesn't work well in all cases so we have to go back to the (modified) old method. To get the correct position of the editor cell from the absolute position of the splitter 0 we have to shift it by the origin of the scrolled view area.

See #18313.
2019-01-04 21:31:39 +01:00
Artur Wieczorek
066c422c81 Take into account scrolling while obtaining absolute mouse pointer position
See #18313.
2019-01-04 21:30:32 +01:00
Artur Wieczorek
4eef8d9658 Use row height value stored already in another variable
No reason to calculate it twice.
2018-12-28 14:02:03 +01:00
Artur Wieczorek
99c53ca4bb Don't retrieve unused x-coordinate of the view 2018-12-28 14:02:03 +01:00
Artur Wieczorek
76ff4ab2b6 Use dedicated method to move rectangle 2018-12-28 14:02:02 +01:00
Artur Wieczorek
18e03af068 Use conditional operator instead of conditional statement 2018-12-28 14:02:01 +01:00
Artur Wieczorek
9d2fbef751 Only render columns that are within update region 2018-12-28 14:02:01 +01:00
Artur Wieczorek
95461c566d Fix repositioning editors for horizontally scrolled grid
Closes #18313.
2018-12-28 14:01:34 +01:00
Artur Wieczorek
831a81fb90 Fix positioning property editor
Account scrolled horizontal position.

See #18313.
2018-12-27 14:22:18 +01:00
Artur Wieczorek
de6469610a Fix determining width of the entire row
See #18313.
2018-12-27 14:20:13 +01:00
Artur Wieczorek
9ad19622fd Fix drawing horizontal lines between the rows of the grid
See #18313.
2018-12-27 14:18:04 +01:00
Artur Wieczorek
2f918abf3a Clear empty space beyond the right edge of the grid
See #18313.
2018-12-27 14:15:44 +01:00
Artur Wieczorek
48c71a5f04 Fix calculating width of the first cell
See #18313.
2018-12-27 14:14:19 +01:00
Artur Wieczorek
73b5d3420e Fix determining shift of the drawn scrolled contents
Position of the visible portion of the window should be taken as a drawing offset.

See #18313.
2018-12-27 14:12:32 +01:00
Artur Wieczorek
cc32ebc979 Adjust scroll bar and refresh the grid after changing virtual width 2018-12-27 13:18:06 +01:00
Artur Wieczorek
311e5e8414 Use conditional operator instead of conditional statement 2018-12-26 11:38:52 +01:00
Artur Wieczorek
a57aacd5af Calculate splitter positions once
Column widths are the same for all rows so there is no need to calculate splitters positions for each drawn row.
2018-12-26 11:38:10 +01:00
Artur Wieczorek
c112c20d5f Optimize calculating position of the right edge of the last cell
Cell widths are invariant during the drawing so calculation can be done once, not on every loop.
2018-12-26 11:37:31 +01:00
Artur Wieczorek
5c0acce694 Hide editor button while column splitter is being dragged
Main editor and its button (secondary editor) should be both hidden while dragging the splitter because it's misleading when one part of the property editor disappears and another part remains visible.
2018-12-26 11:36:12 +01:00
Artur Wieczorek
e74e345e04 Use dedicated function to check if array of selected properties is empty 2018-12-26 11:32:09 +01:00