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

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

?? tntcontrols.pas

?? TNTUniCtrlsWithExceptions 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精品综合久久久久久| 日韩一区二区三区视频在线 | 国产精品一区一区三区| av电影一区二区| 日韩欧美三级在线| 亚洲精品第一国产综合野| 日韩中文字幕不卡| 91在线国内视频| 久久这里只有精品6| 日韩中文字幕91| 色婷婷国产精品综合在线观看| 久久久久久免费网| 日韩激情一二三区| 欧美天天综合网| 亚洲视频小说图片| 成人丝袜18视频在线观看| 日韩午夜精品电影| 丝袜美腿亚洲综合| 欧美日韩国产大片| 夜夜嗨av一区二区三区四季av| 成人黄色a**站在线观看| 久久综合网色—综合色88| 日韩av一二三| 3d动漫精品啪啪1区2区免费| 亚洲一区在线视频| 91久久香蕉国产日韩欧美9色| 国产精品蜜臀av| a亚洲天堂av| 最新热久久免费视频| 国产成人8x视频一区二区 | 精品视频资源站| 一区二区三区欧美日韩| 91高清在线观看| 亚洲美女免费视频| 色婷婷久久综合| 伊人夜夜躁av伊人久久| 欧美影院午夜播放| 首页亚洲欧美制服丝腿| 欧美精品免费视频| 日韩精品亚洲专区| 欧美一级免费大片| 精品影院一区二区久久久| 精品国产凹凸成av人导航| 国产美女在线观看一区| 国产精品系列在线| 91农村精品一区二区在线| 一区二区在线看| 欧美三级电影网| 免费日本视频一区| 久久夜色精品一区| aaa国产一区| 亚洲成a人片在线观看中文| 91精品国产一区二区| 国产精品一区在线观看乱码 | 一本在线高清不卡dvd| 一区二区三区av电影| 欧美一区二区三区公司| 国产在线精品一区二区不卡了| 欧美国产日产图区| 欧美在线观看视频一区二区 | 91亚洲资源网| 亚洲成av人在线观看| 精品国产一区二区三区忘忧草 | 日韩一级视频免费观看在线| 国产剧情一区二区| 亚洲一区在线看| 久久蜜桃香蕉精品一区二区三区| www.亚洲色图.com| 天天射综合影视| 中文在线一区二区| 欧美日本一区二区| 99精品欧美一区二区三区小说 | 蜜臀av一级做a爰片久久| 欧美经典一区二区| 欧美日韩国产精品自在自线| 国产91高潮流白浆在线麻豆| 午夜精品久久久久久久99水蜜桃| 久久久久久麻豆| 欧美日韩久久一区二区| 国产99一区视频免费| 日韩高清不卡在线| 亚洲丝袜精品丝袜在线| 日韩精品一区二区三区老鸭窝 | 在线亚洲一区观看| 国产精品18久久久久久久久久久久| 亚洲黄网站在线观看| 国产欧美一二三区| 欧美一二三在线| 欧美系列一区二区| 成人av网站在线观看免费| 久久99精品久久久| 日韩国产在线观看一区| 一区二区三区四区不卡在线| 久久精品一区四区| 精品人伦一区二区色婷婷| 欧美日韩极品在线观看一区| 色综合色综合色综合| 国产99久久久国产精品免费看| 免费高清在线视频一区·| 亚洲国产日韩综合久久精品| 亚洲色欲色欲www| 国产女人18水真多18精品一级做| 日韩一区二区麻豆国产| 欧美精品亚洲一区二区在线播放| 91麻豆国产福利精品| 不卡一区在线观看| 国产白丝网站精品污在线入口| 国产一区二区三区最好精华液| 蜜臀91精品一区二区三区| 日本美女视频一区二区| 五月天激情综合网| 午夜精品久久久久久久久久久| 亚洲综合精品久久| 亚洲午夜电影在线| 午夜电影网亚洲视频| 亚洲成av人片在线观看无码| 亚洲成人精品在线观看| 亚洲一二三专区| 香港成人在线视频| 午夜精品在线看| 蜜臀av一区二区在线免费观看 | 日韩三级免费观看| 精品国产制服丝袜高跟| 国产亚洲综合在线| 国产精品蜜臀av| 一区二区三区免费观看| 亚洲一区二区中文在线| 日本中文字幕一区二区视频 | 亚洲视频1区2区| 亚洲色图视频网站| 一区二区三区自拍| 亚洲成人一二三| 激情综合色综合久久综合| 韩国视频一区二区| 不卡欧美aaaaa| 欧美在线看片a免费观看| 欧美一级在线观看| 久久久久久久久99精品| 国产精品国产自产拍高清av | 国产成人av电影| 色一情一伦一子一伦一区| 69堂国产成人免费视频| 精品成人私密视频| 日韩美女视频19| 男女视频一区二区| 不卡av在线网| 欧美福利视频导航| 久久女同精品一区二区| 一区二区三区四区高清精品免费观看| 日韩成人一区二区| 成人h动漫精品一区二| 精品视频全国免费看| 久久精品综合网| 午夜精彩视频在线观看不卡| 国产一级精品在线| 欧美日韩午夜在线| 中文字幕欧美国产| 日韩精品一区第一页| 99精品视频一区二区| 日韩你懂的在线观看| 亚洲色图在线看| 国内不卡的二区三区中文字幕| 色成人在线视频| 欧美高清在线精品一区| 日本亚洲欧美天堂免费| 99久久99精品久久久久久 | 综合久久一区二区三区| 日本免费在线视频不卡一不卡二| 不卡高清视频专区| 日韩精品中午字幕| 亚洲一区二区视频在线| 国产成人综合自拍| 日韩亚洲国产中文字幕欧美| 亚洲男同性恋视频| 国产激情91久久精品导航| 在线电影国产精品| 亚洲综合一区二区三区| 成人免费毛片app| 久久久久久久久久久久久夜| 日韩精品久久理论片| 在线一区二区三区| 成人欧美一区二区三区视频网页| 国产原创一区二区| 欧美videos大乳护士334| 视频一区视频二区在线观看| 在线视频一区二区三| 日韩久久一区二区| 99久久99精品久久久久久| 欧美激情在线看| 成人av在线电影| 国产精品理论片在线观看| 从欧美一区二区三区| 国产婷婷色一区二区三区| 国产精品66部| 国产欧美日本一区二区三区| 国产精品一级在线| 久久精品水蜜桃av综合天堂| 国产九色sp调教91| 国产日本欧美一区二区| 国产激情91久久精品导航|