convert LM_SETPROPERTIES message to interface method for TProgressBar

git-svn-id: trunk@6053 -
This commit is contained in:
micha 2004-09-23 14:50:47 +00:00
parent 7c078384c9
commit fe50379736
6 changed files with 82 additions and 60 deletions

View File

@ -255,7 +255,7 @@ begin
if Position<Min then FPosition:=Min;
if Position>Max then FPosition:=Max;
if HandleAllocated then begin
CNSendMessage(LM_SETPROPERTIES, Self, nil);
TWSProgressBarClass(WidgetSetClass).ApplyChanges(Self);
end;
end;
end;
@ -302,6 +302,9 @@ end;
{
$Log$
Revision 1.10 2004/09/23 14:50:47 micha
convert LM_SETPROPERTIES message to interface method for TProgressBar
Revision 1.9 2004/09/21 10:05:26 mattias
fixed disable at designtime and bounding TProgressBar position

View File

@ -6258,40 +6258,6 @@ begin
Widget:= GTK_WIDGET(wHandle);
case TControl(Sender).fCompStyle of
csProgressBar :
with TProgressBar(Sender) do
begin
if Smooth
then gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_CONTINUOUS)
else gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_DISCRETE);
case Orientation of
pbVertical : gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_BOTTOM_TO_TOP);
pbRightToLeft: gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_RIGHT_TO_LEFT);
pbTopDown : gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_TOP_TO_BOTTOM);
else { pbHorizontal is default }
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(wHandle),
GTK_PROGRESS_LEFT_TO_RIGHT);
end;
if BarShowText then
begin
gtk_progress_set_format_string (GTK_PROGRESS(wHandle),
'%v from [%l-%u] (=%p%%)');
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GdkTrue);
end
else
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GDKFalse);
gtk_progress_configure(GTK_PROGRESS(wHandle),Position,Min,Max);
end;
csScrollBar:
with (TScrollBar (Sender)) do
begin
@ -7495,6 +7461,9 @@ end;
{ =============================================================================
$Log$
Revision 1.594 2004/09/23 14:50:47 micha
convert LM_SETPROPERTIES message to interface method for TProgressBar
Revision 1.593 2004/09/22 18:06:32 micha
convert LM_SETPROPERTIES message to interface methods for TCustomListView

View File

@ -114,6 +114,7 @@ type
private
protected
public
class procedure ApplyChanges(const AProgressBar: TProgressBar); override;
class procedure SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer); override;
end;
@ -883,6 +884,44 @@ end;
{ TGtkWSProgressBar }
procedure TGtkWSProgressBar.ApplyChanges(const AProgressBar: TProgressBar);
var
wHandle: HWND;
begin
wHandle := AProgressBar.Handle;
with AProgressBar do
begin
if Smooth
then gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_CONTINUOUS)
else gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_DISCRETE);
case Orientation of
pbVertical : gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_BOTTOM_TO_TOP);
pbRightToLeft: gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_RIGHT_TO_LEFT);
pbTopDown : gtk_progress_bar_set_orientation(
GTK_PROGRESS_BAR(whandle),
GTK_PROGRESS_TOP_TO_BOTTOM);
else { pbHorizontal is default }
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(wHandle),
GTK_PROGRESS_LEFT_TO_RIGHT);
end;
if BarShowText then
begin
gtk_progress_set_format_string (GTK_PROGRESS(wHandle),
'%v from [%l-%u] (=%p%%)');
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GdkTrue);
end
else
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GDKFalse);
gtk_progress_configure(GTK_PROGRESS(wHandle),Position,Min,Max);
end;
end;
procedure TGtkWSProgressBar.SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer);
begin
gtk_progress_set_value(GTK_PROGRESS(AProgressBar.Handle), NewPosition);

View File

@ -1700,29 +1700,6 @@ begin
Case TControl(Sender).FCompStyle Of
csProgressBar:
With TProgressBar(Sender) Do
Begin
{ smooth and vertical need window recreation }
if ((GetWindowLong(Handle, GWL_STYLE) and PBS_SMOOTH ) <>
Integer(Smooth) * PBS_SMOOTH) or
((GetWindowLong(Handle, GWL_STYLE) and PBS_VERTICAL) <>
Integer((Orientation = pbVertical) or (Orientation = pbTopDown)) * PBS_VERTICAL) then
Self.RecreateWnd(TWinControl(Sender));
SendMessage(Handle, PBM_SETRANGE, 0, MakeLParam(Min, Max));
SendMessage(Handle, PBM_SETPOS, Position, 0);
{ TODO: Implementable?
If BarShowText Then
Begin
SetWindowText(Handle, StrToPChar((Sender As TControl).Caption));
End
Else
SetWindowText(Handle, Nil);
}
End;
csScrollBar:
With (TScrollBar(Sender)) Do
Begin
@ -1797,6 +1774,9 @@ End;
{
$Log$
Revision 1.282 2004/09/23 14:50:47 micha
convert LM_SETPROPERTIES message to interface method for TProgressBar
Revision 1.281 2004/09/22 18:06:32 micha
convert LM_SETPROPERTIES message to interface methods for TCustomListView

View File

@ -28,10 +28,10 @@ interface
uses
// FCL
Classes, Windows, SysUtils,
Classes, Windows, SysUtils, WinExt,
// LCL
ComCtrls, LCLType, Controls, Graphics,
LCLProc,
LCLProc, InterfaceBase, Win32Int,
// widgetset
WSComCtrls, WSLCLClasses, WSProc;
@ -105,6 +105,7 @@ type
private
protected
public
class procedure ApplyChanges(const AProgressBar: TProgressBar); override;
class procedure SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer); override;
end;
@ -512,6 +513,31 @@ end;
{ TWin32WSProgressBar }
procedure TWin32WSProgressBar.ApplyChanges(const AProgressBar: TProgressBar);
begin
with AProgressBar do
begin
{ smooth and vertical need window recreation }
if ((GetWindowLong(Handle, GWL_STYLE) and PBS_SMOOTH ) <>
Integer(Smooth) * PBS_SMOOTH) or
((GetWindowLong(Handle, GWL_STYLE) and PBS_VERTICAL) <>
Integer((Orientation = pbVertical) or (Orientation = pbTopDown)) * PBS_VERTICAL) then
TWin32WidgetSet(InterfaceObject).RecreateWnd(AProgressBar);
SendMessage(Handle, PBM_SETRANGE, 0, MakeLParam(Min, Max));
SendMessage(Handle, PBM_SETPOS, Position, 0);
{ TODO: Implementable?
If BarShowText Then
Begin
SetWindowText(Handle, StrToPChar((Sender As TControl).Caption));
End
Else
SetWindowText(Handle, Nil);
}
end;
end;
procedure TWin32WSProgressBar.SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer);
begin
Windows.SendMessage(AProgressBar.Handle, PBM_SETPOS, Windows.WPARAM(NewPosition), 0);

View File

@ -105,6 +105,7 @@ type
TWSProgressBarClass = class of TWSProgressBar;
TWSProgressBar = class(TWSWinControl)
class procedure ApplyChanges(const AProgressBar: TProgressBar); virtual;
class procedure SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer); virtual;
end;
@ -242,6 +243,10 @@ end;
{ TWSProgressBar }
procedure TWSProgressBar.ApplyChanges(const AProgressBar: TProgressBar);
begin
end;
procedure TWSProgressBar.SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer);
begin
end;