SpkToolbar: Support SpkPopupMenu also by MenuButton. Integrate SpkPopupMenu into the "actions" and "runtime" demo projects.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8739 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-02-23 22:25:12 +00:00
parent 318afbd40f
commit a49c3ad55f
9 changed files with 890 additions and 1653 deletions

View File

@ -555,7 +555,7 @@ type
implementation
uses
LCLIntf, Themes, spkt_Buttons;
LCLIntf, Themes, spkt_Buttons, SpkPopup;
{ TSpkToolbarDispatch }
@ -2551,6 +2551,9 @@ end;
procedure TSpkToolbar.SetMenuButtonDropdownMenu(const Value: TPopupMenu);
begin
FMenuButtonDropdownMenu := Value;
if (FMenuButtonDropdownMenu is TSpkPopupMenu) then
TSpkPopupMenu(FMenuButtonDropdownMenu).Appearance := Self.Appearance;
//if Assigned(FToolbarDispatch) then
// FToolbarDispatch.NotifyMetricsChanged;
end;

View File

@ -111,7 +111,6 @@ type
property AllowAllUp: Boolean read FAllowAllUp write SetAllowAllUp default false;
property ButtonKind: TSpkButtonKind read FButtonKind write SetButtonKind default bkButton;
property Checked: Boolean read GetChecked write SetChecked default false;
property DropdownMenu: TPopupMenu read FDropdownMenu write SetDropdownMenu;
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
@ -129,6 +128,7 @@ type
function GetRootComponent: TComponent;
property ActionLink: TSpkButtonActionLink read FActionLink;
property Checked: Boolean read GetChecked write SetChecked default false;
published
property Action: TBasicAction read GetAction write SetAction;

View File

@ -76,6 +76,9 @@
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>

View File

