progwin.pp 815 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {$mode objfpc}{$h+}
  2. unit ProgWin;
  3. interface
  4. uses FPgtk, gtk, classes;
  5. type
  6. TProgressWindow = class (TFPgtkWindow)
  7. private
  8. Bar : TFPgtkProgressbar;
  9. procedure ComposeWindow;
  10. public
  11. procedure StepIt;
  12. procedure SetMax (max : integer);
  13. constructor create;
  14. end;
  15. implementation
  16. uses gtkDefTexts;
  17. procedure TProgressWindow.ComposeWindow;
  18. begin
  19. Title := ProgressWinTitle;
  20. border := 20;
  21. bar := TFPgtkProgressBar.Create (nil);
  22. bar.FormatString := '- %p%% -';
  23. add (bar);
  24. end;
  25. procedure TProgressWindow.StepIt;
  26. begin
  27. with bar do
  28. CurrentValue := CurrentValue + 1.0;
  29. end;
  30. procedure TProgressWindow.SetMax (max : integer);
  31. begin
  32. bar.Configure (0.0,0.0,max);
  33. end;
  34. constructor TProgressWindow.create;
  35. begin
  36. inherited create (gtk_window_dialog);
  37. ComposeWindow;
  38. end;
  39. end.