~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/interfaces/customdrawn/customdrawnint.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
 /***************************************************************************
 
3
                CustomDrawnInt.pas -  CustomDrawn Interface Object
 
4
                             -------------------
 
5
 
 
6
 ***************************************************************************/
 
7
 
 
8
 *****************************************************************************
 
9
 *                                                                           *
 
10
 *  This file is part of the Lazarus Component Library (LCL)                 *
 
11
 *                                                                           *
 
12
 *  See the file COPYING.modifiedLGPL.txt, included in this distribution,    *
 
13
 *  for details about the copyright.                                         *
 
14
 *                                                                           *
 
15
 *  This program is distributed in the hope that it will be useful,          *
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
 
18
 *                                                                           *
 
19
 *****************************************************************************
 
20
}
 
21
 
 
22
unit CustomDrawnInt;
 
23
 
 
24
{$mode objfpc}{$H+}
 
25
 
 
26
{$I customdrawndefines.inc}
 
27
 
 
28
interface
 
29
 
 
30
uses
 
31
  // RTL
 
32
  Types, Classes, SysUtils, Math,
 
33
  fpimage, fpcanvas, fpimgcanv, ctypes, dateutils,
 
34
  // XML
 
35
  XMLRead, Dom,
 
36
  // Platform specific
 
37
  {$ifdef CD_Windows}Windows, customdrawn_WinProc,{$endif}
 
38
  {$ifdef CD_Cocoa}MacOSAll, CocoaAll, customdrawn_cocoaproc, CocoaGDIObjects,{$endif}
 
39
  {$ifdef CD_X11}X, XLib, XUtil, BaseUnix, customdrawn_x11proc, contnrs,{$ifdef CD_UseNativeText}xft, fontconfig,{$endif}{$endif}
 
40
  {$ifdef CD_Android}
 
41
  customdrawn_androidproc, jni, bitmap, log, keycodes,
 
42
  {$endif}
 
43
  {$ifdef WinCE}aygshell,{$endif}
 
44
  // LazUtils
 
45
  fileutil, lazutf8,
 
46
  {$ifndef CD_UseNativeText}
 
47
  // LazFreeType
 
48
  LazFreeTypeIntfDrawer, LazFreeType, EasyLazFreeType, IniFiles,
 
49
  {$endif}
 
50
  // Widgetset
 
51
  customdrawnproc,
 
52
  // LCL
 
53
  customdrawn_common, customdrawncontrols, customdrawndrawers,
 
54
  lazcanvas, lazregions, lazdeviceapis,
 
55
  InterfaceBase,
 
56
  Controls,  Forms, lclproc, IntfGraphics, GraphType,
 
57
  LCLType, LMessages, Graphics, LCLStrConsts, Menus, LazLoggerBase;
 
58
 
 
59
type
 
60
  {$ifdef CD_Windows}
 
61
  TWinCETitlePolicy = (tpAlwaysUseOKButton, tpOKButtonOnlyOnDialogs, tpControlWithBorderIcons);
 
62
 
 
63
  PPPipeEventInfo = ^PPipeEventInfo;
 
64
  PPipeEventInfo = ^TPipeEventInfo;
 
65
  TPipeEventInfo = record
 
66
    Handle: THandle;
 
67
    UserData: PtrInt;
 
68
    OnEvent: TPipeEvent;
 
69
    Prev: PPipeEventInfo;
 
70
    Next: PPipeEventInfo;
 
71
  end;
 
72
 
 
73
  TWaitHandler = record
 
74
    ListIndex: pdword;
 
75
    UserData: PtrInt;
 
76
    OnEvent: TWaitHandleEvent;
 
77
  end;
 
78
 
 
79
  TSocketEvent = function(ASocket: THandle; Flags: dword): Integer of object;
 
80
  {$endif}
 
81
  {$ifdef CD_Cocoa}
 
82
 
 
83
  TCDTimerObject=objcclass(NSObject)
 
84
    func : TWSTimerProc;
 
85
    procedure timerEvent; message 'timerEvent';
 
86
    class function initWithFunc(afunc: TWSTimerProc): TCDTimerObject; message 'initWithFunc:';
 
