亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tntcontrols.pas

?? Delphi知道現在也沒有提供Unicode支持
?? PAS
?? 第 1 頁 / 共 3 頁
字號:

{*****************************************************************************}
{                                                                             }
{    Tnt Delphi Unicode Controls                                              }
{      http://www.tntware.com/delphicontrols/unicode/                         }
{        Version: 2.3.0                                                       }
{                                                                             }
{    Copyright (c) 2002-2007, Troy Wolbrink (troy.wolbrink@tntware.com)       }
{                                                                             }
{*****************************************************************************}

unit TntControls;

{$INCLUDE TntCompilers.inc}

{
  Windows NT provides support for native Unicode windows.  To add Unicode support to a
    TWinControl descendant, override CreateWindowHandle() and call CreateUnicodeHandle().

  One major reason this works is because the VCL only uses the ANSI version of
    SendMessage() -- SendMessageA().  If you call SendMessageA() on a UNICODE
    window, Windows deals with the ANSI/UNICODE conversion automatically.  So
    for example, if the VCL sends WM_SETTEXT to a window using SendMessageA,
    Windows actually *expects* a PAnsiChar even if the target window is a UNICODE
    window.  So caling SendMessageA with PChars causes no problems.

  A problem in the VCL has to do with the TControl.Perform() method. Perform()
    calls the window procedure directly and assumes an ANSI window.  This is a
    problem if, for example, the VCL calls Perform(WM_SETTEXT, ...) passing in a
    PAnsiChar which eventually gets passed downto DefWindowProcW() which expects a PWideChar.

  This is the reason for SubClassUnicodeControl().  This procedure will subclass the
    Windows WndProc, and the TWinControl.WindowProc pointer.  It will determine if the
    message came from Windows or if the WindowProc was called directly.  It will then
    call SendMessageA() for Windows to perform proper conversion on certain text messages.

  Another problem has to do with TWinControl.DoKeyPress().  It is called from the WM_CHAR
    message.  It casts the WideChar to an AnsiChar, and sends the resulting character to
    DefWindowProc.  In order to avoid this, the DefWindowProc is subclassed as well.  WindowProc
    will make a WM_CHAR message safe for ANSI handling code by converting the char code to
    #FF before passing it on.  It stores the original WideChar in the .Unused field of TWMChar.
    The code #FF is converted back to the WideChar before passing onto DefWindowProc.
}

{
  Things to consider when designing new controls:
    1)  Check that a WideString Hint property is published.
    2)  If descending from TWinControl, override CreateWindowHandle().
    3)  If not descending from TWinControl, handle CM_HINTSHOW message.
    4)  Check to make sure that CN_CHAR, CN_SYSCHAR and CM_DIALOGCHAR are handled properly.
    5)  If descending from TWinControl, verify Unicode chars are preserved after RecreateWnd.
    6)  Consider using storage specifiers for Hint and Caption properties.
    7)  If any class could possibly have published WideString properties,
          override DefineProperties and call TntPersistent_AfterInherited_DefineProperties.
    8)  Check if TTntThemeManager needs to be updated.
    9)  Override GetActionLinkClass() and ActionChange().
    10) If class updates Application.Hint then update TntApplication.Hint instead.
}

interface

{ TODO: Unicode enable .OnKeyPress event }

uses
  Classes, Windows, Messages, Controls, Menus;


{TNT-WARN TCaption}
type TWideCaption = type WideString;

// caption/text management
function TntControl_IsCaptionStored(Control: TControl): Boolean;
function TntControl_GetStoredText(Control: TControl; const Default: WideString): WideString;
procedure TntControl_SetStoredText(Control: TControl; const Value: WideString);
function TntControl_GetText(Control: TControl): WideString;
procedure TntControl_SetText(Control: TControl; const Text: WideString);

// hint management
function TntControl_IsHintStored(Control: TControl): Boolean;
function TntControl_GetHint(Control: TControl): WideString;
procedure TntControl_SetHint(Control: TControl; const Value: WideString);

function WideGetHint(Control: TControl): WideString;
function WideGetShortHint(const Hint: WideString): WideString;
function WideGetLongHint(const Hint: WideString): WideString;
procedure ProcessCMHintShowMsg(var Message: TMessage);

