diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-30 16:26:14 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-30 16:26:14 +0200 |
commit | 55f853725f65051c9e9e30e6ae4f3d64d2a81ad1 (patch) | |
tree | 7aa11283cd9806992fd38538d4287d493c22d7ab /examples | |
parent | e4847853af1009bc0380cd7cd1e539e6b495cc20 (diff) | |
download | fpGUI-55f853725f65051c9e9e30e6ae4f3d64d2a81ad1.tar.xz |
A simple example of customized MenuBar theme.
Now the menu bar has a gradient look to it.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gui/customstyles/mystyle.pas | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/examples/gui/customstyles/mystyle.pas b/examples/gui/customstyles/mystyle.pas index 5f95506c..afeef61b 100644 --- a/examples/gui/customstyles/mystyle.pas +++ b/examples/gui/customstyles/mystyle.pas @@ -46,9 +46,10 @@ type TMyStyle = class(TfpgStyle) public constructor Create; override; - procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); override; - procedure DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); override; + procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); override; + procedure DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); override; procedure DrawMenuRow(ACanvas: TfpgCanvas; r: TfpgRect; AFlags: TfpgMenuItemFlags); override; + procedure DrawMenuBar(ACanvas: TfpgCanvas; r: TfpgRect; ABackgroundColor: TfpgColor); override; end; @@ -124,5 +125,23 @@ begin ACanvas.GradientFill(r, TfpgColor($fec475), TfpgColor($fb9d24), gdVertical); end; +procedure TMyStyle.DrawMenuBar(ACanvas: TfpgCanvas; r: TfpgRect; ABackgroundColor: TfpgColor); +var + FLightColor: TfpgColor; + FDarkColor: TfpgColor; +begin + // a possible future theme option + FLightColor := TfpgColor($f0ece3); // color at top of menu bar + FDarkColor := TfpgColor($beb8a4); // color at bottom of menu bar + ACanvas.GradientFill(r, FLightColor, FDarkColor, gdVertical); + + // inner bottom line + ACanvas.SetColor(clShadow1); + ACanvas.DrawLine(r.Left, r.Bottom-1, r.Right+1, r.Bottom-1); // bottom + // outer bottom line + ACanvas.SetColor(clWhite); + ACanvas.DrawLine(r.Left, r.Bottom, r.Right+1, r.Bottom); // bottom +end; + end. |