mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:39:15 +02:00
LCL, Win32: Reduce PDrawItemStruct typecasts in WindowProc methods.
git-svn-id: trunk@47568 -
This commit is contained in:
parent
f611836e4c
commit
4945b58a15
@ -1341,23 +1341,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWindowProcHelper.UpdateDrawListItem(aMsg: UInt);
|
procedure TWindowProcHelper.UpdateDrawListItem(aMsg: UInt);
|
||||||
|
var
|
||||||
|
PDrawIS: PDrawItemStruct;
|
||||||
begin
|
begin
|
||||||
if PDrawItemStruct(LParam)^.itemID <> dword(-1) then
|
PDrawIS := PDrawItemStruct(LParam);
|
||||||
|
if PDrawIS^.itemID <> dword(-1) then
|
||||||
begin
|
begin
|
||||||
LMessage.Msg := aMsg;
|
LMessage.Msg := aMsg;
|
||||||
TLMDrawListItem(LMessage).DrawListItemStruct := @DrawListItemStruct;
|
TLMDrawListItem(LMessage).DrawListItemStruct := @DrawListItemStruct;
|
||||||
with DrawListItemStruct do
|
with DrawListItemStruct do
|
||||||
begin
|
begin
|
||||||
ItemID := PDrawItemStruct(LParam)^.itemID;
|
ItemID := PDrawIS^.itemID;
|
||||||
Area := PDrawItemStruct(LParam)^.rcItem;
|
Area := PDrawIS^.rcItem;
|
||||||
ItemState := TOwnerDrawState(PDrawItemStruct(LParam)^.itemState);
|
ItemState := TOwnerDrawState(PDrawIS^.itemState);
|
||||||
DC := PDrawItemStruct(LParam)^._hDC;
|
DC := PDrawIS^._hDC;
|
||||||
end;
|
end;
|
||||||
if (aMsg = LM_DRAWLISTITEM) and (WindowInfo <> @DefaultWindowInfo) then
|
if (aMsg = LM_DRAWLISTITEM) and (WindowInfo <> @DefaultWindowInfo) then
|
||||||
begin
|
begin
|
||||||
WindowInfo^.DrawItemIndex := PDrawItemStruct(LParam)^.itemID;
|
WindowInfo^.DrawItemIndex := PDrawIS^.itemID;
|
||||||
WindowInfo^.DrawItemSelected :=
|
WindowInfo^.DrawItemSelected := (PDrawIS^.itemState and ODS_SELECTED) = ODS_SELECTED;
|
||||||
(PDrawItemStruct(LParam)^.itemState and ODS_SELECTED) = ODS_SELECTED;
|
|
||||||
end;
|
end;
|
||||||
WinProcess := false;
|
WinProcess := false;
|
||||||
end;
|
end;
|
||||||
@ -1377,25 +1379,25 @@ end;
|
|||||||
procedure TWindowProcHelper.DoMsgDrawItem;
|
procedure TWindowProcHelper.DoMsgDrawItem;
|
||||||
var
|
var
|
||||||
menuItem: TObject;
|
menuItem: TObject;
|
||||||
|
PDrawIS: PDrawItemStruct;
|
||||||
begin
|
begin
|
||||||
if (WParam = 0) and (PDrawItemStruct(LParam)^.ctlType = ODT_MENU) then
|
PDrawIS := PDrawItemStruct(LParam);
|
||||||
|
if (WParam = 0) and (PDrawIS^.ctlType = ODT_MENU) then
|
||||||
begin
|
begin
|
||||||
menuItem := TObject(PDrawItemStruct(LParam)^.itemData);
|
menuItem := TObject(PDrawIS^.itemData);
|
||||||
if menuItem is TMenuItem then
|
if menuItem is TMenuItem then
|
||||||
DrawMenuItem(TMenuItem(menuItem), PDrawItemStruct(LParam)^._hDC,
|
DrawMenuItem(TMenuItem(menuItem),
|
||||||
PDrawItemStruct(LParam)^.rcItem,
|
PDrawIS^._hDC, PDrawIS^.rcItem, PDrawIS^.itemAction, PDrawIS^.itemState);
|
||||||
PDrawItemStruct(LParam)^.itemAction,
|
|
||||||
PDrawItemStruct(LParam)^.itemState);
|
|
||||||
UpdateDrawItems;
|
UpdateDrawItems;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
WindowInfo := GetWin32WindowInfo(PDrawItemStruct(LParam)^.hwndItem);
|
WindowInfo := GetWin32WindowInfo(PDrawIS^.hwndItem);
|
||||||
if WindowInfo^.WinControl<>nil then
|
if WindowInfo^.WinControl<>nil then
|
||||||
lWinControl := WindowInfo^.WinControl;
|
lWinControl := WindowInfo^.WinControl;
|
||||||
{$IFDEF MSG_DEBUG}
|
{$IFDEF MSG_DEBUG}
|
||||||
with PDrawItemStruct(LParam)^ do
|
debugln(format('Received WM_DRAWITEM type %d handle %x',
|
||||||
debugln(format('Received WM_DRAWITEM type %d handle %x', [ctlType, integer(hwndItem)]));
|
[PDrawIS^.ctlType, integer(PDrawIS^.hwndItem)]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if (lWinControl<>nil) and
|
if (lWinControl<>nil) and
|
||||||
@ -1409,7 +1411,7 @@ begin
|
|||||||
else
|
else
|
||||||
if (lWinControl <> nil) and (lWinControl is TListView) and
|
if (lWinControl <> nil) and (lWinControl is TListView) and
|
||||||
(TListView(lWinControl).ViewStyle = vsReport) and
|
(TListView(lWinControl).ViewStyle = vsReport) and
|
||||||
(PDrawItemStruct(LParam)^.ctlType = ODT_LISTVIEW) and
|
(PDrawIS^.ctlType = ODT_LISTVIEW) and
|
||||||
(TListView(lWinControl).OwnerDraw)
|
(TListView(lWinControl).OwnerDraw)
|
||||||
then
|
then
|
||||||
UpdateDrawListItem(CN_DRAWITEM)
|
UpdateDrawListItem(CN_DRAWITEM)
|
||||||
|
Loading…
Reference in New Issue
Block a user