{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
unit Unit1;
{

  ("`-''-/").___..--''"`-._
 `6_ 6  )   `-.  (     ).`-.__.`)
 (_Y_.)'  ._   )  `._ `. ``-..-'
  _..`--'_..-_/  /--'_.' ,'
(il).-''  (li).'  ((!.-'

 KOLQProgressBar Demo Application
 The component that provides a set of various progress bars.

 QProgressBar ported to KOL © 2007-2008 Denis Fateyev (Danger)
 E-Mail: <denis@fateyev.com> <danger@artline.kz>

 Original excellent TQProgressBar VCL component was developed by QnnO
 and was ported to KOL with his permission. Merci a Qnno!
}

interface

{$IF Defined(KOL_MCK)}
uses Windows, Messages, KOL, KOLQProgBar, KOLCCtrls, KOLMHUpDown {$IF Defined(KOL_MCK)}{$ELSE}, mirror, Classes, Controls, mckControls, mckObjs, Graphics,  mckCtrls,  mckCCtrls, mckQProgBar,
  MCKMHUpDown {$IFEND (place your units here->)};
{$ELSE}
{$I uses.inc}
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;
{$IFEND}

type
  {$IF Defined(KOL_MCK)}
  {$I MCKfakeClasses.inc}
  {$IFDEF KOLCLASSES} {$I TForm1class.inc} {$ELSE OBJECTS} PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
  {$IFDEF KOLCLASSES}{$I TForm1.inc}{$ELSE} TForm1 = object(TObj) {$ENDIF}
    Form: PControl;
  {$ELSE not_KOL_MCK}
  TForm1 = class(TForm)
  {$IFEND KOL_MCK}
    KOLProj_: TKOLProject;
    KOLForm_: TKOLForm;
    GroupBox1: TKOLGroupBox;
    GroupBox2: TKOLGroupBox;
    Label1: TKOLLabel;
    ColorDialog1: TKOLColorDialog;
    Panel1: TKOLPanel;
    Label2: TKOLLabel;
    Label3: TKOLLabel;
    Label4: TKOLLabel;
    Label5: TKOLLabel;
    QProgressBar1: TKOLQProgressBar;
    QProgressBar2: TKOLQProgressBar;
    Panel2: TKOLPanel;
    Label6: TKOLLabel;
    Panel3: TKOLPanel;
    Label7: TKOLLabel;
    QProgressBar3: TKOLQProgressBar;
    TrackBar1: TKOLTrackBar;
    Panel4: TKOLPanel;
    Label8: TKOLLabel;
    TrackBar2: TKOLTrackBar;
    GroupBox3: TKOLGroupBox;
    Label9: TKOLLabel;
    Label10: TKOLLabel;
    QProgressBar4: TKOLQProgressBar;
    Label11: TKOLLabel;
    QProgressBar5: TKOLQProgressBar;
    GroupBox4: TKOLGroupBox;
    Label12: TKOLLabel;
    QProgressBar6: TKOLQProgressBar;
    TrackBar3: TKOLTrackBar;
    QProgressBar7: TKOLQProgressBar;
    QProgressBar8: TKOLQProgressBar;
    QProgressBar9: TKOLQProgressBar;
    QProgressBar10: TKOLQProgressBar;
    GroupBox5: TKOLGroupBox;
    Label13: TKOLLabel;
    CheckBox1: TKOLCheckBox;
    GroupBox6: TKOLGroupBox;
    RadioBox1: TKOLRadioBox;
    RadioBox2: TKOLRadioBox;
    CheckBox2: TKOLCheckBox;
    GroupBox7: TKOLGroupBox;
    RadioBox3: TKOLRadioBox;
    RadioBox4: TKOLRadioBox;
    Label14: TKOLLabel;
    CheckBox3: TKOLCheckBox;
    CheckBox4: TKOLCheckBox;
    EditBox1: TKOLEditBox;
    MHUpDown1: TKOLMHUpDown;
    EditBox2: TKOLEditBox;
    MHUpDown2: TKOLMHUpDown;
    Label15: TKOLLabel;
    Label16: TKOLLabel;
    Label17: TKOLLabel;
    CheckBox5: TKOLCheckBox;
    Panel5: TKOLPanel;
    Label18: TKOLLabel;
    QProgressBar11: TKOLQProgressBar;
    Panel6: TKOLPanel;
    TrackBar4: TKOLTrackBar;
    Label19: TKOLLabel;
    procedure KOLForm_FormCreate(Sender: PObj);
    procedure TrackBar1Scroll(Sender: PTrackbar; Code: Integer);
    procedure TrackBar2Scroll(Sender: PTrackbar; Code: Integer);
    procedure TrackBar3Scroll(Sender: PTrackbar; Code: Integer);
    procedure MHUpDown1ChangingEx(Sender: PObj; var Allow: Boolean;
      NewValue: Smallint; Direction: TUpDownDirection);
    procedure MHUpDown2ChangingEx(Sender: PObj; var Allow: Boolean;
      NewValue: Smallint; Direction: TUpDownDirection);
    procedure TrackBar4Scroll(Sender: PTrackbar; Code: Integer);
    procedure Panel5Click(Sender: PObj);
    procedure CheckBox1Click(Sender: PObj);
    procedure RadioBox1Click(Sender: PObj);
    procedure EditBox1Change(Sender: PObj);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

{$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}

{$IFDEF KOL_MCK}
{$I Unit1_1.inc}
{$ENDIF}

// ----------------------------------------------------------
procedure TForm1.KOLForm_FormCreate(Sender: PObj);
begin
 Form.Perform( WM_SETICON, ICON_SMALL, LoadIcon( 0, IDI_ASTERISK ) );
end;

// ----------------------------------------------------------
procedure TForm1.TrackBar1Scroll(Sender: PTrackbar; Code: Integer);
begin
 Form.ProcessMessages;
 QProgressBar1.Progress:= Sender.Position;
 QProgressBar2.Progress:= Sender.Position;
 QProgressBar3.Progress:= Sender.Position;
end;

// ----------------------------------------------------------
procedure TForm1.TrackBar2Scroll(Sender: PTrackbar; Code: Integer);
begin
 Form.ProcessMessages;
 QProgressBar7.Progress:= Sender.Position;
 QProgressBar8.Progress:= Sender.Position;
 QProgressBar9.Progress:= Sender.Position;
 QProgressBar10.Progress:= Sender.Position;
end;

// ----------------------------------------------------------
procedure TForm1.TrackBar3Scroll(Sender: PTrackbar; Code: Integer);
begin
 Form.ProcessMessages;
 QProgressBar4.Progress:= Sender.Position;
 QProgressBar5.Progress:= Sender.Position;
 QProgressBar6.Progress:= Sender.Position;
end;

// ----------------------------------------------------------
procedure TForm1.MHUpDown1ChangingEx(Sender: PObj; var Allow: Boolean;
  NewValue: Smallint; Direction: TUpDownDirection);
begin
 EditBox1.Text:= Int2Str( NewValue );
end;

// ----------------------------------------------------------
procedure TForm1.MHUpDown2ChangingEx(Sender: PObj; var Allow: Boolean;
  NewValue: Smallint; Direction: TUpDownDirection);
begin
 EditBox2.Text:= Int2Str( NewValue );
end;

// ----------------------------------------------------------
procedure TForm1.TrackBar4Scroll(Sender: PTrackbar; Code: Integer);
begin
 QProgressBar11.Progress:= Sender.Position;
end;

// ----------------------------------------------------------
procedure TForm1.Panel5Click(Sender: PObj);
begin
 if ColorDialog1.Execute then
 begin
  with QProgressBar11^ do
  case Sender.Tag of
   1: {Panel5} StartColor:= ColorDialog1.Color;
   2: {Panel6} FinalColor:= ColorDialog1.Color;
  end;
  PControl( Sender ).Color:= ColorDialog1.Color;
 end;
end;

// ----------------------------------------------------------
procedure TForm1.CheckBox1Click(Sender: PObj);
begin
 with QProgressBar11^ do
 case Sender.Tag of
  1: {RoundCorners}
   RoundCorner:= PControl( Sender ).Checked;
  2: {Shaped}
   Shaped:= PControl( Sender ).Checked;
  3: {ShowInactivePos}
   begin
    ShowInactivePos:= PControl( Sender ).Checked;
    if RadioBox2.Checked then CheckBox4.Enabled:= true
     else CheckBox4.Enabled:= false;
   end;
  4: {InvertInactPos}
   InvertInactPos:= PControl( Sender ).Checked;
  5: {ShowFullBlock}
   ShowFullBlock:= PControl( Sender ).Checked;
 end;
end;

// ----------------------------------------------------------
procedure TForm1.RadioBox1Click(Sender: PObj);
begin
 with QProgressBar11^ do
 case Sender.Tag of
  1: {bkFlat}
   begin
    BarKind:= bkFlat;
    RadioBox3.Enabled:= false;
    RadioBox4.Enabled:= false;
    CheckBox4.Enabled:= false;
   end;
  2: {bkCylinder}
   begin
    BarKind:= bkCylinder;
    RadioBox3.Enabled:= true;
    RadioBox4.Enabled:= true;
    if CheckBox3.Checked then CheckBox4.Enabled:= true
    else CheckBox4.Enabled:= false;
   end;
  3: {blMetal}
   BarLook:= blMetal;
  4: {blGlass}
   BarLook:= blGlass;
 end;
end;

// ----------------------------------------------------------
procedure TForm1.EditBox1Change(Sender: PObj);
begin
 with QProgressBar11^ do
  case Sender.Tag of
   1: {BlockSize}
    BlockSize:= Str2Int( EditBox1.Text );
   2: {SpaceSize}
    SpaceSize:= Str2Int( EditBox2.Text );
  end;
end;

// ----------------------------------------------------------


end.









