spiegel-keyman/windows/src/engine/kmcomapi/keymancontext.pas
Marc Durdin b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00

112 lines
2.8 KiB
ObjectPascal

(*
Name: keymancontext
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 1 Aug 2006
Modified Date: 12 Mar 2010
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 01 Aug 2006 - mcdurdin - Add Control property
27 Mar 2008 - mcdurdin - Add Languages and Options access
12 Mar 2010 - mcdurdin - I2230 - Resolve crashes due to incorrect reference counting
*)
unit keymancontext;
interface
uses
comobj,
keymanapi_tlb,
internalinterfaces,
utilkeymancontrol;
type
TKeymanContext = class
private
FKeyman: TObject;
FController: TKeymanController;
function GetErrors: IIntKeymanErrors;
function GetKeyboards: IIntKeymanKeyboardsInstalled;
function GetPackages: IIntKeymanPackagesInstalled;
function GetSystemInfo: IIntKeymanSystemInfo;
function GetControl: IIntKeymanControl;
function GetOptions: IIntKeymanOptions;
function GetLanguages: IIntKeymanLanguages;
public
constructor Create(AKeyman: TObject);
destructor Destroy; override;
property Errors: IIntKeymanErrors read GetErrors;
property Keyboards: IIntKeymanKeyboardsInstalled read GetKeyboards;
property Languages: IIntKeymanLanguages read GetLanguages;
property Options: IIntKeymanOptions read GetOptions;
property Packages: IIntKeymanPackagesInstalled read GetPackages;
property SystemInfo: IIntKeymanSystemInfo read GetSystemInfo;
property Control: IIntKeymanControl read GetControl;
property Controller: TKeymanController read FController;
end;
implementation
uses
SysUtils, keyman_implementation;
{ TKeymanContext }
constructor TKeymanContext.Create(AKeyman: TObject);
begin
inherited Create;
FKeyman := AKeyman;
FController := TKeymanController.Create(FKeyman);
end;
destructor TKeymanContext.Destroy;
begin
FreeAndNil(FController);
inherited Destroy;
end;
function TKeymanContext.GetControl: IIntKeymanControl;
begin
Result := (FKeyman as TKeyman).Control;
end;
function TKeymanContext.GetErrors: IIntKeymanErrors;
begin
Result := (FKeyman as TKeyman).Errors;
end;
function TKeymanContext.GetKeyboards: IIntKeymanKeyboardsInstalled;
begin
Result := (FKeyman as TKeyman).Keyboards;
end;
function TKeymanContext.GetLanguages: IIntKeymanLanguages;
begin
Result := (FKeyman as TKeyman).Languages;
end;
function TKeymanContext.GetOptions: IIntKeymanOptions;
begin
Result := (FKeyman as TKeyman).Options;
end;
function TKeymanContext.GetPackages: IIntKeymanPackagesInstalled;
begin
Result := (FKeyman as TKeyman).Packages;
end;
function TKeymanContext.GetSystemInfo: IIntKeymanSystemInfo;
begin
Result := (FKeyman as TKeyman).SystemInfo;
end;
end.