From 7686d846ed1338ea601e854c54f54c1ccc6b4964 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 17 May 2010 01:10:18 +0000 Subject: [PATCH] lcl, win32, wince: move button controls flags into CreateParams methods git-svn-id: trunk@25473 - --- lcl/include/customcheckbox.inc | 6 ++++++ lcl/include/customgroupbox.inc | 6 ++++++ lcl/include/radiobutton.inc | 8 ++++++++ lcl/include/togglebox.inc | 8 +++++++- lcl/interfaces/win32/win32wsstdctrls.pp | 6 ------ lcl/interfaces/wince/wincewsstdctrls.pp | 13 ------------- lcl/lcltype.pp | 5 +++++ lcl/stdctrls.pp | 5 ++++- 8 files changed, 36 insertions(+), 21 deletions(-) diff --git a/lcl/include/customcheckbox.inc b/lcl/include/customcheckbox.inc index 4786feacf3..0752e3bfe7 100644 --- a/lcl/include/customcheckbox.inc +++ b/lcl/include/customcheckbox.inc @@ -242,6 +242,12 @@ begin inherited TextChanged; end; +procedure TCustomCheckBox.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + Params.Style := Params.Style or BS_3STATE; +end; + function TCustomCheckBox.DialogChar(var Message: TLMKey): boolean; begin if IsAccel(Message.CharCode, Caption) and CanFocus then diff --git a/lcl/include/customgroupbox.inc b/lcl/include/customgroupbox.inc index cff1b6bb1d..944a9461f2 100644 --- a/lcl/include/customgroupbox.inc +++ b/lcl/include/customgroupbox.inc @@ -26,6 +26,12 @@ begin Result.CY := 105; end; +procedure TCustomGroupBox.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + Params.Style := Params.Style or BS_GROUPBOX; +end; + {------------------------------------------------------------------------------ function TCustomGroupBox.Create ------------------------------------------------------------------------------} diff --git a/lcl/include/radiobutton.inc b/lcl/include/radiobutton.inc index 48f94c14ae..df946d5eb3 100644 --- a/lcl/include/radiobutton.inc +++ b/lcl/include/radiobutton.inc @@ -105,6 +105,14 @@ begin end; end; +procedure TRadioButton.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + // BS_AUTORADIOBUTTON may hang the application, + // if the radiobuttons are not consecutive controls. + Params.Style := (Params.Style and not BS_3STATE) or BS_RADIOBUTTON; +end; + class procedure TRadioButton.WSRegisterClass; begin inherited WSRegisterClass; diff --git a/lcl/include/togglebox.inc b/lcl/include/togglebox.inc index 008af7a673..3a3efd774f 100644 --- a/lcl/include/togglebox.inc +++ b/lcl/include/togglebox.inc @@ -22,11 +22,17 @@ begin RegisterToggleBox; end; +procedure TToggleBox.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + Params.Style := (Params.Style and not BS_3STATE) or BS_AUTOCHECKBOX or BS_PUSHLIKE; +end; + constructor TToggleBox.Create(TheOwner : TComponent); begin inherited Create(TheOwner); fCompStyle := csToggleBox; - AutoSize:=false; + AutoSize := False; end; {------------------------------------------------------------------------------} diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index b87f3c6f19..014cd6c5d9 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -498,7 +498,6 @@ begin SubClassWndProc := @GroupBoxWindowProc; pClassName := @ButtonClsName[0]; WindowTitle := StrCaption; - Flags := Flags or BS_GROUPBOX; end; // create window FinishCreateWindow(AWinControl, Params, False); @@ -1570,7 +1569,6 @@ begin begin pClassName := @ButtonClsName[0]; WindowTitle := StrCaption; - Flags := Flags or BS_3STATE; end; // create window FinishCreateWindow(AWinControl, Params, false); @@ -1652,7 +1650,6 @@ begin begin pClassName := @ButtonClsName[0]; WindowTitle := StrCaption; - Flags := Flags or BS_AUTOCHECKBOX or BS_PUSHLIKE; end; // create window FinishCreateWindow(AWinControl, Params, false); @@ -1674,9 +1671,6 @@ begin begin pClassName := @ButtonClsName[0]; WindowTitle := StrCaption; - // BS_AUTORADIOBUTTON may hang the application, - // if the radiobuttons are not consecutive controls. - Flags := Flags or BS_RADIOBUTTON; end; // create window FinishCreateWindow(AWinControl, Params, false); diff --git a/lcl/interfaces/wince/wincewsstdctrls.pp b/lcl/interfaces/wince/wincewsstdctrls.pp index cc773975e7..7d546c7212 100644 --- a/lcl/interfaces/wince/wincewsstdctrls.pp +++ b/lcl/interfaces/wince/wincewsstdctrls.pp @@ -413,18 +413,10 @@ begin begin pClassName := @ButtonClsName; WindowTitle := StrCaption; - Flags := Flags Or BS_GROUPBOX; end; // create window Params.SubClassWndProc := @GroupBoxPanelWindowProc; FinishCreateWindow(AWinControl, Params, false); - // handle winxp panel hack - // if themed but does not have tabpage as parent - // remember we are a groupbox in need of erasebackground hack -// if TWinCEWidgetSet(WidgetSet).ThemesActive -// and not Params.WindowInfo^.hasTabParent then -// Params.WindowInfo^.isGroupBox := true; -// AWinControl.InvalidateClientRectCache(true); Result := Params.Window; end; @@ -1268,7 +1260,6 @@ begin begin pClassName := @ButtonClsName; WindowTitle := StrCaption; - Flags := Flags or BS_3STATE; end; // create window FinishCreateWindow(AWinControl, Params, false); @@ -1341,7 +1332,6 @@ begin begin pClassName := @ButtonClsName; WindowTitle := StrCaption; - Flags := Flags or BS_AUTOCHECKBOX or BS_PUSHLIKE; end; // create window FinishCreateWindow(AWinControl, Params, false); @@ -1366,9 +1356,6 @@ begin begin pClassName := @ButtonClsName; WindowTitle := StrCaption; - // BS_AUTORADIOBUTTON may hang the application, - // if the radiobuttons are not consecutive controls.//roozbeh:is it so in wince? - Flags := Flags or BS_RADIOBUTTON; end; // create window FinishCreateWindow(AWinControl, Params, false); diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 8f5d38b3fa..df5f97898d 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -906,7 +906,12 @@ const { Button styles } BS_PUSHBUTTON = $00000000; BS_DEFPUSHBUTTON = $00000001; + BS_AUTOCHECKBOX = $00000003; + BS_RADIOBUTTON = $00000004; + BS_3STATE = $00000005; + BS_GROUPBOX = $00000007; BS_OWNERDRAW = $0000000B; + BS_PUSHLIKE = $00001000; const //============================================== diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 0d31cddde7..85a5b61609 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -163,6 +163,7 @@ type protected class procedure WSRegisterClass; override; class function GetControlClassDefaultSize: TSize; override; + procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent); Override; end; @@ -1194,6 +1195,7 @@ type procedure Loaded; override; procedure WSSetText(const AText: String); override; procedure TextChanged; override; + procedure CreateParams(var Params: TCreateParams); override; public constructor Create(TheOwner: TComponent); override; public @@ -1263,9 +1265,9 @@ type { TToggleBox } TToggleBox = class(TCustomCheckBox) - private protected class procedure WSRegisterClass; override; + procedure CreateParams(var Params: TCreateParams); override; public constructor Create(TheOwner: TComponent); override; published @@ -1315,6 +1317,7 @@ type procedure SetChecked(Value: Boolean); override; procedure DoChange(var Msg); message LM_CHANGED; procedure DoApplyChanges; + procedure CreateParams(var Params: TCreateParams); override; public constructor Create(TheOwner: TComponent); override; published