87
  end;
 
88
 
 
89
  TCDAppDelegate = objcclass(NSObject, NSApplicationDelegateProtocol)
 
90
    function applicationShouldTerminate(sender: NSApplication): NSApplicationTerminateReply; message 'applicationShouldTerminate:';
 
91
  end;
 
92
  {$endif}
 
93
 
 
94
  { TLazCDCustomFont }
 
95
 
 
96
  TLazCDCustomFont = class(TFPCustomFont)
 
97
  public
 
98
    {$ifndef CD_UseNativeText}
 
99
    FTFont: TFreeTypeFont;
 
100
    {$endif}
 
101
    constructor Create; override;
 
102
    destructor Destroy; override;
 
103
  end;
 
104
 
 
105
  { TCDWidgetSet }
 
106
 
 
107
  TCDWidgetSet = class(TWidgetSet)
 
108
  private
 
109
    FTerminating: Boolean;
 
110
 
 
111
    {$ifdef CD_WINDOWS}
 
112
    // In win32 it is: The parent of all windows, represents the button of the taskbar
 
113
    // In wince it is just an invisible window, but retains the following functions:
 
114
    // * This window is also the owner of the clipboard.
 
115
    // * Assoc. windowproc also acts as handler for popup menus
 
116
    // * It is indispensable for popupmenus and thread synchronization
 
117
    FAppHandle: THandle;
 
118
 
 
119
    FMetrics: TNonClientMetrics;
 
120
    FMetricsFailed: Boolean;
 
121
 
 
122
    FStockNullBrush: HBRUSH;
 
123
    FStockBlackBrush: HBRUSH;
 
124
    FStockLtGrayBrush: HBRUSH;
 
125
    FStockGrayBrush: HBRUSH;
 
126
    FStockDkGrayBrush: HBRUSH;
 
127
    FStockWhiteBrush: HBRUSH;
 
128
 
 
129
    FStatusFont: HFONT;
 
130
    FMessageFont: HFONT;
 
131
 
 
132
    FWaitHandleCount: dword;
 
133
    FWaitHandles: array of HANDLE;
 
134
    FWaitHandlers: array of TWaitHandler;
 
135
    FWaitPipeHandlers: PPipeEventInfo;
 
136
 
 
137
    FOnAsyncSocketMsg: TSocketEvent;
 
138
 
 
139
    function WinRegister: Boolean;
 
140
    procedure CreateAppHandle;
 
141
    {$endif}
 
142
  public
 
143
    {$ifdef CD_X11}
 
144
    FDisplayName: string;
 
145
    FDisplay: PDisplay;
 
146
 
 
147
    LeaderWindow: X.TWindow;
 
148
    ClientLeaderAtom: TAtom;
 
149
 
 
150
    FWMProtocols: TAtom;          // Atom for "WM_PROTOCOLS"
 
151
    FWMDeleteWindow: TAtom;       // Atom for "WM_DELETE_WINDOW"
 
152
    FWMHints: TAtom;              // Atom for "_MOTIF_WM_HINTS"
 
153
    FWMPaint: TAtom;              // Atom for "WM_PAINT"
 
154
 
 
155
    // For composing character events
 
156
    ComposeBuffer: string;
 
157
    ComposeStatus: TStatus;
 
158
    InputMethod: xlib.PXIM;
 
159
    InputContext: PXIC;
 
160
    LastKeySym: TKeySym; // Used for KeyRelease event
 
161
    LastKey: Word;       // Used for KeyRelease event
 
162
 
 
163
    ShiftState: TShiftState; // Keeps ShiftState from X
 
164
 
 
165
    // XConnections list
 
166
    XConnections: TFPList;
 
167
    // Windows Info List
 
168
    XWindowList: TStringList;
 
169
 
 
170
    // Functions to keep track of windows needing repaint
 
171
    function CheckInvalidateWindowForX(XWIndowID: X.TWindow): Boolean;
 
172
    procedure WindowUpdated(XWIndowID: X.TWindow);
 