type
  TTntCustomHintWindow = class(THintWindow)
  private
    FActivating: Boolean;
    FBlockPaint: Boolean;
    function GetCaption: TWideCaption;
    procedure SetCaption(const Value: TWideCaption);
    procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
  protected
    procedure CreateWindowHandle(const Params: TCreateParams); override;
{$IFNDEF COMPILER_7_UP}
    procedure CreateParams(var Params: TCreateParams); override;
{$ENDIF}
    procedure Paint; override;
  public
    procedure ActivateHint(Rect: TRect; const AHint: AnsiString); override;
    procedure ActivateHintData(Rect: TRect; const AHint: AnsiString; AData: Pointer); override;
    function CalcHintRect(MaxWidth: Integer; const AHint: AnsiString; AData: Pointer): TRect; override;
    property Caption: TWideCaption read GetCaption write SetCaption;
  end;

  TTntHintWindow = class(TTntCustomHintWindow)
  public
    procedure ActivateHint(Rect: TRect; const AHint: WideString); reintroduce;
    procedure ActivateHintData(Rect: TRect; const AHint: WideString; AData: Pointer); reintroduce;
    function CalcHintRect(MaxWidth: Integer; const AHint: WideString; AData: Pointer): TRect; reintroduce;
  end;

// text/char message
function IsTextMessage(Msg: UINT): Boolean;
procedure MakeWMCharMsgSafeForAnsi(var Message: TMessage);
procedure RestoreWMCharMsg(var Message: TMessage);
function GetWideCharFromWMCharMsg(Message: TWMChar): WideChar;
procedure SetWideCharForWMCharMsg(var Message: TWMChar; Ch: WideChar);

// register/create window
procedure SubClassUnicodeControl(Control: TWinControl; Params_Caption: PAnsiChar; IDEWindow: Boolean = False);
procedure RegisterUnicodeClass(Params: TCreateParams; out WideWinClassName: WideString; IDEWindow: Boolean = False);
procedure CreateUnicodeHandle(Control: TWinControl; const Params: TCreateParams;
                                        const SubClass: WideString; IDEWindow: Boolean = False);
procedure ReCreateUnicodeWnd(Control: TWinControl; Subclass: WideString; IDEWindow: Boolean = False);

type
  IWideCustomListControl = interface
    ['{C1801F41-51E9-4DB5-8DB8-58AC86698C2E}']
    procedure AddItem(const Item: WideString; AObject: TObject);
  end;

procedure WideListControl_AddItem(Control: TCustomListControl; const Item: WideString; AObject: TObject);

var
  _IsShellProgramming: Boolean = False;

var
  TNT_WM_DESTROY: Cardinal;

implementation

uses
  ActnList, Forms, SysUtils, Contnrs, 
  TntGraphics, TntWindows, TntClasses, TntMenus, TntSysUtils;

type
  TAccessControl = class(TControl);
  TAccessWinControl = class(TWinControl);
  TAccessControlActionLink = class(TControlActionLink{TNT-ALLOW TControlActionLink});

//----------------------------------------------- WIDE CAPTION HOLDERS --------

{ TWideControlHelper }

var
  WideControlHelpers: TComponentList = nil;

type
  TWideControlHelper = class(TWideComponentHelper)
  private
    FControl: TControl;
    FWideCaption: WideString;
    FWideHint: WideString;
    procedure SetAnsiText(const Value: AnsiString);
    procedure SetAnsiHint(const Value: AnsiString);
  public
    constructor Create(AOwner: TControl); reintroduce;
    property WideCaption: WideString read FWideCaption;
    property WideHint: WideString read FWideHint;
  end;

constructor TWideControlHelper.Create(AOwner: TControl);
begin
  inherited CreateHelper(AOwner, WideControlHelpers);
  FControl := AOwner;
end;

procedure TWideControlHelper.SetAnsiText(const Value: AnsiString);
begin
  TAccessControl(FControl).Text := Value;
end;

procedure TWideControlHelper.SetAnsiHint(const Value: AnsiString);
begin
  FControl.Hint := Value;
end;

