From fe5574b9e94d00dbe1fbbd3561b25fe3ff4815e0 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 6 Aug 2009 08:44:12 +0000 Subject: [PATCH] Added: support for "for...in" enumerators --- Packages/D7/X2CLGL.dproj | 100 ++++++++++++++++++++++++++++++++++++ Packages/D7/X2CLGLD.dproj | 104 ++++++++++++++++++++++++++++++++++++++ Packages/D7/X2CLMB.dproj | 95 ++++++++++++++++++++++++++++++++++ Packages/D7/X2CLMBD.dproj | 95 ++++++++++++++++++++++++++++++++++ Source/X2CLMenuBar.pas | 79 ++++++++++++++++++++++++++++- X2CL.groupproj | 64 +++++++++++++++++++++++ 6 files changed, 535 insertions(+), 2 deletions(-) create mode 100644 Packages/D7/X2CLGL.dproj create mode 100644 Packages/D7/X2CLGLD.dproj create mode 100644 Packages/D7/X2CLMB.dproj create mode 100644 Packages/D7/X2CLMBD.dproj create mode 100644 X2CL.groupproj diff --git a/Packages/D7/X2CLGL.dproj b/Packages/D7/X2CLGL.dproj new file mode 100644 index 0000000..8119a00 --- /dev/null +++ b/Packages/D7/X2CLGL.dproj @@ -0,0 +1,100 @@ + + + {a9bc9ffc-0787-41fb-9118-a3ef4766b6fc} + X2CLGL.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\bin\D2007\X2CLGL.bpl + + + 7.0 + False + True + False + True + 0 + 3 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHIBIN) + RELEASE + True + True + True + + + 7.0 + True + True + 3 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHIBIN) + True + True + True + + + Delphi.Personality + Package + + + ip-to-country.csv countries.csv geo.db + False + True + False + + + X²CL GraphicList + True + False + True + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + X2CLGL.dpk + + + + + + + MainSource + + + + + + + \ No newline at end of file diff --git a/Packages/D7/X2CLGLD.dproj b/Packages/D7/X2CLGLD.dproj new file mode 100644 index 0000000..1ed9f59 --- /dev/null +++ b/Packages/D7/X2CLGLD.dproj @@ -0,0 +1,104 @@ + + + {97ec2b0b-f415-40d5-ae50-d6331b95a0a3} + X2CLGLD.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\bin\D2007\X2CLGLD.bpl + + + 7.0 + False + True + False + True + 0 + 3 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHIBIN) + RELEASE + True + True + True + + + 7.0 + True + True + 3 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHIBIN) + True + True + True + + + Delphi.Personality + Package + + + False + True + False + + + X²CL GraphicList (Designtime) + True + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + X2CLGLD.dpk + + + + + + + MainSource + + + + +
GraphicsEditorForm
+
+ + + +
+ +
\ No newline at end of file diff --git a/Packages/D7/X2CLMB.dproj b/Packages/D7/X2CLMB.dproj new file mode 100644 index 0000000..527ca86 --- /dev/null +++ b/Packages/D7/X2CLMB.dproj @@ -0,0 +1,95 @@ + + + {6c6302d6-b6c5-4139-a95d-f401031a295b} + X2CLMB.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\bin\D2007\X2CLMB.bpl + + + 7.0 + False + False + 0 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHILIB) + RELEASE + + + 7.0 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHILIB) + + + Delphi.Personality + Package + + + False + True + False + + + X²CL MenuBar + False + False + True + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + X2CLMB.dpk + + + + + + + MainSource + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Packages/D7/X2CLMBD.dproj b/Packages/D7/X2CLMBD.dproj new file mode 100644 index 0000000..438f59e --- /dev/null +++ b/Packages/D7/X2CLMBD.dproj @@ -0,0 +1,95 @@ + + + {3c83cecf-b9d9-484e-93ce-d9c34cdc7b05} + X2CLMBD.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\bin\D2007\X2CLMBD.bpl + + + 7.0 + False + False + 0 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHILIB) + RELEASE + + + 7.0 + $(DELPHILIB) + $(DELPHILIB) + $(DELPHILIB) + $(DELPHIBIN) + $(DELPHILIB) + + + Delphi.Personality + Package + + + False + True + False + + + X²CL MenuBar (Designtime) + False + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + X2CLMBD.dpk + + + + + + + MainSource + + + + +
frmMenuBarEditor
+
+ + + + + + +
+ +
\ No newline at end of file diff --git a/Source/X2CLMenuBar.pas b/Source/X2CLMenuBar.pas index e35ba16..2779457 100644 --- a/Source/X2CLMenuBar.pas +++ b/Source/X2CLMenuBar.pas @@ -11,6 +11,12 @@ } unit X2CLMenuBar; + +{$IFDEF VER180} + {$DEFINE D2006} +{$ENDIF} + + interface uses ActnList, @@ -53,6 +59,10 @@ type TX2CustomMenuBar = class; + TX2MenuBarItemsEnumerator = class; + TX2MenuBarGroupsEnumerator = class; + + IX2MenuBarDesigner = interface ['{F648CFD2-771D-4531-84D0-621FD7597E48}'] procedure ItemAdded(AItem: TX2CustomMenuBarItem); @@ -290,7 +300,6 @@ type TX2ComponentNotification = class(TComponent) private FOnNotification: TX2ComponentNotificationEvent; - published protected procedure Notification(AComponent: TComponent; Operation: TOperation); override; published @@ -388,6 +397,8 @@ type public constructor Create(AOwner: TPersistent); + function GetEnumerator: TX2MenuBarItemsEnumerator; + function Add(const ACaption: TCaption = ''): TX2MenuBarItem; property Items[Index: Integer]: TX2MenuBarItem read GetItem write SetItem; default; @@ -417,6 +428,8 @@ type constructor Create(Collection: TCollection); override; destructor Destroy; override; + function GetEnumerator: TX2MenuBarItemsEnumerator; + procedure Assign(Source: TPersistent); override; property SelectedItem: Integer read GetSelectedItem write FSelectedItem; @@ -436,6 +449,8 @@ type public constructor Create(AOwner: TPersistent); + function GetEnumerator: TX2MenuBarGroupsEnumerator; + function Add(const ACaption: TCaption = ''): TX2MenuBarGroup; property Items[Index: Integer]: TX2MenuBarGroup read GetItem write SetItem; default; @@ -594,6 +609,8 @@ type constructor Create(AOwner: TComponent); override; destructor Destroy; override; + function GetEnumerator: TX2MenuBarGroupsEnumerator; + function HitTest(const APoint: TPoint): TX2MenuBarHitTest; overload; function HitTest(AX, AY: Integer): TX2MenuBarHitTest; overload; @@ -659,7 +676,7 @@ type property OnExpanding; property OnSelectedChanged; property OnSelectedChanging; - {$IFDEF VER180} + {$IFDEF D2006} property OnMouseActivate; property OnMouseEnter; property OnMouseLeave; @@ -673,6 +690,26 @@ type end; + { + :$ For iterators support for D2006+ + } + TX2MenuBarItemsEnumerator = class(TCollectionEnumerator) + private + function GetCurrent: TX2MenuBarItem; + public + property Current: TX2MenuBarItem read GetCurrent; + end; + + + TX2MenuBarGroupsEnumerator = class(TCollectionEnumerator) + private + function GetCurrent: TX2MenuBarGroup; + public + property Current: TX2MenuBarGroup read GetCurrent; + end; + + + const { HitTest Codes } htUnknown = 0; @@ -1331,6 +1368,12 @@ begin end; +function TX2MenuBarItems.GetEnumerator: TX2MenuBarItemsEnumerator; +begin + Result := TX2MenuBarItemsEnumerator.Create(Self); +end; + + function TX2MenuBarItems.Add(const ACaption: TCaption): TX2MenuBarItem; begin Result := TX2MenuBarItem(inherited Add); @@ -1377,6 +1420,12 @@ begin end; +function TX2MenuBarGroup.GetEnumerator: TX2MenuBarItemsEnumerator; +begin + Result := TX2MenuBarItemsEnumerator.Create(Items); +end; + + procedure TX2MenuBarGroup.Assign(Source: TPersistent); begin if Source is TX2MenuBarGroup then @@ -1479,6 +1528,12 @@ begin end; +function TX2MenuBarGroups.GetEnumerator: TX2MenuBarGroupsEnumerator; +begin + Result := TX2MenuBarGroupsEnumerator.Create(Self); +end; + + function TX2MenuBarGroups.Add(const ACaption: TCaption): TX2MenuBarGroup; begin Result := TX2MenuBarGroup(inherited Add); @@ -1568,6 +1623,12 @@ begin end; +function TX2CustomMenuBar.GetEnumerator: TX2MenuBarGroupsEnumerator; +begin + Result := TX2MenuBarGroupsEnumerator.Create(Groups); +end; + + procedure TX2CustomMenuBar.WMEraseBkgnd(var Msg: TWMEraseBkgnd); begin Msg.Result := 0; @@ -3203,4 +3264,18 @@ end; //// MessageBox(0, 'I gots a mousewheel', '', 0); //end; + +{ TX2MenuBarItemsEnumerator } +function TX2MenuBarItemsEnumerator.GetCurrent: TX2MenuBarItem; +begin + Result := TX2MenuBarItem(inherited GetCurrent); +end; + + +{ TX2MenuBarGroupsEnumerator } +function TX2MenuBarGroupsEnumerator.GetCurrent: TX2MenuBarGroup; +begin + Result := TX2MenuBarGroup(inherited GetCurrent); +end; + end. diff --git a/X2CL.groupproj b/X2CL.groupproj new file mode 100644 index 0000000..a260a85 --- /dev/null +++ b/X2CL.groupproj @@ -0,0 +1,64 @@ + + + {3a4e1d27-aacb-4d4d-8812-c03e8125faf1} + + + + + + + + + + Default.Personality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file