@ -4,12 +4,12 @@ object Form1: TForm1
Top = 248
Width = 501
Caption = 'TSpkToolbar demo'
ClientHeight = 284
ClientHeight = 304
ClientWidth = 501
Menu = MainMenu
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
LCLVersion = '2.1.0.0'
LCLVersion = '2.3.0.0'
object ToolBar1: TToolBar
Left = 0
Height = 24
@ -105,12 +105,12 @@ object Form1: TForm1
end
object Panel1: TPanel
Left = 0
Height = 148
Height = 168
Top = 136
Width = 501
Align = alClient
BevelOuter = bvNone
ClientHeight = 148
ClientHeight = 168
ClientWidth = 501
ParentFont = False
TabOrder = 1
@ -218,6 +218,26 @@ object Form1: TForm1
Appearance.Element.ActiveInnerDarkColor = 961020
Appearance.Element.ActiveCaptionColor = 8405614
Appearance.Element.Style = esRounded
Appearance.Popup.CheckedFrameColor = 3577330
Appearance.Popup.CheckedGradientFromColor = 9823231
Appearance.Popup.CheckedGradientToColor = 9823231
Appearance.Popup.CheckedGradientType = bkSolid
Appearance.Popup.DisabledCaptionColor = clSilver
Appearance.Popup.DividerLineColor = 14922381
Appearance.Popup.GutterFrameColor = 12961221
Appearance.Popup.GutterGradientFromColor = 15658729
Appearance.Popup.GutterGradientToColor = 15658729
Appearance.Popup.GutterGradientType = bkSolid
Appearance.Popup.HotTrackCaptionColor = 8864367
Appearance.Popup.HotTrackFrameColor = 10079963
Appearance.Popup.HotTrackGradientFromColor = 14351615
Appearance.Popup.HotTrackGradientToColor = 5101567
Appearance.Popup.HotTrackGradientType = bkConcave
Appearance.Popup.IdleCaptionColor = 11631958
Appearance.Popup.IdleGradientFromColor = 16448250
Appearance.Popup.IdleGradientToColor = 16448250
Appearance.Popup.IdleGradientType = bkConcave
Appearance.Popup.Style = psGutter
TabIndex = 0
Images = ImageList
LargeImages = LargeImageList
@ -295,6 +315,26 @@ object Form1: TForm1
CustomAppearance.Element.ActiveInnerDarkColor = 961020
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
CustomAppearance.Popup.CheckedFrameColor = 3577330
CustomAppearance.Popup.CheckedGradientFromColor = 9823231
CustomAppearance.Popup.CheckedGradientToColor = 9823231
CustomAppearance.Popup.CheckedGradientType = bkSolid
CustomAppearance.Popup.DisabledCaptionColor = clSilver
CustomAppearance.Popup.DividerLineColor = 14922381
CustomAppearance.Popup.GutterFrameColor = 12961221
CustomAppearance.Popup.GutterGradientFromColor = 15658729
CustomAppearance.Popup.GutterGradientToColor = 15658729
CustomAppearance.Popup.GutterGradientType = bkSolid
CustomAppearance.Popup.HotTrackCaptionColor = 8864367
CustomAppearance.Popup.HotTrackFrameColor = 10079963
CustomAppearance.Popup.HotTrackGradientFromColor = 14351615
CustomAppearance.Popup.HotTrackGradientToColor = 5101567
CustomAppearance.Popup.HotTrackGradientType = bkConcave
CustomAppearance.Popup.IdleCaptionColor = 11631958
CustomAppearance.Popup.IdleGradientFromColor = 16448250
CustomAppearance.Popup.IdleGradientToColor = 16448250
CustomAppearance.Popup.IdleGradientType = bkConcave
CustomAppearance.Popup.Style = psGutter
Caption = 'File'
Panes = (
'SpkPane1'
@ -391,6 +431,26 @@ object Form1: TForm1
CustomAppearance.Element.ActiveInnerDarkColor = 961020
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
CustomAppearance.Popup.CheckedFrameColor = 3577330
CustomAppearance.Popup.CheckedGradientFromColor = 9823231
CustomAppearance.Popup.CheckedGradientToColor = 9823231
CustomAppearance.Popup.CheckedGradientType = bkSolid
CustomAppearance.Popup.DisabledCaptionColor = clSilver
CustomAppearance.Popup.DividerLineColor = 14922381
CustomAppearance.Popup.GutterFrameColor = 12961221
CustomAppearance.Popup.GutterGradientFromColor = 15658729
CustomAppearance.Popup.GutterGradientToColor = 15658729
CustomAppearance.Popup.GutterGradientType = bkSolid
CustomAppearance.Popup.HotTrackCaptionColor = 8864367
CustomAppearance.Popup.HotTrackFrameColor = 10079963
CustomAppearance.Popup.HotTrackGradientFromColor = 14351615
CustomAppearance.Popup.HotTrackGradientToColor = 5101567
CustomAppearance.Popup.HotTrackGradientType = bkConcave
CustomAppearance.Popup.IdleCaptionColor = 11631958
CustomAppearance.Popup.IdleGradientFromColor = 16448250
CustomAppearance.Popup.IdleGradientToColor = 16448250
CustomAppearance.Popup.IdleGradientType = bkConcave
CustomAppearance.Popup.Style = psGutter
Caption = 'Edit'
Panes = (
'SpkPane3'
@ -488,6 +548,26 @@ object Form1: TForm1
CustomAppearance.Element.ActiveInnerDarkColor = 961020
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
CustomAppearance.Popup.CheckedFrameColor = 3577330
CustomAppearance.Popup.CheckedGradientFromColor = 9823231
CustomAppearance.Popup.CheckedGradientToColor = 9823231
CustomAppearance.Popup.CheckedGradientType = bkSolid
CustomAppearance.Popup.DisabledCaptionColor = clSilver
CustomAppearance.Popup.DividerLineColor = 14922381
CustomAppearance.Popup.GutterFrameColor = 12961221
CustomAppearance.Popup.GutterGradientFromColor = 15658729
CustomAppearance.Popup.GutterGradientToColor = 15658729
CustomAppearance.Popup.GutterGradientType = bkSolid
CustomAppearance.Popup.HotTrackCaptionColor = 8864367
CustomAppearance.Popup.HotTrackFrameColor = 10079963
CustomAppearance.Popup.HotTrackGradientFromColor = 14351615
CustomAppearance.Popup.HotTrackGradientToColor = 5101567
CustomAppearance.Popup.HotTrackGradientType = bkConcave
CustomAppearance.Popup.IdleCaptionColor = 11631958
CustomAppearance.Popup.IdleGradientFromColor = 16448250
CustomAppearance.Popup.IdleGradientToColor = 16448250
CustomAppearance.Popup.IdleGradientType = bkConcave
CustomAppearance.Popup.Style = psGutter
Caption = 'Format'
Panes = (
'SpkPane2'
@ -620,6 +700,26 @@ object Form1: TForm1
CustomAppearance.Element.ActiveInnerDarkColor = 961020
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
CustomAppearance.Popup.CheckedFrameColor = 3577330
CustomAppearance.Popup.CheckedGradientFromColor = 9823231
CustomAppearance.Popup.CheckedGradientToColor = 9823231
CustomAppearance.Popup.CheckedGradientType = bkSolid
CustomAppearance.Popup.DisabledCaptionColor = clSilver
CustomAppearance.Popup.DividerLineColor = 14922381
CustomAppearance.Popup.GutterFrameColor = 12961221
CustomAppearance.Popup.GutterGradientFromColor = 15658729
CustomAppearance.Popup.GutterGradientToColor = 15658729
CustomAppearance.Popup.GutterGradientType = bkSolid
CustomAppearance.Popup.HotTrackCaptionColor = 8864367
CustomAppearance.Popup.HotTrackFrameColor = 10079963
CustomAppearance.Popup.HotTrackGradientFromColor = 14351615
CustomAppearance.Popup.HotTrackGradientToColor = 5101567
CustomAppearance.Popup.HotTrackGradientType = bkConcave
CustomAppearance.Popup.IdleCaptionColor = 11631958
CustomAppearance.Popup.IdleGradientFromColor = 16448250
CustomAppearance.Popup.IdleGradientToColor = 16448250
CustomAppearance.Popup.IdleGradientType = bkConcave
CustomAppearance.Popup.Style = psGutter
Caption = 'Options'
Panes = (
'SpkPane6'
@ -746,6 +846,26 @@ object Form1: TForm1
CustomAppearance.Element.ActiveInnerDarkColor = 961020
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
CustomAppearance.Popup.CheckedFrameColor = 3577330
CustomAppearance.Popup.CheckedGradientFromColor = 9823231
CustomAppearance.Popup.CheckedGradientToColor = 9823231
CustomAppearance.Popup.CheckedGradientType = bkSolid
CustomAppearance.Popup.DisabledCaptionColor = clSilver
CustomAppearance.Popup.DividerLineColor = 14922381
CustomAppearance.Popup.GutterFrameColor = 12961221
CustomAppearance.Popup.GutterGradientFromColor = 15658729
CustomAppearance.Popup.GutterGradientToColor = 15658729
CustomAppearance.Popup.GutterGradientType = bkSolid
CustomAppearance.Popup.HotTrackCaptionColor = 8864367
CustomAppearance.Popup.HotTrackFrameColor = 10079963
CustomAppearance.Popup.HotTrackGradientFromColor = 14351615
CustomAppearance.Popup.HotTrackGradientToColor = 5101567
CustomAppearance.Popup.HotTrackGradientType = bkConcave
CustomAppearance.Popup.IdleCaptionColor = 11631958
CustomAppearance.Popup.IdleGradientFromColor = 16448250
CustomAppearance.Popup.IdleGradientToColor = 16448250
CustomAppearance.Popup.IdleGradientType = bkConcave
CustomAppearance.Popup.Style = psGutter
Caption = 'Help'
Panes = (
'SpkPane4'
@ -995,34 +1115,6 @@ object Form1: TForm1
end
end
end
object StyleMenu: TPopupMenu
Left = 352
Top = 216
object MenuItem17: TMenuItem
Caption = 'Office2007 blue'
OnClick = StyleMenuClick
end
object MenuItem18: TMenuItem
Tag = 1
Caption = 'Office2007 silver'
OnClick = StyleMenuClick
end
object MenuItem21: TMenuItem
Tag = 2
Caption = 'Office2007 silver / turquoise'
OnClick = StyleMenuClick
end
object MenuItem19: TMenuItem
Tag = 3
Caption = 'Metro light'
OnClick = StyleMenuClick
end
object MenuItem20: TMenuItem
Tag = 4
Caption = 'Metro dark'
OnClick = StyleMenuClick
end
end
object ImageList: TImageList
Left = 160
Top = 179
@ -1500,4 +1592,32 @@ object Form1: TForm1
DCB672DAA75A682DACFB3F460B036BFA763A7DAA51DBFF01579529BE
}
end
object StyleMenu: TSpkPopupMenu
Left = 352
Top = 216
object MenuItem17: TMenuItem
Caption = 'Office2007 blue'
OnClick = StyleMenuClick
end
object MenuItem18: TMenuItem
Tag = 1
Caption = 'Office2007 silver'
OnClick = StyleMenuClick
end
object MenuItem21: TMenuItem
Tag = 2
Caption = 'Office2007 silver / turquoise'
OnClick = StyleMenuClick
end
object MenuItem19: TMenuItem
Tag = 3
Caption = 'Metro light'
OnClick = StyleMenuClick
end
object MenuItem20: TMenuItem
Tag = 4
Caption = 'Metro dark'
OnClick = StyleMenuClick
end
end
end

View File

@ -6,8 +6,8 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ActnList,
StdActns, StdCtrls, Menus, ComCtrls, ExtCtrls,
SpkToolbar, spkt_Buttons, spkt_Checkboxes, spkt_Pane, spkt_Tab, spkt_Appearance;
StdActns, StdCtrls, Menus, ComCtrls, ExtCtrls, SpkToolbar, spkt_Buttons,
spkt_Checkboxes, spkt_Pane, spkt_Tab, spkt_Appearance, SpkPopup;
type
@ -85,7 +85,6 @@ type
SpkSmallButton9: TSpkSmallButton;
SpkTab4: TSpkTab;
SpkTab5: TSpkTab;
StyleMenu: TPopupMenu;
SpkCheckbox1: TSpkCheckbox;
SpkLargeButton1: TSpkLargeButton;
SpkLargeButton2: TSpkLargeButton;
@ -105,6 +104,7 @@ type
SpkTab2: TSpkTab;
SpkTab3: TSpkTab;
SpkToolbar1: TSpkToolbar;
StyleMenu: TSpkPopupMenu;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton10: TToolButton;

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,11 @@ unit Unit1;
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, SpkToolbar,
SpkGUITools, SpkMath, SpkGraphTools, spkt_Tab, spkt_Pane, spkt_Types,
spkt_Tools, ImgList, ComCtrls, Menus, Grids, ExtCtrls, StdCtrls,
spkt_BaseItem, spkt_Buttons, spkt_Checkboxes;
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
ImgList, ComCtrls, Menus, Grids, ExtCtrls, StdCtrls,
SpkToolbar, SpkGUITools, SpkMath, SpkGraphTools, SpkPopup, spkt_Tab,
spkt_Pane, spkt_Types, spkt_Tools, spkt_BaseItem, spkt_Buttons,
spkt_Checkboxes;
type
@ -17,20 +18,9 @@ type
TForm1 = class(TForm)
ImageList: TImageList;
LargeImageList: TImageList;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MnuOffice2007Blue: TMenuItem;
MnuOffice2007Silver1: TMenuItem;
MnuOffice2007Silver2: TMenuItem;
MnuMetroLight: TMenuItem;
MnuMetroDark: TMenuItem;
Panel1: TPanel;
SpkLargeButton1: TSpkLargeButton;
SpkLargeButton2: TSpkLargeButton;
SpkPane2: TSpkPane;
StylePopupMenu: TPopupMenu;
RecentFilesPopupMenu: TPopupMenu;
SpkPane1: TSpkPane;
SpkSmallButton1: TSpkSmallButton;
SpkSmallButton2: TSpkSmallButton;
@ -39,17 +29,24 @@ type
StatusBar1: TStatusBar;
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure StringGrid1PrepareCanvas(Sender: TObject; aCol, aRow: Integer;
aState: TGridDrawState);
procedure StyleChangeHandler(Sender: TObject);
private
{ private declarations }
SpkToolbar : TSpkToolbar;
StylePopupMenu: TSpkPopupMenu;
RecentFilesPopupMenu: TSpkPopupMenu;
CbHorizGrid : TSpkCheckbox;
CbVertGrid: TSpkCheckbox;
CbRowSelect: TSpkCheckbox;
procedure AboutHandler(Sender: TObject);
function CreateRecentFilesPopup: TSpkPopupMenu;
function CreateStylePopup: TSpkPopupMenu;
procedure FileOpenHandler(Sender: TObject);
procedure FileSaveHandler(Sender: TObject);
procedure FileQuitHandler(Sender: TObject);
procedure FormatGridHandler(Sender: TObject);
procedure HorizontalGridLinesHandler(Sender: TObject);
procedure VerticalGridLinesHandler(Sender: TObject);
procedure RowSelectHandler(Sender: TObject);
@ -107,7 +104,6 @@ begin
with FIconLink do begin
Caption := 'http://www.fatcow.com/free-icons';
Font.Color := clBlue;
//Font.Style := [fsUnderline];
Parent := self;
Align := alTop;
Alignment := taCenter;
@ -157,6 +153,75 @@ begin
end;
end;
function TForm1.CreateRecentFilesPopup: TSpkPopupMenu;
var
item: TMenuItem;
begin
Result := TSpkPopupMenu.Create(Self);
item := TMenuItem.Create(Self);
item.Caption := 'First file';
item.ImageIndex := 15;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Second file';
item.ImageIndex := 16;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Third file';
item.ImageIndex := 17;
Result.Items.Add(item);
RecentFilesPopupMenu := Result;
end;
function TForm1.CreateStylePopup: TSpkPopupMenu;
var
item: TMenuItem;
begin
Result := TSpkPopupMenu.Create(Self);
item := TMenuItem.Create(Self);
item.Caption := 'Office2007 blue';
item.GroupIndex := 10;
item.Checked := true;
item.Tag := ord(spkOffice2007Blue);
item.OnClick := @StyleChangeHandler;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Office2007 silver (yellow highlight)';
item.GroupIndex := 10;
item.Tag := ord(spkOffice2007Silver);
item.OnClick := @StyleChangeHandler;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Office2007 silver (tuquoise highlight)';
item.GroupIndex := 10;
item.Tag := ord(spkOffice2007SilverTurquoise);
item.OnClick := @StyleChangeHandler;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Metro light';
item.GroupIndex := 10;
item.Tag := ord(spkMetroLight);
item.OnClick := @StyleChangeHandler;
Result.Items.Add(item);
item := TMenuItem.Create(Self);
item.Caption := 'Metro dark';
item.GroupIndex := 10;
item.Tag := ord(spkMetroDark);
item.OnClick := @StyleChangeHandler;
Result.Items.Add(item);
StylePopupMenu := Result;
end;
procedure TForm1.FileOpenHandler(Sender: TObject);
begin
Statusbar1.SimpleText := '"File" / "Open" clicked';
@ -172,6 +237,13 @@ begin
Close;
end;
procedure TForm1.FormatGridHandler(Sender: TObject);
begin
// Formatting is handled by the grid's OnPrepareCanvas event immediately
// before painting.
StringGrid1.Invalidate;
end;
procedure TForm1.HorizontalGridLinesHandler(Sender: TObject);
begin
if CbHorizGrid.Checked then
@ -215,7 +287,7 @@ begin
with Items.AddLargeButton do begin
Caption := 'Open file';
ButtonKind := bkButtonDropdown;
DropdownMenu := RecentFilesPopupMenu;
DropdownMenu := CreateRecentFilesPopup; //RecentFilesPopupMenu;
LargeImageIndex := 1;
Hint := 'Open a file';
OnClick := @FileOpenHandler;
@ -276,6 +348,7 @@ begin
ShowCaption := false;
AllowAllUp := true;
Hint := 'Bold';
OnClick := @FormatGridHandler;
end;
with Items.AddSmallButton do begin
Caption := 'Italic';
@ -286,6 +359,7 @@ begin
ShowCaption := false;
AllowAllUp := true;
Hint := 'Italic';
OnClick := @FormatGridHandler;
end;
with Items.AddSmallButton do begin
Caption := 'Underline';
@ -296,6 +370,7 @@ begin
ShowCaption := false;
AllowAllUp := true;
Hint := 'Underlined';
OnClick := @FormatGridHandler;
end;
with Items.AddSmallButton do begin
@ -308,6 +383,7 @@ begin
GroupIndex := 2;
Checked := true;
Hint := 'Left-aligned';
OnClick := @FormatGridHandler;
end;
with Items.AddSmallButton do begin
Caption := 'Centered';
@ -319,6 +395,7 @@ begin
GroupIndex := 2;
Checked := false;
Hint := 'Centered';
OnClick := @FormatGridHandler;
end;
with Items.AddSmallButton do begin
Caption := 'Right-aligned';
@ -329,7 +406,11 @@ begin
ShowCaption := false;
GroupIndex := 2;
Hint := 'Right-aligned';
OnClick := @FormatGridHandler;
end;
{
// I don't have an event handler for these...
with Items.AddSmallButton do begin
Caption := 'Block';
ButtonKind := bkToggle;
@ -370,6 +451,7 @@ begin
HideFrameWhenIdle := true;
Caption := '';
end;
}
end;
end;
@ -408,7 +490,7 @@ begin
Caption := 'Change style';
Hint := 'Change theme';
ButtonKind := bkDropdown;
DropdownMenu := StylePopupMenu;
DropdownMenu := CreateStylePopup; //StylePopupMenu;
LargeImageIndex := 7;
end;
end;
@ -443,6 +525,53 @@ begin
end;
end;
procedure TForm1.StringGrid1PrepareCanvas(Sender: TObject; aCol, aRow: Integer;
aState: TGridDrawState);
var
grid: TStringGrid;
ts: TTextStyle;
R: TRect;
begin
if Sender is TStringGrid then
grid := TStringGrid(Sender)
else
exit;
if (ACol = 0) or (ARow = 0) then
exit;
// Button "bold"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[0]).Checked then
grid.Canvas.Font.Style := grid.Canvas.Font.Style + [fsBold]
else
grid.Canvas.Font.Style := grid.Canvas.Font.Style - [fsBold];
// Button "italic"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[1]).Checked then
grid.Canvas.Font.Style := grid.Canvas.Font.Style + [fsItalic]
else
grid.Canvas.Font.Style := grid.Canvas.Font.Style - [fsItalic];
// Button "underline"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[2]).Checked then
grid.Canvas.Font.Style := grid.Canvas.Font.Style + [fsUnderline]
else
grid.Canvas.Font.Style := grid.Canvas.Font.Style - [fsUnderline];
ts := grid.Canvas.TextStyle;
// Button "left-aligned"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[3]).Checked then
ts.Alignment := taLeftJustify;
// Button "centered"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[4]).Checked then
ts.Alignment := taCenter;
// Button "right-aligned"
if TSpkBaseButton(SpkToolbar.Tabs[2].Panes[0].Items[5]).Checked then
ts.Alignment := taRightJustify;
grid.Canvas.Textstyle := ts;
end;
procedure TForm1.StyleChangeHandler(Sender: TObject);
var
i: Integer;

View File

@ -2,11 +2,11 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 933
Height = 546
Top = 211
Width = 723
Width = 715
AutoSize = True
Caption = 'Toolbar appearance editor'
ClientHeight = 546
ClientWidth = 723
ClientWidth = 715
Color = clBtnFace
Font.Color = clWindowText
OnActivate = FormActivate
@ -20,19 +20,19 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 0
Height = 133
Top = 0
Width = 723
Width = 715
Align = alTop
AutoSize = True
Caption = ' Preview '
ClientHeight = 113
ClientWidth = 719
ClientWidth = 711
ParentBackground = False
TabOrder = 0
object tbPreview: TSpkToolbar
Left = 0
Height = 113
Top = 0
Width = 719
Width = 711
Color = clBtnFace
Appearance.Tab.TabHeaderFont.Color = 9126421
Appearance.Tab.TabHeaderFont.Height = -13
@ -399,7 +399,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 0
Height = 372
Top = 133
Width = 723
Width = 715
ActivePage = pgPopup
Align = alClient
TabIndex = 4
@ -407,7 +407,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet6: TTabSheet
Caption = 'Menu Button'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
object pMenuButtonIdleFrame: TPanel
AnchorSideLeft.Control = lblMenuButtonFont
AnchorSideLeft.Side = asrBottom
@ -1146,7 +1146,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 6
Height = 15
Top = 274
Width = 703
Width = 695
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 32
@ -1159,7 +1159,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet1: TTabSheet
Caption = 'Tab'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
object sTabRectangle: TShape
AnchorSideLeft.Control = lblTabFrame
AnchorSideLeft.Side = asrBottom
@ -1599,7 +1599,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet2: TTabSheet
Caption = 'Pane'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
ImageIndex = 1
object lblPaneBorderDark: TLabel
AnchorSideTop.Control = pPaneBorderDark
@ -2124,7 +2124,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet3: TTabSheet
Caption = 'Item'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
ImageIndex = 2
object sItemRectangle: TShape
AnchorSideLeft.Control = lblItemIdleFrame
@ -3177,7 +3177,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object pgPopup: TTabSheet
Caption = 'Dropdown Menu'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
object lblPopupIdle: TLabel
AnchorSideLeft.Control = bvPopupIdleFrame
AnchorSideLeft.Side = asrCenter
@ -3295,7 +3295,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideRight.Side = asrBottom
Left = 60
Height = 15
Top = 224
Top = 255
Width = 62
Anchors = [akTop, akRight]
Caption = 'Divider Line'
@ -3400,11 +3400,11 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object pPopupDividerLineColor: TPanel
AnchorSideLeft.Control = lblPopupGradientTo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = pPopupDisabledCaptionColor
AnchorSideTop.Control = pPopupFont
AnchorSideTop.Side = asrBottom
Left = 138
Height = 25
Top = 219
Top = 250
Width = 100
BorderSpacing.Left = 16
BorderSpacing.Top = 6
@ -3431,11 +3431,11 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object pPopupFont: TPanel
AnchorSideLeft.Control = lblPopupGradientTo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = pPopupDividerLineColor
AnchorSideTop.Control = pPopupDisabledCaptionColor
AnchorSideTop.Side = asrBottom
Left = 138
Height = 25
Top = 250
Top = 219
Width = 100
BorderSpacing.Left = 16
BorderSpacing.Top = 6
@ -3453,7 +3453,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideRight.Side = asrBottom
Left = 71
Height = 15
Top = 255
Top = 224
Width = 51
Anchors = [akTop, akRight]
Caption = 'Item Font'
@ -3535,7 +3535,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideBottom.Side = asrBottom
Left = 240
Height = 24
Top = 219
Top = 250
Width = 25
AllowAllUp = True
BorderSpacing.Left = 2
@ -3950,7 +3950,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet4: TTabSheet
Caption = 'Import / Export'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
ImageIndex = 3
object bImport: TButton
AnchorSideLeft.Control = bExportToXML
@ -3993,7 +3993,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 4
Height = 307
Top = 33
Width = 707
Width = 699
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 4
@ -4024,7 +4024,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideTop.Control = TabSheet4
AnchorSideRight.Control = TabSheet4
AnchorSideRight.Side = asrBottom
Left = 657
Left = 649
Height = 25
Top = 4
Width = 54
@ -4040,7 +4040,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object TabSheet5: TTabSheet
Caption = 'Tools'
ClientHeight = 344
ClientWidth = 715
ClientWidth = 707
ImageIndex = 4
object Label17: TLabel
AnchorSideLeft.Control = TabSheet5
@ -4079,7 +4079,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 8
Height = 33
Top = 509
Width = 706
Width = 698
Align = alBottom
AutoSize = True
BorderSpacing.Left = 8
@ -4088,7 +4088,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
BorderSpacing.Bottom = 4
BevelOuter = bvNone
ClientHeight = 33
ClientWidth = 706
ClientWidth = 698
Constraints.MinWidth = 75
ParentBackground = False
TabOrder = 2
@ -4097,7 +4097,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideRight.Control = bCancel
AnchorSideBottom.Control = bCancel
AnchorSideBottom.Side = asrBottom
Left = 550
Left = 542
Height = 25
Top = 4
Width = 75
@ -4114,7 +4114,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = ButtonPanel
AnchorSideRight.Side = asrBottom
Left = 631
Left = 623
Height = 25
Top = 4
Width = 75
@ -4179,8 +4179,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
'ColorS=F0FBFF'
'ColorT=A4A0A0'
)
Left = 280
Top = 504
Left = 400
Top = 416
end
object fdFontDialog: TFontDialog
Font.Color = clWindowText
@ -4188,8 +4188,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Font.Name = 'Tahoma'
MinFontSize = 0
MaxFontSize = 0
Left = 376
Top = 504
Left = 496
Top = 416
end
object Images_200: TImageList
Height = 32