diff --git a/lcl/include/intfbaselcl.inc b/lcl/include/intfbaselcl.inc index 7822df2ed0..5b7bd5d47a 100644 --- a/lcl/include/intfbaselcl.inc +++ b/lcl/include/intfbaselcl.inc @@ -517,6 +517,21 @@ begin Result := False; end; +procedure TWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); +begin + +end; + +procedure TWidgetSet.LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); +begin + +end; + +procedure TWidgetSet.LazDeviceAPIs_UpdateAccelerometerData(); +begin + +end; + function TWidgetSet.MoveWindowOrgEx(dc: hdc; dX,dY: Integer): boolean; var P: TPoint; diff --git a/lcl/include/lclintf.inc b/lcl/include/lclintf.inc index fba9751d82..ae77741320 100644 --- a/lcl/include/lclintf.inc +++ b/lcl/include/lclintf.inc @@ -350,6 +350,21 @@ begin Result := WidgetSet.IsDesignerDC(WindowHandle, DC); end; +procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); +begin + Widgetset.LazDeviceAPIs_RequestPositionInfo(AMethod); +end; + +procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); +begin + Widgetset.LazDeviceAPIs_SendMessage(AMsg); +end; + +procedure LazDeviceAPIs_UpdateAccelerometerData(); +begin + Widgetset.LazDeviceAPIs_UpdateAccelerometerData(); +end; + function MoveWindowOrgEx(dc: hdc; dX,dY: Integer): boolean; begin Result := WidgetSet.MoveWindowOrgEx(DC, dX, dY); diff --git a/lcl/include/lclintfh.inc b/lcl/include/lclintfh.inc index d6cde11caf..7101bd1ac4 100644 --- a/lcl/include/lclintfh.inc +++ b/lcl/include/lclintfh.inc @@ -91,9 +91,12 @@ function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boole function IntfSendsUTF8KeyPress: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} deprecated; function InvalidateFrame(aHandle : HWND; ARect : pRect; bErase : Boolean; BorderWidth: integer) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} - function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} +procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} +procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} +procedure LazDeviceAPIs_UpdateAccelerometerData(); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} + function MoveWindowOrgEx(dc : hdc; dX,dY : Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function PromptUser(const DialogCaption, DialogMessage : String; DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} diff --git a/lcl/lazdeviceapis.pas b/lcl/lazdeviceapis.pas index 92c7de20cc..dc010f4fbe 100644 --- a/lcl/lazdeviceapis.pas +++ b/lcl/lazdeviceapis.pas @@ -46,32 +46,6 @@ type // TLazMessaging - TLazDeviceMessageKind = (dmkSMS, dmkMMS, dmkEMail); - - { TLazDeviceMessage } - - TLazDeviceMessage = class - public - Kind: TLazDeviceMessageKind; - // The commends indicate in which message kind each field is available - // in this order: SMS MMS EMail - //bccAddress N N Y - Body: string; // Y Y Y - {callbackNumber Y N N - ccAddress N N Y} - destinationAddress: TstringList; // Y Y Y - {isRead Y Y Y - messageId Y Y Y - messagePriority Y Y Y - messageType Y Y Y - sourceAddress Y Y Y - Subject N Y Y - Time Y Y Y - validityPeriodHours Y N N} - constructor Create; virtual; - destructor Destroy; override; - end; - TLazMessageSendingStatus = (mssSuccess, mssGeneralError); TOnMessageSendingFinished = procedure (AMessage: TLazDeviceMessage; @@ -84,7 +58,7 @@ type FTOnMessageSendingFinished: TOnMessageSendingFinished; public // Attempt to send the specified message. - procedure sendMessage(AMsg: TLazDeviceMessage); + procedure SendMessage(AMsg: TLazDeviceMessage); // Called asynchronously when the message sending is finished property OnMessageSendingFinished: TOnMessageSendingFinished read FTOnMessageSendingFinished write FTOnMessageSendingFinished; @@ -92,8 +66,6 @@ type // TLazPositionInfo - TLazPositionMethod = (pmCellID, pmGPS, pmAGPS); - TOnPositionRetrieved = procedure of object; TLazPositionInfo = class @@ -125,35 +97,21 @@ implementation procedure TLazAccelerometer.UpdateAccelerometerData; begin - //LCLIntf.UpdateAccelerometerData(Self); + LCLIntf.LazDeviceAPIs_UpdateAccelerometerData(); end; { TLazPositionInfo } procedure TLazPositionInfo.RequestPositionInfo(AMethod: TLazPositionMethod); begin - -end; - -{ TLazDeviceMessage } - -constructor TLazDeviceMessage.Create; -begin - inherited Create; - destinationAddress := TStringList.Create; -end; - -destructor TLazDeviceMessage.Destroy; -begin - destinationAddress.Free; - inherited Destroy; + LCLIntf.LazDeviceAPIs_RequestPositionInfo(AMethod); end; { TLazMessaging } -procedure TLazMessaging.sendMessage(AMsg: TLazDeviceMessage); +procedure TLazMessaging.SendMessage(AMsg: TLazDeviceMessage); begin - //LCLIntf.LazMessaging_SendMessage(Self, AMsg); + LCLIntf.LazDeviceAPIs_SendMessage(AMsg); end; initialization diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 2da1a1bffa..e4af68d576 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -96,6 +96,46 @@ type TNativeCanvasType = (nctWindowsDC, nctLazCanvas); TNativeCanvasTypes = set of TNativeCanvasType; + // Types for LazDeviceAPIs + + TLazPositionMethodCriteria = ( + // about quality + pmcBest, // Will try the best available quality + // about price + pmcMightCostMoney, // Might choose a position method which incurs money cost + // about speed + pmFastest, + // about one should try to select a method which gives speed measures + pmMustGiveSpeed + ); + + TLazPositionMethod = set of TLazPositionMethodCriteria; + + { TLazDeviceMessage } + + TLazDeviceMessageKind = (dmkSMS, dmkMMS, dmkEMail); + + TLazDeviceMessage = class + public + // The commends indicate in which message kind each field is available + // in this order: SMS MMS EMail + bccAddress: TStringList; // N N Y + Body: string; // Y Y Y + callbackNumber: string; // Y N N + ccAddress: TstringList; // N N Y + destinationAddress: TStringList; // Y Y Y + isRead: Boolean; // Y Y Y + messageId: string; // Y Y Y + //messagePriority Y Y Y + messageType: TLazDeviceMessageKind;//Y Y Y + sourceAddress: string; // Y Y Y + Subject: string; // N Y Y + Time: TDateTime; // Y Y Y + validityPeriod:TTime; // Y N N + constructor Create; virtual; + destructor Destroy; override; + end; + {$ifndef WINDOWS} THandle = type PtrUInt; // define our own, because the SysUtils.THandle = System.THandle is a longint HANDLE = THandle; @@ -3230,6 +3270,24 @@ begin end; +{ TLazDeviceMessage } + +constructor TLazDeviceMessage.Create; +begin + inherited Create; + bccAddress := TStringList.Create; + ccAddress := TStringList.Create; + destinationAddress := TStringList.Create; +end; + +destructor TLazDeviceMessage.Destroy; +begin + bccAddress.Free; + ccAddress.Free; + destinationAddress.Free; + inherited Destroy; +end; + { TListWithEvent } procedure TListWithEvent.Notify(Ptr: Pointer; AnAction: TListNotification);