mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 19:16:45 +02:00
lcl: rename AttachMenuToWindow to SetMenu for winapi compatibility
git-svn-id: trunk@21868 -
This commit is contained in:
parent
5861a1b4dd
commit
00ec699a6e
@ -49,10 +49,6 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TWidgetSet.AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWidgetSet.CallDefaultWndHandler(Sender: TObject; var Message);
|
||||
begin
|
||||
end;
|
||||
|
@ -1449,6 +1449,11 @@ begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TWidgetSet.SetProp(Handle: hwnd; Str : PChar;
|
||||
Data : Pointer) : Boolean;
|
||||
Begin
|
||||
|
@ -56,11 +56,6 @@ begin
|
||||
Result := WidgetSet.AllocateHWnd(Method);
|
||||
end;
|
||||
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
begin
|
||||
WidgetSet.AttachMenuToWindow(AWindowHandle, AMenuHandle);
|
||||
end;
|
||||
|
||||
procedure CallDefaultWndHandler(Sender: TObject; var Message);
|
||||
begin
|
||||
WidgetSet.CallDefaultWndHandler(Sender,Message);
|
||||
|
@ -41,7 +41,6 @@ function AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHa
|
||||
function AddProcessEventHandler(AHandle: THandle; AEventHandler: TChildExitEvent; AData: PtrInt): PProcessEventHandler; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function AddPipeEventHandler(AHandle: THandle; AEventHandler: TPipeEvent; AData: PtrInt): PPipeEventHandler; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function AllocateHWnd(Method: TLCLWndMethod): HWND; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
||||
procedure CallDefaultWndHandler(Sender: TObject; var Message); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function ClipboardFormatToMimeType(FormatID: TClipboardFormat): string; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
@ -22,11 +22,11 @@ begin
|
||||
FWindowHandle := AValue;
|
||||
if HandleAllocated then
|
||||
begin
|
||||
WidgetSet.AttachMenuToWindow(FWindowHandle, Handle);
|
||||
SetMenu(FWindowHandle, Handle);
|
||||
BidiModeChanged;
|
||||
end
|
||||
else
|
||||
WidgetSet.AttachMenuToWindow(FWindowHandle, 0);
|
||||
SetMenu(FWindowHandle, 0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -776,8 +776,13 @@ begin
|
||||
Result := WidgetSet.SetCursorPos(X, Y);
|
||||
end;
|
||||
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
begin
|
||||
Result := WidgetSet.SetMenu(AWindowHandle, AMenuHandle);
|
||||
end;
|
||||
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean;
|
||||
Begin
|
||||
begin
|
||||
Result := WidgetSet.SetProp(Handle,Str,Data);
|
||||
end;
|
||||
|
||||
|
@ -219,6 +219,7 @@ function SetCursor(hCursor: HICON): HCURSOR; {$IFDEF IF_BASE_MEMBER}virtual;{$EN
|
||||
function SetCursorPos(X, Y: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetFocus(hWnd: HWND): HWND; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetForegroundWindow(hWnd : HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
//function SetRect --> independent
|
||||
//function SetRectEmpty --> independent
|
||||
|
@ -104,8 +104,6 @@ type
|
||||
procedure AppSetTitle(const ATitle: string); override;
|
||||
|
||||
function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; override;
|
||||
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); override;
|
||||
|
||||
function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
|
||||
procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
|
||||
|
@ -1078,22 +1078,6 @@ begin
|
||||
Result:= lpCarbon;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonWidgetSet.AttachMenuToWindow
|
||||
Params: AMenuObject - Menu
|
||||
|
||||
Attaches the menu of window to menu bar
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonWidgetSet.AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
const SName = 'TCarbonWidgetSet.AttachMenuToWindow';
|
||||
begin
|
||||
{$IFDEF VerboseObject}
|
||||
DebugLn('TCarbonWidgetSet.AttachMenuToWindow ' + AMenuObject.Name);
|
||||
{$ENDIF}
|
||||
|
||||
SetRootMenu(AMenuHandle)
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonWidgetSet.DCGetPixel
|
||||
Params: CanvasHandle - Canvas handle to get color from
|
||||
|
@ -3175,6 +3175,28 @@ begin
|
||||
Result := TCarbonWindow(HWnd).SetForeground;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonWidgetSet.SetMenu
|
||||
Params: AMenuObject - Menu
|
||||
|
||||
Attaches the menu of window to menu bar
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('TCarbonWidgetSet.SetMenu AWindowHAndle: ' + DbgS(HWnd) + ' AMenuHandle: ' + DbgS(AMenuHandle));
|
||||
{$ENDIF}
|
||||
|
||||
if not CheckWidget(AWindowHandle, 'SetMenu') then Exit;
|
||||
if not CheckMenu(AMenuHandle, 'SetMenu') then Exit;
|
||||
|
||||
|
||||
SetRootMenu(AMenuHandle);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetProp
|
||||
Params: Handle - Handle of window
|
||||
|
@ -190,6 +190,7 @@ function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
function SetFocus(HWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
|
@ -90,8 +90,6 @@ type
|
||||
procedure AppRestore; override;
|
||||
procedure AppBringToFront; override;
|
||||
procedure AppSetTitle(const ATitle: string); override;
|
||||
|
||||
// procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); override;
|
||||
|
||||
// function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
|
||||
// procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
|
||||
|
@ -102,7 +102,6 @@ type
|
||||
procedure AppBringToFront; override;
|
||||
procedure AppSetIcon(const Small, Big: HICON); override;
|
||||
procedure AppSetTitle(const ATitle: string); override;
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); override;
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
|
@ -250,30 +250,6 @@ begin
|
||||
QCoreApplication_setApplicationName(@W);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
var
|
||||
AWidget, AMenuWidget: TQtWidget;
|
||||
QtMainWindow: TQtMainWindow absolute AWidget;
|
||||
QtMenuBar: TQtMenuBar absolute AMenuWidget;
|
||||
R, R1: TRect;
|
||||
begin
|
||||
AWidget := TQtWidget(AWindowHandle);
|
||||
if AWidget is TQtMainWindow then
|
||||
begin
|
||||
AMenuWidget := TQtWidget(AMenuHandle);
|
||||
if AMenuWidget is TQtMenuBar then
|
||||
begin
|
||||
R := AWidget.LCLObject.ClientRect;
|
||||
R1 := QtMainWindow.MenuBar.getGeometry;
|
||||
R1.Right := R.Right;
|
||||
QtMenuBar.setGeometry(R1);
|
||||
QtMainWindow.setMenuBar(QMenuBarH(QtMenuBar.Widget));
|
||||
end
|
||||
else
|
||||
QtMainWindow.setMenuBar(QMenuBarH(QtMainWindow.MenuBar.Widget));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SetOverrideCursor(const AValue: TObject);
|
||||
begin
|
||||
if AValue = nil then
|
||||
|
@ -4503,6 +4503,31 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
var
|
||||
AWidget, AMenuWidget: TQtWidget;
|
||||
QtMainWindow: TQtMainWindow absolute AWidget;
|
||||
QtMenuBar: TQtMenuBar absolute AMenuWidget;
|
||||
R, R1: TRect;
|
||||
begin
|
||||
AWidget := TQtWidget(AWindowHandle);
|
||||
Result := AWidget is TQtMainWindow;
|
||||
if Result then
|
||||
begin
|
||||
AMenuWidget := TQtWidget(AMenuHandle);
|
||||
if AMenuWidget is TQtMenuBar then
|
||||
begin
|
||||
R := AWidget.LCLObject.ClientRect;
|
||||
R1 := QtMainWindow.MenuBar.getGeometry;
|
||||
R1.Right := R.Right;
|
||||
QtMenuBar.setGeometry(R1);
|
||||
QtMainWindow.setMenuBar(QMenuBarH(QtMenuBar.Widget));
|
||||
end
|
||||
else
|
||||
QtMainWindow.setMenuBar(QMenuBarH(QtMainWindow.MenuBar.Widget));
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetWindowOrgEx
|
||||
Params: DC - handle of device context
|
||||
|
@ -177,6 +177,7 @@ function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||
|
@ -179,7 +179,6 @@ type
|
||||
function AppRestoreStayOnTopFlags: Boolean; override;
|
||||
|
||||
function InitStockFont(AFont: TObject; AStockFont: TStockFont): Boolean; override;
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); override;
|
||||
|
||||
procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
|
||||
function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
|
||||
|
@ -594,12 +594,6 @@ begin
|
||||
Windows.PostMessage(AppHandle, WM_NULL, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TWin32WidgetSet.AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
begin
|
||||
Windows.SetMenu(AWindowHandle, AMenuHandle);
|
||||
AddToChangedMenus(AWindowHandle);
|
||||
end;
|
||||
|
||||
{ Private methods (in no significant order) }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -3141,6 +3141,13 @@ begin
|
||||
Assert(False, 'Trace:TWin32WidgetSet.SetForegroundWindow - Exit');
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
begin
|
||||
Result := Windows.SetMenu(AWindowHandle, AMenuHandle);
|
||||
AddToChangedMenus(AWindowHandle);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetProp
|
||||
Params: Handle - handle of window
|
||||
|
@ -189,6 +189,7 @@ function SetCursor(hCursor: HICON): HCURSOR; override;
|
||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
function SetFocus(HWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; override;
|
||||
|
@ -196,7 +196,6 @@ type
|
||||
procedure AppWaitMessage; override;
|
||||
procedure AppTerminate; override;
|
||||
procedure AppSetTitle(const ATitle: string); override;
|
||||
procedure AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU); override;
|
||||
procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
|
||||
function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
|
||||
procedure DCRedraw(CanvasHandle: HDC); override;
|
||||
|
@ -498,12 +498,6 @@ begin
|
||||
Windows.PostMessage(AppHandle, WM_NULL, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TWinCEWidgetSet.AttachMenuToWindow(AWindowHandle: HWND; AMenuHandle: HMENU);
|
||||
begin
|
||||
CeSetMenu(AWindowHandle, AMenuHandle);
|
||||
AddToChangedMenus(AWindowHandle);
|
||||
end;
|
||||
|
||||
{ Private methods (in no significant order) }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -2432,6 +2432,14 @@ begin
|
||||
Result := Windows.SetForegroundWindow(HWnd);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
|
||||
begin
|
||||
CeSetMenu(AWindowHandle, AMenuHandle);
|
||||
AddToChangedMenus(AWindowHandle);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetProp
|
||||
Params: Handle - handle of window
|
||||
|
@ -206,6 +206,7 @@ function SetCursor(hCursor: HICON): HCURSOR; override;
|
||||
function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override;
|
||||
|
Loading…
Reference in New Issue
Block a user