173
 
 
174
    function FindWindowByXID(XWindowID: X.TWindow; out AWindowInfo: TX11WindowInfo): TWinControl;
 
175
    procedure AppProcessMessage;
 
176
    procedure AppProcessInvalidates;
 
177
    function XStateToLCLState(XKeyState: cuint): TShiftState;
 
178
    {$endif}
 
179
    {$ifdef CD_Android}
 
180
    CombiningAccent: Cardinal;
 
181
    {$IFnDEF WithOldDebugln}
 
182
    procedure AndroidDebugLn(ASender: TObject; AStr: string; var AHandled: Boolean;
 
183
      Target: TLazLoggerWriteTarget; Data: Pointer);
 
184
    {$ELSE}
 
185
    procedure AndroidDebugLn(AStr: string);
 
186
    {$ENDIF}
 
187
    function AndroidKeyCodeToLCLKeyCode(AAndroidKeyCode: Integer): Word;
 
188
    {$endif}
 
189
    {$ifdef CD_Cocoa}
 
190
    pool      : NSAutoreleasePool;
 
191
    NSApp     : NSApplication;
 
192
    delegate  : TCDAppDelegate;
 
193
    ScreenBitmapContext: CGContextRef;
 
194
    {$endif}
 
195
  // For generic methods added in customdrawn
 
196
  // They are used internally in LCL-CustomDrawn, LCL app should not use them
 
197
  public
 
198
    {$ifndef CD_UseNativeText}
 
199
    // Font Path List
 
200
    FFontPaths: TstringList;
 
201
    FFontList: THashedStringList;
 
202
    // default fonts availability
 
203
    LiberationFont: Boolean;
 
204
    LuxiFont: Boolean;
 
205
    {$endif}
 
206
    //
 
207
    DefaultFontSize: Integer;
 
208
    //
 
209
    AccumulatedStr: string;
 
210
    // The currently focused control
 
211
    FocusedControl: TWinControl;
 
212
    FocusedIntfControl: TWinControl;
 
213
    // Default Fonts
 
214
    DefaultFont: TFPCustomFont;
 
215
    DefaultFontAndroidSize: Integer;
 
216
    // Mobile emulator and mobile mode
 
217
    MobileMainForm: TLCLIntfHandle;
 
218
    // For unusual implementations of DebugLn/DebugOut
 
219
    {$IFnDEF WithOldDebugln}
 
220
    procedure AccumulatingDebugOut(ASender: TObject; AStr: string; var AHandled: Boolean;
 
221
      Target: TLazLoggerWriteTarget; Data: Pointer);
 
222
    {$ELSE}
 
223
    procedure AccumulatingDebugOut(AStr: string);
 
224
    {$ENDIF}
 
225
    //
 
226
    procedure CDSetFocusToControl(ALCLControl, AIntfControl: TWinControl);
 
227
  //
 
228
  protected
 
229
    {function CreateThemeServices: TThemeServices; override;}
 
230
    function GetAppHandle: THandle; override; //BackendSpecific
 
231
    //procedure SetAppHandle(const AValue: THandle); override;
 
232
    //
 
233
    procedure BackendCreate;
 
234
    procedure BackendDestroy;
 
235
    //
 
236
    procedure GenericAppInit;
 
237
  public
 
238
    // ScreenDC and Image for doing Canvas operations outside the Paint event
 
239
    // and also for text drawing operations
 
240
    ScreenDC: TLazCanvas;
 
241
    ScreenBitmapRawImage: TRawImage;
 
242
    ScreenBitmapHeight: Integer;
 
243
    ScreenBitmapWidth: Integer;
 
244
    ScreenImage: TLazIntfImage;
 
245
 
 
246
    // Android Activity callbacks
 
247
    ActivityOnCreate: TProcedure;
 
248
 
 
249
    constructor Create; override;
 
250
    destructor Destroy; override;
 
251
 
 
252
    function LCLPlatform: TLCLPlatform; override;
 
253
    function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; override;
 
254
 
 
255
    { Initialize the API }
 
256
    procedure AppInit(var ScreenInfo: TScreenInfo); override;
 
