mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-03 17:36:15 +02:00
492 lines
14 KiB
PHP
492 lines
14 KiB
PHP
{ $Id$ }
|
|
{******************************************************************************
|
|
TInterfaceBase
|
|
|
|
interface communication stuff
|
|
|
|
!! In this file only interface related code as defined in lclintfh.inc
|
|
Most routines implement only the default
|
|
|
|
!! Keep this alphabetical !!
|
|
******************************************************************************
|
|
|
|
*****************************************************************************
|
|
* *
|
|
* This file is part of the Lazarus Component Library (LCL) *
|
|
* *
|
|
* See the file COPYING.LCL, included in this distribution, *
|
|
* for details about the copyright. *
|
|
* *
|
|
* This program is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
* *
|
|
*****************************************************************************
|
|
}
|
|
//##apiwiz##sps## // Do not remove
|
|
|
|
procedure TInterfaceBase.AttachMenuToWindow(AMenuObject: TComponent);
|
|
begin
|
|
end;
|
|
|
|
procedure TInterfaceBase.CallDefaultWndHandler(Sender: TObject; var Message);
|
|
begin
|
|
end;
|
|
|
|
// the clipboard functions are internally used by TClipboard
|
|
function TInterfaceBase.ClipboardFormatToMimeType(FormatID: TClipboardFormat): string;
|
|
begin
|
|
Result := '';
|
|
end;
|
|
|
|
function TInterfaceBase.ClipboardGetData(ClipboardType: TClipboardType;
|
|
FormatID: TClipboardFormat; Stream: TStream): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
// ! List will be created. You must free it yourself with FreeMem(List) !
|
|
function TInterfaceBase.ClipboardGetFormats(ClipboardType: TClipboardType;
|
|
var Count: integer; var List: PClipboardFormat): boolean;
|
|
begin
|
|
Result := true;
|
|
Count := 0;
|
|
List := nil;
|
|
end;
|
|
|
|
function TInterfaceBase.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
|
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
|
Formats: PClipboardFormat): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.ClipboardRegisterFormat(
|
|
const AMimeType: string): TClipboardFormat;
|
|
begin
|
|
Result := 0;
|
|
end;
|
|
|
|
function TInterfaceBase.ComboBoxDropDown(Handle: HWND;
|
|
DropDown: boolean): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.CreateBitmapFromRawImage(const RawImage: TRawImage;
|
|
var Bitmap, MaskBitmap: HBitmap): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
//todo: remove ?
|
|
function TInterfaceBase.CreateEmptyRegion: hRGN;
|
|
begin
|
|
Result:=CreateRectRGN(0,0,0,0);
|
|
end;
|
|
|
|
function TInterfaceBase.CreatePixmapIndirect(const Data: Pointer; const TransColor: Longint): HBITMAP;
|
|
begin
|
|
Result := 0;
|
|
end;
|
|
|
|
function TInterfaceBase.CreateRegionCopy(SrcRGN: hRGN): hRGN;
|
|
begin
|
|
// If the interface has a better way to create a copy it can override this
|
|
Result:=CreateEmptyRegion;
|
|
CombineRGN(Result,SrcRGN,SrcRGN,RGN_COPY);
|
|
end;
|
|
|
|
function TInterfaceBase.DCClipRegionValid(DC: HDC): boolean;
|
|
var
|
|
Clip: hRGN;
|
|
begin
|
|
// If the interface has a better way to check a region it can override this
|
|
Clip:=CreateEmptyRegion;
|
|
Result:=GetClipRGN(DC,Clip)>=0;
|
|
DeleteObject(Clip);
|
|
end;
|
|
|
|
function TInterfaceBase.Frame(DC: HDC; const ARect: TRect) : integer;
|
|
begin
|
|
Result:= 0;
|
|
end;
|
|
|
|
function TInterfaceBase.Frame3d(DC: HDC; var ARect: TRect;
|
|
const FrameWidth: integer; const Style: TGraphicsBevelCut) : boolean;
|
|
begin
|
|
Result:= false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetBitmapRawImageDescription(Bitmap: HBITMAP;
|
|
Desc: PRawImageDescription): boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetCaretRespondToFocus(handle: HWND;
|
|
var ShowHideOnFocus: boolean): Boolean;
|
|
begin
|
|
ShowHideOnFocus := true;
|
|
Result := False;
|
|
end;
|
|
|
|
function TInterfaceBase.GetClientBounds(Handle : HWND; var ARect: TRect) : Boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetCmdLineParamDescForInterface: string;
|
|
begin
|
|
Result := '';
|
|
end;
|
|
|
|
function TInterfaceBase.GetDeviceRawImageDescription(DC: HDC;
|
|
Desc: PRawImageDescription): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetDeviceSize(DC: HDC; var p: TPoint): boolean;
|
|
begin
|
|
p.X := 0;
|
|
p.Y := 0;
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetDesignerDC(WindowHandle: HWND): HDC;
|
|
begin
|
|
Result:=GetDC(WindowHandle);
|
|
end;
|
|
|
|
function TInterfaceBase.GetNotebookTabIndexAtPos(Handle: HWND;
|
|
const ClientPos: TPoint): integer;
|
|
begin
|
|
Result:=-1;
|
|
end;
|
|
|
|
function TInterfaceBase.GetRawImageFromDevice(SrcDC: HDC;
|
|
const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP;
|
|
const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
// TODO: remove
|
|
function TInterfaceBase.GetScrollBarSize(Handle: HWND;
|
|
SBStyle: Integer): integer;
|
|
begin
|
|
Result := GetSystemMetrics(SBStyle);
|
|
end;
|
|
|
|
function TInterfaceBase.GetScrollbarVisible(Handle: HWND;
|
|
SBStyle: Integer): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.GetWindowRelativePosition(Handle : hwnd;
|
|
var Left, Top: integer): boolean;
|
|
{ returns the position of the left, top coordinate relative to the clientorigin
|
|
of its parent. This is normally the Left, Top of a TWinControl. But not
|
|
during moving/sizing. }
|
|
var
|
|
ChildRect: TRect;
|
|
ParentLeftTop: TPoint;
|
|
ParentHandle: hWnd;
|
|
begin
|
|
Result:=false;
|
|
GetWindowRect(Handle,ChildRect);
|
|
Left:=ChildRect.Left;
|
|
Top:=ChildRect.Top;
|
|
ParentHandle:=GetParent(Handle);
|
|
if ParentHandle<>0 then begin
|
|
ParentLeftTop.X:=0;
|
|
ParentLeftTop.Y:=0;
|
|
if not ClientToScreen(ParentHandle,ParentLeftTop) then exit;
|
|
dec(Left,ParentLeftTop.X);
|
|
dec(Top,ParentLeftTop.Y);
|
|
end;
|
|
Result := true;
|
|
end;
|
|
|
|
function TInterfaceBase.GetWindowSize(Handle : hwnd;
|
|
var Width, Height: integer): boolean;
|
|
// Returns the current Width and Height
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
Function TInterfaceBase.InvalidateFrame(aHandle : HWND; ARect : pRect;
|
|
bErase : Boolean; BorderWidth: integer) : Boolean;
|
|
|
|
function Min(i1, i2: integer): integer;
|
|
begin
|
|
if i1<=i2 then Result:=i1 else Result:=i2;
|
|
end;
|
|
|
|
function Max(i1, i2: integer): integer;
|
|
begin
|
|
if i1<=i2 then Result:=i2 else Result:=i1;
|
|
end;
|
|
|
|
var
|
|
BorderRect: TRect;
|
|
begin
|
|
Result:=false;
|
|
BorderRect:=ARect^;
|
|
// left
|
|
BorderRect.Right:=Min(BorderRect.Right,BorderRect.Left+BorderWidth);
|
|
if not InvalidateRect(aHandle,@BorderRect,bErase) then exit;
|
|
BorderRect.Right:=ARect^.Right;
|
|
// top
|
|
BorderRect.Bottom:=Min(BorderRect.Bottom,BorderRect.Top+BorderWidth);
|
|
if not InvalidateRect(aHandle,@BorderRect,bErase) then exit;
|
|
BorderRect.Bottom:=ARect^.Bottom;
|
|
// right
|
|
BorderRect.Left:=Max(BorderRect.Left,BorderRect.Right-BorderWidth);
|
|
if not InvalidateRect(aHandle,@BorderRect,bErase) then exit;
|
|
BorderRect.Left:=ARect^.Left;
|
|
// bottom
|
|
BorderRect.Top:=Max(BorderRect.Top,BorderRect.Bottom-BorderWidth);
|
|
if not InvalidateRect(aHandle,@BorderRect,bErase) then exit;
|
|
Result:=true;
|
|
end;
|
|
|
|
function TInterfaceBase.LclCheckMenuItem(AMenuItem: TComponent): Boolean;
|
|
begin
|
|
Result := False;
|
|
end;
|
|
|
|
function TInterfaceBase.LclEnableMenuItem(AMenuItem: TComponent): Boolean;
|
|
begin
|
|
Result := False;
|
|
end;
|
|
|
|
Function TInterfaceBase.LoadStockPixmap(StockID: longint) : HBitmap;
|
|
begin
|
|
Case StockID of
|
|
idButtonOk :
|
|
Result := CreatePixmapIndirect(@IMGOK_Check[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonYes :
|
|
Result := CreatePixmapIndirect(@IMGOK_Check[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonNo :
|
|
Result := CreatePixmapIndirect(@IMG_NO[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonCancel :
|
|
Result := CreatePixmapIndirect(@IMGCancel_X[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonHelp :
|
|
Result := CreatePixmapIndirect(@IMGHELP[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonAll :
|
|
Result := CreatePixmapIndirect(@IMGAll_Check[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonYesToAll :
|
|
Result := CreatePixmapIndirect(@IMGAll_Check[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonNoToAll :
|
|
Result := CreatePixmapIndirect(@IMGCancel_X[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonAbort :
|
|
Result := CreatePixmapIndirect(@IMGCancel_X[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonRetry :
|
|
Result := CreatePixmapIndirect(@IMG_RETRY[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonIgnore :
|
|
Result := CreatePixmapIndirect(@IMG_IGNIORE[0], GetSysColor(COLOR_BTNFACE));
|
|
idButtonClose :
|
|
Result := CreatePixmapIndirect(@IMGClose[0], GetSysColor(COLOR_BTNFACE));
|
|
|
|
idDialogWarning :
|
|
Result := CreatePixmapIndirect(@IMGWarning[0], GetSysColor(COLOR_BTNFACE));
|
|
idDialogError :
|
|
Result := CreatePixmapIndirect(@IMGError[0], GetSysColor(COLOR_BTNFACE));
|
|
idDialogInfo :
|
|
Result := CreatePixmapIndirect(@IMGInfo[0], GetSysColor(COLOR_BTNFACE));
|
|
idDialogConfirm :
|
|
Result := CreatePixmapIndirect(@IMGConfirmation[0], GetSysColor(COLOR_BTNFACE));
|
|
|
|
else
|
|
Result := CreatePixmapIndirect(@IMGOK_Check[0], GetSysColor(COLOR_BTNFACE));
|
|
end;
|
|
end;
|
|
|
|
function TInterfaceBase.MoveWindowOrgEx(dc : hdc; dX,dY : Integer): boolean;
|
|
var
|
|
P : TPoint;
|
|
Begin
|
|
GetWindowOrgEx(dc, @P);
|
|
Result:=SetWindowOrgEx(dc, P.x-dX, P.y-dY, @P);
|
|
end;
|
|
|
|
function TInterfaceBase.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
|
Side: integer): Boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
function TInterfaceBase.PairSplitterGetInterfaceInfo: boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
function TInterfaceBase.PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd;
|
|
Side: integer): Boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
function TInterfaceBase.PairSplitterSetPosition(SplitterHandle: hWnd;
|
|
var NewPosition: integer): Boolean;
|
|
begin
|
|
Result:=false;
|
|
end;
|
|
|
|
Function TInterfaceBase.PromptUser(const DialogCaption, DialogMessage : String;
|
|
DialogType : longint; Buttons : PLongint;
|
|
ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint;
|
|
begin
|
|
if PromptDialogFunction<>nil then
|
|
Result:=PromptDialogFunction(DialogCaption, DialogMessage, DialogType,
|
|
Buttons, ButtonCount, DefaultIndex, EscapeResult, true, 0, 0)
|
|
else
|
|
Result:=0;
|
|
end;
|
|
|
|
function TInterfaceBase.PromptUserAtXY(const DialogCaption,
|
|
DialogMessage : String;
|
|
DialogType : longint; Buttons : PLongint;
|
|
ButtonCount, DefaultIndex, EscapeResult : Longint;
|
|
X, Y : Longint) : Longint;
|
|
begin
|
|
if PromptDialogFunction<>nil then
|
|
Result:=PromptDialogFunction(DialogCaption, DialogMessage, DialogType,
|
|
Buttons, ButtonCount, DefaultIndex, EscapeResult, false, X, Y)
|
|
else
|
|
Result:=0;
|
|
end;
|
|
|
|
function TInterfaceBase.RadialArc(DC: HDC;
|
|
x,y,width,height,sx,sy,ex,ey : Integer): Boolean;
|
|
var
|
|
A1, A2 : Extended;
|
|
begin
|
|
Coords2Angles(x,y,width,height,sx,sy,ex,ey,A1,A2);
|
|
Result := Arc(DC, X, Y, Width, Height, RoundToInt(A1), RoundToInt(A2));
|
|
end;
|
|
|
|
function TInterfaceBase.RadialChord(DC: HDC;
|
|
x,y,width,height,sx,sy,ex,ey : Integer): Boolean;
|
|
var
|
|
A1, A2 : Extended;
|
|
Begin
|
|
Coords2Angles(x,y,width,height,sx,sy,ex,ey,A1,A2);
|
|
Result := AngleChord(DC, X, Y, Width, Height, RoundToInt(A1), RoundToInt(A2));
|
|
End;
|
|
|
|
function TInterfaceBase.RadialPie(DC: HDC; x,y,width,height,sx,sy,ex,ey : Integer): Boolean;
|
|
var
|
|
A1, A2 : Extended;
|
|
begin
|
|
Coords2Angles(x,y,width,height,sx,sy,ex,ey,A1,A2);
|
|
Result := RadialPieWithAngles(DC, X, Y, Width, Height,
|
|
RoundToInt(A1), RoundToInt(A2));
|
|
end;
|
|
|
|
function TInterfaceBase.RadialPieWithAngles(DC: HDC; X,Y,Width,Height,
|
|
Angle1, Angle2: Integer): Boolean;
|
|
var
|
|
Points : PPoint;
|
|
Count : Longint;
|
|
begin
|
|
Result := False;
|
|
Points := nil;
|
|
Count := 0;
|
|
PolyBezierArcPoints(X,Y,Width,Height,Angle1, Angle2, 0, Points, Count);
|
|
Inc(Count,2);
|
|
ReallocMem(Points, Count*SizeOf(TPoint));
|
|
Points[Count - 2] := CenterPoint(Rect(X,Y,X+Width,Y+Height));
|
|
Points[Count - 1] := Points[0];
|
|
Polygon(DC, Points, Count, True);
|
|
ReallocMem(Points, 0);
|
|
Result := True;
|
|
end;
|
|
|
|
function TInterfaceBase.RadioMenuItemGroup(hndMenu: HMENU; bRadio: Boolean): Boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.RegroupMenuItem(hndMenu: HMENU; GroupIndex: Integer) : Boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.ReleaseDesignerDC(hWnd: HWND; DC: HDC): Integer;
|
|
begin
|
|
Result := ReleaseDC(hWnd, DC);
|
|
end;
|
|
|
|
function TInterfaceBase.RequestInput(const InputCaption, InputPrompt : String;
|
|
MaskInput : Boolean; var Value : String) : Boolean;
|
|
begin
|
|
if InputDialogFunction<>nil then
|
|
Result := InputDialogFunction(InputCaption, InputPrompt, MaskInput, Value)
|
|
else
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.RightJustifyMenuItem(HndMenu: HMenu;
|
|
bRightJustify: boolean): Boolean;
|
|
begin
|
|
Result := False;
|
|
end;
|
|
|
|
procedure TInterfaceBase.SendCachedLCLMessages;
|
|
begin
|
|
end;
|
|
|
|
function TInterfaceBase.SetCaretRespondToFocus(Handle: HWnd;
|
|
ShowHideOnFocus: Boolean): Boolean;
|
|
begin
|
|
Result := False;
|
|
end;
|
|
|
|
function TInterfaceBase.SetComboMinDropDownSize(Handle: HWND;
|
|
MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean;
|
|
begin
|
|
Result := false;
|
|
end;
|
|
|
|
function TInterfaceBase.StretchMaskBlt(DestDC: HDC;
|
|
X, Y, Width, Height: Integer; SrcDC: HDC;
|
|
XSrc, YSrc, SrcWidth, SrcHeight: Integer;
|
|
Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean;
|
|
begin
|
|
Result := False;
|
|
end;
|
|
|
|
//##apiwiz##eps## // Do not remove
|
|
{ =============================================================================
|
|
|
|
$Log$
|
|
Revision 1.6 2003/12/25 14:17:07 mattias
|
|
fixed many range check warnings
|
|
|
|
Revision 1.5 2003/11/27 23:02:30 mattias
|
|
removed menutype.pas
|
|
|
|
Revision 1.4 2003/11/26 21:30:19 mattias
|
|
reduced unit circles, fixed fpImage streaming
|
|
|
|
Revision 1.3 2003/11/26 00:23:47 marc
|
|
* implemented new LCL(check|enable)Menuitem functions
|
|
* introduced the lclintf inc files to win32
|
|
|
|
Revision 1.2 2003/11/25 14:21:28 micha
|
|
new api lclenable,checkmenuitem according to list
|
|
|
|
Revision 1.1 2003/11/24 11:03:07 marc
|
|
* Splitted winapi*.inc into a winapi and a lcl interface communication part
|
|
|
|
}
|