function FindWideControlHelper(Control: TControl; CreateIfNotFound: Boolean = True): TWideControlHelper;
begin
  Result := TWideControlHelper(FindWideComponentHelper(WideControlHelpers, Control));
  if (Result = nil) and CreateIfNotFound then
  	Result := TWideControlHelper.Create(Control);
end;

//----------------------------------------------- GET/SET WINDOW CAPTION/HINT -------------

function TntControl_IsCaptionStored(Control: TControl): Boolean;
begin
  with TAccessControl(Control) do
    Result := (ActionLink = nil) or not TAccessControlActionLink(ActionLink).IsCaptionLinked;
end;

function TntControl_GetStoredText(Control: TControl; const Default: WideString): WideString;
var
  WideControlHelper: TWideControlHelper;
begin
  WideControlHelper := FindWideControlHelper(Control, False);
  if WideControlHelper <> nil then
    Result := WideControlHelper.WideCaption
  else
    Result := Default;
end;

procedure TntControl_SetStoredText(Control: TControl; const Value: WideString);
begin
  FindWideControlHelper(Control).FWideCaption := Value;
  TAccessControl(Control).Text := Value;
end;

function TntControl_GetText(Control: TControl): WideString;
var
  WideControlHelper: TWideControlHelper;
begin
  if (not Win32PlatformIsUnicode)
  or ((Control is TWinControl) and TWinControl(Control).HandleAllocated and (not IsWindowUnicode(TWinControl(Control).Handle))) then
    // Win9x / non-unicode handle
    Result := TAccessControl(Control).Text
  else if (not (Control is TWinControl)) then begin
    // non-windowed TControl
    WideControlHelper := FindWideControlHelper(Control, False);
    if WideControlHelper = nil then
      Result := TAccessControl(Control).Text
    else
      Result := GetSyncedWideString(WideControlHelper.FWideCaption, TAccessControl(Control).Text);
  end else if (not TWinControl(Control).HandleAllocated) then begin
    // NO HANDLE
    Result := TntControl_GetStoredText(Control, TAccessControl(Control).Text)
  end else begin
    // UNICODE & HANDLE
    SetLength(Result, GetWindowTextLengthW(TWinControl(Control).Handle) + 1);
    GetWindowTextW(TWinControl(Control).Handle, PWideChar(Result), Length(Result));
    SetLength(Result, Length(Result) - 1);
  end;
end;

procedure TntControl_SetText(Control: TControl; const Text: WideString);
begin
  if (not Win32PlatformIsUnicode)
  or ((Control is TWinControl) and TWinControl(Control).HandleAllocated and (not IsWindowUnicode(TWinControl(Control).Handle))) then
    // Win9x / non-unicode handle
    TAccessControl(Control).Text := Text
  else if (not (Control is TWinControl)) then begin
    // non-windowed TControl
    with FindWideControlHelper(Control) do
      SetSyncedWideString(Text, FWideCaption, TAccessControl(Control).Text, SetAnsiText)
  end else if (not TWinControl(Control).HandleAllocated) then begin
    // NO HANDLE
    TntControl_SetStoredText(Control, Text);
  end else if TntControl_GetText(Control) <> Text then begin
    // UNICODE & HANDLE
    Tnt_SetWindowTextW(TWinControl(Control).Handle, PWideChar(Text));
    Control.Perform(CM_TEXTCHANGED, 0, 0);
  end;
end;

// hint management -----------------------------------------------------------------------

function TntControl_IsHintStored(Control: TControl): Boolean;
begin
  with TAccessControl(Control) do
    Result := (ActionLink = nil) or not TAccessControlActionLink(ActionLink).IsHintLinked;
end;

function TntControl_GetHint(Control: TControl): WideString;
var
  WideControlHelper: TWideControlHelper;
begin
  if (not Win32PlatformIsUnicode) then
    Result := Control.Hint
  else begin
    WideControlHelper := FindWideControlHelper(Control, False);
    if WideControlHelper <> nil then
      Result := GetSyncedWideString(WideControlHelper.FWideHint, Control.Hint)
    else
      Result := Control.Hint;
  end;
end;

procedure TntControl_SetHint(Control: TControl; const Value: WideString);
begin
  if (not Win32PlatformIsUnicode) then
    Control.Hint := Value
  else
    with FindWideControlHelper(Control) do
      SetSyncedWideString(Value, FWideHint, Control.Hint, SetAnsiHint);
