summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fpgtk/src/editor/progwin.pp
blob: da195a70e8a63e201891287c65252c8ccdd3d625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{$mode objfpc}{$h+}
unit ProgWin;

interface

uses FPgtk, gtk, classes;

type

  TProgressWindow = class (TFPgtkWindow)
  private
    Bar : TFPgtkProgressbar;
    procedure ComposeWindow;
  public
    procedure StepIt;
    procedure SetMax (max : integer);
    constructor create;
  end;

implementation

uses gtkDefTexts;

procedure TProgressWindow.ComposeWindow;
begin
  Title := ProgressWinTitle;
  border := 20;

  bar := TFPgtkProgressBar.Create (nil);
  bar.FormatString := '- %p%% -';
  add (bar);

end;

procedure TProgressWindow.StepIt;
begin
  with bar do
    CurrentValue := CurrentValue + 1.0;
end;

procedure TProgressWindow.SetMax (max : integer);
begin
  bar.Configure (0.0,0.0,max);
end;

constructor TProgressWindow.create;
begin
  inherited create (gtk_window_dialog);
  ComposeWindow;
end;

end.