summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/palmunits/src/textservicesmgr.pp
blob: 61d6677db70082167c28866d7738367a1e3b149c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{$MACRO ON}
(******************************************************************************
 *
 * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: TextServicesMgr.h
 *
 * Release: Palm OS SDK 4.0 (63220)
 *
 * Description:
 *    Header file for Text Services Manager. This provides the caller with
 *    an API for interacting with various text services, including front-end
 *    processors (FEPs), which are sometimes known as input methods.
 *
 * History:
 *    03/05/98 kwk   Created by Ken Krugler.
 *    02/03/99 kwk   Changed name to TextServicesMgr.h, was TextServices.h.
 *    10/20/99 kwk   Moved private stuff into TextServicesPrv.h
 *    04/19/00 kwk   Use portable typedef for TsmSelector and TsmFepModeType.
 *                   Fixed up descriptions for TsmGet/SetFepMode. Added new
 *                   selectors for TsmInit, TsmDrawMode, TsmFepHandleEvent,
 *                   TsmFepTerminate, and TsmFepCommit.
 *    07/06/00 kwk   Set type of unused status ptr param to be void*, and
 *                   moved TsmFepStatusType into the private header file.
 *    08/21/00 kwk   Moved tsmFtrCreator here from TextServicesPrv.h.
 *                   Added tsmFtrNumFlags, tsmFtrFlagsHasFep.
 *    11/15/00 kwk   Added tsmGet/SetSystemFep, tsmGet/SetCurrentFep selectors.
 *
 *****************************************************************************)

unit textservicesmgr;

interface

uses palmos, coretraps, systemresources;

(***********************************************************************
 * Public constants
 ***********************************************************************)

// Feature Creators and numbers, for use with the FtrGet() call.
const
  tsmFtrCreator = sysFileCTextServices;

// Selector used with call to FtrGet(tsmFtrCreator, xxx) to get the
// Text Services Manager flags.
  tsmFtrNumFlags = 0;

// Flags returned by FtrGet(tsmFtrCreator, tsmFtrNumFlags) call.
  tsmFtrFlagsHasFep = $1; // Bit set if FEP is installed.

// Selectors for routines found in the Text Services manager. The order
// of these selectors MUST match the jump table in TextServicesMgr.c.
type
  TsmSelector = UInt16;

const
  tsmGetFepMode_    = 0;
  tsmSetFepMode_    = 1;
  tsmHandleEvent    = 2;
  tsmInit           = 3; // new in 4.0
  tsmDrawMode       = 4; // new in 4.0
  tsmGetSystemFep   = 5; // new in 4.0
  tsmSetSystemFep   = 6; // new in 4.0
  tsmGetCurrentFep  = 7; // new in 4.0
  tsmSetCurrentFep  = 8; // new in 4.0

  tsmMaxSelector    = tsmSetCurrentFep;

// Input mode - used with TsmGet/SetFepMode.
type
  TsmFepModeType = UInt16;

const
  tsmFepModeDefault = TsmFepModeType(0);
  tsmFepModeOff     = TsmFepModeType(1);
  tsmFepModeCustom  = TsmFepModeType(128);

(***********************************************************************
 * Public types
 ***********************************************************************)

(***********************************************************************
 * Public routines
 ***********************************************************************)

// Return the current mode for the active FEP. The <nullParam> parameter
// is unused and must be set to NULL.
function TsmGetFepMode(nullParam: Pointer): TsmFepModeType;

// Set the mode for the active FEP to be <inNewMode>. The previous mode
// is returned. The <nullParam> parameter is unused and must be set
// to NULL.
function TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType;

implementation

function __TsmGetFepMode(nullParam: Pointer): TsmFepModeType; syscall sysTrapTsmDispatch;
function __TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType; syscall sysTrapTsmDispatch;

function TsmGetFepMode(nullParam: Pointer): TsmFepModeType;
begin
 asm
  move.l #$tsmGetFepMode_, D2;
 end;
 TsmGetFepMode := __TsmGetFepMode(nullParam);
end;

function TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType;
begin
 asm
  move.l #$tsmSetFepMode_, D2;
 end;
 TsmSetFepMode := __TsmSetFepMode(nullParam, inNewMode);
end;

end.