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

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

?? tntcontrols.pas

?? TNT Components Source
?? 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一区二区三区免费野_久草精品视频
久久亚洲春色中文字幕久久久| 国产精品白丝av| 欧美日本在线看| 日韩高清在线不卡| 欧美一级在线视频| 国产高清不卡二三区| 国产精品欧美综合在线| 91丨porny丨首页| 亚洲一区二区欧美激情| 欧美一区午夜视频在线观看| 精品一区二区免费| 国产精品久久久久久久久图文区| 91麻豆免费观看| 日韩精品91亚洲二区在线观看 | 在线观看国产一区二区| 亚洲国产裸拍裸体视频在线观看乱了| 欧美日韩精品三区| 国内久久精品视频| 亚洲日本电影在线| 欧美一区二区精美| 成人av电影在线观看| 亚洲成人av一区二区| 久久婷婷色综合| 一本久久精品一区二区| 美女诱惑一区二区| 中文字幕日本不卡| 日韩一区二区三区四区| www.欧美日韩国产在线| 五月天亚洲婷婷| 中文字幕av一区二区三区| 欧美日韩精品免费观看视频| 国产成人在线电影| 午夜精品福利一区二区三区av| 久久精品亚洲精品国产欧美kt∨ | 国产麻豆视频一区二区| 亚洲欧美在线视频| 欧美电影免费观看完整版| 99久久免费视频.com| 日韩二区三区四区| 亚洲丝袜精品丝袜在线| 精品精品国产高清一毛片一天堂| 一本色道久久加勒比精品 | 国产精品女人毛片| 日韩午夜在线观看| 在线免费观看日本欧美| 国产成人aaa| 久久精品国产在热久久| 亚洲成人午夜电影| 中文字幕在线播放不卡一区| 亚洲精品在线网站| 777a∨成人精品桃花网| 色婷婷精品大在线视频| 高清国产一区二区三区| 久久狠狠亚洲综合| 日韩国产欧美三级| 一区二区激情小说| 日韩一区欧美小说| 国产精品国产自产拍高清av | 欧美日韩久久一区| 在线中文字幕不卡| 99久久综合狠狠综合久久| 国产精品一卡二卡| 麻豆视频一区二区| 蜜桃视频在线观看一区二区| 亚洲影院免费观看| 亚洲免费伊人电影| 亚洲欧美乱综合| 亚洲日本在线天堂| 亚洲精选一二三| 一区二区高清在线| 亚洲午夜久久久久久久久电影网 | 国产精品99久久久| 国产九色sp调教91| 国产精品原创巨作av| 国产在线国偷精品产拍免费yy| 免费成人在线网站| 久久精品国产第一区二区三区| 美女任你摸久久| 久久99国产精品久久99 | 懂色av一区二区在线播放| 国产伦理精品不卡| 国产成人亚洲综合a∨婷婷图片| 经典一区二区三区| 国产成人高清在线| 99免费精品视频| 在线观看成人小视频| 欧美日韩三级一区| 欧美三级一区二区| 日韩欧美一区中文| 亚洲无人区一区| 色综合婷婷久久| 国产xxx精品视频大全| 高清shemale亚洲人妖| www.综合网.com| 在线精品视频免费观看| 欧美日韩不卡视频| 精品免费国产二区三区| 国产精品丝袜一区| 亚洲六月丁香色婷婷综合久久| 亚洲国产精品综合小说图片区| 奇米亚洲午夜久久精品| 国产69精品一区二区亚洲孕妇| 成人av资源在线| 欧美日韩一卡二卡| 精品国产一区二区三区忘忧草| 专区另类欧美日韩| 丝袜国产日韩另类美女| 国产伦理精品不卡| 欧美中文字幕不卡| 2019国产精品| 亚洲一区二区三区三| 韩国在线一区二区| 色综合久久久久| 精品美女一区二区| 一区二区三区在线免费观看| 久久国产乱子精品免费女| 成人黄动漫网站免费app| 欧美肥大bbwbbw高潮| 欧美韩日一区二区三区| 偷窥少妇高潮呻吟av久久免费| 国产福利一区二区| 欧美另类一区二区三区| 国产精品午夜久久| 蜜臀久久99精品久久久久久9| 99精品视频一区二区三区| 日韩欧美在线综合网| 亚洲卡通动漫在线| 国产精品一线二线三线| 欧美日韩国产bt| 国产精品二区一区二区aⅴ污介绍| 午夜欧美电影在线观看| 97久久精品人人爽人人爽蜜臀| 精品少妇一区二区三区在线视频 | 欧美丰满美乳xxx高潮www| 国产精品久线观看视频| 久久成人免费电影| 欧美日韩一区在线观看| 最好看的中文字幕久久| 国产一区二区免费在线| 欧美一区二区三区在线观看 | 精品国产免费人成电影在线观看四季 | 日本免费在线视频不卡一不卡二| av电影天堂一区二区在线观看| 日韩精品一区二区三区四区 | 久久超碰97中文字幕| 欧美三级午夜理伦三级中视频| 亚洲天堂免费看| 成人免费视频网站在线观看| 久久久久久一二三区| 久久精品国产在热久久| 欧美一区2区视频在线观看| 亚洲国产精品一区二区久久恐怖片 | 国产麻豆精品久久一二三| 日韩三区在线观看| 日韩精品一区第一页| 欧美日韩的一区二区| 亚洲一区成人在线| 在线观看欧美黄色| 亚洲另类在线视频| 一本一道综合狠狠老| 亚洲视频图片小说| 91丨九色丨黑人外教| 中文字幕亚洲区| 91免费国产在线观看| 亚洲啪啪综合av一区二区三区| 99久久精品免费看| 亚洲免费高清视频在线| 91在线云播放| 亚洲精品美腿丝袜| 在线观看日产精品| 同产精品九九九| 日韩三级电影网址| 免费人成网站在线观看欧美高清| 在线综合视频播放| 美女高潮久久久| 日韩精品中文字幕一区| 精品一区二区三区免费毛片爱 | 国产露脸91国语对白| 久久久久国产成人精品亚洲午夜| 国模冰冰炮一区二区| 国产免费成人在线视频| 国产一区二区女| 国产午夜久久久久| 成人精品视频一区二区三区尤物| 欧美国产日本韩| 91在线porny国产在线看| 亚洲黄色录像片| 欧美日韩一二三| 美女精品一区二区| 国产亚洲精品精华液| 91免费在线看| 午夜精品久久久久久久久久久| 在线电影一区二区三区| 国产一区二区三区最好精华液| 欧美高清在线精品一区| 在线视频你懂得一区| 九一久久久久久| 日本一区二区三区国色天香| 欧美写真视频网站| 国产精品综合一区二区三区|