257
    procedure AppRun(const ALoop: TApplicationMainLoop); override;
 
258
    procedure AppWaitMessage; override;
 
259
    procedure AppProcessMessages; override;
 
260
    procedure AppTerminate; override;
 
261
    procedure AppMinimize; override;
 
262
    procedure AppRestore; override;
 
263
    procedure AppBringToFront; override;
 
264
    procedure AppSetIcon(const Small, Big: HICON); override;
 
265
    procedure AppSetTitle(const ATitle: string); override;
 
266
    procedure AppSetVisible(const AVisible: Boolean); override;
 
267
    function AppRemoveStayOnTopFlags(const ASystemTopAlso: Boolean = False): Boolean; override;
 
268
    function AppRestoreStayOnTopFlags(const ASystemTopAlso: Boolean = False): Boolean; override;
 
269
    procedure AppSetMainFormOnTaskBar(const DoSet: Boolean); override;
 
270
 
 
271
    //function  InitStockFont(AFont: TObject; AStockFont: TStockFont): Boolean; override;
 
272
 
 
273
    procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
 
274
    function  DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
 
275
    procedure DCRedraw(CanvasHandle: HDC); override;
 
276
    procedure DCSetAntialiasing(CanvasHandle: HDC; AEnabled: Boolean); override;
 
277
    procedure SetDesigning(AComponent: TComponent); override;
 
278
 
 
279
    // create and destroy
 
280
    function CreateTimer(Interval: integer; TimerFunc: TWSTimerProc): THandle; override;
 
281
    function DestroyTimer(TimerHandle: THandle): boolean; override;
 
282
 
 
283
    {$I customdrawnwinapih.inc}
 
284
    {$I customdrawnlclintfh.inc}
 
285
  public
 
286
    { Variables to be set by the user }
 
287
    {$ifdef WinCE}
 
288
    WinCETitlePolicy: TWinCETitlePolicy;
 
289
    {$endif}
 
290
  end;
 
291
 
 
292
var
 
293
  CDWidgetSet: TCDWidgetSet absolute WidgetSet;
 
294
 
 
295
function CDMessageBoxFunction(Text, Caption : PChar; Flags : Longint) : Integer;
 
296
 
 
297
{$ifdef CD_WINDOWS}
 
298
function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
 
299
  LParam: Windows.LParam): LResult; {$ifdef WinCE}cdecl;{$else}stdcall;{$endif}
 
300
{$endif}
 
301
{$ifdef CD_X11}
 
302
procedure MyXConnectionWatchProc(display: PDisplay; client_data: TXPointer;
 
303
  fd: cint; opening: XLib.TBool; watch_data: PXPointer); cdecl;
 
304
{$endif}
 
305
{$ifdef CD_Android}
 
306
function Java_com_pascal_lclproject_LCLActivity_LCLOnTouch(env:PJNIEnv;this:jobject; x, y: single; action: jint): jint; cdecl;
 
307
function Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap(
 
308
    env:PJNIEnv;this:jobject; width, height: jint; abitmap: jobject): jint; cdecl;
 
309
function Java_com_pascal_lclproject_LCLActivity_LCLOnCreate(
 
310
    env:PJNIEnv; this:jobject; alclactivity: jobject): jint; cdecl;
 
311
function Java_com_pascal_lclproject_LCLActivity_LCLOnMessageBoxFinished(
 
312
    env:PJNIEnv; this:jobject; AResult, ADialogType: jint): jint; cdecl;
 
313
function Java_com_pascal_lclproject_LCLActivity_LCLOnKey(
 
314
    env:PJNIEnv; this:jobject; AKind: jint; AKeyCode: jint;
 
315
    AEvent: jobject; AChar: jint): jint; cdecl;
 
316
function Java_com_pascal_lclproject_LCLActivity_LCLOnTimer(
 
317
    env:PJNIEnv; this:jobject; ATimer: jobject): jint; cdecl;
 
318
function Java_com_pascal_lclproject_LCLActivity_LCLOnConfigurationChanged(
 
319
    env:PJNIEnv; this:jobject; ANewDPI, ANewWidth: jint): jint; cdecl;
 
