Browse Source

Added BGRAThemeRadioButton.

lainz 6 years ago
parent
commit
30689d2ea0

+ 48 - 1
bgracolortheme.pas

@@ -5,7 +5,8 @@ unit BGRAColorTheme;
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, BGRATheme;
+  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, BGRATheme,
+  BGRABitmap, BGRABitmapTypes;
 
 type
 
@@ -31,6 +32,8 @@ type
   public
     procedure DrawButton(Caption: string; State: TBGRAThemeButtonState;
       Focused: boolean; ARect: TRect; DestCanvas: TCanvas); override;
+    procedure DrawRadioButton(Caption: string; State: TBGRAThemeButtonState;
+      Focused: boolean; Checked: boolean; ARect: TRect; DestCanvas: TCanvas); override;
   published
     property ColorNormal: TColor read FColorNormal write SetFColorNormal;
     property ColorHover: TColor read FColorHover write SetFColorHover;
@@ -128,4 +131,48 @@ begin
   end;
 end;
 
+procedure TBGRAColorTheme.DrawRadioButton(Caption: string;
+  State: TBGRAThemeButtonState; Focused: boolean; Checked: boolean;
+  ARect: TRect; DestCanvas: TCanvas);
+var
+  Style: TTextStyle;
+  Bitmap: TBGRABitmap;
+  Color: TBGRAPixel;
+begin
+  DestCanvas.Font.Color := ColorText;
+  case State of
+    btbsNormal: Color := ColorNormal;
+    btbsHover: Color := ColorHover;
+    btbsActive: Color := ColorActive;
+    btbsDisabled:
+    begin
+      DestCanvas.Font.Color := ColorDisabled;
+      Color := ColorDisabled;
+    end;
+  end;
+
+  Bitmap := TBGRABitmap.Create(ARect.Height, ARect.Height);
+  Bitmap.FillEllipseAntialias(Bitmap.Height / 2, Bitmap.Height / 2,
+    Bitmap.Height / 2 - 2, Bitmap.Height / 2 - 2, BGRAWhite);
+  Bitmap.EllipseAntialias(Bitmap.Height / 2, Bitmap.Height / 2,
+    Bitmap.Height / 2 - 2, Bitmap.Height / 2 - 2, Color{%H-}, 1);
+  if Checked then
+    Bitmap.FillEllipseAntialias(Bitmap.Height / 2, Bitmap.Height /
+      2, Bitmap.Height / 4, Bitmap.Height / 4, Color);
+  Bitmap.Draw(DestCanvas, Arect.Left, Arect.Top, False);
+  Bitmap.Free;
+
+  if Caption <> '' then
+  begin
+    Style.Alignment := taLeftJustify;
+    Style.Layout := tlCenter;
+    Style.Wordbreak := True;
+    Style.SystemFont := False;
+    Style.Clipping := True;
+    Style.Opaque := False;
+    DestCanvas.TextRect(Rect(Arect.Height, 0, ARect.Right, ARect.Bottom),
+      ARect.Height, 0, Caption, Style);
+  end;
+end;
+
 end.

+ 6 - 1
bgracontrols.lpk

@@ -34,7 +34,7 @@
     <Description Value="BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications."/>
     <License Value="Modified LGPL"/>
     <Version Major="6" Release="4"/>
-    <Files Count="51">
+    <Files Count="52">
       <Item1>
         <Filename Value="bcbasectrls.pas"/>
         <AddToUsesPkgSection Value="False"/>
@@ -283,6 +283,11 @@
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAColorTheme"/>
       </Item51>
+      <Item52>
+        <Filename Value="bgrathemeradiobutton.pas"/>
+        <HasRegisterProc Value="True"/>
+        <UnitName Value="BGRAThemeRadioButton"/>
+      </Item52>
     </Files>
     <RequiredPkgs Count="2">
       <Item1>

+ 2 - 1
bgracontrols.pas

@@ -17,7 +17,7 @@ uses
   BGRASpeedButton, BGRASpriteAnimation, BGRAVirtualScreen, ColorSpeedButton, 
   DTAnalogClock, DTAnalogCommon, DTAnalogGauge, dtthemedclock, dtthemedgauge, 
   MaterialColors, BGRAImageTheme, BGRAThemeButton, BGRATheme, BGRAColorTheme, 
