mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:49:12 +02:00
convert LM_BTNDEFAULT_CHANGED message to interface method
git-svn-id: trunk@5970 -
This commit is contained in:
parent
b09d407049
commit
9331f9ce12
@ -61,7 +61,7 @@ end;
|
|||||||
procedure TCustomButton.DoSendBtnDefault;
|
procedure TCustomButton.DoSendBtnDefault;
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
CNSendMessage(LM_BTNDEFAULT_CHANGED,Self,nil);
|
TWSButtonClass(WidgetSetClass).DefaultButtonChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomButton.ControlKeyDown(var Key: Word; Shift: TShiftState);
|
procedure TCustomButton.ControlKeyDown(var Key: Word; Shift: TShiftState);
|
||||||
@ -224,6 +224,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.35 2004/09/11 14:54:01 micha
|
||||||
|
convert LM_BTNDEFAULT_CHANGED message to interface method
|
||||||
|
|
||||||
Revision 1.34 2004/08/26 19:09:34 mattias
|
Revision 1.34 2004/08/26 19:09:34 mattias
|
||||||
moved navigation key handling to TApplication and added options for custom navigation
|
moved navigation key handling to TApplication and added options for custom navigation
|
||||||
|
|
||||||
|
@ -3164,21 +3164,6 @@ begin
|
|||||||
handle := hwnd(ObjectToGtkObject(Sender));
|
handle := hwnd(ObjectToGtkObject(Sender));
|
||||||
Case LM_Message of
|
Case LM_Message of
|
||||||
|
|
||||||
LM_BTNDEFAULT_CHANGED :
|
|
||||||
Begin
|
|
||||||
if (TCustomButton(Sender).Default)
|
|
||||||
and (GTK_WIDGET_CAN_DEFAULT(pgtkwidget(handle))) then
|
|
||||||
//gtk_widget_grab_default(pgtkwidget(handle))
|
|
||||||
else begin
|
|
||||||
{DebugLn('LM_BTNDEFAULT_CHANGED ',TCustomButton(Sender).Name,':',Sender.ClassName,' widget can not grab default ',
|
|
||||||
' visible=',GTK_WIDGET_VISIBLE(PGtkWidget(Handle)),
|
|
||||||
' realized=',GTK_WIDGET_REALIZED(PGtkWidget(Handle)),
|
|
||||||
' mapped=',GTK_WIDGET_MAPPED(PGtkWidget(Handle)),
|
|
||||||
'');}
|
|
||||||
// gtk_widget_Draw_Default(pgtkwidget(Handle)); //this isn't right but I'm not sure what to call
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
LM_DESTROY :
|
LM_DESTROY :
|
||||||
DestroyLCLComponent(Sender);
|
DestroyLCLComponent(Sender);
|
||||||
|
|
||||||
@ -8651,6 +8636,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.552 2004/09/11 14:54:01 micha
|
||||||
|
convert LM_BTNDEFAULT_CHANGED message to interface method
|
||||||
|
|
||||||
Revision 1.551 2004/09/11 13:38:37 micha
|
Revision 1.551 2004/09/11 13:38:37 micha
|
||||||
convert LM_BRINGTOFRONT message to interface method
|
convert LM_BRINGTOFRONT message to interface method
|
||||||
NOTE: was only used for tapplication, not from other controls
|
NOTE: was only used for tapplication, not from other controls
|
||||||
|
@ -58,6 +58,7 @@ type
|
|||||||
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
||||||
public
|
public
|
||||||
class function CreateHandle(const AComponent: TComponent; const AParams: TCreateParams): THandle; override;
|
class function CreateHandle(const AComponent: TComponent; const AParams: TCreateParams): THandle; override;
|
||||||
|
class procedure DefaultButtonChanged(const AButton: TCustomButton); override;
|
||||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||||
end;
|
end;
|
||||||
@ -132,6 +133,21 @@ begin
|
|||||||
SetCallbacks(PGtkWidget(Result), WidgetInfo);
|
SetCallbacks(PGtkWidget(Result), WidgetInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGtkWSButton.DefaultButtonChanged(const AButton: TCustomButton);
|
||||||
|
begin
|
||||||
|
if (AButton.Default)
|
||||||
|
and (GTK_WIDGET_CAN_DEFAULT(pgtkwidget(AButton.Handle))) then
|
||||||
|
//gtk_widget_grab_default(pgtkwidget(handle))
|
||||||
|
else begin
|
||||||
|
{DebugLn('LM_BTNDEFAULT_CHANGED ',TCustomButton(Sender).Name,':',Sender.ClassName,' widget can not grab default ',
|
||||||
|
' visible=',GTK_WIDGET_VISIBLE(PGtkWidget(Handle)),
|
||||||
|
' realized=',GTK_WIDGET_REALIZED(PGtkWidget(Handle)),
|
||||||
|
' mapped=',GTK_WIDGET_MAPPED(PGtkWidget(Handle)),
|
||||||
|
'');}
|
||||||
|
// gtk_widget_Draw_Default(pgtkwidget(Handle)); //this isn't right but I'm not sure what to call
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGtkWSButton.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
|
function TGtkWSButton.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
|
||||||
begin
|
begin
|
||||||
// The button text is static, so let the LCL fallback to FCaption
|
// The button text is static, so let the LCL fallback to FCaption
|
||||||
|
@ -308,15 +308,6 @@ Begin
|
|||||||
Exit;
|
Exit;
|
||||||
End;
|
End;
|
||||||
Case LM_Message of
|
Case LM_Message of
|
||||||
LM_BTNDEFAULT_CHANGED:
|
|
||||||
Begin
|
|
||||||
WindowStyle := Windows.GetWindowLong(Handle, GWL_STYLE) and not (BS_DEFPUSHBUTTON or BS_PUSHBUTTON);
|
|
||||||
If TCustomButton(Sender).Default then
|
|
||||||
WindowStyle := WindowStyle or BS_DEFPUSHBUTTON
|
|
||||||
else
|
|
||||||
WindowStyle := WindowStyle or BS_PUSHBUTTON;
|
|
||||||
Windows.SendMessage(Handle, BM_SETSTYLE, WindowStyle, 1);
|
|
||||||
End;
|
|
||||||
LM_DESTROY:
|
LM_DESTROY:
|
||||||
Begin
|
Begin
|
||||||
If (Sender Is TWinControl) Or (Sender Is TCommonDialog) Then
|
If (Sender Is TWinControl) Or (Sender Is TCommonDialog) Then
|
||||||
@ -2575,6 +2566,9 @@ End;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.244 2004/09/11 14:54:01 micha
|
||||||
|
convert LM_BTNDEFAULT_CHANGED message to interface method
|
||||||
|
|
||||||
Revision 1.243 2004/09/11 13:38:37 micha
|
Revision 1.243 2004/09/11 13:38:37 micha
|
||||||
convert LM_BRINGTOFRONT message to interface method
|
convert LM_BRINGTOFRONT message to interface method
|
||||||
NOTE: was only used for tapplication, not from other controls
|
NOTE: was only used for tapplication, not from other controls
|
||||||
|
@ -45,6 +45,7 @@ type
|
|||||||
private
|
private
|
||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
|
class procedure DefaultButtonChanged(const AButton: TCustomButton); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWin32WSBitBtn }
|
{ TWin32WSBitBtn }
|
||||||
@ -71,6 +72,20 @@ implementation
|
|||||||
uses
|
uses
|
||||||
Win32Int, InterfaceBase;
|
Win32Int, InterfaceBase;
|
||||||
|
|
||||||
|
{ TWin32WSButton }
|
||||||
|
|
||||||
|
procedure TWin32WSButton.DefaultButtonChanged(const AButton: TCustomButton);
|
||||||
|
var
|
||||||
|
WindowStyle: dword;
|
||||||
|
begin
|
||||||
|
WindowStyle := Windows.GetWindowLong(AButton.Handle, GWL_STYLE) and not (BS_DEFPUSHBUTTON or BS_PUSHBUTTON);
|
||||||
|
If AButton.Default then
|
||||||
|
WindowStyle := WindowStyle or BS_DEFPUSHBUTTON
|
||||||
|
else
|
||||||
|
WindowStyle := WindowStyle or BS_PUSHBUTTON;
|
||||||
|
Windows.SendMessage(AButton.Handle, BM_SETSTYLE, WindowStyle, 1);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWin32WSBitBtn }
|
{ TWin32WSBitBtn }
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -346,7 +361,7 @@ initialization
|
|||||||
// To improve speed, register only classes
|
// To improve speed, register only classes
|
||||||
// which actually implement something
|
// which actually implement something
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// RegisterWSComponent(TCustomButton, TWin32WSButton);
|
RegisterWSComponent(TCustomButton, TWin32WSButton);
|
||||||
RegisterWSComponent(TCustomBitBtn, TWin32WSBitBtn);
|
RegisterWSComponent(TCustomBitBtn, TWin32WSBitBtn);
|
||||||
// RegisterWSComponent(TCustomSpeedButton, TWin32WSSpeedButton);
|
// RegisterWSComponent(TCustomSpeedButton, TWin32WSSpeedButton);
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
@ -74,8 +74,6 @@ const
|
|||||||
LM_INSERTTOOLBUTTON = LM_ComUser+46;
|
LM_INSERTTOOLBUTTON = LM_ComUser+46;
|
||||||
LM_DELETETOOLBUTTON = LM_ComUser+47;
|
LM_DELETETOOLBUTTON = LM_ComUser+47;
|
||||||
|
|
||||||
LM_BTNDEFAULT_CHANGED = LM_ComUser+51;
|
|
||||||
|
|
||||||
LM_DRAGINFOCHANGED = LM_COMUSER+53;
|
LM_DRAGINFOCHANGED = LM_COMUSER+53;
|
||||||
|
|
||||||
//LM_SETENABLED = LM_COMUSER+54;
|
//LM_SETENABLED = LM_COMUSER+54;
|
||||||
@ -873,8 +871,6 @@ begin
|
|||||||
LM_INSERTTOOLBUTTON :Result:='LM_INSERTTOOLBUTTON';
|
LM_INSERTTOOLBUTTON :Result:='LM_INSERTTOOLBUTTON';
|
||||||
LM_DELETETOOLBUTTON :Result:='LM_DELETETOOLBUTTON';
|
LM_DELETETOOLBUTTON :Result:='LM_DELETETOOLBUTTON';
|
||||||
|
|
||||||
LM_BTNDEFAULT_CHANGED :Result:='LM_BTNDEFAULT_CHANGED';
|
|
||||||
|
|
||||||
LM_DRAGINFOCHANGED :Result:='LM_DRAGINFOCHANGED';
|
LM_DRAGINFOCHANGED :Result:='LM_DRAGINFOCHANGED';
|
||||||
|
|
||||||
//LM_SETENABLED :Result:='LM_SETENABLED';
|
//LM_SETENABLED :Result:='LM_SETENABLED';
|
||||||
@ -1015,6 +1011,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.86 2004/09/11 14:54:01 micha
|
||||||
|
convert LM_BTNDEFAULT_CHANGED message to interface method
|
||||||
|
|
||||||
Revision 1.85 2004/09/11 13:38:37 micha
|
Revision 1.85 2004/09/11 13:38:37 micha
|
||||||
convert LM_BRINGTOFRONT message to interface method
|
convert LM_BRINGTOFRONT message to interface method
|
||||||
NOTE: was only used for tapplication, not from other controls
|
NOTE: was only used for tapplication, not from other controls
|
||||||
|
@ -49,10 +49,14 @@ uses
|
|||||||
WSLCLClasses, WSStdCtrls, WSControls;
|
WSLCLClasses, WSStdCtrls, WSControls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TWSButton }
|
{ TWSButton }
|
||||||
|
|
||||||
TWSButton = class(TWSButtonControl)
|
TWSButton = class(TWSButtonControl)
|
||||||
|
public
|
||||||
|
class procedure DefaultButtonChanged(const AButton: TCustomButton); virtual;
|
||||||
end;
|
end;
|
||||||
|
TWSButtonClass = class of TWSButton;
|
||||||
|
|
||||||
{ TWSBitBtn }
|
{ TWSBitBtn }
|
||||||
|
|
||||||
@ -74,6 +78,14 @@ implementation
|
|||||||
|
|
||||||
// TODO: Can't be virtual abstract ?
|
// TODO: Can't be virtual abstract ?
|
||||||
|
|
||||||
|
{ TWSButton }
|
||||||
|
|
||||||
|
procedure TWSButton.DefaultButtonChanged(const AButton: TCustomButton);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TWSCustomBitBtn }
|
||||||
|
|
||||||
procedure TWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
|
procedure TWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
|
||||||
const AValue: TBitmap);
|
const AValue: TBitmap);
|
||||||
begin
|
begin
|
||||||
@ -101,7 +113,7 @@ initialization
|
|||||||
// To improve speed, register only classes
|
// To improve speed, register only classes
|
||||||
// which actually implement something
|
// which actually implement something
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// RegisterWSComponent(CustomTButton, TWSButton);
|
// RegisterWSComponent(TCustomButton, TWSButton);
|
||||||
// RegisterWSComponent(TCustomBitBtn, TWSBitBtn);
|
// RegisterWSComponent(TCustomBitBtn, TWSBitBtn);
|
||||||
// RegisterWSComponent(TCustomSpeedButton, TWSSpeedButton);
|
// RegisterWSComponent(TCustomSpeedButton, TWSSpeedButton);
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user