win32: don't perform 'is TCustomFloatSpinEdit' comparisons in code. Therefore empty application does not contains spinedit code anymore (and executable is 12Kb smaller)

git-svn-id: trunk@23624 -
This commit is contained in:
paul 2010-02-04 03:09:32 +00:00
parent 46bb53cc00
commit 9d6fb42169
4 changed files with 8 additions and 6 deletions

View File

@ -249,7 +249,7 @@ uses
Win32WSStdCtrls, Win32WSStdCtrls,
Win32Themes, Win32Themes,
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
Arrow, Calendar, Spin, CheckLst, Win32Extra, LclProc, LCLMessageGlue; Arrow, Calendar, CheckLst, Win32Extra, LclProc, LCLMessageGlue;
type type
TMouseDownFocusStatus = (mfNone, mfFocusSense, mfFocusChanged); TMouseDownFocusStatus = (mfNone, mfFocusSense, mfFocusChanged);

View File

@ -55,6 +55,7 @@ Type
isComboEdit: boolean; // is buddy of combobox, the edit control isComboEdit: boolean; // is buddy of combobox, the edit control
isChildEdit: boolean; // is buddy edit of a control isChildEdit: boolean; // is buddy edit of a control
isGroupBox: boolean; // is groupbox, and does not have themed tabpage as parent isGroupBox: boolean; // is groupbox, and does not have themed tabpage as parent
askBuddyCoords: boolean; // ask buddy window about position and size
ThemedCustomDraw: boolean;// controls needs themed drawing in wm_notify/nm_customdraw ThemedCustomDraw: boolean;// controls needs themed drawing in wm_notify/nm_customdraw
MaxLength: integer; MaxLength: integer;
DrawItemIndex: integer; // in case of listbox, when handling WM_DRAWITEM DrawItemIndex: integer; // in case of listbox, when handling WM_DRAWITEM

View File

@ -2251,7 +2251,7 @@ var
begin begin
Result := False; Result := False;
WindowInfo := GetWin32WindowInfo(Handle); WindowInfo := GetWin32WindowInfo(Handle);
if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then if WindowInfo^.askBuddyCoords then
Handle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0); Handle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0);
if IsIconic(Handle) and GetWindowPlacement(Handle, @WindowPlacement) then if IsIconic(Handle) and GetWindowPlacement(Handle, @WindowPlacement) then
@ -2299,8 +2299,8 @@ var
BuddyWP: WINDOWPLACEMENT; BuddyWP: WINDOWPLACEMENT;
begin begin
BuddyHandle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0); BuddyHandle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0);
if (BuddyHandle<>HWND(nil)) and Windows.GetWindowPlacement(BuddyHandle, BuddyWP) if (BuddyHandle<>HWND(nil)) and Windows.GetWindowPlacement(BuddyHandle, BuddyWP) then
then Width := WP.rcNormalPosition.Right - BuddyWP.rcNormalPosition.Left; Width := WP.rcNormalPosition.Right - BuddyWP.rcNormalPosition.Left;
end; end;
procedure ExcludeCaption; inline; procedure ExcludeCaption; inline;
@ -2382,7 +2382,7 @@ begin
ExcludeCaption; ExcludeCaption;
if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then if WindowInfo^.askBuddyCoords then
AdjustForBuddySize; AdjustForBuddySize;
end; end;

View File

@ -194,7 +194,8 @@ begin
// init buddy // init buddy
Params.SubClassWndProc := @SpinBuddyWindowProc; Params.SubClassWndProc := @SpinBuddyWindowProc;
WindowCreateInitBuddy(AWinControl, Params); WindowCreateInitBuddy(AWinControl, Params);
Params.BuddyWindowInfo^.isChildEdit := true; Params.BuddyWindowInfo^.isChildEdit := True;
Params.WindowInfo^.askBuddyCoords := True;
// make possible LCL Wincontrol identification by Buddy handle // make possible LCL Wincontrol identification by Buddy handle
// TODO: should move to widget specific SetProp method // TODO: should move to widget specific SetProp method
SetProp(Params.Buddy, 'WinControl', PtrUInt(AWinControl)); SetProp(Params.Buddy, 'WinControl', PtrUInt(AWinControl));