-  LazarusPackageIntf;
+  BGRAThemeRadioButton, LazarusPackageIntf;
 
 implementation
 
@@ -57,6 +57,7 @@ begin
   RegisterUnit('BGRAThemeButton', @BGRAThemeButton.Register);
   RegisterUnit('BGRATheme', @BGRATheme.Register);
   RegisterUnit('BGRAColorTheme', @BGRAColorTheme.Register);
+  RegisterUnit('BGRAThemeRadioButton', @BGRAThemeRadioButton.Register);
 end;
 
 initialization

+ 48 - 1
bgratheme.pas

@@ -5,7 +5,8 @@ unit BGRATheme;
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
+  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
+  BGRABitmap, BGRABitmapTypes;
 
 type
   TBGRAThemeButtonState = (btbsNormal, btbsHover, btbsActive, btbsDisabled);
@@ -20,6 +21,8 @@ type
   public
     procedure DrawButton(Caption: string; State: TBGRAThemeButtonState;
       Focused: boolean; ARect: TRect; DestCanvas: TCanvas); virtual;
+    procedure DrawRadioButton(Caption: string; State: TBGRAThemeButtonState;
+      Focused: boolean; Checked: boolean; ARect: TRect; DestCanvas: TCanvas); virtual;
   published
 
   end;
