mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 16:41:26 +02:00
convert LM_SETPROPERTIES message to interface method for TCustomSpinEdit
git-svn-id: trunk@6058 -
This commit is contained in:
parent
01a5a0a6c7
commit
add872a567
@ -27,7 +27,7 @@ begin
|
||||
fValueNeedsUpdate:=true;
|
||||
exit;
|
||||
end;
|
||||
CNSendMessage(LM_SetProperties,Self,nil);
|
||||
TWSCustomSpinEditClass(WidgetSetClass).UpdateControl(Self);
|
||||
fValueNeedsUpdate:=false;
|
||||
end;
|
||||
|
||||
|
@ -6243,7 +6243,6 @@ const
|
||||
var
|
||||
Widget : PGtkWidget;
|
||||
wHandle : Pointer;
|
||||
AnAdjustment: PGtkAdjustment;
|
||||
|
||||
begin
|
||||
Result := 0; // default if nobody sets it
|
||||
@ -6286,31 +6285,6 @@ begin
|
||||
//Not here (Delphi compatibility): gtk_signal_emit_by_name (GTK_Object (Widget), 'value_changed');
|
||||
end;
|
||||
|
||||
csListView :
|
||||
{$IfDef GTK2}
|
||||
DebugLn('TODO: TGtkWidgetSet.SetProperties csListView');
|
||||
{$Else}
|
||||
begin
|
||||
end;
|
||||
{$EndIf}
|
||||
|
||||
csSpinEdit:
|
||||
Begin
|
||||
AnAdjustment:=gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(wHandle));
|
||||
if (AnAdjustment^.lower<>TSpinEdit(Sender).MinValue)
|
||||
or (AnAdjustment^.upper<>TSpinEdit(Sender).MaxValue) then
|
||||
begin
|
||||
AnAdjustment^.lower:=TSpinEdit(Sender).MinValue;
|
||||
AnAdjustment^.upper:=TSpinEdit(Sender).MaxValue;
|
||||
gtk_adjustment_changed(AnAdjustment);
|
||||
end;
|
||||
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(wHandle),
|
||||
TSpinEdit(Sender).Decimal_Places);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(wHandle),
|
||||
TSpinEdit(Sender).Value);
|
||||
GTK_SPIN_BUTTON(wHandle)^.climb_rate:=TSpinEdit(Sender).Climb_Rate;
|
||||
End;
|
||||
|
||||
else
|
||||
Assert (true, Format ('WARNING:[TGtkWidgetSet.SetProperties] failed for %s', [Sender.ClassName]));
|
||||
end;
|
||||
@ -7450,6 +7424,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.596 2004/09/23 21:16:45 micha
|
||||
convert LM_SETPROPERTIES message to interface method for TCustomSpinEdit
|
||||
|
||||
Revision 1.595 2004/09/23 20:36:30 micha
|
||||
convert LM_SETPROPERTIES message to interface method for TScrollBar
|
||||
|
||||
|
@ -27,7 +27,12 @@ unit GtkWSSpin;
|
||||
interface
|
||||
|
||||
uses
|
||||
Spin, WSSpin, WSLCLClasses;
|
||||
{$IFDEF gtk2}
|
||||
glib2, gdk2pixbuf, gdk2, gtk2, Pango,
|
||||
{$ELSE}
|
||||
glib, gdk, gtk, {$Ifndef NoGdkPixbufLib}gdkpixbuf,{$EndIf} GtkFontCache,
|
||||
{$ENDIF}
|
||||
Spin, WSSpin, WSLCLClasses, LCLType;
|
||||
|
||||
type
|
||||
|
||||
@ -37,6 +42,7 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class procedure UpdateControl(const ACustomSpinEdit: TCustomSpinEdit); override;
|
||||
end;
|
||||
|
||||
{ TGtkWSSpinEdit }
|
||||
@ -50,6 +56,29 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{ TGtkWSCustomSpinEdit }
|
||||
|
||||
procedure TGtkWSCustomSpinEdit.UpdateControl(const ACustomSpinEdit: TCustomSpinEdit);
|
||||
var
|
||||
AnAdjustment: PGtkAdjustment;
|
||||
wHandle: HWND;
|
||||
begin
|
||||
wHandle := ACustomSpinEdit.Handle;
|
||||
AnAdjustment:=gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(wHandle));
|
||||
if (AnAdjustment^.lower<>ACustomSpinEdit.MinValue)
|
||||
or (AnAdjustment^.upper<>ACustomSpinEdit.MaxValue) then
|
||||
begin
|
||||
AnAdjustment^.lower:=ACustomSpinEdit.MinValue;
|
||||
AnAdjustment^.upper:=ACustomSpinEdit.MaxValue;
|
||||
gtk_adjustment_changed(AnAdjustment);
|
||||
end;
|
||||
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(wHandle),
|
||||
ACustomSpinEdit.Decimal_Places);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(wHandle),
|
||||
ACustomSpinEdit.Value);
|
||||
GTK_SPIN_BUTTON(wHandle)^.climb_rate:=ACustomSpinEdit.Climb_Rate;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -58,7 +87,7 @@ initialization
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCustomSpinEdit, TGtkWSCustomSpinEdit);
|
||||
RegisterWSComponent(TCustomSpinEdit, TGtkWSCustomSpinEdit);
|
||||
// RegisterWSComponent(TSpinEdit, TGtkWSSpinEdit);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
|
@ -1700,12 +1700,6 @@ begin
|
||||
|
||||
Case TControl(Sender).FCompStyle Of
|
||||
|
||||
csSpinEdit:
|
||||
Begin
|
||||
SendMessage(Handle, UDM_SETRANGE, 0, MakeLong(Trunc(TSpinEdit(Sender).MaxValue), Trunc(TSpinEdit(Sender).MinValue)));
|
||||
SendMessage(Handle, UDM_SETPOS, 0, MakeLong(Trunc(TSpinEdit(Sender).Value), 0));
|
||||
End;
|
||||
|
||||
csTrackbar:
|
||||
With(TCustomTrackBar(Sender)) Do
|
||||
Begin
|
||||
@ -1760,6 +1754,9 @@ End;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.284 2004/09/23 21:16:46 micha
|
||||
convert LM_SETPROPERTIES message to interface method for TCustomSpinEdit
|
||||
|
||||
Revision 1.283 2004/09/23 20:36:30 micha
|
||||
convert LM_SETPROPERTIES message to interface method for TScrollBar
|
||||
|
||||
|
@ -51,6 +51,8 @@ type
|
||||
|
||||
class procedure SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer); override;
|
||||
|
||||
class procedure UpdateControl(const ACustomSpinEdit: TCustomSpinEdit); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSSpinEdit }
|
||||
@ -91,6 +93,16 @@ begin
|
||||
EditSetSelLength(SendMessage(ACustomSpinEdit.Handle, UDM_GETBUDDY, 0, 0), NewLength);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomSpinEdit.UpdateControl(const ACustomSpinEdit: TCustomSpinEdit);
|
||||
var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ACustomSpinEdit.Handle;
|
||||
SendMessage(Handle, UDM_SETRANGE, 0, MakeLong(Trunc(ACustomSpinEdit.MaxValue),
|
||||
Trunc(ACustomSpinEdit.MinValue)));
|
||||
SendMessage(Handle, UDM_SETPOS, 0, MakeLong(Trunc(ACustomSpinEdit.Value), 0));
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -58,6 +58,8 @@ type
|
||||
|
||||
class procedure SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer); virtual;
|
||||
|
||||
class procedure UpdateControl(const ACustomSpinEdit: TCustomSpinEdit); virtual;
|
||||
end;
|
||||
TWSCustomSpinEditClass = class of TWSCustomSpinEdit;
|
||||
|
||||
@ -94,6 +96,10 @@ procedure TWSCustomSpinEdit.SetSelLength(const ACustomSpinEdit: TCustomSpinEdit;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomSpinEdit.UpdateControl(const ACustomSpinEdit: TCustomSpinEdit);
|
||||
begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user