1 { Lazarus IDE wizard for fpweb package.
2 
3   Copyright (C) 2010 Lagunov Aleksey alexs75@hotbox.ru
4 
5   This library is free software; you can redistribute it and/or modify it
6   under the terms of the GNU Library General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or (at your
8   option) any later version with the following modification:
9 
10   As a special exception, the copyright holders of this library give you
11   permission to link this library with independent modules to produce an
12   executable, regardless of the license terms of these independent modules,and
13   to copy and distribute the resulting executable under terms of your choice,
14   provided that you also meet, for each linked independent module, the terms
15   and conditions of the license of that module. An independent module is a
16   module which is not derived from or based on this library. If you modify
17   this library, you may extend this exception to your version of the library,
18   but you are not obligated to do so. If you do not wish to do so, delete this
19   exception statement from your version.
20 
21   This program is distributed in the hope that it will be useful, but WITHOUT
22   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
24   for more details.
25 
26   You should have received a copy of the GNU Library General Public License
27   along with this library; if not, write to the Free Software Foundation,
28   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
29 }
30 unit fpwebNewHtmlTagTDUnit;
31 
32 {$mode objfpc}{$H+}
33 
34 interface
35 
36 uses
37   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
38   StdCtrls, ColorBox, ButtonPanel, Spin;
39 
40 type
41 
42   { TfpwebNewHtmlTagTDForm }
43 
44   TfpwebNewHtmlTagTDForm = class(TForm)
45     ButtonPanel1: TButtonPanel;
46     CBAlign: TComboBox;
47     CBClass: TComboBox;
48     CBColor: TColorBox;
49     CBId: TComboBox;
50     CBValign: TComboBox;
51     CheckBox1: TCheckBox;
52     edtText: TEdit;
53     Label1: TLabel;
54     Label10: TLabel;
55     Label2: TLabel;
56     Label3: TLabel;
57     Label4: TLabel;
58     Label5: TLabel;
59     Label6: TLabel;
60     Label7: TLabel;
61     Label8: TLabel;
62     Label9: TLabel;
63     PageControl1: TPageControl;
64     edtWidth: TSpinEdit;
65     edtCollSpan: TSpinEdit;
66     edtHeight: TSpinEdit;
67     edtRowSpan: TSpinEdit;
68     TabSheet1: TTabSheet;
69     TabSheet2: TTabSheet;
70     TabSheet3: TTabSheet;
71     procedure FormCreate(Sender: TObject);
72   private
73     { private declarations }
74   public
HtmlTextnull75     function HtmlText:string;
76   end;
77 
78 var
79   fpwebNewHtmlTagTDForm: TfpwebNewHtmlTagTDForm;
80 
81 implementation
82 uses fpWebStrConsts;
83 
84 {$R *.lfm}
85 
86 { TfpwebNewHtmlTagTDForm }
87 
88 procedure TfpwebNewHtmlTagTDForm.FormCreate(Sender: TObject);
89 begin
90   Caption:=Format(SHTMLTagProperty, ['TD']);
91 end;
92 
TfpwebNewHtmlTagTDForm.HtmlTextnull93 function TfpwebNewHtmlTagTDForm.HtmlText: string;
94 begin
95   Result:='<TD';
96   if edtWidth.Value > 0 then
97     Result:=Result + Format(' width="%d"', [edtWidth.Value]);
98 
99   if edtCollSpan.Value > 0 then
100     Result:=Result + Format(' colspan="%d"', [edtCollSpan.Value]);
101 
102   if edtHeight.Value > 0 then
103     Result:=Result + Format(' height="%d"', [edtHeight.Value]);
104 
105   if edtRowSpan.Value > 0 then
106     Result:=Result + Format(' rowspan="%d"', [edtRowSpan.Value]);
107 
108   if CBAlign.Text<>'' then
109     Result:=Result + ' align="'+CBAlign.Text+'"';
110 
111   if CBValign.Text<>'' then
112     Result:=Result + ' valign="'+CBValign.Text+'"';
113 
114   if CBColor.Selected <> CBColor.NoneColorColor then
115     Result:=Result + ' bgcolor="#'+IntToHex(CBColor.Selected,6)+'"';
116 
117   if CheckBox1.Checked then
118     Result:=Result + ' nowrap';
119   Result:=Result + '>'+edtText.Text+'</TD>';
120 end;
121 
122 end.
123 
124