@@ -43,6 +46,7 @@ procedure TBGRATheme.DrawButton(Caption: string; State: TBGRAThemeButtonState;
 var
   Style: TTextStyle;
 begin
+  DestCanvas.Font.Color := clBlack;
   case State of
     btbsNormal: DestCanvas.Brush.Color := RGBToColor(225, 225, 225);
     btbsHover: DestCanvas.Brush.Color := RGBToColor(229, 241, 251);
@@ -71,6 +75,49 @@ begin
   end;
 end;
 
+procedure TBGRATheme.DrawRadioButton(Caption: string; State: TBGRAThemeButtonState;
+  Focused: boolean; Checked: boolean; ARect: TRect; DestCanvas: TCanvas);
+var
+  Style: TTextStyle;
+  Bitmap: TBGRABitmap;
+  Color: TBGRAPixel;
+begin
+  DestCanvas.Font.Color := clBlack;
+  case State of
+    btbsNormal: Color := BGRABlack;
+    btbsHover: Color := BGRA(0, 120, 215);
+    btbsActive: Color := BGRA(0, 84, 153);
+    btbsDisabled:
+    begin
+      DestCanvas.Font.Color := clGray;
+      Color := BGRA(204, 204, 204);
+    end;
+  end;
+
+  Bitmap := TBGRABitmap.Create(ARect.Height, ARect.Height);
+  Bitmap.FillEllipseAntialias(Bitmap.Height / 2, Bitmap.Height / 2,
+    Bitmap.Height / 2 - 2, Bitmap.Height / 2 - 2, BGRAWhite);
+  Bitmap.EllipseAntialias(Bitmap.Height / 2, Bitmap.Height / 2,
+    Bitmap.Height / 2 - 2, Bitmap.Height / 2 - 2, Color{%H-}, 1);
+  if Checked then
+    Bitmap.FillEllipseAntialias(Bitmap.Height / 2, Bitmap.Height /
+      2, Bitmap.Height / 4, Bitmap.Height / 4, Color);
+  Bitmap.Draw(DestCanvas, Arect.Left, Arect.Top, False);
+  Bitmap.Free;
+
+  if Caption <> '' then
+  begin
+    Style.Alignment := taLeftJustify;
+    Style.Layout := tlCenter;
+    Style.Wordbreak := True;
+    Style.SystemFont := False;
+    Style.Clipping := True;
+    Style.Opaque := False;
+    DestCanvas.TextRect(Rect(Arect.Height, 0, ARect.Right, ARect.Bottom),
+      ARect.Height, 0, Caption, Style);
+  end;
+end;
+
 initialization
   BGRADefaultTheme := TBGRATheme.Create(nil);
 

+ 168 - 0
bgrathemeradiobutton.pas

@@ -0,0 +1,168 @@
+unit BGRAThemeRadioButton;
+
+{$mode delphi}
+
+interface
+
+uses
+  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
+  BGRATheme, Types;
+
+type
+
+  { TBGRAThemeRadioButton }
+
+  TBGRAThemeRadioButton = class(TCustomControl)
+  private
+    FChecked: boolean;
+    FTheme: TBGRATheme;
+    FState: TBGRAThemeButtonState;
+    procedure SetFChecked(AValue: boolean);
+    procedure SetFTheme(AValue: TBGRATheme);
+  protected
+    class function GetControlClassDefaultSize: TSize; override;
+    procedure MouseEnter; override;
+    procedure MouseLeave; override;
+    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
+      X, Y: integer); override;
+    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
+    procedure Click; override;
+    procedure SetEnabled(Value: boolean); override;
+    procedure TextChanged; override;
+    procedure Paint; override;
+    procedure UncheckOthers;
+  public
+    constructor Create(AOwner: TComponent); override;
+  published
+    property Caption;
+    property Checked: boolean read FChecked write SetFChecked;
+    property Font;
+    property Enabled;
+    property Theme: TBGRATheme read FTheme write SetFTheme;
+  end;
+
+procedure Register;
+
+implementation
+
+procedure Register;
+begin
+  RegisterComponents('BGRA Themes', [TBGRAThemeRadioButton]);
+end;
+
+{ TBGRAThemeRadioButton }
+
+procedure TBGRAThemeRadioButton.SetFTheme(AValue: TBGRATheme);
+begin
+  if FTheme = AValue then
+    Exit;
+  FTheme := AValue;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.SetFChecked(AValue: boolean);
+begin
+  if FChecked = AValue then
+    Exit;
+  FChecked := AValue;
+  if FChecked then
+    UncheckOthers;
+  Invalidate;
+end;
+
+class function TBGRAThemeRadioButton.GetControlClassDefaultSize: TSize;
+begin
+  Result.CX := 165;
+  Result.CY := 19;
+end;
+
+procedure TBGRAThemeRadioButton.MouseEnter;
+begin
+  inherited MouseEnter;
+  FState := btbsHover;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.MouseLeave;
+begin
+  inherited MouseLeave;
+  FState := btbsNormal;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.MouseDown(Button: TMouseButton;
+  Shift: TShiftState; X, Y: integer);
+begin
+  inherited MouseDown(Button, Shift, X, Y);
+  FState := btbsActive;
+  FChecked := True;
+  UncheckOthers;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.MouseUp(Button: TMouseButton;
+  Shift: TShiftState; X, Y: integer);
+begin
+  inherited MouseUp(Button, Shift, X, Y);
+  if ClientRect.Contains(Point(X, Y)) then
+    FState := btbsHover
+  else
+    FState := btbsNormal;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.Click;
+begin
+  inherited Click;
+end;
+
+procedure TBGRAThemeRadioButton.SetEnabled(Value: boolean);
+begin
+  inherited SetEnabled(Value);
+  if Value then
+    FState := btbsNormal
+  else
+    FState := btbsDisabled;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.TextChanged;
+begin
+  inherited TextChanged;
+  Invalidate;
+end;
+
+procedure TBGRAThemeRadioButton.Paint;
+begin
+  if Assigned(Theme) then
+    Theme.DrawRadioButton(Caption, FState, Focused, Checked, ClientRect, Canvas)
+  else
+    BGRADefaultTheme.DrawRadioButton(Caption, FState, Focused, Checked,
+      ClientRect, Canvas);
+end;
+
+procedure TBGRAThemeRadioButton.UncheckOthers;
+var
+  i: integer;
+  control: TWinControl;
+begin
+  if Parent is TWinControl then
+  begin
+    control := TWinControl(Parent);
+    for i := 0 to control.ControlCount - 1 do
+      if (control.Controls[i] <> Self) and (control.Controls[i] is
+        TBGRAThemeRadioButton) then
+        TBGRAThemeRadioButton(control.Controls[i]).Checked := False;
+  end;
+end;
+
+constructor TBGRAThemeRadioButton.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FState := btbsNormal;
+
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, CY);
+end;
+
+end.

+ 117 - 0
images/bgracontrols_images.lrs

@@ -8994,3 +8994,120 @@ LazarusResources.Add('tbcpaperlistbox_200','PNG',[
   +#254#145'9'#28#14#135#221'|'#3'R'#225#146#28'3'#215'm'#155#0#0#0#0'IEND'#174
   +'B`'#130
 ]);
