mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 12:00:58 +02:00
Carbon intf:
- improved capturing, TForm.BorderStyle - fixed mouse pos bug while tracking - working TSpeedButton git-svn-id: trunk@11144 -
This commit is contained in:
parent
61b1572001
commit
1d3d886efd
@ -356,7 +356,17 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonWidgetSet.SetCaptureWidget(const AWidget: HWND);
|
||||
begin
|
||||
FCaptureWidget := AWidget;
|
||||
{$IFDEF VerboseLCLIntf}
|
||||
DebugLn('TCarbonWidgetSet.SetCaptureWidget AWidget: ' + DbgS(AWidget));
|
||||
{$ENDIF}
|
||||
|
||||
if AWidget <> FCaptureWidget then
|
||||
begin
|
||||
FCaptureWidget := AWidget;
|
||||
|
||||
if FCaptureWidget <> 0 then
|
||||
LCLSendCaptureChangedMsg(TCarbonWidget(FCaptureWidget).LCLObject);
|
||||
end;
|
||||
end;
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||
|
@ -196,8 +196,6 @@ end;
|
||||
Frees Carbon menu item
|
||||
------------------------------------------------------------------------------}
|
||||
destructor TCarbonMenu.Destroy;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
if Menu <> nil then
|
||||
begin
|
||||
|
@ -110,8 +110,6 @@ type
|
||||
{ TCarbonWindow }
|
||||
|
||||
TCarbonWindow = class(TCarbonWidget)
|
||||
private
|
||||
FBorderStyle: TFormBorderStyle;
|
||||
protected
|
||||
procedure RegisterEvents; override;
|
||||
procedure CreateWidget(const AParams: TCreateParams); override;
|
||||
|
@ -120,8 +120,8 @@ begin
|
||||
|
||||
FillChar(Msg, SizeOf(TLMMouseMove), 0);
|
||||
Msg.Msg := LM_MOUSEMOVE;
|
||||
Msg.XPos := P.Y;
|
||||
Msg.YPos := P.X;
|
||||
Msg.XPos := P.X;
|
||||
Msg.YPos := P.Y;
|
||||
Msg.Keys := GetCarbonMsgKeyState;
|
||||
DeliverMessage(Widget.LCLObject, Msg);
|
||||
|
||||
@ -187,8 +187,6 @@ begin
|
||||
Msg.YPos := P.Y;
|
||||
Msg.Keys := GetCarbonMsgKeyState;
|
||||
|
||||
CarbonWidgetSet.SetCaptureWidget(0); // capture is released
|
||||
|
||||
if (AWidget is TCarbonControl) and
|
||||
(cceHit in (AWidget as TCarbonControl).GetValidEvents) then
|
||||
begin
|
||||
@ -211,6 +209,7 @@ begin
|
||||
DeliverMessage(AWidget.LCLObject, Msg);
|
||||
|
||||
NotifyApplicationUserInput(Msg.Msg);
|
||||
CarbonWidgetSet.SetCaptureWidget(0); // capture is released
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,7 @@ begin
|
||||
DeliverMessage(AWidget.LCLObject, SavedMouseUpMsg);
|
||||
|
||||
NotifyApplicationUserInput(SavedMouseUpMsg.Msg);
|
||||
CarbonWidgetSet.SetCaptureWidget(0); // capture is released
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -971,8 +971,6 @@ begin
|
||||
SetControlProperty(Content, LAZARUS_FOURCC, WIDGETINFO_FOURCC, SizeOf(Self), @Self),
|
||||
Self, SCreateWidget, SSetControlProp);
|
||||
|
||||
FBorderStyle := (LCLObject as TCustomForm).BorderStyle;
|
||||
|
||||
SetBounds(Bounds(AParams.X, AParams.Y, AParams.Width, AParams.Height));
|
||||
SetText(AParams.Caption);
|
||||
DebugLn('TCarbonWindow.CreateWidget succeeds');
|
||||
@ -1465,21 +1463,17 @@ procedure TCarbonWindow.SetFormBorderStyle(AFormBorderStyle: TFormBorderStyle);
|
||||
var
|
||||
AttrsSet, AttrsRemove: WindowAttributes;
|
||||
begin
|
||||
if AFormBorderStyle = FBorderStyle then Exit;
|
||||
if (AFormBorderStyle = bsNone) or (FBorderStyle = bsNone) then
|
||||
begin
|
||||
RecreateWnd(LCLObject);
|
||||
Exit;
|
||||
end;
|
||||
BeginUpdate(WindowRef(Widget));
|
||||
try
|
||||
AttrsSet := FormBorderToWindowAttrs(AFormBorderStyle);
|
||||
AttrsRemove := (kWindowNoTitleBarAttribute or kWindowCloseBoxAttribute or
|
||||
kWindowCollapseBoxAttribute or kWindowFullZoomAttribute or
|
||||
kWindowResizableAttribute) and (not AttrsSet);
|
||||
|
||||
AttrsSet := FormBorderToWindowAttrs(AFormBorderStyle);
|
||||
AttrsRemove := (kWindowNoTitleBarAttribute or kWindowCloseBoxAttribute or
|
||||
kWindowCollapseBoxAttribute or kWindowFullZoomAttribute or
|
||||
kWindowResizableAttribute) and (not AttrsSet);
|
||||
|
||||
if OSError(
|
||||
ChangeWindowAttributes(WindowRef(Widget), AttrsSet, AttrsRemove), Self,
|
||||
'SetFormBorderStyle', SChangeWindowAttrs) then Exit;
|
||||
|
||||
FBorderStyle := AFormBorderStyle;
|
||||
if OSError(
|
||||
ChangeWindowAttributes(WindowRef(Widget), AttrsSet, AttrsRemove), Self,
|
||||
'SetFormBorderStyle', SChangeWindowAttrs) then Exit;
|
||||
finally
|
||||
EndUpdate(WindowRef(Widget));
|
||||
end;
|
||||
end;
|
||||
|
@ -2192,9 +2192,25 @@ begin
|
||||
Result:=inherited RegroupMenuItem(hndMenu, GroupIndex);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: ReleaseCapture
|
||||
Returns: If the function succeeds
|
||||
|
||||
Releases the mouse capture from a window and restores normal mouse input
|
||||
processing
|
||||
TODO: not only release capture indicator
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWidgetSet.ReleaseCapture: Boolean;
|
||||
begin
|
||||
Result:=inherited ReleaseCapture;
|
||||
Result := False;
|
||||
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('TCarbonWidgetSet.ReleaseCapture');
|
||||
{$ENDIF}
|
||||
|
||||
SetCaptureWidget(0);
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -261,7 +261,6 @@ end;
|
||||
Returns: If the function succeeds
|
||||
|
||||
Sets the enabled of menu item in Carbon interface
|
||||
TODO: disable menu bar items
|
||||
------------------------------------------------------------------------------}
|
||||
class function TCarbonWSMenuItem.SetEnable(const AMenuItem: TMenuItem;
|
||||
const Enabled: boolean): boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user