summaryrefslogtreecommitdiff
path: root/packages/fcl-web
diff options
context:
space:
mode:
authorjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-01-15 17:55:08 +0000
committerjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-01-15 17:55:08 +0000
commit2e2cae7f2a1ab3816791da9dc07ae5a1e8af24c7 (patch)
tree689ea3928b7f585111f0cc0766b006d728f280f5 /packages/fcl-web
parent2391066083e08bcb70cf695c9360ff95854bdd9f (diff)
downloadfpc-2e2cae7f2a1ab3816791da9dc07ae5a1e8af24c7.tar.gz
* Implemented IHTMLDesignable
* Fixed moving an element forward, so that it is inserted before the given element git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16768 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-web')
-rw-r--r--packages/fcl-web/src/base/fphtml.pp5
-rw-r--r--packages/fcl-web/src/base/webpage.pp29
2 files changed, 32 insertions, 2 deletions
diff --git a/packages/fcl-web/src/base/fphtml.pp b/packages/fcl-web/src/base/fphtml.pp
index 7f977b2b4b..f2bf67807d 100644
--- a/packages/fcl-web/src/base/fphtml.pp
+++ b/packages/fcl-web/src/base/fphtml.pp
@@ -145,6 +145,8 @@ type
TForeachContentProducerProc = procedure(const AContentProducer: THTMLContentProducer) of object;
+ { IHTMLContentProducerContainer }
+
IHTMLContentProducerContainer = interface
['{8B4D8AE0-4873-49BF-B677-D03C8A02CDA5}']
procedure AddContentProducer(AContentProducer: THTMLContentProducer);
@@ -152,6 +154,8 @@ type
function ExchangeContentProducers(Child1, Child2: THTMLContentProducer) : boolean;
function MoveContentProducer(MoveElement, MoveBeforeElement: THTMLContentProducer) : boolean;
procedure ForeachContentProducer(AForeachChildsProc: TForeachContentProducerProc; Recursive: boolean);
+
+ function ProduceContent : string;
end;
{ THTMLContentProducer }
@@ -739,6 +743,7 @@ begin
ChildIndex2:=GetContentProducerList.IndexOf(MoveBeforeElement);
if (ChildIndex2=-1) then
Exit;
+ if ChildIndex2>ChildIndex1 then dec(ChildIndex2);
GetContentProducerList.Move(ChildIndex1,ChildIndex2);
result := true;
end;
diff --git a/packages/fcl-web/src/base/webpage.pp b/packages/fcl-web/src/base/webpage.pp
index 8938ffdd94..a80a1b0d76 100644
--- a/packages/fcl-web/src/base/webpage.pp
+++ b/packages/fcl-web/src/base/webpage.pp
@@ -14,10 +14,23 @@ type
TAjaxRequestResponseEvent = procedure(Sender: TObject; ARequest: TRequest; AResponse: TAjaxResponse) of object;
type
+
+ { IWebPageDesigner }
+
IWebPageDesigner = interface(IUnknown)
+ ['{25629DEA-79D5-4165-A0A3-BE6E2BA74442}']
procedure Invalidate;
end;
+ { IHTMLDesignable }
+
+ IHTMLDesignable = interface(IUnknown)
+ ['{C75546D6-9C93-49F0-809F-D29C52CD306D}']
+ function GetDesigner: IWebPageDesigner;
+ procedure SetDesigner(const AValue: IWebPageDesigner);
+ property Designer: IWebPageDesigner read GetDesigner write SetDesigner;
+ end;
+
{ TStandardWebController }
TStandardWebController = class(TWebController)
@@ -41,7 +54,7 @@ type
{ TWebPage }
- TWebPage = class(TDataModule, IHTMLContentProducerContainer)
+ TWebPage = class(TDataModule, IHTMLContentProducerContainer, IHTMLDesignable)
private
FAfterAjaxRequest: TAjaxRequestResponseEvent;
FBaseURL: string;
@@ -56,8 +69,10 @@ type
function GetContentProducer(Index: integer): THTMLContentProducer;
function GetContentProducerList: TFPList;
function GetContentProducers(Index: integer): THTMLContentProducer;
+ function GetDesigner: IWebPageDesigner;
function GetHasWebController: boolean;
function GetWebController: TWebController;
+ procedure SetDesigner(const AValue: IWebPageDesigner);
protected
procedure DoAfterAjaxRequest(ARequest: TRequest; AnAjaxResponse: TAjaxResponse); virtual;
procedure DoHandleAjaxRequest(ARequest: TRequest; AnAjaxResponse: TAjaxResponse; var Handled: boolean); virtual;
@@ -82,7 +97,7 @@ type
procedure HandlePage(ARequest: TRequest; AResponse: TResponse; AWriter: THTMLwriter; AWebModule: TFPWebModule = nil); virtual;
procedure DoBeforeGenerateXML; virtual;
procedure CleanupAfterRequest; virtual;
- property Designer: IWebPageDesigner read FDesigner write FDesigner;
+ property Designer: IWebPageDesigner read GetDesigner write SetDesigner;
property Request: TRequest read FRequest;
property ContentProducers[Index: integer]: THTMLContentProducer read GetContentProducer;
property HasWebController: boolean read GetHasWebController;
@@ -259,6 +274,11 @@ begin
Result:=THTMLContentProducer(ContentProducerList[Index]);
end;
+function TWebPage.GetDesigner: IWebPageDesigner;
+begin
+ result := FDesigner;
+end;
+
function TWebPage.GetHasWebController: boolean;
begin
result := assigned(FWebController);
@@ -271,6 +291,11 @@ begin
result := FWebController;
end;
+procedure TWebPage.SetDesigner(const AValue: IWebPageDesigner);
+begin
+ FDesigner := AValue;
+end;
+
function TWebPage.GetContentProducerList: TFPList;
begin
if not assigned(FContentProducers) then