Top = 0
Width = 193
Height = 240
+ OnClickCheck = lstRulesClickCheck
Align = alLeft
ItemHeight = 16
- Items.Strings = (
- 'hoge'
- 'nyo')
Style = lbOwnerDrawVariable
TabOrder = 0
OnDrawItem = lstRulesDrawItem
procedure lstRulesDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
procedure Button1Click(Sender: TObject);
+ procedure lstRulesClickCheck(Sender: TObject);
private
{ Private \90é\8c¾ }
public
{ Public \90é\8c¾ }
+ procedure UpdateDisplay;
end;
implementation
var Str: String;
ARect: TRect;
begin
- ARect := Rect(0, 0, lstRules.Width, lstRules.Height);
- Str := lstRules.Items[Index];
+ ARect := lstRules.ItemRect(Index);
+ Str := BottleChainRuleList[Index].StringExpression;
+ //
+ lstRules.Canvas.Font.Style := lstRules.Canvas.Font.Style + [fsBold];
DrawText(lstRules.Canvas.Handle, PChar(Str), -1,
ARect, DT_NOPREFIX or DT_EDITCONTROL or DT_CALCRECT or DT_WORDBREAK);
Height := ARect.Bottom - ARect.Top;
+ //
+ lstRules.Canvas.Font.Style := lstRules.Canvas.Font.Style - [fsBold];
+ Str := BottleChainRuleList[Index].Title;
+ DrawText(lstRules.Canvas.Handle, PChar(Str), -1,
+ ARect, DT_NOPREFIX or DT_EDITCONTROL or DT_CALCRECT or DT_WORDBREAK);
+ Height := Height + ARect.Bottom - ARect.Top;
+ Height := Height + 4;
end;
procedure TfrmBottleChainList.lstRulesDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var Str: String;
+ y: integer;
begin
lstRules.Canvas.FillRect(Rect);
- Str := lstRules.Items[Index];
+
+ // \83e\83L\83X\83g\95`\89æ\97Ì\88æ\82Ì\83}\81[\83W\83\93\82ð\8eæ\82é
+ Rect.Left := Rect.Left + 2;
+ Rect.Top := Rect.Top + 2;
+ Rect.Right := Rect.Right - 2;
+ Rect.Bottom := Rect.Bottom - 2;
+
+ lstRules.Canvas.Font.Style := lstRules.Canvas.Font.Style + [fsBold];
+ Str := BottleChainRuleList[Index].Title;
+ y := DrawText(lstRules.Canvas.Handle, PChar(Str), -1, Rect, DT_NOPREFIX or DT_EDITCONTROL or DT_WORDBREAK);
+ lstRules.Canvas.Font.Style := lstRules.Canvas.Font.Style - [fsBold];
+ Str := BottleChainRuleList[Index].StringExpression;
+ Rect.Top := Rect.Top + y;
DrawText(lstRules.Canvas.Handle, PChar(Str), -1, Rect, DT_NOPREFIX or DT_EDITCONTROL or DT_WORDBREAK);
end;
ShowMessage(ComponentToString(instance));
end;
+procedure TfrmBottleChainList.UpdateDisplay;
+var i: integer;
+begin
+ lstRules.Items.Clear;
+ for i := 0 to BottleChainRuleList.Count-1 do begin
+ lstRules.Items.Add(BottleChainRuleList.Rules[i].StringExpression);
+ lstRules.Checked[i] := BottleChainRuleList[i].Enabled;
+ end;
+end;
+
+procedure TfrmBottleChainList.lstRulesClickCheck(Sender: TObject);
+var i: integer;
+begin
+ for i := 0 to BottleChainRuleList.Count-1 do begin
+ BottleChainRuleList[i].Enabled := lstRules.Checked[i];
+ end;
+end;
+
end.
function GetParentComponent: TComponent; override;
class function Editable: boolean; virtual;
function Edit: boolean; virtual; abstract;
+ function StringExpression: String; virtual; abstract;
property Rule: TBottleChainRule read FRule write SetRule;
end;
FConditions: TObjectList;
FActions: TObjectList;
FRuleList: TBottleChainRuleList;
+ FEnabled: boolean;
+ FTitle: String;
procedure SetActions(const Value: TObjectList);
procedure SetConditions(const Value: TObjectList);
procedure SetRuleList(const Value: TBottleChainRuleList);
+ procedure SetEnabled(const Value: boolean);
+ procedure SetTitle(const Value: String);
protected
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure SetParentComonent(AParent: TComponent);
property Conditions: TObjectList read FConditions write SetConditions;
property Actions: TObjectList read FActions write SetActions;
property RuleList: TBottleChainRuleList read FRuleList write SetRuleList;
+ published
+ property Enabled: boolean read FEnabled write SetEnabled;
+ property Title: String read FTitle write SetTitle;
end;
// \83\8b\81[\83\8b\82Ì\83\8a\83X\83g
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Count: integer read GetCount;
- property Rules[Index: integer]: TBottleChainRule read GetRules;
+ property Rules[Index: integer]: TBottleChainRule read GetRules; default;
end;
{\82±\82±\82©\82ç\8cÂ\95Ê}
TBottleChainChannelCondition
);
+var BottleChainRuleList: TBottleChainRuleList;
+
function ComponentToString(Component: TComponent): string;
function StringToComponent(Value: string): TComponent;
chs := '';
for i := 0 to FChannels.Count-1 do begin
if i > 0 then chs := chs + ' \82© ';
- chs := chs + FChannels[i];
+ chs := Format('%s\81u%s\81v', [chs, FChannels[i]]);
end;
Result := Format('\8eó\90M\83`\83\83\83\93\83l\83\8b\82ª %s \82Ì\82Æ\82«', [chs]);
end;
if i > 0 then Result := Result + '\81A\82³\82ç\82É';
Result := Result + (FConditions[i] as TBottleChainCondition).StringExpression;
end;
+ if FActions.Count = 0 then begin
+ Result := Result + '\89½\82à\82µ\82È\82¢';
+ end else begin
+ for i := 0 to FActions.Count-1 do begin
+ if i > 0 then Result := Result + '\81A\82³\82ç\82É';
+ Result := Result + (FActions[i] as TBottleChainAction).StringExpression;
+ end;
+ end;
+end;
+
+procedure TBottleChainRule.SetEnabled(const Value: boolean);
+begin
+ FEnabled := Value;
+end;
+
+procedure TBottleChainRule.SetTitle(const Value: String);
+begin
+ FTitle := Value;
end;
{ TBottleChainRuleList }
Left = 544
Top = 401
Width = 415
- Height = 312
+ Height = 315
Caption = #12452#12505#12531#12488#35373#23450
Color = clBtnFace
Font.Charset = SHIFTJIS_CHARSET
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 12
- object CheckListBox1: TCheckListBox
- Left = 168
+ object PageControl1: TPageControl
+ Left = 16
Top = 16
- Width = 217
- Height = 161
- ItemHeight = 12
+ Width = 369
+ Height = 177
+ ActivePage = tstGeneral
TabOrder = 0
+ object tstGeneral: TTabSheet
+ Caption = #19968#33324
+ object Label1: TLabel
+ Left = 24
+ Top = 56
+ Width = 87
+ Height = 12
+ Caption = #12523#12540#12523#12398#12479#12452#12488#12523
+ end
+ object cbxRuleEnabled: TCheckBox
+ Left = 24
+ Top = 16
+ Width = 225
+ Height = 17
+ Caption = #12371#12398#12523#12540#12523#12434#26377#21177#12395#12377#12427
+ TabOrder = 0
+ end
+ object Edit1: TEdit
+ Left = 120
+ Top = 56
+ Width = 217
+ Height = 20
+ TabOrder = 1
+ end
+ end
+ object tstCondition: TTabSheet
+ Caption = #26465#20214
+ ImageIndex = 1
+ end
+ object tstAction: TTabSheet
+ Caption = #12450#12463#12471#12519#12531
+ ImageIndex = 2
+ end
+ end
+ object btnClose: TButton
+ Left = 312
+ Top = 256
+ Width = 75
+ Height = 25
+ Caption = #38281#12376#12427'(&C)'
+ Default = True
+ TabOrder = 1
+ end
+ object memStringExpression: TMemo
+ Left = 16
+ Top = 200
+ Width = 369
+ Height = 49
+ Lines.Strings = (
+ 'memStringExpression')
+ ParentColor = True
+ ReadOnly = True
+ TabOrder = 2
end
end
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, CheckLst;
+ Dialogs, StdCtrls, CheckLst, ComCtrls;
type
TfrmBottleChainListEditor = class(TForm)
- CheckListBox1: TCheckListBox;
+ PageControl1: TPageControl;
+ tstGeneral: TTabSheet;
+ tstCondition: TTabSheet;
+ tstAction: TTabSheet;
+ cbxRuleEnabled: TCheckBox;
+ Label1: TLabel;
+ Edit1: TEdit;
+ btnClose: TButton;
+ memStringExpression: TMemo;
private
{ Private \90é\8c¾ }
public