end;

function WideGetHint(Control: TControl): WideString;
begin
  while Control <> nil do
    if TntControl_GetHint(Control) = '' then
      Control := Control.Parent
    else
    begin
      Result := TntControl_GetHint(Control);
      Exit;
    end;
  Result := '';
end;

function WideGetShortHint(const Hint: WideString): WideString;
var
  I: Integer;
begin
  I := Pos('|', Hint);
  if I = 0 then
    Result := Hint else
    Result := Copy(Hint, 1, I - 1);
end;

function WideGetLongHint(const Hint: WideString): WideString;
var
  I: Integer;
begin
  I := Pos('|', Hint);
  if I = 0 then
    Result := Hint else
    Result := Copy(Hint, I + 1, Maxint);
end;

//----------------------------------------------------------------------------------------

var UnicodeCreationControl: TWinControl = nil;

function IsUnicodeCreationControl(Handle: HWND): Boolean;
begin
  Result := (UnicodeCreationControl <> nil)
        and (UnicodeCreationControl.HandleAllocated)
        and (UnicodeCreationControl.Handle = Handle);
end;

function WMNotifyFormatResult(FromHandle: HWND): Integer;
begin
  if Win32PlatformIsUnicode
  and (IsWindowUnicode(FromHandle) or IsUnicodeCreationControl(FromHandle)) then
    Result := NFR_UNICODE
  else
    Result := NFR_ANSI;
end;

function IsTextMessage(Msg: UINT): Boolean;
begin
  // WM_CHAR is omitted because of the special handling it receives
  Result := (Msg = WM_SETTEXT)
         or (Msg = WM_GETTEXT)
         or (Msg = WM_GETTEXTLENGTH);
end;

const
  ANSI_UNICODE_HOLDER = $FF;

