-
-
Notifications
You must be signed in to change notification settings - Fork 799
Winforms detailed list revamp #4319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 15 commits
d8d83cf
4dfc544
c78a935
9449409
6288581
5488dea
1c8dd38
cb8516d
00faba2
2eb4beb
a0cc900
ab9374d
c363887
4ad5af3
de0df59
7eb8d19
29915c9
a02059f
6ae2d51
7514d3b
1b7b203
b94ed30
50add47
245ba48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The DetailedList widget on Windows now supports actions. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The style of the DetailedList widget on Windows now matches the other platforms. |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,13 +12,22 @@ | |||
| LPWSTR, | ||||
| POINT, | ||||
| RECT, | ||||
| SIZE, | ||||
| UINT, | ||||
| WPARAM, | ||||
| ) | ||||
|
|
||||
| from .win32 import DWORD_PTR, INT_PTR, LRESULT, PUINT, UINT_PTR | ||||
|
|
||||
|
|
||||
| # learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-initcommoncontrolsex | ||||
| class INITCOMMONCONTROLSEX(c_Structure): | ||||
| _fields_ = [ | ||||
| ("dwSize", DWORD), | ||||
| ("dwICC", DWORD), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvitemw | ||||
| class LVITEMW(c_Structure): | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noting that the first field here is |
||||
| _fields_ = [ | ||||
|
|
@@ -40,15 +49,51 @@ class LVITEMW(c_Structure): | |||
| ] | ||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-nmhdr | ||||
| class NMHDR(c_Structure): | ||||
| # learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvcolumnw | ||||
| class LVCOLUMNW(c_Structure): | ||||
| _fields_ = [ | ||||
| ("mask", UINT), | ||||
| ("fmt", INT), | ||||
| ("cx", INT), | ||||
| ("pszText", LPWSTR), | ||||
| ("cchTextMax", INT), | ||||
| ("iSubItem", INT), | ||||
| ("cchTextMax", INT), | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The duplicated entry here seems odd... not sure why it isn't causing problems...
Suggested change
|
||||
| ("iImage", INT), | ||||
| ("iOrder", INT), | ||||
| ("cxMin", INT), | ||||
| ("cxDefault", INT), | ||||
| ("cxIdeal", INT), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvhittestinfo | ||||
| class LVHITTESTINFO(c_Structure): | ||||
| _fields_ = [ | ||||
| ("pt", POINT), | ||||
| ("flags", UINT), | ||||
| ("iItem", INT), | ||||
| ("iSubItem", INT), | ||||
| ("iGroup", INT), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvtileviewinfo | ||||
| class LVTILEVIEWINFO(c_Structure): | ||||
| _fields_ = [ | ||||
| ("hwndFrom", HWND), | ||||
| ("idFrom", UINT_PTR), | ||||
| ("code", UINT), | ||||
| ("cbSize", UINT), | ||||
| ("dwMask", DWORD), | ||||
| ("dwFlags", DWORD), | ||||
| ("sizeTile", SIZE), | ||||
| ("cLines", INT), | ||||
| ("rcLabelMargin", RECT), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # Import .user32classes here to avoid circular reference. | ||||
| from .user32classes import NMHDR # noqa | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather do some re-org of the imports to avoid circular references, rather than rely on specific import order side effects. Could we pull all the structures into a |
||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmcustomdraw | ||||
| class NMCUSTOMDRAW(c_Structure): | ||||
| _fields_ = [ | ||||
|
|
@@ -62,6 +107,21 @@ class NMCUSTOMDRAW(c_Structure): | |||
| ] | ||||
|
|
||||
|
|
||||
| # learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmitemactivate | ||||
| class NMITEMACTIVATE(c_Structure): | ||||
| _fields_ = [ | ||||
| ("hdr", NMHDR), | ||||
| ("iItem", INT), | ||||
| ("iSubItem", INT), | ||||
| ("uNewState", UINT), | ||||
| ("uOldState", UINT), | ||||
| ("uChanged", UINT), | ||||
| ("ptAction", POINT), | ||||
| ("lParam", LPARAM), | ||||
| ("uKeyFlags", UINT), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlistview | ||||
| class NMLISTVIEW(c_Structure): | ||||
| _fields_ = [ | ||||
|
|
@@ -76,6 +136,15 @@ class NMLISTVIEW(c_Structure): | |||
| ] | ||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcachehint | ||||
| class NMLVCACHEHINT(c_Structure): | ||||
| _fields_ = [ | ||||
| ("hdr", NMHDR), | ||||
| ("iFrom", INT), | ||||
| ("iTo", INT), | ||||
| ] | ||||
|
|
||||
|
|
||||
| # https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw | ||||
| class NMLVCUSTOMDRAW(c_Structure): | ||||
| _fields_ = [ | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from ctypes import windll | ||
| from ctypes.wintypes import COLORREF, HDC | ||
|
|
||
| gdi32 = windll.GDI32 | ||
|
|
||
|
|
||
| # https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-settextcolor | ||
| SetTextColor = gdi32.SetTextColor | ||
| SetTextColor.restype = COLORREF | ||
| SetTextColor.argtypes = [HDC, COLORREF] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works; however, when there's a clear method we can call that wraps the "unsupported" behavior, we usually wrap the skip logic into that method. In this case, adding a
deselect_all()method to all backends and raising the skip/xfail in that method means one less probe attribute; plus we can differentiate between "is not implemented on this platform yet" and "cannot be implemented on this platform"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed now. I went through the Android code again, and the solution blindingly obvious.