source: GraphicTest/Packages/bgracontrols/testbgracontrols/umain.pas

Last change on this file was 452, checked in by chronos, 12 years ago
  • Updated BGRABitmap package.
File size: 4.3 KB
Line 
1unit umain;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, Forms, Graphics, Dialogs, Menus, StdCtrls, BGRAButton,
9 BGRABitmap, BGRABitmapTypes;
10
11type
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
58var
59 frmMain: TfrmMain;
60
61implementation
62
63{$R *.lfm}
64
65uses
66 bgrasamples, uflashplayersetup, uwin7toolbar, uglassmenu,
67 uribbon, umetroui, umathgame, unice, uioselements, ubgraimagebuttontest, uanim,
68 uallofthem;
69
70{ TfrmMain }
71
72procedure TfrmMain.FormShow(Sender: TObject);
73begin
74 Constraints.MinWidth := Width;
75 Constraints.MinHeight := Height;
76end;
77
78procedure TfrmMain.btnStyleClick(Sender: TObject);
79begin
80 ListBox1.Visible := not ListBox1.Visible;
81end;
82
83procedure TfrmMain.btnFontClick(Sender: TObject);
84begin
85 fntDialog.Font := btnFont.BodyNormal.Font;
86 if fntDialog.Execute then
87 SetAllBGRAButtonFont(Self, fntDialog.Font);
88end;
89
90procedure TfrmMain.ShowSampleForm(Sender: TObject);
91begin
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');
116end;
117
118procedure TfrmMain.FormCreate(Sender: TObject);
119var
120 ss: TBGRASampleStyle;
121begin
122 Bitmap := TBGRABitmap.Create(Width, Height);
123
124 for ss := low(TBGRASampleStyle) to high(TBGRASampleStyle) do
125 ListBox1.Items.Add(TBGRASampleStyleStr[ss]);
126end;
127
128procedure TfrmMain.FormDestroy(Sender: TObject);
129begin
130 Bitmap.Free;
131end;
132
133procedure TfrmMain.FormPaint(Sender: TObject);
134begin
135 Bitmap.Draw(Canvas, ClientRect, False);
136end;
137
138procedure TfrmMain.FormResize(Sender: TObject);
139begin
140 DrawBackground;
141end;
142
143procedure TfrmMain.ListBox1SelectionChange(Sender: TObject; User: boolean);
144begin
145 StyleButtonsSample(Self, StrToTBGRASampleStyle(ListBox1.GetSelectedText));
146 DrawBackground;
147end;
148
149procedure TfrmMain.DrawBackground;
150begin
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;
168end;
169
170end.
171
Note: See TracBrowser for help on using the repository browser.