Browse Source

Fix TBCLeaQLED alignment and phong effect ...

Fixing the alignment issue with TBCLeaQLED #214;
Fixing the phong effect for TBCLeaQLED and TBCLeaLED #214;
Fixing the missing redraw issue when the form is resized (applies to GTK2 only);
Fixing the inconsistency in the Size property of TBCLeaLED. It was intended as the radius but is the button size.
Melchiorre Caruso 11 months ago
parent
commit
9189b8055c
4 changed files with 95 additions and 62 deletions
  1. 40 27
      bclealed.pas
  2. 41 33
      bcleaqled.pas
  3. 7 1
      bclearingslider.pas
  4. 7 1
      bcleaselector.pas

+ 40 - 27
bclealed.pas

@@ -70,6 +70,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -115,7 +116,7 @@ type
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
-    property Size: integer read FSize write SetSize default 15;
+    property Size: integer read FSize write SetSize default 30;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Clickable: boolean read FClickable write SetClickable default False;
     property Clickable: boolean read FClickable write SetClickable default False;
@@ -139,9 +140,9 @@ begin
   with GetControlClassDefaultSize do
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, 50, 50);
     SetInitialBounds(0, 0, 50, 50);
   FValue := False;
   FValue := False;
+  ApplyDefaultTheme;
   FBitmap := TBGRABitmap.Create(Width, Height, FBkgColor);
   FBitmap := TBGRABitmap.Create(Width, Height, FBkgColor);
   FClickable := False;
   FClickable := False;
-  ApplyDefaultTheme;
 end;
 end;
 
 
 destructor TBCLeaLED.Destroy;
 destructor TBCLeaLED.Destroy;
@@ -168,6 +169,12 @@ begin
   Redraw;
   Redraw;
 end;
 end;
 
 
+procedure TBCLeaLED.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaLED.SetStyle(AValue: TZStyle);
 procedure TBCLeaLED.SetStyle(AValue: TZStyle);
 begin
 begin
   if FStyle = AValue then
   if FStyle = AValue then
@@ -306,7 +313,7 @@ begin
   FColorOff := TColor($009E5A00);
   FColorOff := TColor($009E5A00);
   FBkgColor := clBtnFace;
   FBkgColor := clBtnFace;
   FStyle := zsRaised;
   FStyle := zsRaised;
-  FSize := 15;
+  FSize := 30;
   FAltitude := 2;
   FAltitude := 2;
   FAmbientFactor := 0.3;
   FAmbientFactor := 0.3;
   FSpecularIndex := 10;
   FSpecularIndex := 10;
@@ -351,28 +358,36 @@ var
   Blur: TBGRABitmap;
   Blur: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Phong: TPhongShading;
   Phong: TPhongShading;
-  ScaledPhongSize, ScaledSize: integer;
+  ScaledPhongSize, ScaledBlurSize, ScaledRadius: integer;
+  imgSize: integer;
+  img: TBGRABitmap;
+  Margin: integer;
 begin
 begin
   FBitmap.SetSize(Width, Height);
   FBitmap.SetSize(Width, Height);
   FBitmap.Fill(FBkgColor);
   FBitmap.Fill(FBkgColor);
 
 
   if (Width < 2) or (Height < 2) then exit;
   if (Width < 2) or (Height < 2) then exit;
-  ScaledSize := Scale96ToForm(FSize);
+  ScaledRadius := Scale96ToForm(FSize div 2);
   ScaledPhongSize := Scale96ToForm(5);
   ScaledPhongSize := Scale96ToForm(5);
+  ScaledBlurSize := Scale96ToForm(10);
+  Margin := ScaledBlurSize;
+
+  imgSize := 2*(ScaledRadius + Margin);
+  img := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
 
 
   if Enabled then
   if Enabled then
   begin
   begin
     if FValue then
     if FValue then
-      FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOn)
+      img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOn)
     else
     else
-      FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOff);
+      img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOff);
   end
   end
   else
   else
-    FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, clGray);
+    img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, clGray);
 
 
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   begin
   begin
-    Mask := FBitmap.FilterGrayscale as TBGRABitmap;
+    Mask := img.FilterGrayscale as TBGRABitmap;
     if (FStyle = zsRaised) then
     if (FStyle = zsRaised) then
       Mask.Negative;
       Mask.Negative;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
