mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 11:59:20 +02:00
Lcl/Cocoa/TabControl: refactoring to remove duplicate code
This commit is contained in:
parent
bf6d81c33d
commit
590019f083
@ -55,6 +55,8 @@ type
|
||||
function shouldSelectTabViewItem(aTabIndex: Integer): Boolean;
|
||||
procedure willSelectTabViewItem(aTabIndex: Integer);
|
||||
procedure didSelectTabViewItem(aTabIndex: Integer);
|
||||
private
|
||||
procedure sengNotifyMsg(aTabIndex:Integer; aCode:Integer);
|
||||
end;
|
||||
|
||||
{ TCocoaWSCustomPage }
|
||||
@ -445,7 +447,7 @@ begin
|
||||
Result:= NOT TTabControl(Target).Dragging;
|
||||
end;
|
||||
|
||||
procedure TLCLTabControlCallback.willSelectTabViewItem(aTabIndex: Integer);
|
||||
procedure TLCLTabControlCallback.sengNotifyMsg(aTabIndex:Integer; aCode:Integer);
|
||||
var
|
||||
Msg: TLMNotify;
|
||||
Hdr: TNmHdr;
|
||||
@ -456,31 +458,22 @@ begin
|
||||
Msg.Msg := LM_NOTIFY;
|
||||
FillChar(Hdr, SizeOf(Hdr), 0);
|
||||
|
||||
Hdr.hwndFrom := FTarget.Handle;
|
||||
Hdr.Code := TCN_SELCHANGING;
|
||||
Hdr.hwndFrom := Target.Handle;
|
||||
Hdr.Code := aCode;
|
||||
Hdr.idFrom := TTabControl(Target).TabToPageIndex(ATabIndex);
|
||||
Msg.NMHdr := @Hdr;
|
||||
Msg.Result := 0;
|
||||
LCLMessageGlue.DeliverMessage(Target, Msg);
|
||||
end;
|
||||
|
||||
procedure TLCLTabControlCallback.didSelectTabViewItem(aTabIndex: Integer);
|
||||
var
|
||||
Msg: TLMNotify;
|
||||
Hdr: TNmHdr;
|
||||
procedure TLCLTabControlCallback.willSelectTabViewItem(aTabIndex: Integer);
|
||||
begin
|
||||
if aTabIndex<0 then exit;
|
||||
sengNotifyMsg(aTabIndex, TCN_SELCHANGING);
|
||||
end;
|
||||
|
||||
FillChar(Msg, SizeOf(Msg), 0);
|
||||
Msg.Msg := LM_NOTIFY;
|
||||
FillChar(Hdr, SizeOf(Hdr), 0);
|
||||
|
||||
Hdr.hwndFrom := FTarget.Handle;
|
||||
Hdr.Code := TCN_SELCHANGE;
|
||||
Hdr.idFrom := TTabControl(Target).TabToPageIndex(ATabIndex);
|
||||
Msg.NMHdr := @Hdr;
|
||||
Msg.Result := 0;
|
||||
LCLMessageGlue.DeliverMessage(Target, Msg);
|
||||
procedure TLCLTabControlCallback.didSelectTabViewItem(aTabIndex: Integer);
|
||||
begin
|
||||
sengNotifyMsg(aTabIndex, TCN_SELCHANGE);
|
||||
end;
|
||||
|
||||
{ TCocoaWSStatusBar }
|
||||
|
Loading…
Reference in New Issue
Block a user