2 {*****************************************************************************}
4 { Tnt Delphi Unicode Controls }
5 { http://www.tntware.com/delphicontrols/unicode/ }
8 { Copyright (c) 2002-2007, Troy Wolbrink (troy.wolbrink@tntware.com) }
10 {*****************************************************************************}
14 {$INCLUDE TntCompilers.inc}
23 TTntClipboard
= class(TClipboard
{TNT-ALLOW TClipboard})
25 function GetAsWideText
: WideString
;
26 procedure SetAsWideText(const Value
: WideString
);
28 property AsWideText
: WideString read GetAsWideText write SetAsWideText
;
29 property AsText
: WideString read GetAsWideText write SetAsWideText
;
33 function TntClipboard
: TTntClipboard
;
39 function TTntClipboard
.GetAsWideText
: WideString
;
44 Data
:= GetClipboardData(CF_UNICODETEXT
);
47 Result
:= PWideChar(GlobalLock(Data
))
51 if Data
<> 0 then GlobalUnlock(Data
);
54 if (Data
= 0) or (Result
= '') then
55 Result
:= inherited AsText
58 procedure TTntClipboard
.SetAsWideText(const Value
: WideString
);
62 inherited AsText
:= Value
; {Ensures ANSI compatiblity across platforms.}
63 SetBuffer(CF_UNICODETEXT
, PWideChar(Value
)^, (Length(Value
) + 1) * SizeOf(WideChar
));
69 //------------------------------------------
72 GTntClipboard
: TTntClipboard
;
74 function TntClipboard
: TTntClipboard
;
76 if GTntClipboard
= nil then
77 GTntClipboard
:= TTntClipboard
.Create
;
78 Result
:= GTntClipboard
;