@@ -380,7 +395,6 @@ begin
     Mask.Free;
     Mask.Free;
 
 
     Phong := TPhongShading.Create;
     Phong := TPhongShading.Create;
-    if assigned(FTheme) then
     begin
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.SpecularIndex := FSpecularIndex;
@@ -396,39 +410,38 @@ begin
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.LightColor := FLightColor;
       Phong.LightColor := FLightColor;
     end;
     end;
-    Phong.Draw(FBitmap, Blur, FAltitude, 0, 0, FBitmap);
+    Phong.Draw(img, Blur, FAltitude, 0, 0, img);
     Phong.Free;
     Phong.Free;
     Blur.Free;
     Blur.Free;
 
 
-    Mask := TBGRABitmap.Create(Width, Height, BGRABlack);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(Width, Height, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask2.ApplyMask(Mask);
     Mask.Free;
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
     Mask2.Free;
   end
   end
   else
   else
   begin
   begin
-    Mask := TBGRABitmap.Create(Width, Height, BGRABlack);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(Width, Height, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask2.ApplyMask(Mask);
     Mask.Free;
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
     Mask2.Free;
   end;
   end;
+  img.Free;
 
 
   if FValue then
   if FValue then
   begin
   begin
-    Mask := TBGRABitmap.Create(Width, Height);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOn);
-    Mask := Mask.FilterBlurRadial(ScaledPhongSize * 2, ScaledPhongSize * 2, rbFast);
-    FBitmap.BlendImageOver(0, 0, Mask, boGlow);
+    Mask := TBGRABitmap.Create(imgSize, imgSize);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOn);
+    Mask := Mask.FilterBlurRadial(ScaledBlurSize, ScaledBlurSize, rbFast);
+    FBitmap.BlendImageOver((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask, boGlow);
     Mask.Free;
     Mask.Free;
   end;
   end;
 
 

+ 41 - 33
bcleaqled.pas

@@ -72,6 +72,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -86,6 +87,7 @@ type
     procedure ApplyDefaultTheme;
     procedure ApplyDefaultTheme;
   published
   published
     property Align;
     property Align;
+    property BorderSpacing;
     property Cursor;
     property Cursor;
     property Enabled;
     property Enabled;
     property Font;
     property Font;
@@ -117,7 +119,7 @@ type
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
-    property Size: integer read FSize write SetSize default 20;
+    property Size: integer read FSize write SetSize default 30;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Clickable: boolean read FClickable write SetClickable default False;
     property Clickable: boolean read FClickable write SetClickable default False;
@@ -171,6 +173,12 @@ begin
   Redraw;
   Redraw;
 end;
 end;
 
 
+procedure TBCLeaQLED.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaQLED.SetStyle(AValue: TZStyle);
 procedure TBCLeaQLED.SetStyle(AValue: TZStyle);
 begin
 begin
   if FStyle = AValue then
   if FStyle = AValue then
@@ -319,7 +327,7 @@ begin
   FColorOff := TColor($009E5A00);
   FColorOff := TColor($009E5A00);
   FBkgColor := clBtnFace;
   FBkgColor := clBtnFace;
   FStyle := zsRaised;
   FStyle := zsRaised;
-  FSize := 20;
+  FSize := 30;
   FAltitude := 2;
   FAltitude := 2;
   FRounding := 3;
   FRounding := 3;
   FAmbientFactor := 0.3;
   FAmbientFactor := 0.3;
@@ -362,36 +370,38 @@ end;
 
 
 procedure TBCLeaQLED.Redraw;
 procedure TBCLeaQLED.Redraw;
 var
 var
-  EffectiveSize: integer;
   Blur: TBGRABitmap;
   Blur: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Phong: TPhongShading;
   Phong: TPhongShading;
-  ScaledPhongSize, ScaledSize: integer;
+  ScaledPhongSize, ScaledBlurSize, ScaledSize: integer;
+  img: TBGRABitmap;
+  imgSize: integer;
+  Margin: integer;
 begin
 begin
   FBitmap.SetSize(Width, Height);
   FBitmap.SetSize(Width, Height);
   FBitmap.Fill(FBkgColor);
   FBitmap.Fill(FBkgColor);
 
 
-  if Width < Height then
-    EffectiveSize := Width
-  else
-    EffectiveSize := Height;
-  if EffectiveSize < 2 then exit;
+  if (Width < 2) or (Height < 2) then Exit;
   ScaledSize := Scale96ToForm(FSize);
   ScaledSize := Scale96ToForm(FSize);
   ScaledPhongSize := Scale96ToForm(5);
   ScaledPhongSize := Scale96ToForm(5);
+  ScaledBlurSize := Scale96ToForm(10);
+  Margin := ScaledBlurSize;
+
+  imgSize := ScaledSize + 2*Margin;
+  img := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
 
 
   if Enabled then
   if Enabled then
   begin
   begin
     if FValue then
     if FValue then
-      FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOn)
+      img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOn)
     else
     else
