6 Windows, Messages, SysUtils, Classes, Controls,
7 StdCtrls, ExtCtrls, ComCtrls, ActnList, IniFiles,
11 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
12 DEF_STANDARD: array[0..9] of string = ('RoundAction',
20 'CabinetHistoryAction',
21 'CabinetFavoriteAction');
22 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
23 DEF_LIST: array[0..16] of string = ('ListNumberVisibleAction',
36 'SelectListReloadAction',
37 'SelectThreadReloadAction',
39 'SelectReservAction');
40 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
41 DEF_BROWSER: array[0..15] of string = ('BrowserMaxAction',
59 //
\83{
\83^
\83\93\83X
\83^
\83C
\83\8b\82ª"tbsCheck"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
60 CHECK_STYLE: array[0..30] of string = ('CabinetVisibleAction',
67 'StdToolBarVisibleAction',
68 'AddressBarVisibleAction',
69 'LinkBarVisibleAction',
70 'ListToolBarVisibleAction',
71 'ListNameBarVisibleAction',
72 'BrowserToolBarVisibleAction',
73 'BrowserNameBarVisibleAction',
74 'MsgBarVisibleAction',
75 'StatusBarVisibleAction',
76 'CabinetHistoryAction',
77 'CabinetFavoriteAction',
82 'BrowserTabVisibleAction',
83 'BrowserTabTopAction',
84 'BrowserTabBottomAction',
85 'BrowserTabTabStyleAction',
86 'BrowserTabButtonStyleAction',
87 'BrowserTabFlatStyleAction',
89 'ListNumberVisibleAction',
94 //
\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\82ª"tbsDropDown"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
95 DROPDOWN_STYLE: array[0..2] of string = ('IconStyle',
99 INI_FILENAME: string = 'ToolBar.ini';
101 function IsCheckStyle(Action: TCustomAction): Boolean;
102 function IsDropDownStyle(Action: TCustomAction): Boolean;
103 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
104 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
105 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
106 procedure SaveToolBarSetting(ToolBar: TToolBar);
110 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
116 Action: TCustomAction;
117 ToolButton: TToolButton;
119 FileName := GikoSys.GetConfigDir + INI_FILENAME;
120 if FileExists(FileName) then begin
121 for i := ToolBar.ButtonCount - 1 downto 0 do
122 ToolBar.RemoveControl(ToolBar.Buttons[i]);
124 ini := TMemIniFile.Create(FileName);
128 s := ini.ReadString(ToolBar.Name, 'Button' + IntToStr(i), '');
129 if s = '-' then begin
130 ToolButton := TToolButton.Create(ToolBar);
131 ToolButton.Style := tbsSeparator;
132 ToolButton.Width := 8;
133 ToolButton.Left := 10000;
134 ToolBar.InsertControl(ToolButton);
135 end else if s <> '' then begin
136 Action := GetActionItem(ActionList, s);
137 if Action <> nil then begin
138 ToolButton := TToolButton.Create(ToolBar);
139 ToolButton.Action := Action;
140 ToolButton.Left := 10000;
141 SetButtonStyle(Action, ToolButton);
142 ToolBar.InsertControl(ToolButton);
154 procedure SaveToolBarSetting(ToolBar: TToolBar);
158 Action: TBasicAction;
160 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
163 ini.EraseSection(ToolBar.Name);
164 for i := 0 to ToolBar.ButtonCount - 1 do begin
165 if ToolBar.Buttons[i].Style = tbsSeparator then begin
166 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), '-');
169 Action := ToolBar.Buttons[i].Action;
170 if Action <> nil then
172 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), Action.Name);
183 //ActionName
\82ÌAction
\82ð
\95Ô
\82µ
\82Ü
\82·
184 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
188 for i := 0 to ActionList.ActionCount - 1 do begin
189 if ActionList.Actions[i].Name = ActionName then begin
190 Result := TCustomAction(ActionList.Actions[i]);
197 //
\83c
\81[
\83\8b\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\90Ý
\92è
\82Æ
\83|
\83b
\83v
\83A
\83b
\83v
\90Ý
\92è
198 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
200 if IsCheckStyle(Action) then
201 Button.Style := tbsCheck
202 else if IsDropDownStyle(Action) then
203 Button.Style := tbsDropDown
205 Button.Style := tbsButton;
208 //Action
\82ª
\83`
\83F
\83b
\83N
\83X
\83^
\83C
\83\8b\82Ì
\83A
\83N
\83V
\83\87\83\93\82©
\82Ç
\82¤
\82©
\82ð
\95Ô
\82µ
\82Ü
\82·
209 function IsCheckStyle(Action: TCustomAction): Boolean;
213 for i := 0 to Length(CHECK_STYLE) - 1 do begin
214 if Action.Name = CHECK_STYLE[i] then begin
222 //Action
\82ª
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\83X
\83^
\83C
\83\8b\82Ì
\83A
\83N
\83V
\83\87\83\93\82©
\82Ç
\82¤
\82©
\82ð
\95Ô
\82µ
\82Ü
\82·
223 function IsDropDownStyle(Action: TCustomAction): Boolean;
227 for i := 0 to Length(DROPDOWN_STYLE) - 1 do begin
228 if Action.Name = DROPDOWN_STYLE[i] then begin