unit UnitButtons;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  sPanel, ExtCtrls, sFrameAdapter, Menus, sButton, sColorSelect, StdCtrls, Buttons, 
  sBitBtn, sSpeedButton, ComCtrls, ToolWin, sToolBar, sComboBox, sGroupBox,
  sTrackBar, sLabel, sCheckBox;

type
  TFrameButtons = class(TFrame)
    sFrameAdapter1: TsFrameAdapter;
    PopupMenu1: TPopupMenu;
    Item11: TMenuItem;
    Item21: TMenuItem;
    Item31: TMenuItem;
    Item41: TMenuItem;
    Subitem411: TMenuItem;
    Subitem421: TMenuItem;
    Subitem431: TMenuItem;
    Subitem441: TMenuItem;
    Subitem451: TMenuItem;
    Subitem461: TMenuItem;
    Subitem471: TMenuItem;
    sToolBar2: TsToolBar;
    ToolButton1: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    ToolButton6: TToolButton;
    ToolButton7: TToolButton;
    ToolButton8: TToolButton;
    sGroupBox1: TsGroupBox;
    sComboBox1: TsComboBox;
    sComboBox3: TsComboBox;
    sBitBtn3: TsBitBtn;
    sComboBox2: TsComboBox;
    sBitBtn8: TsBitBtn;
    sGroupBox2: TsGroupBox;
    sCheckBox1: TsCheckBox;
    sTrackBar1: TsTrackBar;
    sLabel1: TsLabel;
    sBitBtn4: TsBitBtn;
    sCheckBox2: TsCheckBox;
    sLabel2: TsLabel;
    sPanel2: TsPanel;
    sComboBox4: TsComboBox;
    sSpeedButton2: TsSpeedButton;
    sSpeedButton1: TsSpeedButton;
    sBitBtn1: TsBitBtn;
    sBitBtn2: TsBitBtn;
    sButton1: TsButton;
    sSpeedButton4: TsSpeedButton;
    sBitBtn5: TsBitBtn;
    sBitBtn6: TsBitBtn;
    procedure FrameResize(Sender: TObject);
    procedure sComboBox1Change(Sender: TObject);
    procedure sComboBox3Change(Sender: TObject);
    procedure sComboBox2Change(Sender: TObject);
    procedure sTrackBar1Change(Sender: TObject);
    procedure sCheckBox1Click(Sender: TObject);
    procedure sCheckBox2Click(Sender: TObject);
    procedure sComboBox4Change(Sender: TObject);
  end;

implementation

uses MainUnit;

{$R *.DFM}

procedure TFrameButtons.FrameResize(Sender: TObject);
begin
  sComboBox1.ItemIndex := 0;
end;

procedure TFrameButtons.sComboBox1Change(Sender: TObject);
const
  la : array [0..3] of TButtonLayout = (blGlyphTop, blGlyphLeft, blGlyphBottom, blGlyphRight);
begin
  sBitBtn5.Layout := la[sComboBox1.ItemIndex];
  sSpeedButton4.Layout := la[sComboBox1.ItemIndex];
  sSpeedButton4.Repaint
end;

procedure TFrameButtons.sComboBox3Change(Sender: TObject);
begin
  sBitBtn5.SkinData.SkinSection := sComboBox3.Text;
  sSpeedButton4.SkinData.SkinSection := sComboBox3.Text;
end;

procedure TFrameButtons.sComboBox2Change(Sender: TObject);
begin
  sToolBar2.SkinData.SkinSection := sComboBox2.Text;
  MainForm.sCoolBar1.SkinData.SkinSection := sComboBox2.Text;
end;

procedure TFrameButtons.sTrackBar1Change(Sender: TObject);
var
  i : integer;
begin
  sLabel2.Caption := IntToStr(sTrackBar1.Position);
  for i := 0 to ComponentCount -1 do begin
    if Components[i] is TsBitBtn then TsBitBtn(Components[i]).Blend := sTrackBar1.Position;
    if Components[i] is TsSpeedButton then TsSpeedButton(Components[i]).Blend := sTrackBar1.Position;
  end;
  for i := 0 to Parent.ComponentCount -1 do with Parent do if Components[i] is TsSpeedButton
    then TsSpeedButton(Components[i]).Blend := sTrackBar1.Position;
end;

procedure TFrameButtons.sCheckBox1Click(Sender: TObject);
var
  i : integer;
begin
  for i := 0 to ComponentCount -1 do begin
    if Components[i] is TsBitBtn then TsBitBtn(Components[i]).Grayed := sCheckBox1.Checked;
    if Components[i] is TsSpeedButton then TsSpeedButton(Components[i]).Grayed := sCheckBox1.Checked;
  end;
  for i := 0 to Parent.ComponentCount -1 do with Parent do if Components[i] is TsSpeedButton
    then TsSpeedButton(Components[i]).Grayed := sCheckBox1.Checked;
end;

procedure TFrameButtons.sCheckBox2Click(Sender: TObject);
var
  i : integer;
begin
  for i := 0 to ComponentCount -1 do begin
    if Components[i] is TsBitBtn then TsBitBtn(Components[i]).Reflected := sCheckBox2.Checked;
    if Components[i] is TsSpeedButton then TsSpeedButton(Components[i]).Reflected := sCheckBox2.Checked;
  end;
  for i := 0 to Parent.ComponentCount -1 do with Parent do if Components[i] is TsSpeedButton
    then TsSpeedButton(Components[i]).Reflected := sCheckBox2.Checked;
end;

procedure TFrameButtons.sComboBox4Change(Sender: TObject);
var
  i : integer;
begin
  for i := 0 to sComboBox4.Parent.ControlCount -1 do with sComboBox4.Parent do begin
    if Controls[i] is TsBitBtn then TsBitBtn(Controls[i]).SkinData.SkinSection := sComboBox4.Text;
    if Controls[i] is TsSpeedButton then TsSpeedButton(Controls[i]).SkinData.SkinSection := sComboBox4.Text;
    if Controls[i] is TsButton then TsButton(Controls[i]).SkinData.SkinSection := sComboBox4.Text;
  end;
end;

end.
