Starts Accessibility API structure and adds a routine to detect if we are on a mobile platform

git-svn-id: trunk@34656 -
This commit is contained in:
sekelsenmat 2012-01-08 10:05:55 +00:00
parent fd126d3ed6
commit 45beb7cd01
13 changed files with 113 additions and 8 deletions

View File

@ -1211,7 +1211,9 @@ type
atPDA, // For smartphones and other devices with touch screen and a small screen atPDA, // For smartphones and other devices with touch screen and a small screen
atKeyPadDevice,// Devices without any pointing device, such as keypad feature phones or kiosk machines atKeyPadDevice,// Devices without any pointing device, such as keypad feature phones or kiosk machines
atTablet, // Similar to a PDA/Smartphone, but with a large screen atTablet, // Similar to a PDA/Smartphone, but with a large screen
atTV // The device is a television atTV, // The device is a television
atMobileEmulator// For desktop platforms. It will create a main windows of 240x320
// and place all forms there to immitate a mobile platform
); );
TApplicationShowGlyphs = ( TApplicationShowGlyphs = (

View File

@ -517,6 +517,23 @@ begin
Result := False; Result := False;
end; end;
function TWidgetSet.IsMobilePlatform: Boolean;
begin
Result := False;
// A good default would be: Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
// But Forms is not in the uses clause
end;
procedure TWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
end;
procedure TWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
end;
procedure TWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure TWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
begin begin

View File

@ -350,6 +350,22 @@ begin
Result := WidgetSet.IsDesignerDC(WindowHandle, DC); Result := WidgetSet.IsDesignerDC(WindowHandle, DC);
end; end;
// Indicates of we have fullscreen-only forms like in a mobile platform
function IsMobilePlatform: Boolean;
begin
Result := WidgetSet.IsMobilePlatform();
end;
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
WidgetSet.LazAccessibility_SendTextChangedNotification(ANewText);
end;
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
WidgetSet.LazAccessibility_SendSelectionChangedNotification(ASelStart, ASelEnd);
end;
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
begin begin
Widgetset.LazDeviceAPIs_RequestPositionInfo(AMethod); Widgetset.LazDeviceAPIs_RequestPositionInfo(AMethod);

View File

@ -92,7 +92,10 @@ function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boole
function IntfSendsUTF8KeyPress: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} deprecated; 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 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} function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function IsMobilePlatform: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); {$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_SendMessage(AMsg: TLazDeviceMessage); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazDeviceAPIs_StartReadingAccelerometerData(); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} procedure LazDeviceAPIs_StartReadingAccelerometerData(); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -163,8 +163,7 @@ type
// Default Fonts // Default Fonts
DefaultFont: TFPCustomFont; DefaultFont: TFPCustomFont;
DefaultFontAndroidSize: Integer; DefaultFontAndroidSize: Integer;
// Mobile emulator // Mobile emulator and mobile mode
MobileMode: Boolean;
MobileMainForm: TLCLIntfHandle; MobileMainForm: TLCLIntfHandle;
// For unusual implementations of DebugLn/DebugOut // For unusual implementations of DebugLn/DebugOut
procedure AccumulatingDebugOut(AStr: string); procedure AccumulatingDebugOut(AStr: string);

View File

@ -163,6 +163,21 @@ begin
javaEnvRef^^.CallVoidMethod(javaEnvRef, javaActivityObject, javaMethod_LCLDoHideVirtualKeyboard); javaEnvRef^^.CallVoidMethod(javaEnvRef, javaActivityObject, javaMethod_LCLDoHideVirtualKeyboard);
end; end;
function TCDWidgetSet.IsMobilePlatform: Boolean;
begin
Result := True;
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
end;
procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
var var
lPositionMethod: jint; lPositionMethod: jint;

View File

@ -113,6 +113,21 @@ begin
end; end;
function TCDWidgetSet.IsMobilePlatform: Boolean;
begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
end;
procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
begin begin

View File

@ -114,6 +114,21 @@ begin
end; end;
function TCDWidgetSet.IsMobilePlatform: Boolean;
begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
end;
procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
begin begin

View File

