1 | unit umain;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, Forms, Graphics, Dialogs, Menus, StdCtrls, BGRAButton,
|
---|
9 | BGRABitmap, BGRABitmapTypes;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TfrmMain }
|
---|
14 |
|
---|
15 | TfrmMain = class(TForm)
|
---|
16 | btnAllOfThem: TBGRAButton;
|
---|
17 | btnStyle: TBGRAButton;
|
---|
18 | btnImageButton: TBGRAButton;
|
---|
19 | btnAnimation: TBGRAButton;
|
---|
20 | btnMathGame: TBGRAButton;
|
---|
21 | btniOSElements: TBGRAButton;
|
---|
22 | btnNiceButtons: TBGRAButton;
|
---|
23 | btnRibbon: TBGRAButton;
|
---|
24 | btnGoGlassMenu: TBGRAButton;
|
---|
25 | btnFont: TBGRAButton;
|
---|
26 | btnGoFlashPlayerSetup: TBGRAButton;
|
---|
27 | btnGoWin7ToolBar: TBGRAButton;
|
---|
28 | btnMetroUI: TBGRAButton;
|
---|
29 | fntDialog: TFontDialog;
|
---|
30 | ListBox1: TListBox;
|
---|
31 | miWin7ToolBarSmooth: TMenuItem;
|
---|
32 | miRibbonTab: TMenuItem;
|
---|
33 | miRibbonButton: TMenuItem;
|
---|
34 | miRibbonMenu: TMenuItem;
|
---|
35 | miWin7Cristal: TMenuItem;
|
---|
36 | miFlashPlayer: TMenuItem;
|
---|
37 | miWin7ToolBar: TMenuItem;
|
---|
38 | miWin7: TMenuItem;
|
---|
39 | miOffice2010: TMenuItem;
|
---|
40 | miMacOSXLion: TMenuItem;
|
---|
41 | procedure FormCreate(Sender: TObject);
|
---|
42 | procedure FormDestroy(Sender: TObject);
|
---|
43 | procedure FormPaint(Sender: TObject);
|
---|
44 | procedure FormResize(Sender: TObject);
|
---|
45 | procedure ListBox1SelectionChange(Sender: TObject; User: boolean);
|
---|
46 | procedure ShowSampleForm(Sender: TObject);
|
---|
47 | procedure btnFontClick(Sender: TObject);
|
---|
48 | procedure btnStyleClick(Sender: TObject);
|
---|
49 | procedure FormShow(Sender: TObject);
|
---|
50 | private
|
---|
51 | { private declarations }
|
---|
52 | public
|
---|
53 | { public declarations }
|
---|
54 | Bitmap: TBGRABitmap;
|
---|
55 | procedure DrawBackground;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | var
|
---|
59 | frmMain: TfrmMain;
|
---|
60 |
|
---|
61 | implementation
|
---|
62 |
|
---|
63 | {$R *.lfm}
|
---|
64 |
|
---|
65 | uses
|
---|
66 | bgrasamples, uflashplayersetup, uwin7toolbar, uglassmenu,
|
---|
67 | uribbon, umetroui, umathgame, unice, uioselements, ubgraimagebuttontest, uanim,
|
---|
68 | uallofthem;
|
---|
69 |
|
---|
70 | { TfrmMain }
|
---|
71 |
|
---|
72 | procedure TfrmMain.FormShow(Sender: TObject);
|
---|
73 | begin
|
---|
74 | Constraints.MinWidth := Width;
|
---|
75 | Constraints.MinHeight := Height;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TfrmMain.btnStyleClick(Sender: TObject);
|
---|
79 | begin
|
---|
80 | ListBox1.Visible := not ListBox1.Visible;
|
---|
81 | end;
|
---|
82 |
|
---|
83 | procedure TfrmMain.btnFontClick(Sender: TObject);
|
---|
84 | begin
|
---|
85 | fntDialog.Font := btnFont.BodyNormal.Font;
|
---|
86 | if fntDialog.Execute then
|
---|
87 | SetAllBGRAButtonFont(Self, fntDialog.Font);
|
---|
88 | end;
|
---|
89 |
|
---|
90 | procedure TfrmMain.ShowSampleForm(Sender: TObject);
|
---|
91 | begin
|
---|
92 | if Sender = btnGoFlashPlayerSetup then
|
---|
93 | frmFlashPlayerSetup.ShowModal
|
---|
94 | else if Sender = btnGoWin7ToolBar then
|
---|
95 | frmWin7ToolBar.ShowModal
|
---|
96 | else if Sender = btnGoGlassMenu then
|
---|
97 | frmGlassMenu.ShowModal
|
---|
98 | else if Sender = btnRibbon then
|
---|
99 | frmRibbon.ShowModal
|
---|
100 | else if Sender = btnMetroUI then
|
---|
101 | frmMetroUI.ShowModal
|
---|
102 | else if Sender = btnMathGame then
|
---|
103 | frmJuego.ShowModal
|
---|
104 | else if Sender = btnNiceButtons then
|
---|
105 | frmNice.ShowModal
|
---|
106 | else if Sender = btniOSElements then
|
---|
107 | frmiOSElements.ShowModal
|
---|
108 | else if Sender = btnImageButton then
|
---|
109 | frmibtest.ShowModal
|
---|
110 | else if Sender = btnAnimation then
|
---|
111 | frmAnimation.ShowModal
|
---|
112 | else if Sender = btnAllOfThem then
|
---|
113 | frmAllOfThem.ShowModal;
|
---|
114 | //else if Sender = btnBGRAControls then
|
---|
115 | // ShowMessage('http://wiki.lazarus.freepascal.org/BGRAControls');
|
---|
116 | end;
|
---|
117 |
|
---|
118 | procedure TfrmMain.FormCreate(Sender: TObject);
|
---|
119 | var
|
---|
120 | ss: TBGRASampleStyle;
|
---|
121 | begin
|
---|
122 | Bitmap := TBGRABitmap.Create(Width, Height);
|
---|
123 |
|
---|
124 | for ss := low(TBGRASampleStyle) to high(TBGRASampleStyle) do
|
---|
125 | ListBox1.Items.Add(TBGRASampleStyleStr[ss]);
|
---|
126 | end;
|
---|
127 |
|
---|
128 | procedure TfrmMain.FormDestroy(Sender: TObject);
|
---|
129 | begin
|
---|
130 | Bitmap.Free;
|
---|
131 | end;
|
---|
132 |
|
---|
133 | procedure TfrmMain.FormPaint(Sender: TObject);
|
---|
134 | begin
|
---|
135 | Bitmap.Draw(Canvas, ClientRect, False);
|
---|
136 | end;
|
---|
137 |
|
---|
138 | procedure TfrmMain.FormResize(Sender: TObject);
|
---|
139 | begin
|
---|
140 | DrawBackground;
|
---|
141 | end;
|
---|
142 |
|
---|
143 | procedure TfrmMain.ListBox1SelectionChange(Sender: TObject; User: boolean);
|
---|
144 | begin
|
---|
145 | StyleButtonsSample(Self, StrToTBGRASampleStyle(ListBox1.GetSelectedText));
|
---|
146 | DrawBackground;
|
---|
147 | end;
|
---|
148 |
|
---|
149 | procedure TfrmMain.DrawBackground;
|
---|
150 | begin
|
---|
151 | Bitmap.SetSize(Width, Height);
|
---|
152 |
|
---|
153 | case StrToTBGRASampleStyle(ListBox1.GetSelectedText) of
|
---|
154 | ssWin7ToolBar: DrawWin7ToolBar(Bitmap, Align);
|
---|
155 | ssWin7ToolBarSmooth: DrawWin7ToolBar(Bitmap, Align, True);
|
---|
156 | ssFlashPlayer: DrawFlashPlayerButtonPanel(Bitmap);
|
---|
157 | ssiOSBar: DrawiOSBar(Bitmap);
|
---|
158 | ssiOSToolBar: DrawiOSToolBar(Bitmap, False);
|
---|
159 | ssiOSBackground: DrawiOSBackground(Bitmap);
|
---|
160 | ssBlack: Bitmap.Fill(BGRA(23, 23, 23, 255));
|
---|
161 | ssSilverSquared, ssGreen, ssBlue: Bitmap.Fill(BGRA(223, 226, 230, 255));
|
---|
162 | ssSilver: DrawSilverToolBar(Bitmap);
|
---|
163 | else
|
---|
164 | Bitmap.Fill(clWhite);
|
---|
165 | end;
|
---|
166 |
|
---|
167 | Invalidate;
|
---|
168 | end;
|
---|
169 |
|
---|
170 | end.
|
---|
171 |
|
---|