1 | { See NOTICE.txt for the Android buttons. }
|
---|
2 |
|
---|
3 | unit ubgraimagebuttontest;
|
---|
4 |
|
---|
5 | {$mode objfpc}{$H+}
|
---|
6 |
|
---|
7 | interface
|
---|
8 |
|
---|
9 | uses
|
---|
10 | Forms, Controls, BGRAImageButton, BGRABitmap,
|
---|
11 | BGRABitmapTypes, Dialogs;
|
---|
12 |
|
---|
13 | type
|
---|
14 |
|
---|
15 | { TfrmMain }
|
---|
16 |
|
---|
17 | Tfrmibtest = class(TForm)
|
---|
18 | android_14_dark: TBGRAImageButton;
|
---|
19 | android_14_normal: TBGRAImageButton;
|
---|
20 | android_dark: TBGRAImageButton;
|
---|
21 | android_normal: TBGRAImageButton;
|
---|
22 | sample_1: TBGRAImageButton;
|
---|
23 | sample_2: TBGRAImageButton;
|
---|
24 | sample_3: TBGRAImageButton;
|
---|
25 | sample_4: TBGRAImageButton;
|
---|
26 | sample_5: TBGRAImageButton;
|
---|
27 | sample_6: TBGRAImageButton;
|
---|
28 | sample_7: TBGRAImageButton;
|
---|
29 | procedure FormCreate(Sender: TObject);
|
---|
30 | procedure sample_2Click(Sender: TObject);
|
---|
31 | private
|
---|
32 | { private declarations }
|
---|
33 | public
|
---|
34 | { public declarations }
|
---|
35 | end;
|
---|
36 |
|
---|
37 | var
|
---|
38 | frmibtest: Tfrmibtest;
|
---|
39 |
|
---|
40 | implementation
|
---|
41 |
|
---|
42 | uses
|
---|
43 | BGRASamples;
|
---|
44 |
|
---|
45 | {$R *.lfm}
|
---|
46 |
|
---|
47 | { TfrmMain }
|
---|
48 |
|
---|
49 | procedure Tfrmibtest.FormCreate(Sender: TObject);
|
---|
50 | var
|
---|
51 | i: integer;
|
---|
52 | begin
|
---|
53 | {$IFDEF WINDOWS}
|
---|
54 | DoubleBuffered := True;
|
---|
55 | {$ENDIF}
|
---|
56 |
|
---|
57 | { Load all the button images from file according to name}
|
---|
58 | for i := 0 to Self.ControlCount - 1 do
|
---|
59 | if Self.Controls[i] is TBGRAImageButton then
|
---|
60 | TBGRAImageButton(Self.Controls[i]).BitmapLoadFromFile(TBGRAImageButton(Self.Controls[i]).Name + '.png');
|
---|
61 |
|
---|
62 | { BGRASamples DrawFacebookImageButton }
|
---|
63 | DrawFacebookImageButton(sample_6);
|
---|
64 | end;
|
---|
65 |
|
---|
66 | procedure Tfrmibtest.sample_2Click(Sender: TObject);
|
---|
67 | var
|
---|
68 | i: integer;
|
---|
69 | begin
|
---|
70 | { Switch Enable in all controls in the form }
|
---|
71 | for i := 0 to Self.ControlCount - 1 do
|
---|
72 | Self.Controls[i].Enabled := not Self.Controls[i].Enabled;
|
---|
73 |
|
---|
74 | { Enable this button }
|
---|
75 | TControl(Sender).Enabled := True;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | end.
|
---|
79 |
|
---|