320
function Java_com_pascal_lclproject_LCLActivity_LCLOnSensorChanged(
 
321
    env:PJNIEnv; this:jobject; ASensorKind: jint; AValues: JDoubleArray): jint; cdecl;
 
322
function Java_com_pascal_lclproject_LCLActivity_LCLOnMenuAction(
 
323
  env:PJNIEnv; this:jobject; kind, itemIndex: jint): jint; cdecl;
 
324
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; cdecl;
 
325
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); cdecl;
 
326
 
 
327
var
 
328
  javaVMRef: PJavaVM=nil;
 
329
  javaEnvRef: PJNIEnv=nil;
 
330
  javaActivityClass: JClass = nil;
 
331
  javaActivityObject: jobject = nil;
 
332
 
 
333
  // Other classes and objects
 
334
  javaAndroidAppActivityClass: JClass = nil;
 
335
  javaJavaLangSystemClass: JClass = nil;
 
336
  javaAndroidOSBuildClass: JClass = nil;
 
337
  javaAndroidOSVibratorClass: JClass = nil;
 
338
  javaAndroidContentContextClass: JClass = nil;
 
339
  javaJavaLangStringClass: JClass = nil;
 
340
 
 
341
  // Fields of our Activity
 
342
  // Strings
 
343
  javaField_lcltext: JfieldID=nil;
 
344
  javaField_lcltitle: JfieldID=nil;
 
345
  javaField_lclbutton1str: JfieldID=nil;
 
346
  javaField_lclbutton2str: JfieldID=nil;
 
347
  javaField_lclbutton3str: JfieldID=nil;
 
348
  // Integers
 
349
  javaField_lclwidth: JfieldID=nil;
 
350
  javaField_lclheight: JfieldID=nil;
 
351
  javaField_lclbutton1: JfieldID=nil;
 
352
  javaField_lclbutton2: JfieldID=nil;
 
353
  javaField_lclbutton3: JfieldID=nil;
 
354
  javaField_lclbitmap: JfieldID=nil;
 
355
  javaField_lcltextsize: JfieldID=nil;
 
356
  // Text metrics
 
357
  javaField_lcltextascent: JfieldID=nil;
 
358
  javaField_lcltextbottom: JfieldID=nil;
 
359
  javaField_lcltextdescent: JfieldID=nil;
 
360
  javaField_lcltextleading: JfieldID=nil;
 
361
  javaField_lcltexttop: JfieldID=nil;
 
362
  javaField_lclmaxwidth: JfieldID=nil;
 
363
  javaField_lclmaxcount: JfieldID=nil;
 
364
  javaField_lclpartialwidths: JfieldID=nil;
 
365
  // Timer
 
366
  javaField_lcltimerinterval: JfieldID=nil;
 
367
  javaField_lcltimerid: JfieldID=nil;
 
368
  // Screen Metrics
 
369
  javaField_lclxdpi: JfieldID=nil;
 
370
  javaField_lclydpi: JfieldID=nil;
 
371
  javaField_lclformwidth: JfieldID=nil;
 
372
  javaField_lclformheight: JfieldID=nil;
 
373
  javaField_lclscreenwidth: JfieldID=nil;
 
374
  javaField_lclscreenheight: JfieldID=nil;
 
375
  // For LazDeviceAPIs
 
376
  javaField_lcldestination: JfieldID=nil;
 
377
  javaField_lclkind: JfieldID=nil;
 
378
 
 
379
  // Methods of our Activity
 
380
  javaMethod_LCLDoGetTextBounds: jmethodid = nil;
 
381
  javaMethod_LCLDoGetTextPartialWidths: jmethodid = nil;
 
382
  javaMethod_LCLDoDrawText: jmethodid = nil;
 
383
  javaMethod_LCLDoShowMessageBox: jmethodid = nil;
 
384
  javaMethod_LCLDoCreateTimer: jmethodid = nil;
 
385
  javaMethod_LCLDoDestroyTimer: jmethodid = nil;
 
386
  javaMethod_LCLDoHideVirtualKeyboard: jmethodid = nil;
 