@ -114,6 +114,21 @@ begin
end; end;
function TCDWidgetSet.IsMobilePlatform: Boolean;
begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
begin
end;
procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); procedure TCDWidgetSet.LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);
begin begin

View File

@ -55,7 +55,10 @@ procedure HideVirtualKeyboard();
(*function IntfSendsUTF8KeyPress: boolean; override; (*function IntfSendsUTF8KeyPress: boolean; override;
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*) function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*)
function IsMobilePlatform: Boolean; override;
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string); override;
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer); override;
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); override; procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); override;
procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); override; procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); override;
procedure LazDeviceAPIs_StartReadingAccelerometerData(); override; procedure LazDeviceAPIs_StartReadingAccelerometerData(); override;

View File

@ -39,8 +39,6 @@ begin
if Application.ApplicationType = atDefault then if Application.ApplicationType = atDefault then
Application.ApplicationType := atDesktop; Application.ApplicationType := atDesktop;
MobileMode := Application.ApplicationType in [atPDA, atKeyPadDevice];
if Application.LayoutAdjustmentPolicy = lapDefault then if Application.LayoutAdjustmentPolicy = lapDefault then
Application.LayoutAdjustmentPolicy := lapFixedLayout; Application.LayoutAdjustmentPolicy := lapFixedLayout;
@ -63,7 +61,7 @@ begin
DebugLn('TCDWidgetSet.AppRun'); DebugLn('TCDWidgetSet.AppRun');
{$ENDIF} {$ENDIF}
if MobileMode and (Application.MainForm <> nil) then if LCLIntf.IsMobilePlatform() and (Application.MainForm <> nil) then
TCDWSCustomForm.DoShowHide(Application.MainForm); TCDWSCustomForm.DoShowHide(Application.MainForm);
{ Enters main message loop } { Enters main message loop }

View File

@ -24,7 +24,8 @@ begin
winhandle := TCocoaWindow.Create; winhandle := TCocoaWindow.Create;
winhandle.LCLForm := TCustomForm(AWinControl); winhandle.LCLForm := TCustomForm(AWinControl);
if CDWidgetset.MobileMode then lRect := GetNSRect(200, 200, 240, 320) if Application.ApplicationType = atMobileEmulator then lRect := GetNSRect(200, 200, 240, 320)
// else ToDo: for atPDA make it fullscreen
else lRect := CreateParamsToNSRect(AParams); else lRect := CreateParamsToNSRect(AParams);
win:=TCocoaForm(win.initWithContentRect_styleMask_backing_defer(lRect, WinMask, NSBackingStoreBuffered, False)); win:=TCocoaForm(win.initWithContentRect_styleMask_backing_defer(lRect, WinMask, NSBackingStoreBuffered, False));
win.WindowHandle := winhandle; win.WindowHandle := winhandle;
@ -66,7 +67,7 @@ end;
class function TCDWSCustomForm.CreateHandle(const AWinControl: TWinControl; class function TCDWSCustomForm.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle; const AParams: TCreateParams): TLCLIntfHandle;
begin begin
if CDWidgetset.MobileMode then if LCLIntf.IsMobilePlatform() then
begin begin
Result := TLCLIntfhandle(AddNewForm(TCustomForm(AWinControl))); Result := TLCLIntfhandle(AddNewForm(TCustomForm(AWinControl)));
if AWinControl = Application.MainForm then if AWinControl = Application.MainForm then

View File

@ -63,6 +63,10 @@ type
{ TLazMessaging } { TLazMessaging }
TLazDeviceMessageKind = LCLType.TLazDeviceMessageKind;
TLazDeviceMessage = LCLType.TLazDeviceMessage;
TLazMessaging = class TLazMessaging = class
private private
FOnMessagingStatus: TOnMessagingStatus; FOnMessagingStatus: TOnMessagingStatus;
@ -81,6 +85,8 @@ type
// TLazPositionInfo // TLazPositionInfo
TLazPositionMethod = LCLType.TLazPositionMethod;
TLazPositionInfo = class TLazPositionInfo = class
private private
FOnPositionRetrieved: TNotifyEvent; FOnPositionRetrieved: TNotifyEvent;