-      FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOff);
-  end
-  else
-    FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, clGray);
+      img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOff);
+  end else
+    img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, clGray);
 
 
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   begin
   begin
-    Mask := FBitmap.FilterGrayscale as TBGRABitmap;
+    Mask := img.FilterGrayscale as TBGRABitmap;
     if (FStyle = zsRaised) then
     if (FStyle = zsRaised) then
       Mask.Negative;
       Mask.Negative;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
@@ -399,7 +409,6 @@ begin
     Mask.Free;
     Mask.Free;
 
 
     Phong := TPhongShading.Create;
     Phong := TPhongShading.Create;
-    if assigned(FTheme) then
     begin
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.SpecularIndex := FSpecularIndex;
@@ -415,39 +424,38 @@ begin
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.LightColor := FLightColor;
       Phong.LightColor := FLightColor;
     end;
     end;
-    Phong.Draw(FBitmap, Blur, FAltitude, 0, 0, FBitmap);
+    Phong.Draw(img, Blur, FAltitude, 0, 0, img);
     Phong.Free;
     Phong.Free;
     Blur.Free;
     Blur.Free;
 
 
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask2.ApplyMask(Mask);
     Mask.Free;
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width - imgSize) div 2, (FBitmap.Height - imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
     Mask2.Free;
   end
   end
   else
   else
   begin
   begin
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask2.ApplyMask(Mask);
     Mask.Free;
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
     Mask2.Free;
   end;
   end;
+  img.Free;
 
 
   if FValue then
   if FValue then
   begin
   begin
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOn);
-    Mask := Mask.FilterBlurRadial(ScaledPhongSize * 2, ScaledPhongSize * 2, rbFast);
-    FBitmap.BlendImageOver(0, 0, Mask, boGlow);
+    Mask := TBGRABitmap.Create(imgSize, imgSize);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOn);
+    Mask := Mask.FilterBlurRadial(ScaledBlurSize, ScaledBlurSize, rbFast);
+    FBitmap.BlendImageOver((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask, boGlow);
     Mask.Free;
     Mask.Free;
   end;
   end;
 
 

+ 7 - 1
bclearingslider.pas

@@ -119,6 +119,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -346,6 +347,12 @@ begin
   Redraw;
   Redraw;
 end;
 end;
 
 
+procedure TBCLeaRingSlider.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaRingSlider.Redraw;
 procedure TBCLeaRingSlider.Redraw;
 const
 const
   pi15 = pi * 1.5;
   pi15 = pi * 1.5;
@@ -485,7 +492,6 @@ begin
     Mask.Free;
     Mask.Free;
 
 
     Phong := TPhongShading.Create;
     Phong := TPhongShading.Create;
-    if Assigned(FTheme) then
     begin
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.SpecularIndex := FSpecularIndex;

+ 7 - 1
bcleaselector.pas

@@ -111,6 +111,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -338,6 +339,12 @@ begin
   Redraw;
   Redraw;
 end;
 end;
 
 
+procedure TBCLeaSelector.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaSelector.Redraw;
 procedure TBCLeaSelector.Redraw;
 const
 const
   pi15 = pi * 1.5;
   pi15 = pi * 1.5;
@@ -460,7 +467,6 @@ begin
     Mask.Free;
     Mask.Free;
 
 
     Phong := TPhongShading.Create;
     Phong := TPhongShading.Create;
-    if Assigned(FTheme) then
     begin
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.SpecularIndex := FSpecularIndex;