mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 05:01:50 +02:00
CarbonListView + column sorting partial support + column moving + windows-like mouse handling at for ListView's header
git-svn-id: trunk@19910 -
This commit is contained in:
parent
f3dfb636c4
commit
1760ca6826
@ -87,6 +87,7 @@ type
|
|||||||
procedure ControlAdded; dynamic;
|
procedure ControlAdded; dynamic;
|
||||||
function FilterKeyPress(SysKey: Boolean; const Char: TUTF8Char): Boolean; dynamic;
|
function FilterKeyPress(SysKey: Boolean; const Char: TUTF8Char): Boolean; dynamic;
|
||||||
procedure ProcessKeyEvent(const msg: TLMKey; var Result: OSStatus); virtual;
|
procedure ProcessKeyEvent(const msg: TLMKey; var Result: OSStatus); virtual;
|
||||||
|
function NeedDeliverMouseEvent(Msg: Integer; const AMessage): Boolean; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(const AObject: TWinControl; const AParams: TCreateParams);
|
constructor Create(const AObject: TWinControl; const AParams: TCreateParams);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -614,6 +615,11 @@ procedure TCarbonWidget.ProcessKeyEvent(const msg: TLMKey; var Result: OSStatus)
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCarbonWidget.NeedDeliverMouseEvent(Msg: Integer; const AMessage): Boolean;
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCarbonWidget.Create
|
Method: TCarbonWidget.Create
|
||||||
Params: AObject - LCL conrol
|
Params: AObject - LCL conrol
|
||||||
|
@ -211,6 +211,8 @@ type
|
|||||||
procedure UpdateColumnView; override;
|
procedure UpdateColumnView; override;
|
||||||
|
|
||||||
procedure ClearIconCache;
|
procedure ClearIconCache;
|
||||||
|
|
||||||
|
function NeedDeliverMouseEvent(Msg: Integer; const AMessage): Boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCarbonListBox }
|
{ TCarbonListBox }
|
||||||
@ -404,7 +406,9 @@ function TCarbonListColumn.GetHeaderPropertyFlags: Integer;
|
|||||||
begin
|
begin
|
||||||
Result := kDataBrowserPropertyIsMutable or
|
Result := kDataBrowserPropertyIsMutable or
|
||||||
kDataBrowserListViewSelectionColumn or
|
kDataBrowserListViewSelectionColumn or
|
||||||
kDataBrowserListViewTypeSelectColumn;
|
kDataBrowserListViewTypeSelectColumn or
|
||||||
|
kDataBrowserListViewSortableColumn or
|
||||||
|
kDataBrowserListViewMovableColumn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCarbonListColumn.Create(AOwner: TCarbonDataBrowser;
|
constructor TCarbonListColumn.Create(AOwner: TCarbonDataBrowser;
|
||||||
@ -1601,6 +1605,38 @@ begin
|
|||||||
FIcons.Clear;
|
FIcons.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCarbonListView.NeedDeliverMouseEvent(Msg: Integer; const AMessage): Boolean;
|
||||||
|
var
|
||||||
|
h : UInt16;
|
||||||
|
y : Integer;
|
||||||
|
type
|
||||||
|
PLMMouse = ^TLMMouse;
|
||||||
|
PLMMouseMove = ^TLMMouseMove;
|
||||||
|
|
||||||
|
// for some unkown reason, HIViewConvertPoint does return inaccurate x,y position for ListView
|
||||||
|
// (because of focus ring?)
|
||||||
|
const
|
||||||
|
OfsY = -2;
|
||||||
|
begin
|
||||||
|
if Assigned(LCLObject) and (TListView(LCLObject).Columns.Count > 0) and
|
||||||
|
(TListView(LCLObject).ViewStyle = vsReport) then
|
||||||
|
begin
|
||||||
|
case Msg of
|
||||||
|
LM_LBUTTONDOWN..LM_MBUTTONDBLCLK: y := PLMMouse(@AMessage)^.YPos;
|
||||||
|
LM_MOUSEMOVE: y := PLMMouseMove(@AMessage)^.YPos ;
|
||||||
|
LM_MOUSEWHEEL: y := PLMMouseEvent(@AMessage)^.Y;
|
||||||
|
else
|
||||||
|
Result := inherited NeedDeliverMouseEvent(msg, AMessage);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
GetDataBrowserListViewHeaderBtnHeight(Content, h);
|
||||||
|
inc(y, OfsY);
|
||||||
|
Result := y > h;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := inherited NeedDeliverMouseEvent(msg, AMessage);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCarbonListBox }
|
{ TCarbonListBox }
|
||||||
|
|
||||||
procedure TCarbonListBox.CreateWidget(const AParams: TCreateParams);
|
procedure TCarbonListBox.CreateWidget(const AParams: TCreateParams);
|
||||||
|
@ -173,10 +173,14 @@ begin
|
|||||||
Msg.XPos := P.X;
|
Msg.XPos := P.X;
|
||||||
Msg.YPos := P.Y;
|
Msg.YPos := P.Y;
|
||||||
Msg.Keys := GetCarbonMsgKeyState;
|
Msg.Keys := GetCarbonMsgKeyState;
|
||||||
|
|
||||||
|
if Widget.NeedDeliverMouseEvent(Msg.Msg, Msg) then
|
||||||
|
begin
|
||||||
NotifyApplicationUserInput(Msg.Msg);
|
NotifyApplicationUserInput(Msg.Msg);
|
||||||
DeliverMessage(Widget.LCLObject, Msg);
|
DeliverMessage(Widget.LCLObject, Msg);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Name: CarbonCommon_Track
|
Name: CarbonCommon_Track
|
||||||
@ -208,9 +212,12 @@ begin
|
|||||||
if PostponedDown then
|
if PostponedDown then
|
||||||
begin
|
begin
|
||||||
PostponedDown := False;
|
PostponedDown := False;
|
||||||
|
if AWidget.NeedDeliverMouseEvent(PostponedDownMsg.Msg, PostponedDownMsg) then
|
||||||
|
begin
|
||||||
NotifyApplicationUserInput(PostponedDownMsg.Msg);
|
NotifyApplicationUserInput(PostponedDownMsg.Msg);
|
||||||
DeliverMessage(AWidget.LCLObject, PostponedDownMsg);
|
DeliverMessage(AWidget.LCLObject, PostponedDownMsg);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
MouseButton := GetCarbonMouseButton(AEvent);
|
MouseButton := GetCarbonMouseButton(AEvent);
|
||||||
|
|
||||||
@ -262,11 +269,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if AWidget.NeedDeliverMouseEvent(Msg.Msg, Msg) then
|
||||||
|
begin
|
||||||
DeliverMessage(AWidget.LCLObject, Msg);
|
DeliverMessage(AWidget.LCLObject, Msg);
|
||||||
|
|
||||||
NotifyApplicationUserInput(Msg.Msg);
|
NotifyApplicationUserInput(Msg.Msg);
|
||||||
CarbonWidgetSet.SetCaptureWidget(0); // capture is released
|
CarbonWidgetSet.SetCaptureWidget(0); // capture is released
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Name: CarbonCommon_CursorChange
|
Name: CarbonCommon_CursorChange
|
||||||
|
@ -81,7 +81,7 @@ const
|
|||||||
SName, SGetEvent, 'kEventParamClickCount') then Exit;
|
SName, SGetEvent, 'kEventParamClickCount') then Exit;
|
||||||
|
|
||||||
Result := ClickCount;
|
Result := ClickCount;
|
||||||
//debugln('GetClickCount ClickCount=',dbgs(ClickCount));
|
{debugln('GetClickCount ClickCount=',dbgs(ClickCount));}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetMousePoint: TPoint;
|
function GetMousePoint: TPoint;
|
||||||
@ -143,7 +143,7 @@ const
|
|||||||
MousePoint := GetMousePoint;
|
MousePoint := GetMousePoint;
|
||||||
|
|
||||||
if (ClickCount < Low(MSGKIND)) or (ClickCount > High(MSGKIND)) then
|
if (ClickCount < Low(MSGKIND)) or (ClickCount > High(MSGKIND)) then
|
||||||
ClickCount := 1;
|
ClickCount := (ClickCount mod High(MSGKIND))+1;
|
||||||
|
|
||||||
if (MouseButton < Low(MSGKIND[1])) or (MouseButton > High(MSGKIND[1])) then Exit;
|
if (MouseButton < Low(MSGKIND[1])) or (MouseButton > High(MSGKIND[1])) then Exit;
|
||||||
Msg^.Msg := MSGKIND[ClickCount, MouseButton];
|
Msg^.Msg := MSGKIND[ClickCount, MouseButton];
|
||||||
@ -296,6 +296,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
if Widget.NeedDeliverMouseEvent(Msg.Message.Msg, Msg) then begin
|
||||||
// Msg is set in the Appropriate HandleMousexxx procedure
|
// Msg is set in the Appropriate HandleMousexxx procedure
|
||||||
NotifyApplicationUserInput(Msg.Message.Msg);
|
NotifyApplicationUserInput(Msg.Message.Msg);
|
||||||
if DeliverMessage(Widget.LCLObject, Msg) = 0 then
|
if DeliverMessage(Widget.LCLObject, Msg) = 0 then
|
||||||
@ -304,6 +305,9 @@ begin
|
|||||||
end
|
end
|
||||||
else // the LCL does not want the event propagated
|
else // the LCL does not want the event propagated
|
||||||
Result := noErr;
|
Result := noErr;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// interactive design
|
// interactive design
|
||||||
|
Loading…
Reference in New Issue
Block a user