+LazarusResources.Add('tbgrathemeradiobutton','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+  +#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#14#196#0#0#14#196#1#149'+'
+  +#14#27#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#1#218'ID'
+  +'ATH'#137#237#148'?l'#218'@'#24#197#127'`'#148#130'D'#186#241'GaBM'#187'Y'
+  +#170#240#196#194'\)'#25#155#169#202#18#177'6k"'#134#232#200#128'H'#6'/'#204
+  +#12'I'#6#150#170'K'#195#206#194#136#133#140#218'!$c'#226#19'tI#$'#132' '#238
+  +'`'#23'P'#177'K'#232#24#229'I'''#249'{~'#247#222'}'#250#236#131#23'<{'#4#150
+  +#9#132#16'q`'#31#216#2#222#186#244#21'P'#7'*B'#136#222#127#7#20#139#197#29'E'
+  +'Q'#170#154#166#173#171#170'J<'#30#7#160#215#235'a'#154'&'#134'a<'#140#199
+  +#227'=!'#196#151'''4'#179'h'#174#235#250#163#148#210#246#131'eY'#182#174#235
+  +#143'B'#136#143'+u '#132#136#135'B'#161#235'|>'#191#158'H$'#254'y'#16')%'#213
+  +'j'#245'W0'#24#220','#20#10#253#191#223#7'}'#246#237'k'#154'65'#31#141#224
+  +#224#0'66 '#149#130#195'C'#135#3'H&'#147'd2'#153#215#163#209#232#179#151#145
+  +'_'#192#182#170#170#211#226#232#8'NO'#193#178#224#238#14'NN'#28#238#15'\'#237
+  +#246'*'#1'ob'#177#216#180'8?_'#20#156#157#205#158#221#225'o'#174#18'`'#207#23
+  +#1#143'I)'#202#156#216#182#23#246','#11#184#233#247'g'#243#218#221']'#20#204
+  +'s'#174#246#198#203'('#228#19'pi'#154#230#251'T*'#5#192#241#177'C^\'#204#204
+  +#139#197#153#184#211#233#0'|'#243'2'#242#235#160'b'#24#198#131#148#18#128#181
+  +'5('#151#225#246#214'Y'#229#178#195#129#243#153#182'Z'#173'{'#160#226'e'#164
+  +'x'#145#141'Fc'#144#203#229#186#221'nw'''#157'N'#7#162#209#168#231')'#164#148
+  +#212'j5{8'#28'~'#18'B'#180#158#28#224#134#252#200'f'#179#223#219#237#246#135
+  +#193'`'#240'*'#18#137#16#14#135#153'L&X'#150'E'#179#217#164'^'#175#223#187
+  +#230'_'#253'|'#150'^v'#165'R)'#230#254'D['#192';'#151#190#2'.q.'#187#159#203
+  +'<^'#240#204#241#27#145#130#201#228#176#200#3#221#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('tbgrathemeradiobutton_150','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0'$'#0#0#0'$'#8#6#0#0#0#225#0#152#152
+  +#0#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#14#196#0#0#14#196#1#149
+  +'+'#14#27#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#3'-ID'
+  +'ATX'#133#237#150#189'k'#27'g'#28#199'?'#207')`'#201#224#23'Y'#131'h!>'#157
+  +#154#165#149' d'#136'1'#241#226#174#137#236'%'#16#212#164#29'MSj'#252#31#216
+  +'~'#192'c'#137#2#162'M '#155'=D2t:'#242'2'#20#234'%'#6#225'%'#201' L'#27#170
+  +#243'ih'#156#229','#249#6']'#7#243'tP'#149#250',K'#167'Xn'#151#232#11#199'q'
+  +#223#231#247#242#209's'#247'<z`'#160#129#6#250#200'$'#250'I'#150'R'#166#133
+  +#16#151#149'Rq'#0'!'#196';!'#196#171#149#149#149#242#255#6#148#203#229'"'#174
+  +#235'.*'#165#190#5'>'#235#16#246#135#16#226#161'R'#234''')'#165#247#159#1'I)'
+  +#175#1'E'#224'b2'#153'$'#149'J'#161#235':'#163#163#163#0#212#235'u'#170#213
+  +'*'#229'r'#153'J'#165#2'`'#3'Y)e'#233#220#129#164#148#183#128#141'X,6477'#135
+  +#174#235']'#227'm'#219#198'4M'#28#199#241#128'o'#164#148'?'#159#27#208'?3'
+  +#243#171#174#235'C'#217'l'#150'p8'#220'K'#26#158#231'Q('#20#168'V'#171#30#240
+  +'e/3'#165#5#5#228'r'#185#8'P'#140#197'b'#31#4#3#16#14#135#201'f'#179'LLL'#132
+  +#129'B>'#159#31#234#27#200'u'#221'E'#224'b&'#147'9'#21#166'T'#130#251#247#155
+  +'W'#233#148#223#31#137'D'#152#159#159#7'H'#28#28#28','#6#245#187#16#20#160
+  +#148#186#155'L&I$'#18'>'#191'V'#131#219#183#225#249's'#127#252#245#235#240
+  +#248'1'#140#141#253#235#233#186#142'a'#24'X'#150'u'#23#184#215#173'_'#215#25
+  +#146'R'#166#129'd:'#157'n'#27';'#13#6#224#217'3'#184's'#167#221'O'#165'R'#0
+  +#151#164#148'_'#156#25'H'#8'q'#25'`rr'#210#231#151'J'#167#195#180#244#244')'
+  +#236#236#248#189#214#170'l'#213'<'#19#144'R'#234#19#128#145#145#17#159#191
+  +#189#221'-'#171#169#23'/'#252#207#173#189#10#248#244#204'@B'#8#21#220#186'S'
+  +#174#255'Y)'#213#186'w'#173#25'4Co'#1'\'#215#245#249'33'#193'@''c'#142#213
+  +#248#243#204'@'#154#166#189#134#230#174'{\'#211#211#205#213#212'I'#153#12'LM'
+  +#249#189'V'#141'P('#244#186'['#207'@I)'#127#223#216#216'P''U'#171')u'#227#134
+  +'R'#224#191'2'#153#230#216'I'#173#175#175'+)'#229#155#160'~'#129#251#16#240
+  +#168'R'#169#252'`Y'#22#134'a'#188'7'#199#198#224#201#147#230'j'#218#222'n~33'
+  +'3p'#245'j{'#1#219#182#177','#11'!'#196#131#243#0#250#17'X4MS_XX`xx'#216'785'
+  +#213#254'z'#142#171#209'h`'#154'&'#128#21#141'F'#3#129#2#255':'#164#148#158
+  +#166'i7k'#181'Zcss'#147'F'#163#17#148#226#131')'#22#139'8'#142#227'i'#154#246
+  +#213#210#210#210'_A9'#161'^'#10'omm'#189#157#157#157#253#173'^'#175#207#239
+  +#238#238'^'#136#199#227#140#143#143'w'#205#217#219#219#163'X,'#178#191#191
+  +#239#9'!'#190'^]]'#253#165#151'^'#31'z@'#155#6#10'@'#194'0'#140#182#3#218#225
+  +#225'!'#182'mS.'#151#177','#11#192#162'y@'#219#233'\'#181#15' '#128'|>?'#228
+  +'8'#206#247#192'w'#192#165#14'ao'#132#16#15#163#209#232#131'^^S_@'#199#181
+  +#182#182#246#249#209#209#209#21'!D'#28'@)'#245'.'#20#10#189'\^^'#222#237#167
+  +#238'@'#3#13#244'Q'#233'oD'#231'R'#7#188#249#22'v'#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('tbgrathemeradiobutton_200','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0'0'#0#0#0'0'#8#6#0#0#0'W'#2#249#135
+  +#0#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#14#196#0#0#14#196#1#149
+  +'+'#14#27#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#4'CID'
+  +'ATh'#129#237#152#209'K[W'#28#199'?7'#215#165' &'#145#142#21':'#247'R'#166'I'
+  +#168'/NfU'#214'j'#244'ay'#176'C'#20'ZX+'#236#173'O'#5#255#128#213#235'I'#178
+  +'?@'#218#167#210#183#129'c'#16#26'&'#244'A'#9#204#172#163'P7'#152#169#150'jT'
+  +#216'`K'''#20#151'p'#227#131#17'r'#207#30'b\'#198#174#246#30'c'#183'='#220'/'
+  +'\'#184#156#223'9'#223#223#239'{'#239#239#222#223#239#28'p'#225#194#133#11#23
+  +'.\'#252'w'#208'N'#147'+'#30#143'w['#150'5'#10'\'#1#206#3#239#29#216'~'#5#182
+  +#129#199#192#156#16#226#167'Ssz'#26#28'B'#136'k@'#2#8':\'#147#3#238#8'!'#30#2
+  +#178'!'#231#141',N$'#18#239'W*'#149#175#128'K'#0#129'@'#128'P(D0'#24#164#181
+  +#181#21#191#223#15#128'i'#154#20#139'E666X__'#199'4'#205#26#197'S]'#215'oLMM'
+  +#253#252#175#11#16'B\'#6#30#2#231'|>'#31#131#131#131'tww'#163'i'#199'SJ)Y[[#'
+  +#157'NS,'#22#1'v'#128#235'B'#136'oO'#18#199#137#4#196'b'#177'!)'#229#2#240'V'
+  +'8'#28'fll'#12#175#215#171#196#177#191#191'O*'#149'"'#151#203#1#236'{<'#158
+  +#143#13#195#248'N5'#22']uA"'#145#184'`Y'#214#2#224#235#237#237'ett'#148#166
+  +#166'&U'#26't]'#167#179#179#147#189#189'='#242#249#188'.'#165#252'$'#18#137
+  +#164'2'#153#204#31'*<'#30'E'#191'Z'#165'R'#249#26'x'''#28#14#19#141'F_'#155
+  +'2'#199#146'i'#26#209'h'#148'P('#4#240'6'#240'%'#138'Y'#161'$ '#22#139']'#7
+  +'.'#249#253'~'#198#198#198#26#10#190#6'M'#211#24#31#31#199#231#243#1#244#199
+  +'b'#177'q'#149#245'*'#2'4)e'#28'`hh'#232#200#156'/'#151#225#238']'#232#235
+  +#131#150#150#234#213#215#7#247#238'Umv'#240'z'#189'D"'#17#0#164#148'_'#168#8
+  +'p'#252#8#133#16#31#2'?'#6#2#1'&''''m'#159'~>'#15'##'#240#236#153'=GW'#23'<z'
+  +#4'mm'#255#180'I)'#153#153#153#193'4M<'#30'O'#183'a'#24#203'N'#226'Ry'#3#163
+  +#0#225'p'#216'6'#248'r'#249#248#224#1#178'Y'#184'z'#213#254'Mh'#154'V'#251#22
+  +'8'#168#230#142#160'"'#224'2@{{'#187#173#241#254#253#227#131#175'!'#155#133#7
+  +#15#236'm'#29#29#29#181#219'+N'#131'R'#17#208#6'p'#246#236'Y['#227#236#172's'
+  +#162#163#230#214'q'#219'$'#153'=T'#4#156#7'hii'#177'5'#190'x'#225#156#232#249
+  +'s'#251#241#131'?'#17#188'!'#1#13'5]'#127'sz'#132'W)'#15']X'#142#185#20#252
+  +#254#14'P*'#149'l'#141#23'/:'':jn'#29#247'K'#167'\*'#2#242#0#133'B'#193#214
+  +'81'#225#156#232#230'M'#251#241':'#238'7"'#224'{'#128#205#205'M['#227#173'['
+  +#213#255#252#235#208#213'U'#157'k'#135#141#141#141#218#173#227#166'NE'#192#28
+  +#192#250#250'z}'#174#30#226#204#153'j'#145':ND'#173#144#217#21'q'#203#178#14
+  +#5'x<'#158'9'#167'A9'#22' '#132'X'#6'r'#166'i'#146#205'fm'#231#180#181#193
+  +#210'R'#181'm'#168'o%'#250#251#171'cKK'#246'U'#24'`yy'#185#182#209'Y3'#12#195
+  +'AE'#169'B'#165#15#150#192#29' '#185#184#184'Hgg'#167'm?'#228#245#194#237#219
+  +#213#203')'#202#229'2'#153'L'#6#0'M'#211'>W'#136'I'#173#27'='#216#195'>-'#149
+  +'J$'#147'I'#219'TR'#133#148#146'T*'#197#238#238'.'#192#147#233#233#233'oT'
+  +#214#171#238#7'$'#240')'#240'jkk'#139#133#133#133#134'DH)'#153#159#159#175
+  +#229#254#142#174#235#159#161'Xo'#148'wd'#153'L'#166'8<<'#252#131#148#242'F>'
+  +#159#215#183#183#183#9#6#131#232#186#26'U'#185'\&'#153'L'#178#178#178#2#213
+  +'-'#229#136'a'#24#246#31#215'18'#241#142'$'#30#143#127'dYV'#10'8'#215#220#220
+  +#204#192#192#0'===x'#142'*'#179#7#144'R'#178#186#186'J:'#157#174#165#205#142
+  +#166'i'#215#166#167#167#23'O'#18'G'#163#199'*'#23'*'#149#202','#208#15#224
+  +#247#251#143'<V)'#20#10'lnn'#146#203#229#234#143'U'#158#0#19'B'#136'_N'#26
+  +#195#169#28'l'#197'b'#177#241#131#157'T'#216#225#154'5'#170#7'['#169#134#157
+  +'7JP'#143'x<'#254'A'#221#209#226#187#252'u'#180#248#27#240'R'#211#180#199'R'
+  +#202'9!'#132'r'#174#187'p'#225#194#133#11#23'.'#254#143#248#19#167#19#137'M'
+  +#219#2#179#18#0#0#0#0'IEND'#174'B`'#130
+]);

+ 4 - 1
images/bgracontrols_images_list.txt

@@ -93,4 +93,7 @@ tbcpaperpanel_150.png
 tbcpaperpanel_200.png
 tbcpaperlistbox.png
 tbcpaperlistbox_150.png
-tbcpaperlistbox_200.png
+tbcpaperlistbox_200.png
+tbgrathemeradiobutton.png
+tbgrathemeradiobutton_150.png
+tbgrathemeradiobutton_200.png

BIN
images/tbgrathemeradiobutton.png


BIN
images/tbgrathemeradiobutton_150.png


BIN
images/tbgrathemeradiobutton_200.png


+ 1 - 1
test/test_bgrathemes/test.lpi

@@ -11,7 +11,7 @@
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <XPManifest>
-        <DpiAware Value="True"/>
+        <DpiAware Value="True/PM"/>
       </XPManifest>
       <Icon Value="0"/>
       <Resources Count="1">

+ 71 - 32
test/test_bgrathemes/umain.lfm

@@ -2,49 +2,83 @@ object frmBGRAThemesButton: TfrmBGRAThemesButton
   Left = 350
   Height = 240
   Top = 119
-  Width = 449
-  Caption = 'BGRA Themes - Button'
+  Width = 616
+  Caption = 'BGRA Themes'
   ClientHeight = 240
-  ClientWidth = 449
+  ClientWidth = 616
+  Color = clWhite
   OnCreate = FormCreate
   Position = poScreenCenter
   LCLVersion = '2.1.0.0'
+  object BGRAThemeRadioButton1: TBGRAThemeRadioButton
+    Left = 168
+    Height = 19
+    Top = 25
+    Width = 168
+    Caption = 'Radio Button'
+    Checked = False
+  end
+  object BGRAThemeRadioButton2: TBGRAThemeRadioButton
+    Left = 168
+    Height = 19
+    Top = 49
+    Width = 168
+    Caption = 'Radio Button'
+    Checked = False
+  end
+  object BGRAThemeRadioButton3: TBGRAThemeRadioButton
+    Left = 168
+    Height = 19
+    Top = 73
+    Width = 168
+    Caption = 'Radio Button'
+    Checked = True
+    Enabled = False
+  end
   object BGRAThemeButton1: TBGRAThemeButton
-    Left = 8
-    Height = 32
-    Top = 16
-    Width = 144
-    Caption = 'Default Theme'
+    Left = 16
+    Height = 56
+    Top = 24
+    Width = 125
+    Caption = 'Button'
   end
   object BGRAThemeButton2: TBGRAThemeButton
-    Left = 8
-    Height = 32
-    Top = 64
-    Width = 144
-    Caption = 'Color Theme'
-    Theme = BGRAColorTheme1
-  end
-  object BGRAThemeButton3: TBGRAThemeButton
-    Left = 8
-    Height = 80
-    Top = 112
-    Width = 144
-    Caption = 'Image Theme'
-    Theme = BGRAImageTheme1
-  end
-  object ListBox1: TListBox
-    Left = 272
+    Left = 16
+    Height = 59
+    Top = 96
+    Width = 125
+    Caption = 'Button'
+    Enabled = False
+  end
+  object ListBox1: TBCPaperListBox
+    Left = 440
     Height = 211
-    Top = 13
+    Top = 16
     Width = 164
-    Items.Strings = (
+    Alignment = taLeftJustify
+    ChildSizing.LeftRightSpacing = 4
+    ChildSizing.TopBottomSpacing = 5
+    ChildSizing.ControlsPerLine = 1
+    ClientHeight = 211
+    ClientWidth = 164
+    Color = clWhite
+    ParentColor = False
+    TabOrder = 5
+    ListBox.Left = 4
+    ListBox.Height = 201
+    ListBox.Top = 5
+    ListBox.Width = 156
+    ListBox.Align = alClient
+    ListBox.BorderStyle = bsNone
+    ListBox.Items.Strings = (
       'Default'
       'Color'
       'Image'
     )
-    ItemHeight = 15
-    OnSelectionChange = ListBox1SelectionChange
-    TabOrder = 3
+    ListBox.ItemHeight = 48
+    ListBox.OnSelectionChange = ListBox1SelectionChange
+    ListBox.Style = lbOwnerDrawFixed
+    ListBox.TabOrder = 0
   end
   object BGRAColorTheme1: TBGRAColorTheme
     ColorNormal = 4227327
@@ -53,11 +87,16 @@ object frmBGRAThemesButton: TfrmBGRAThemesButton
     ColorDisabled = clGray
     ColorFocused = clBlack
     ColorText = clWhite
-    Left = 224
-    Top = 72
+    Left = 232
+    Top = 73
   end
   object BGRAImageTheme1: TBGRAImageTheme
+    BackgroundColor = clWhite
     Left = 224
     Top = 130
   end
+  object BGRATheme1: TBGRATheme
+    Left = 232
+    Top = 24
+  end
 end

+ 15 - 13
test/test_bgrathemes/umain.pas

@@ -6,7 +6,8 @@ interface
 
 uses
   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, BGRATheme,
-  BGRAThemeButton, BGRAColorTheme, BGRAImageTheme;
+  BGRAThemeButton, BGRAColorTheme, BGRAImageTheme, BGRAThemeRadioButton,
+  BCListBox;
 
 type
 
@@ -15,10 +16,13 @@ type
   TfrmBGRAThemesButton = class(TForm)
     BGRAColorTheme1: TBGRAColorTheme;
     BGRAImageTheme1: TBGRAImageTheme;
+    BGRATheme1: TBGRATheme;
     BGRAThemeButton1: TBGRAThemeButton;
     BGRAThemeButton2: TBGRAThemeButton;
-    BGRAThemeButton3: TBGRAThemeButton;
-    ListBox1: TListBox;
+    BGRAThemeRadioButton1: TBGRAThemeRadioButton;
+    BGRAThemeRadioButton2: TBGRAThemeRadioButton;
+    BGRAThemeRadioButton3: TBGRAThemeRadioButton;
+    ListBox1: TBCPaperListBox;
     procedure FormCreate(Sender: TObject);
     procedure ListBox1SelectionChange(Sender: TObject; User: boolean);
   private
@@ -44,23 +48,21 @@ end;
 procedure TfrmBGRAThemesButton.ListBox1SelectionChange(Sender: TObject;
   User: boolean);
 begin
-  case ListBox1.ItemIndex of
+  case ListBox1.ListBox.ItemIndex of
     0: begin
-      BGRAThemeButton1.Theme := BGRADefaultTheme;
-      BGRAThemeButton2.Theme := BGRADefaultTheme;
-      BGRAThemeButton3.Theme := BGRADefaultTheme;
+      Self.Color := clWhite;
+      BGRADefaultTheme := BGRATheme1;
     end;
     1: begin
-      BGRAThemeButton1.Theme := BGRAColorTheme1;
-      BGRAThemeButton2.Theme := BGRAColorTheme1;
-      BGRAThemeButton3.Theme := BGRAColorTheme1;
+      Self.Color := clBlack;
+      BGRADefaultTheme := BGRAColorTheme1;
     end;
     2: begin
-      BGRAThemeButton1.Theme := BGRAImageTheme1;
-      BGRAThemeButton2.Theme := BGRAImageTheme1;
-      BGRAThemeButton3.Theme := BGRAImageTheme1;
+      Self.Color := clWhite;
+      BGRADefaultTheme := BGRAImageTheme1;
     end;
   end;
+  Invalidate;
 end;
 
 end.