procedure MakeWMCharMsgSafeForAnsi(var Message: TMessage);
begin

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区精品| 91麻豆福利精品推荐| 亚洲精品成人天堂一二三| 精品日韩99亚洲| 日韩欧美国产综合一区 | 不卡一二三区首页| 国产一区999| 国产一区二区在线视频| 毛片不卡一区二区| 蜜臂av日日欢夜夜爽一区| 琪琪久久久久日韩精品| 日本欧美久久久久免费播放网| 午夜精品久久久久久久| 亚洲第一精品在线| 日本欧美肥老太交大片| 免费看欧美女人艹b| 日本va欧美va精品发布| 青青国产91久久久久久| 久久99精品国产麻豆不卡| 极品少妇一区二区| 国产精品自拍三区| 国产99一区视频免费| www.成人在线| 一本色道a无线码一区v| 欧美日韩国产成人在线91| 欧美精品久久久久久久多人混战 | 亚洲国产你懂的| 亚洲第一av色| 毛片av一区二区三区| 国产一区二区成人久久免费影院 | 麻豆成人在线观看| 国产裸体歌舞团一区二区| 大胆欧美人体老妇| 91麻豆精品秘密| 欧美日本一区二区| 久久久无码精品亚洲日韩按摩| 国产精品久久久久毛片软件| 一区二区三区四区不卡在线| 日韩高清一级片| 国产成人精品一区二区三区网站观看| 色综合天天综合网国产成人综合天 | 国产成人精品亚洲日本在线桃色| av亚洲精华国产精华精华| 色狠狠色噜噜噜综合网| 在线综合视频播放| 国产欧美精品一区aⅴ影院| 一区二区三区中文在线观看| 日本女优在线视频一区二区| 国产传媒一区在线| 欧美日韩电影在线播放| 国产校园另类小说区| 亚洲已满18点击进入久久| 日本aⅴ免费视频一区二区三区| 国产精品18久久久久久久网站| 色狠狠色噜噜噜综合网| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 成人黄色av电影| 欧美精三区欧美精三区| 国产欧美一区二区在线| 亚洲高清免费在线| av亚洲精华国产精华精| 欧美成人一区二区三区片免费| 亚洲欧美一区二区三区久本道91| 秋霞电影一区二区| 欧美亚男人的天堂| 1024精品合集| 韩国在线一区二区| 欧美高清视频不卡网| 中文字幕在线不卡视频| 国产精品自拍三区| 日韩免费观看2025年上映的电影| 一区二区不卡在线播放 | 粉嫩一区二区三区在线看| 精品污污网站免费看| 久久精品日产第一区二区三区高清版 | 欧美日韩在线播放三区四区| 亚洲国产精品精华液2区45| 日本少妇一区二区| 欧美男同性恋视频网站| 一区二区三区日韩欧美| av网站一区二区三区| 欧美精品一区二区三| 热久久国产精品| 欧美色电影在线| 一区二区三区毛片| 色综合欧美在线视频区| 国产精品护士白丝一区av| 国产中文字幕一区| 精品理论电影在线| 老司机精品视频在线| 日韩午夜av电影| 老司机一区二区| 日韩欧美美女一区二区三区| 日本亚洲免费观看| 日韩免费电影一区| 狠狠色丁香婷综合久久| 久久久久久久久久久99999| 精品中文字幕一区二区| 精品国产一区a| 激情亚洲综合在线| 国产片一区二区| 成人性生交大片免费看视频在线| 国产偷v国产偷v亚洲高清| 国产成人精品在线看| 中文字幕巨乱亚洲| 99国产精品久久久| 亚洲国产欧美在线人成| 日韩一区二区电影| 国产中文字幕一区| 国产精品毛片久久久久久久| 99视频国产精品| 一区二区三区自拍| 欧美精品v国产精品v日韩精品| 日韩国产在线观看一区| 日韩欧美一区二区视频| 国产原创一区二区| 成人免费在线视频观看| 色婷婷香蕉在线一区二区| 婷婷国产在线综合| 亚洲精品一区在线观看| 成年人国产精品| 一区二区高清免费观看影视大全| 3d动漫精品啪啪1区2区免费| 国产在线一区观看| 亚洲精品国产视频| 日韩一区国产二区欧美三区| 国产激情视频一区二区在线观看| 亚洲免费看黄网站| 日韩欧美的一区| av在线播放不卡| 免费观看一级欧美片| 国产精品理伦片| 777欧美精品| 成人高清伦理免费影院在线观看| 亚洲国产日韩一区二区| 精品国产乱码久久久久久图片| 99久久777色| 精品一区二区在线视频| 一区二区三区在线观看国产| 日韩一区二区在线看| av激情成人网| 久久成人麻豆午夜电影| 一区二区三区四区亚洲| 国产日韩欧美激情| 欧美一级视频精品观看| 91美女片黄在线观看91美女| 六月婷婷色综合| 亚洲电影欧美电影有声小说| 亚洲国产电影在线观看| 91 com成人网| 欧美性生活一区| 成人午夜电影网站| 久久精品99国产精品| 亚洲福中文字幕伊人影院| 国产精品色在线| 久久亚洲精精品中文字幕早川悠里| 欧美性猛片aaaaaaa做受| 成人a区在线观看| 激情综合色播五月| 午夜精品在线看| 日韩伦理av电影| 中文字幕免费不卡| 欧美v亚洲v综合ⅴ国产v| 欧美视频完全免费看| 色综合久久久久综合体桃花网| 成人美女视频在线观看| 国产美女精品一区二区三区| 日本视频一区二区| 五月天一区二区三区| 亚洲综合男人的天堂| 亚洲精品写真福利| 国产精品乱码一区二区三区软件| 久久久久久影视| 久久久www成人免费毛片麻豆 | 欧美日韩综合在线免费观看| 99久久久免费精品国产一区二区| 国产中文字幕精品| 国产一区 二区 三区一级| 国内偷窥港台综合视频在线播放| 久热成人在线视频| 九一久久久久久| 国产在线看一区| 国产999精品久久| 成人激情小说乱人伦| av男人天堂一区| 91黄色小视频| 欧美日韩国产不卡| 欧美电影免费观看高清完整版在线 | 国产精品一区二区91| 国产成人激情av| av不卡免费电影| 色哦色哦哦色天天综合| 欧美日韩免费电影| 日韩精品一区二区三区老鸭窝| 久久综合999| 国产精品热久久久久夜色精品三区| 国产欧美一区二区三区网站| 国产精品久久久久aaaa| 一区二区三区四区中文字幕| 婷婷综合另类小说色区|