From df5611a7ff26d05aaaa96ec819827223b8cc8c4f Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Tue, 8 Nov 2011 13:44:32 +0000 Subject: [PATCH] customdrawws: Adds a skeleton for X11 git-svn-id: trunk@33416 - --- .gitattributes | 2 + .../customdrawn/customdrawnobject_x11.inc | 266 ++++++++++++++++++ .../customdrawn/customdrawnwsforms.pp | 5 +- .../customdrawn/customdrawnwsforms_win.inc | 2 +- .../customdrawn/customdrawnwsforms_x11.inc | 49 ++++ lcl/interfaces/lcl.lpk | 14 +- 6 files changed, 334 insertions(+), 4 deletions(-) create mode 100644 lcl/interfaces/customdrawn/customdrawnobject_x11.inc create mode 100644 lcl/interfaces/customdrawn/customdrawnwsforms_x11.inc diff --git a/.gitattributes b/.gitattributes index e44cae1212..74bdc59aef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5407,12 +5407,14 @@ lcl/interfaces/customdrawn/customdrawnint.pas svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnobject.inc svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnobject_cocoa.inc svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnobject_win.inc svneol=native#text/pascal +lcl/interfaces/customdrawn/customdrawnobject_x11.inc svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnwscontrols.pp svneol=native#text/plain lcl/interfaces/customdrawn/customdrawnwscontrols_win.inc svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnwsfactory.pas svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnwsforms.pp svneol=native#text/plain lcl/interfaces/customdrawn/customdrawnwsforms_cocoa.inc svneol=native#text/pascal lcl/interfaces/customdrawn/customdrawnwsforms_win.inc svneol=native#text/pascal +lcl/interfaces/customdrawn/customdrawnwsforms_x11.inc svneol=native#text/pascal lcl/interfaces/customdrawn/interfaces.pas svneol=native#text/pascal lcl/interfaces/customdrawn/wincallback.inc svneol=native#text/pascal lcl/interfaces/customdrawn/winproc.pas svneol=native#text/pascal diff --git a/lcl/interfaces/customdrawn/customdrawnobject_x11.inc b/lcl/interfaces/customdrawn/customdrawnobject_x11.inc new file mode 100644 index 0000000000..e56e52efca --- /dev/null +++ b/lcl/interfaces/customdrawn/customdrawnobject_x11.inc @@ -0,0 +1,266 @@ +{%MainUnit customdrawnint.pas} + +{****************************************************************************** + customdrawnobject_win.inc + ****************************************************************************** + + ***************************************************************************** + * * + * This file is part of the Lazarus Component Library (LCL) * + * * + * See the file COPYING.modifiedLGPL.txt, 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. * + * * + ***************************************************************************** +} + +{------------------------------------------------------------------------------ + Method: TCDWidgetSet.Create + Params: None + Returns: Nothing + + Constructor for the class. + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.BackendCreate; +begin +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.Destroy + Params: None + Returns: Nothing + + destructor for the class. + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.BackendDestroy; +begin +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppInit + Params: None + Returns: Nothing + + initialize Windows + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.AppInit(var ScreenInfo: TScreenInfo); +begin + {$ifdef VerboseWinCE} +// DebugLn('TWinCEWidgetSet.AppInit'); + {$endif} + +end; + +procedure TCDWidgetSet.AppRun(const ALoop: TApplicationMainLoop); +begin +end; + +(* +function TWinCEWidgetSet.GetAppHandle: THandle; +begin + Result:= FAppHandle; +end; + +procedure TWinCEWidgetSet.SetAppHandle(const AValue: THandle); +begin + // Do it only if handle is not yet created (for example for DLL initialization) + // if handle is already created we can't reassign it + if AppHandle = 0 then + FAppHandle := AValue; +end;*) + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppMinimize + Params: None + Returns: Nothing + + Minimizes the whole application to the taskbar + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.AppMinimize; +begin +// Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0); +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppRestore + Params: None + Returns: Nothing + + Restore minimized whole application from taskbar + ------------------------------------------------------------------------------} + +procedure TCDWidgetSet.AppRestore; +begin +// Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_RESTORE, 0); +end; + + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppBringToFront + Params: None + Returns: Nothing + + Brings the entire application on top of all other non-topmost programs + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.AppBringToFront; +begin +end; + +(* +procedure TWinCEWidgetSet.SetDesigning(AComponent: TComponent); +begin + //if Data<>nil then EnableWindow((AComponent As TWinControl).Handle, boolean(Data^)); +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.SetCallback + Params: Msg - message for which to set a callback + Sender - object to which callback will be sent + Returns: nothing + + Applies a Message to the sender + ------------------------------------------------------------------------------} +procedure TWinCEWidgetSet.SetCallback(Msg: LongInt; Sender: TObject); +var + Window: HWnd; +begin + //DebugLn('Trace:TWinCEWidgetSet.SetCallback - Start'); + //DebugLn(Format('Trace:TWinCEWidgetSet.SetCallback - Class Name --> %S', [Sender.ClassName])); + //DebugLn(Format('Trace:TWinCEWidgetSet.SetCallback - Message Name --> %S', [GetMessageName(Msg)])); + if Sender Is TControlCanvas then + Window := TControlCanvas(Sender).Handle + else if Sender Is TCustomForm then + Window := TCustomForm(Sender).Handle + else + Window := TWinControl(Sender).Handle; + if Window=0 then exit; + + //DebugLn('Trace:TWinCEWidgetSet.SetCallback - Exit'); +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.RemoveCallbacks + Params: Sender - object from which to remove callbacks + Returns: nothing + + Removes Call Back Signals from the sender + ------------------------------------------------------------------------------} +procedure TWinCEWidgetSet.RemoveCallbacks(Sender: TObject); +var + Window: HWnd; +begin + if Sender Is TControlCanvas then + Window := TControlCanvas(Sender).Handle + else if Sender Is TCustomForm then + Window := TCustomForm(Sender).Handle + else + Window := (Sender as TWinControl).Handle; + if Window=0 then exit; +end;*) + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppProcessMessages + Params: None + Returns: Nothing + + Handle all pending messages + ------------------------------------------------------------------------------} +procedure TCDWidgetSet.AppProcessMessages; +begin +end; +(* +procedure TWinCEWidgetSet.CheckPipeEvents; +var + lHandler: PPipeEventInfo; +// lBytesAvail: dword; +// SomethingChanged: Boolean; + ChangedCount:integer; +begin + lHandler := FWaitPipeHandlers; + ChangedCount := 0; + while (lHandler <> nil) and (ChangedCount < 10) do + begin + { + roozbeh : ooops not supported + SomethingChanged:=true; + if Windows.PeekNamedPipe(lHandler^.Handle, nil, 0, nil, @lBytesAvail, nil) then + begin + if lBytesAvail <> 0 then + lHandler^.OnEvent(lHandler^.UserData, [prDataAvailable]) + else + SomethingChanged := false; + end else + lHandler^.OnEvent(lHandler^.UserData, [prBroken]); + if SomethingChanged then + lHandler := FWaitPipeHandlers + else begin + lHandler := lHandler^.Next; + ChangedCount := 0; + end; + inc(ChangedCount);} + end; +end;*) + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppWaitMessage + Params: None + Returns: Nothing + + Passes execution control to Windows + ------------------------------------------------------------------------------} +//roozbeh:new update...whole procedure body is added.what is it? +procedure TCDWidgetSet.AppWaitMessage; +begin +end; + +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppTerminate + Params: None + Returns: Nothing + + Tells Windows to halt and destroy + ------------------------------------------------------------------------------} + +procedure TCDWidgetSet.AppTerminate; +begin + //DebugLn('Trace:TWinCEWidgetSet.AppTerminate - Start'); +end; + + +procedure TCDWidgetSet.AppSetTitle(const ATitle: string); +begin +end; + +{------------------------------------------------------------------------------ + function: CreateTimer + Params: Interval: + TimerFunc: Callback + Returns: a Timer id (use this ID to destroy timer) + + Design: A timer which calls TimerCallBackProc, is created. + The TimerCallBackProc calls the TimerFunc. + ------------------------------------------------------------------------------} +function TCDWidgetSet.CreateTimer(Interval: integer; TimerFunc: TWSTimerProc) : THandle; +begin +end; + +{------------------------------------------------------------------------------ + function: DestroyTimer + Params: TimerHandle + Returns: + ------------------------------------------------------------------------------} +function TCDWidgetSet.DestroyTimer(TimerHandle: THandle) : boolean; +begin +end; +(* +procedure TWinCEWidgetSet.HandleWakeMainThread(Sender: TObject); +begin + // wake up GUI thread by sending a message to it + Windows.PostMessage(AppHandle, WM_NULL, 0, 0); +end; +*) + diff --git a/lcl/interfaces/customdrawn/customdrawnwsforms.pp b/lcl/interfaces/customdrawn/customdrawnwsforms.pp index d144b87d86..da432736fc 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsforms.pp +++ b/lcl/interfaces/customdrawn/customdrawnwsforms.pp @@ -86,7 +86,7 @@ type class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override; - {$ifdef CD_Windows} + {$if defined(CD_Windows) or defined(CD_X11)} class procedure SetBorderIcons(const AForm: TCustomForm; const ABorderIcons: TBorderIcons); override; class procedure SetFormBorderStyle(const AForm: TCustomForm; @@ -155,5 +155,8 @@ implementation {$ifdef CD_Cocoa} {$include customdrawnwsforms_cocoa.inc} {$endif} +{$ifdef CD_X11} + {$include customdrawnwsforms_x11.inc} +{$endif} end. diff --git a/lcl/interfaces/customdrawn/customdrawnwsforms_win.inc b/lcl/interfaces/customdrawn/customdrawnwsforms_win.inc index ee5e3f2bb9..64b34e6d01 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsforms_win.inc +++ b/lcl/interfaces/customdrawn/customdrawnwsforms_win.inc @@ -67,7 +67,7 @@ end; Creates a Windows CE Form, initializes it according to it´s properties and shows it ------------------------------------------------------------------------------} class function TCDWSCustomForm.CreateHandle(const AWinControl: TWinControl; - const AParams: TCreateParams): HWND; + const AParams: TCreateParams): TLCLIntfHandle; var Params: TCreateWindowExParams; LForm : TCustomForm; diff --git a/lcl/interfaces/customdrawn/customdrawnwsforms_x11.inc b/lcl/interfaces/customdrawn/customdrawnwsforms_x11.inc new file mode 100644 index 0000000000..8cf0c143fb --- /dev/null +++ b/lcl/interfaces/customdrawn/customdrawnwsforms_x11.inc @@ -0,0 +1,49 @@ +{$MainForm customdrawnwsforms.pp} + +{ TCDWSCustomForm } + +{------------------------------------------------------------------------------ + Method: TCDWSCustomForm.CreateHandle + Params: None + Returns: Nothing + + Creates a Windows CE Form, initializes it according to it´s properties and shows it + ------------------------------------------------------------------------------} +class function TCDWSCustomForm.CreateHandle(const AWinControl: TWinControl; + const AParams: TCreateParams): TLCLIntfHandle; +begin +end; + +class procedure TCDWSCustomForm.SetBorderIcons(const AForm: TCustomForm; + const ABorderIcons: TBorderIcons); +begin +end; + +class procedure TCDWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm; + const AFormBorderStyle: TFormBorderStyle); +begin + RecreateWnd(AForm); +end; + +class procedure TCDWSCustomForm.SetBounds(const AWinControl: TWinControl; + const ALeft, ATop, AWidth, AHeight: Integer); +begin +end; + +class procedure TCDWSCustomForm.SetIcon(const AForm: TCustomForm; const Small, Big: HICON); +begin +end; + +class procedure TCDWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm; + const AValue: TShowInTaskbar); +begin +end; + +class procedure TCDWSCustomForm.ShowModal(const ACustomForm: TCustomForm); +begin +end; + +class procedure TCDWSCustomForm.ShowHide(const AWinControl: TWinControl); +begin +end; + diff --git a/lcl/interfaces/lcl.lpk b/lcl/interfaces/lcl.lpk index 741385bde8..e53cc26b79 100644 --- a/lcl/interfaces/lcl.lpk +++ b/lcl/interfaces/lcl.lpk @@ -85,7 +85,7 @@ end;"/> - + @@ -110,7 +110,7 @@ end;"/> - + @@ -1803,11 +1803,21 @@ end;"/> + + + + + + + + + +