lcl, win32, wince: move button controls flags into CreateParams methods

git-svn-id: trunk@25473 -
This commit is contained in:
paul 2010-05-17 01:10:18 +00:00
parent 04fbaa3b72
commit 7686d846ed
8 changed files with 36 additions and 21 deletions

View File

@ -242,6 +242,12 @@ begin
inherited TextChanged; inherited TextChanged;
end; 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; function TCustomCheckBox.DialogChar(var Message: TLMKey): boolean;
begin begin
if IsAccel(Message.CharCode, Caption) and CanFocus then if IsAccel(Message.CharCode, Caption) and CanFocus then

View File

@ -26,6 +26,12 @@ begin
Result.CY := 105; Result.CY := 105;
end; end;
procedure TCustomGroupBox.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or BS_GROUPBOX;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function TCustomGroupBox.Create function TCustomGroupBox.Create
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}

View File

@ -105,6 +105,14 @@ begin
end; end;
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; class procedure TRadioButton.WSRegisterClass;
begin begin
inherited WSRegisterClass; inherited WSRegisterClass;

View File

@ -22,11 +22,17 @@ begin
RegisterToggleBox; RegisterToggleBox;
end; 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); constructor TToggleBox.Create(TheOwner : TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
fCompStyle := csToggleBox; fCompStyle := csToggleBox;
AutoSize:=false; AutoSize := False;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}

View File

@ -498,7 +498,6 @@ begin
SubClassWndProc := @GroupBoxWindowProc; SubClassWndProc := @GroupBoxWindowProc;
pClassName := @ButtonClsName[0]; pClassName := @ButtonClsName[0];
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags or BS_GROUPBOX;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, False); FinishCreateWindow(AWinControl, Params, False);
@ -1570,7 +1569,6 @@ begin
begin begin
pClassName := @ButtonClsName[0]; pClassName := @ButtonClsName[0];
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags or BS_3STATE;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);
@ -1652,7 +1650,6 @@ begin
begin begin
pClassName := @ButtonClsName[0]; pClassName := @ButtonClsName[0];
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags or BS_AUTOCHECKBOX or BS_PUSHLIKE;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);
@ -1674,9 +1671,6 @@ begin
begin begin
pClassName := @ButtonClsName[0]; pClassName := @ButtonClsName[0];
WindowTitle := StrCaption; WindowTitle := StrCaption;
// BS_AUTORADIOBUTTON may hang the application,
// if the radiobuttons are not consecutive controls.
Flags := Flags or BS_RADIOBUTTON;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);

View File

@ -413,18 +413,10 @@ begin
begin begin
pClassName := @ButtonClsName; pClassName := @ButtonClsName;
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags Or BS_GROUPBOX;
end; end;
// create window // create window
Params.SubClassWndProc := @GroupBoxPanelWindowProc; Params.SubClassWndProc := @GroupBoxPanelWindowProc;
FinishCreateWindow(AWinControl, Params, false); 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; Result := Params.Window;
end; end;
@ -1268,7 +1260,6 @@ begin
begin begin
pClassName := @ButtonClsName; pClassName := @ButtonClsName;
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags or BS_3STATE;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);
@ -1341,7 +1332,6 @@ begin
begin begin
pClassName := @ButtonClsName; pClassName := @ButtonClsName;
WindowTitle := StrCaption; WindowTitle := StrCaption;
Flags := Flags or BS_AUTOCHECKBOX or BS_PUSHLIKE;
end; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);
@ -1366,9 +1356,6 @@ begin
begin begin
pClassName := @ButtonClsName; pClassName := @ButtonClsName;
WindowTitle := StrCaption; 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; end;
// create window // create window
FinishCreateWindow(AWinControl, Params, false); FinishCreateWindow(AWinControl, Params, false);

View File

@ -906,7 +906,12 @@ const
{ Button styles } { Button styles }
BS_PUSHBUTTON = $00000000; BS_PUSHBUTTON = $00000000;
BS_DEFPUSHBUTTON = $00000001; BS_DEFPUSHBUTTON = $00000001;
BS_AUTOCHECKBOX = $00000003;
BS_RADIOBUTTON = $00000004;
BS_3STATE = $00000005;
BS_GROUPBOX = $00000007;
BS_OWNERDRAW = $0000000B; BS_OWNERDRAW = $0000000B;
BS_PUSHLIKE = $00001000;
const const
//============================================== //==============================================

View File

@ -163,6 +163,7 @@ type
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
class function GetControlClassDefaultSize: TSize; override; class function GetControlClassDefaultSize: TSize; override;
procedure CreateParams(var Params: TCreateParams); override;
public public
constructor Create(AOwner: TComponent); Override; constructor Create(AOwner: TComponent); Override;
end; end;
@ -1194,6 +1195,7 @@ type
procedure Loaded; override; procedure Loaded; override;
procedure WSSetText(const AText: String); override; procedure WSSetText(const AText: String); override;
procedure TextChanged; override; procedure TextChanged; override;
procedure CreateParams(var Params: TCreateParams); override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
public public
@ -1263,9 +1265,9 @@ type
{ TToggleBox } { TToggleBox }
TToggleBox = class(TCustomCheckBox) TToggleBox = class(TCustomCheckBox)
private
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
published published
@ -1315,6 +1317,7 @@ type
procedure SetChecked(Value: Boolean); override; procedure SetChecked(Value: Boolean); override;
procedure DoChange(var Msg); message LM_CHANGED; procedure DoChange(var Msg); message LM_CHANGED;
procedure DoApplyChanges; procedure DoApplyChanges;
procedure CreateParams(var Params: TCreateParams); override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
published published