Index: jvcl/run/JvProgressBar.pas
===================================================================
--- jvcl/run/JvProgressBar.pas	(revision 12842)
+++ jvcl/run/JvProgressBar.pas	(working copy)
@@ -14,7 +14,8 @@
 Portions created by Sébastien Buysse are Copyright (C) 2001 Sébastien Buysse.
 All Rights Reserved.
 
-Contributor(s): Michael Beck [mbeck att bigfoot dott com].
+Contributor(s): Michael Beck [mbeck att bigfoot dott com]
+								Michiel Koot [makoot att gmx dott net] (inverted property)
 
 You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
 located at http://jvcl.delphi-jedi.org
@@ -43,6 +44,7 @@
   private
     FBlockSize: Integer;
     FSmooth: Boolean;
+    FInverted: Boolean;
     FPosition: Integer;
     FMin: Integer;
     FMax: Integer;
@@ -55,6 +57,7 @@
     procedure SetOrientation(Value: TProgressBarOrientation);
     procedure SetPosition(Value: Integer);
     procedure SetSmooth(const Value: Boolean);
+    procedure SetInverted(const Value: Boolean);
     procedure SetBlockSize(const Value: Integer);
     procedure SetBarColor(const Value: TColor);
     procedure SetSteps(const Value: Integer);
@@ -84,6 +87,7 @@
     property Orientation: TProgressBarOrientation read FOrientation write SetOrientation default pbHorizontal;
     property Position: Integer read FPosition write SetPosition default 0;
     property Smooth: Boolean read FSmooth write SetSmooth default False;
+    property Inverted: Boolean read FInverted write SetInverted default False; // Michiel Koot: enabling inverted drawing behaviour.
     property OnChange: TNotifyEvent read FOnChange write FOnChange;
   published
     property Width default 150;
@@ -161,6 +165,7 @@
     property Orientation;
     property Position;
     property Smooth;
+    property Inverted; // MK
 
     property Align;
     property Anchors;
@@ -331,6 +336,15 @@
   end;
 end;
 
+procedure TJvBaseProgressBar.SetInverted(const Value: Boolean);
+begin
+  if FInverted <> Value then
+  begin
+    FInverted := Value;
+    Invalidate;
+  end;
+end;
+
 procedure TJvBaseProgressBar.DrawBar(ACanvas: TCanvas; BarSize: Integer);
 var
   R: TRect;
@@ -599,14 +613,20 @@
   InflateRect(R, -1, -1);
   if Orientation = pbHorizontal then
   begin
-    R.Right := BarSize;
+    if FInverted = false then
+			R.Right := BarSize
+		else
+			R.Left := R.Right - BarSize;				
     if R.Right > ClientWidth - 2 then
       R.Right := ClientWidth - 2;
     GradientFillRect(ACanvas, R, BarColorFrom, BarColorTo, fdLeftToRight, 255);
   end
   else
   begin
-    R.Top := R.Bottom - BarSize;
+    if FInverted = false then
+      R.Top := R.Bottom - BarSize
+    else
+  		R.Bottom := R.Top + BarSize;
     if R.Top < 2 then
       R.Top := 2;
     GradientFillRect(ACanvas, R, BarColorFrom, BarColorTo, fdBottomToTop, 255);
@@ -622,33 +642,71 @@
     if Orientation = pbHorizontal then
     begin
       R := ClientRect;
-      InflateRect(R, -2, -2);
-      R.Right := R.Left + Round(LBlockSize);
-      while R.Left <= BarSize do
-      begin
-        ACanvas.MoveTo(R.Left, R.Top);
-        ACanvas.LineTo(R.Left, R.Bottom);
-        Inc(I);
-        R := ClientRect;
-        InflateRect(R, -2, -2);
-        R.Right := R.Left + Round(LBlockSize);
-        OffsetRect(R, Round(I * LBlockSize), 0);
-      end;
+      if FInverted = false then
+			begin
+				InflateRect(R, -2, -2);
+				R.Right := R.Left + Round(LBlockSize);
+				while R.Left <= BarSize do
+				begin
+					ACanvas.MoveTo(R.Left, R.Top);
+					ACanvas.LineTo(R.Left, R.Bottom);
+					Inc(I);
+					R := ClientRect;
+					InflateRect(R, -2, -2);
+					R.Right := R.Left + Round(LBlockSize);
+					OffsetRect(R, Round(I * LBlockSize), 0);
+				end;
+			end
+			else
+			// Inverted horizontal
+			begin
+        InflateRect(R, 2, 2);
+        R.Left := R.Right - Round(LBlockSize);
+        while (BarSize <> 0) and (R.Left >= (GetMaxBarSize - BarSize)) do
+        begin
+          ACanvas.MoveTo(R.Right, R.Top);
+          ACanvas.LineTo(R.Right, R.Bottom);
+          Inc(I);
+          R := ClientRect;
+          InflateRect(R, 2, 2);
+          R.Left := R.Right - Round(LBlockSize);
+          OffsetRect(R, -Round(I * LBlockSize), 0);
+        end;
+      end;	
     end
     else
     begin
       R := ClientRect;
-      InflateRect(R, -2, -2);
-      R.Top := R.Bottom - Round(LBlockSize);
-      while R.Bottom >= GetMaxBarSize - BarSize do
+      if FInverted = false then
       begin
-        ACanvas.MoveTo(R.Left, R.Bottom);
-        ACanvas.LineTo(R.Right, R.Bottom);
-        Inc(I);
-        R := ClientRect;
         InflateRect(R, -2, -2);
         R.Top := R.Bottom - Round(LBlockSize);
-        OffsetRect(R, 0, -Round(I * LBlockSize));
+        while R.Bottom >= GetMaxBarSize - BarSize do
+        begin
+          ACanvas.MoveTo(R.Left, R.Bottom);
+          ACanvas.LineTo(R.Right, R.Bottom);
+          Inc(I);
+          R := ClientRect;
+          InflateRect(R, -2, -2);
+          R.Top := R.Bottom - Round(LBlockSize);
+          OffsetRect(R, 0, -Round(I * LBlockSize));
+        end;
+      end
+      else
+			// Inverted vertical
+      begin
+        InflateRect(R, 2, 2);
+        R.Bottom := R.Top + Round(LBlockSize);
+        while (BarSize <> 0) and (R.Top <= BarSize) do
+        begin
+          ACanvas.MoveTo(R.Left, R.Top);
+          ACanvas.LineTo(R.Right, R.Top);
+          Inc(I);
+          R := ClientRect;
+          InflateRect(R, 2, 2);
+          R.Bottom := R.Top + Round(LBlockSize);
+          OffsetRect(R, 0, Round(I * LBlockSize));
+        end;
       end;
     end;
   end;