387
  javaMethod_LCLDoShowVirtualKeyboard: jmethodid = nil;
 
388
  javaMethod_LCLDoStartReadingAccelerometer: jmethodid = nil;
 
389
  javaMethod_LCLDoStopReadingAccelerometer: jmethodid = nil;
 
390
  javaMethod_LCLDoSendMessage: jmethodid = nil;
 
391
  javaMethod_LCLDoRequestPositionInfo: jmethodid = nil;
 
392
  // Methods from android.app.Activity
 
393
  javaMethod_Activity_finish: jmethodid = nil;
 
394
  // Methods from java.lang.System
 
395
  javaMethod_System_exit: jmethodid = nil;
 
396
  // Generic methods from Context
 
397
  javaMethod_getSystemService: jmethodid = nil;
 
398
 
 
399
  // This is utilized to store the information such as invalidate requests in events
 
400
  eventResult: jint;
 
401
{$endif}
 
402
 
 
403
implementation
 
404
 
 
405
uses
 
406
  WsControls, lclintf,
 
407
  CustomDrawnWSFactory,
 
408
  CustomDrawnWSForms,
 
409
{  Win32WSButtons,
 
410
  Win32WSMenus,
 
411
  Win32WSStdCtrls,
 
412
  Win32WSDialogs,
 
413
  Win32Themes,
 
414
////////////////////////////////////////////////////
 
415
  Win32Extra,}
 
416
  customdrawnprivate,
 
417
  LCLMessageGlue;
 
418
 
 
419
  {$ifdef CD_Windows}
 
420
const
 
421
  CDBackendNativeHandle = nhtWindowsHWND;
 
422
  {$define CD_HasNativeFormHandle}
 
423
  {$endif}
 
424
  {$ifdef CD_X11}
 
425
const
 
426
  CDBackendNativeHandle = nhtX11TWindow;
 
427
 
 
428
  {$define CD_HasNativeFormHandle}
 
429
  {$endif}
 
430
  {$ifdef CD_Cocoa}
 
431
const
 
432
  CDBackendNativeHandle = nhtCocoaNSWindow;
 
433
  {$define CD_HasNativeFormHandle}
 
434
  {$endif}
 
435
 
 
436
{ TLazCDCustomFont }
 
437
 
 
438
constructor TLazCDCustomFont.Create;
 
439
begin
 
440
  inherited Create;
 
441
  {$ifndef CD_UseNativeText}
 
442
  FTFont := TFreeTypeFont.Create;
 
443
  {$endif}
 
444
end;
 
445
 
 
446
destructor TLazCDCustomFont.Destroy;
 
447
begin
 
448
  {$ifndef CD_UseNativeText}
 
449
  FTFont.Free;
 
450
  {$endif}
 
451
  inherited Destroy;
 
452
end;
 
453
 
 
454
{$I customdrawnobject.inc}
 
455
 
 
456
{$I customdrawnwinapi.inc}
 
457
{$I customdrawnlclintf.inc}
 
458
 
 
459
{$ifdef CD_Windows}
 
460
  {$include wincallback.inc}
 
461
  {$I customdrawnobject_win.inc}
 
462
  {$I customdrawnwinapi_win.inc}
 
463
  {$I customdrawnlclintf_win.inc}
 
464
{$endif}
 
465
{$ifdef CD_Cocoa}
 
466
  {$I customdrawnobject_cocoa.inc}
 
467
  {$I customdrawnwinapi_cocoa.inc}
 
468
  {$I customdrawnlclintf_cocoa.inc}
 
469
{$endif}
 
470
{$ifdef CD_X11}
 
471
  {$I customdrawnobject_x11.inc}
 
472
  {$I customdrawnwinapi_x11.inc}
 
473
  {$I customdrawnlclintf_x11.inc}
 
474
{$endif}
 
475
{$ifdef CD_Android}
 
476
  {$I customdrawnobject_android.inc}
 
477
  {$I customdrawnwinapi_android.inc}
 
478
  {$I customdrawnlclintf_android.inc}
 
479
{$endif}
 
480
 
 
481
end.