1 | unit uglassmenu;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Forms, Dialogs, BGRAVirtualScreen, BGRAButton, BGRAKnob, BGRABitmap;
|
---|
9 |
|
---|
10 | type
|
---|
11 |
|
---|
12 | { TfrmGlassMenu }
|
---|
13 |
|
---|
14 | TfrmGlassMenu = class(TForm)
|
---|
15 | btnShowBkg: TBGRAButton;
|
---|
16 | knbButtonOpacity: TBGRAKnob;
|
---|
17 | btnTextOpacity: TBGRAButton;
|
---|
18 | btnBackground: TBGRAButton;
|
---|
19 | dlgOpenBackground: TOpenDialog;
|
---|
20 | vsBackground: TBGRAVirtualScreen;
|
---|
21 | procedure btnShowBkgClick(Sender: TObject);
|
---|
22 | procedure knbButtonOpacityValueChanged(Sender: TObject; Value: single);
|
---|
23 | procedure btnBackgroundClick(Sender: TObject);
|
---|
24 | procedure btnTextOpacityClick(Sender: TObject);
|
---|
25 | procedure FormCreate(Sender: TObject);
|
---|
26 | procedure FormDestroy(Sender: TObject);
|
---|
27 | procedure vsBackgroundRedraw(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
28 | private
|
---|
29 | { private declarations }
|
---|
30 | theBackground: TBGRABitmap;
|
---|
31 | theBlur: integer;
|
---|
32 | theNiceOption: boolean;
|
---|
33 | public
|
---|
34 | { public declarations }
|
---|
35 | end;
|
---|
36 |
|
---|
37 | var
|
---|
38 | frmGlassMenu: TfrmGlassMenu;
|
---|
39 |
|
---|
40 | implementation
|
---|
41 |
|
---|
42 | {$R *.lfm}
|
---|
43 |
|
---|
44 | uses
|
---|
45 | bgrasamples;
|
---|
46 |
|
---|
47 | { TfrmGlassMenu }
|
---|
48 |
|
---|
49 | procedure TfrmGlassMenu.btnBackgroundClick(Sender: TObject);
|
---|
50 | begin
|
---|
51 | if dlgOpenBackground.Execute then
|
---|
52 | begin
|
---|
53 | theBackground.LoadFromFile(dlgOpenBackground.FileName);
|
---|
54 | vsBackground.RedrawBitmap;
|
---|
55 | end;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TfrmGlassMenu.knbButtonOpacityValueChanged(Sender: TObject; Value: single);
|
---|
59 | begin
|
---|
60 | btnBackground.GlobalOpacity := trunc(Value - knbButtonOpacity.MinValue);
|
---|
61 | end;
|
---|
62 |
|
---|
63 | procedure TfrmGlassMenu.btnShowBkgClick(Sender: TObject);
|
---|
64 | begin
|
---|
65 | theNiceOption := not theNiceOption;
|
---|
66 | vsBackground.RedrawBitmap;
|
---|
67 | end;
|
---|
68 |
|
---|
69 | procedure TfrmGlassMenu.btnTextOpacityClick(Sender: TObject);
|
---|
70 | begin
|
---|
71 | btnBackground.TextApplyGlobalOpacity := not btnBackground.TextApplyGlobalOpacity;
|
---|
72 | end;
|
---|
73 |
|
---|
74 | procedure TfrmGlassMenu.FormCreate(Sender: TObject);
|
---|
75 | begin
|
---|
76 | theBlur := 10;
|
---|
77 | theBackground := TBGRABitmap.Create(Self.Width, Self.Height);
|
---|
78 | theNiceOption := True;
|
---|
79 |
|
---|
80 | StyleButtonsSample(Self, ssMacOSXLion);
|
---|
81 |
|
---|
82 | with btnBackground do
|
---|
83 | begin
|
---|
84 | GlobalOpacity := 100;
|
---|
85 | with BodyNormal do
|
---|
86 | begin
|
---|
87 | BorderColorOpacity := 200;
|
---|
88 | Gradient2.StartColorOpacity := 50;
|
---|
89 | end;
|
---|
90 | with BodyHover do
|
---|
91 | begin
|
---|
92 | BorderColorOpacity := 250;
|
---|
93 | Gradient1.StartColorOpacity := 100;
|
---|
94 | Gradient2.EndColorOpacity := 100;
|
---|
95 | end;
|
---|
96 | with BodyClicked do
|
---|
97 | begin
|
---|
98 | BorderColorOpacity := 100;
|
---|
99 | Gradient1.EndColorOpacity := 100;
|
---|
100 | Gradient2.StartColorOpacity := 100;
|
---|
101 | end;
|
---|
102 | end;
|
---|
103 | end;
|
---|
104 |
|
---|
105 | procedure TfrmGlassMenu.FormDestroy(Sender: TObject);
|
---|
106 | begin
|
---|
107 | theBackground.Free;
|
---|
108 | end;
|
---|
109 |
|
---|
110 | procedure TfrmGlassMenu.vsBackgroundRedraw(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
111 | begin
|
---|
112 | Glass(vsBackground, theBackground, theBlur, theNiceOption);
|
---|
113 | end;
|
---|
114 |
|
---|
115 | end.
|
---|