summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-05-16 20:35:45 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-05-16 20:35:45 +0000
commit083983770abc495933a876ba41465bf0b2bd5a91 (patch)
treeb0035062a3a610b260854e8c1d6f5fbdda4a3f21 /gui
parent72151f3a19a26a27539d2361f832433fcbd7ae26 (diff)
downloadfpGUI-083983770abc495933a876ba41465bf0b2bd5a91.tar.xz
* Implemented two new Windows styles. The Win9x look and the Win2000 look. The later has more flat buttons.
* Modified the OpenSoft style to use the buttons of Win2000. * The default style, auto, now uses the Windows 2000 style.
Diffstat (limited to 'gui')
-rw-r--r--gui/opensoftstyle.pas606
-rw-r--r--gui/stylemanager.pas5
-rw-r--r--gui/windowsstyle.pas72
3 files changed, 402 insertions, 281 deletions
diff --git a/gui/opensoftstyle.pas b/gui/opensoftstyle.pas
index 1e17b84d..cb23cc43 100644
--- a/gui/opensoftstyle.pas
+++ b/gui/opensoftstyle.pas
@@ -1,279 +1,327 @@
-{
- fpGUI - Free Pascal GUI Library
-
- OpenSoft look-and-feel style implementation
-
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
- distribution, for details of the copyright.
-
- See the file COPYING.modifiedLGPL, included in this distribution,
- for details about redistributing fpGUI.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-}
-
-unit OpenSoftStyle;
-
-{$mode objfpc}{$H+}
-
-interface
-uses
- Classes
- ,fpGUI
- ,gfxBase
- ,fpGFX
- ;
-
-type
-
- TGradientDirection = (gdTopToBottom, gdBottomToTop, gdLeftToRight, gdRightToLeft);
- TCalcGradientEndX = function(Y, H: Integer): Integer;
-
-
- TOpenSoftStyle = class(TBasicStyle)
- private
- procedure PaintGradient(pCanvas: TFCanvas; const R: TRect; StartColor, EndColor: TColor; Direction: TGradientDirection; GradLines: Integer = -1);
- public
- // Colors
- function GetGUIColor(Color: TColor): TGfxColor; override;
- // Buttons (todo)
-// procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TFButtonFlags); override;
- // GroupBox
- procedure DrawGroupBox(Canvas: TFCanvas; const ARect: TRect; const ALabel: String; WidgetState: TFWidgetState); override;
- end;
-
-
-implementation
-
-const
- // Some predefined colors:
- rgbaDkBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000);
- rgbaLtYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $e100; Alpha: $0000);
-
- rgbaWindowText: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000);
- rgbaWindow: TGfxColor = (Red: $efef; Green: $efef; Blue: $efef; Alpha: $0000);
- rgbaDkGrey: TGfxColor = (Red: $8686; Green: $8686; Blue: $8686; Alpha: $0000);
- rgbaGbAALtGrey: TGfxColor = (Red: $baba; Green: $baba; Blue: $baba; Alpha: $0000);
- rgbaGbAADkGrey: TGfxColor = (Red: $7878; Green: $7878; Blue: $7878; Alpha: $0000);
-
-
-{
-procedure DrawGradient(Canvas: TCanvas; const R: TRect; StartColor, EndColor: TColor;
- Direction: TGradientDirection; GradLines: Integer = -1; CalcEndX: TCalcGradientEndX = nil);
-procedure DrawGradientEx(Canvas: TCanvas; const R: TRect; StartColor: TColor;
- StartToMidHeight: Integer; MidColor, EndColor: TColor;
- Direction: TGradientDirection; CalcEndX: TCalcGradientEndX = nil);
-
-
-procedure ToRGB(c: TColor; out rgb: TRGB);
-var
- l: TColorRef;
-begin
- c := ColorFromColormap(c);
- l := ColorToRGB(c);
- rgb.r := TRGBValue(l).r;
- rgb.g := TRGBValue(l).g;
- rgb.b := TRGBValue(l).b;
-end;
-}
-
-{ TOpenSoftStyle }
-
-procedure TOpenSoftStyle.PaintGradient(pCanvas: TFCanvas; const R: TRect;
- StartColor, EndColor: TColor; Direction: TGradientDirection;
- GradLines: Integer = -1);
-var
- X: integer;
- i: integer;
- w: integer;
- h: integer;
- Count: integer;
- EndCol: TGfxColor;
- StartCol: TGfxColor;
- AddCol: TGfxColor;
- Tmp: TGfxColor;
-begin
-(*
- w := R.Right - R.Left - 1;
- h := R.Bottom - R.Top - 1;
- if (w <= 0) or (h <= 0) then
- Exit; //==>
-
- StartCol := GetGUIColor(StartColor);
- EndCol := GetGUIColor(EndColor);
-
- case Direction of
- gdTopToBottom:
- Count := h;
- gdLeftToRight:
- Count := w;
- gdBottomToTop:
- begin
- Count := h;
- Tmp := EndCol;
- EndCol := StartCol;
- StartCol := Tmp;
- end;
- gdRightToLeft:
- begin
- Count := w;
- Tmp := EndCol;
- EndCol := StartCol;
- StartCol := Tmp;
- end;
- else
- Exit; //==>
- end;
- if GradLines < 0 then
- GradLines := Count;
-
- AddCol.Red := (EndCol.Red - StartCol.Red) div GradLines;
- AddCol.Green := (EndCol.Green - StartCol.Green) div GradLines;
- AddCol.Blue := (EndCol.Blue - StartCol.Blue) div GradLines;
-
-// Canvas.Pen.Style := psSolid;
- pCanvas.SaveState;
-// Canvas.Start;
- try
-// StartColor := TColor(Round(StartCol.Red), Round(StartCol.Green), Round(StartCol.Blue));
-// Canvas.Pen.Color := StartColor;
- pCanvas.SetColor(GetGUIColor(StartColor));
- for i := 0 to Count - 1 do
- begin
- if Direction in [gdTopToBottom, gdBottomToTop] then
- begin
-// pCanvas.MoveTo(R.Left, R.Top + i);
-// if Assigned(CalcEndX) then
-// X := CalcEndX(i, Count)
-// else
- X := 0;
-// pCanvas.LineTo(R.Right + X, R.Top + i);
- pCanvas.DrawLine(Point(R.Left, R.Top + i), Point(R.Right + X, R.Top + i));
- end
- else
- begin
- pCanvas.DrawLine(Point(R.Left + i, R.Top), Point(R.Left + i, R.Bottom))
-// pCanvas.MoveTo(R.Left + i, R.Top);
-// pCanvas.LineTo(R.Left + i, R.Bottom);
- end;
- StartCol.Red := StartCol.Red + AddCol.Red;
- StartCol.Green := StartCol.Green + AddCol.Green;
- StartCol.Blue := StartCol.Blue + AddCol.Blue;
- EndColor := RGB(Round(StartCol.Red), Round(StartCol.Green), Round(StartCol.Blue));
- if StartColor <> EndColor then
- begin
-// Canvas.Pen.Color := EndColor;
- pCanvas.SetColor(GetGUIColor(EndColor));
- StartColor := EndColor;
- end;
- end; // for
-
- finally
-// Canvas.Stop;
- pCanvas.RestoreState;
- end;
-*)
-end;
-
-
-function TOpenSoftStyle.GetGUIColor(Color: TColor): TGfxColor;
-begin
- Result := inherited GetGUIColor(Color);
- case Color of
- // UI element colors
- clScrollBar: Result := GetUIColor(clLightGrey); //rgbaWindow;
- clMenu: Result := GetUIColor(clLightGrey); //rgbaWindow;
-// clWindow: Result := GetUIColor(clWhite);
-// clMenuText: Result := GetUIColor(clBlack);
-// clWindowText: Result := GetUIColor(clBlack);
-// clAppWorkSpace: Result := GetUIColor(clGray);
-// clHighlight: Result := GetUIColor(clNavy);
-// clHighlightText: Result := GetUIColor(clWhite);
- cl3DFace: Result := GetUIColor(clLightGrey); //rgbaWindow;
-// cl3DShadow: Result := rgbaDkWhite;
-// clGrayText: Result := GetUIColor(clGray);
-// clBtnText: Result := GetUIColor(clBlack);
-// cl3DHighlight: Result := GetUIColor(clWhite);
- cl3DDkShadow: Result := GetUIColor(clBlack);
-// cl3DLight: Result := GetUIColor(clDarkWhite);
-// clInfoText: Result := GetUIColor(clBlack);
-// clInfoBk: Result := GetUIColor(clLightYellow);
-//
-// else Result := GetUIColor(clWhite);
- end;
-
-end;
-
-(*
-procedure TOpenSoftStyle.DrawButtonFace(Canvas: TFCanvas; const ARect: TRect;
- Flags: TFButtonFlags);
-begin
-// inherited DrawButtonFace(Canvas, ARect, Flags);
-// PaintGradient(Canvas, ARect, Flags);
- Draw3DFrame(Canvas, ARect, cl3DHighlight, cl3DLight, cl3DDkShadow, cl3DShadow);
-end;
-*)
-
-procedure TOpenSoftStyle.DrawGroupBox(Canvas: TFCanvas; const ARect: TRect;
- const ALabel: String; WidgetState: TFWidgetState);
-var
- TitleWidth, TitleHeight, TopLine: Integer;
-begin
- TitleWidth := Canvas.TextWidth(ALabel);
- TitleHeight := Canvas.FontCellHeight;
- TopLine := ARect.Top + TitleHeight div 3;
-
- Canvas.SetColor(rgbaDkGrey);
- // box outline
- with ARect do
- begin
- // top
- Canvas.DrawLine(Point(Left + 2, TopLine), Point(Left + 12, TopLine));
- Canvas.DrawLine(Point(Left + TitleWidth + 16, TopLine), Point(Right - 2, TopLine));
- // right
- Canvas.DrawLine(Point(Right-1, TopLine + 2), Point(Right-1, Bottom - 2));
- // bottom
- Canvas.DrawLine(Point(Right - 3, Bottom-1), Point(Left + 1, Bottom-1));
- // left
- Canvas.DrawLine(Point(Left, Bottom - 3), Point(Left, TopLine + 1));
- end;
-
- // Text caption
- SetUIColor(Canvas, clWindowText);
- DrawText(Canvas, ARect.TopLeft + Point(14, 0), ALabel, WidgetState);
-
- { Anti-Aliasing - Top/Left }
- Canvas.SetColor(rgbaGbAALtGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(0, TopLine+1));
- Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine));
- Canvas.SetColor(rgbaGbAADkGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine+1));
- { Anti-Aliasing - Top/Right }
- Canvas.SetColor(rgbaGbAALtGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, TopLine+1));
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine));
- Canvas.SetColor(rgbaGbAADkGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine+1));
- { Anti-Aliasing - Bottom/Right }
- Canvas.SetColor(rgbaGbAALtGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, ARect.Bottom-2));
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-1));
- Canvas.SetColor(rgbaGbAADkGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-2));
- { Anti-Aliasing - Bottom/Left }
- Canvas.SetColor(rgbaGbAALtGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(0, ARect.Bottom-2));
- Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-1));
- Canvas.SetColor(rgbaGbAADkGrey);
- Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-2));
-end;
-
-
-//initialization
-//finalization
-// gStyleManager.RegisterClass('OpenSoft', TOpenSoftStyle);
-
-end.
-
+{
+ fpGUI - Free Pascal GUI Library
+
+ OpenSoft look-and-feel style implementation
+
+ Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+}
+
+unit OpenSoftStyle;
+
+{$mode objfpc}{$H+}
+
+interface
+uses
+ Classes
+ ,fpGUI
+ ,gfxBase
+ ,fpGFX
+ ;
+
+type
+
+ TGradientDirection = (gdTopToBottom, gdBottomToTop, gdLeftToRight, gdRightToLeft);
+ TCalcGradientEndX = function(Y, H: Integer): Integer;
+
+
+ { TOpenSoftStyle }
+
+ TOpenSoftStyle = class(TBasicStyle)
+ private
+ procedure PaintGradient(pCanvas: TFCanvas; const R: TRect; StartColor, EndColor: TColor; Direction: TGradientDirection; GradLines: Integer = -1);
+ public
+ // Colors
+ function GetGUIColor(Color: TColor): TGfxColor; override;
+ // Buttons
+ procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TFButtonFlags); override;
+ function GetButtonBorders: TRect; override;
+ // GroupBox
+ procedure DrawGroupBox(Canvas: TFCanvas; const ARect: TRect; const ALabel: String; WidgetState: TFWidgetState); override;
+ end;
+
+
+implementation
+
+const
+ // Some predefined colors:
+ rgbaDkBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000);
+ rgbaLtYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $e100; Alpha: $0000);
+
+ rgbaWindowText: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000);
+ rgbaWindow: TGfxColor = (Red: $efef; Green: $efef; Blue: $efef; Alpha: $0000);
+ rgbaDkGrey: TGfxColor = (Red: $8686; Green: $8686; Blue: $8686; Alpha: $0000);
+ rgbaGbAALtGrey: TGfxColor = (Red: $baba; Green: $baba; Blue: $baba; Alpha: $0000);
+ rgbaGbAADkGrey: TGfxColor = (Red: $7878; Green: $7878; Blue: $7878; Alpha: $0000);
+
+
+{
+procedure DrawGradient(Canvas: TCanvas; const R: TRect; StartColor, EndColor: TColor;
+ Direction: TGradientDirection; GradLines: Integer = -1; CalcEndX: TCalcGradientEndX = nil);
+procedure DrawGradientEx(Canvas: TCanvas; const R: TRect; StartColor: TColor;
+ StartToMidHeight: Integer; MidColor, EndColor: TColor;
+ Direction: TGradientDirection; CalcEndX: TCalcGradientEndX = nil);
+
+
+procedure ToRGB(c: TColor; out rgb: TRGB);
+var
+ l: TColorRef;
+begin
+ c := ColorFromColormap(c);
+ l := ColorToRGB(c);
+ rgb.r := TRGBValue(l).r;
+ rgb.g := TRGBValue(l).g;
+ rgb.b := TRGBValue(l).b;
+end;
+}
+
+{ TOpenSoftStyle }
+
+procedure TOpenSoftStyle.PaintGradient(pCanvas: TFCanvas; const R: TRect;
+ StartColor, EndColor: TColor; Direction: TGradientDirection;
+ GradLines: Integer = -1);
+var
+ X: integer;
+ i: integer;
+ w: integer;
+ h: integer;
+ Count: integer;
+ EndCol: TGfxColor;
+ StartCol: TGfxColor;
+ AddCol: TGfxColor;
+ Tmp: TGfxColor;
+begin
+(*
+ w := R.Right - R.Left - 1;
+ h := R.Bottom - R.Top - 1;
+ if (w <= 0) or (h <= 0) then
+ Exit; //==>
+
+ StartCol := GetGUIColor(StartColor);
+ EndCol := GetGUIColor(EndColor);
+
+ case Direction of
+ gdTopToBottom:
+ Count := h;
+ gdLeftToRight:
+ Count := w;
+ gdBottomToTop:
+ begin
+ Count := h;
+ Tmp := EndCol;
+ EndCol := StartCol;
+ StartCol := Tmp;
+ end;
+ gdRightToLeft:
+ begin
+ Count := w;
+ Tmp := EndCol;
+ EndCol := StartCol;
+ StartCol := Tmp;
+ end;
+ else
+ Exit; //==>
+ end;
+ if GradLines < 0 then
+ GradLines := Count;
+
+ AddCol.Red := (EndCol.Red - StartCol.Red) div GradLines;
+ AddCol.Green := (EndCol.Green - StartCol.Green) div GradLines;
+ AddCol.Blue := (EndCol.Blue - StartCol.Blue) div GradLines;
+
+// Canvas.Pen.Style := psSolid;
+ pCanvas.SaveState;
+// Canvas.Start;
+ try
+// StartColor := TColor(Round(StartCol.Red), Round(StartCol.Green), Round(StartCol.Blue));
+// Canvas.Pen.Color := StartColor;
+ pCanvas.SetColor(GetGUIColor(StartColor));
+ for i := 0 to Count - 1 do
+ begin
+ if Direction in [gdTopToBottom, gdBottomToTop] then
+ begin
+// pCanvas.MoveTo(R.Left, R.Top + i);
+// if Assigned(CalcEndX) then
+// X := CalcEndX(i, Count)
+// else
+ X := 0;
+// pCanvas.LineTo(R.Right + X, R.Top + i);
+ pCanvas.DrawLine(Point(R.Left, R.Top + i), Point(R.Right + X, R.Top + i));
+ end
+ else
+ begin
+ pCanvas.DrawLine(Point(R.Left + i, R.Top), Point(R.Left + i, R.Bottom))
+// pCanvas.MoveTo(R.Left + i, R.Top);
+// pCanvas.LineTo(R.Left + i, R.Bottom);
+ end;
+ StartCol.Red := StartCol.Red + AddCol.Red;
+ StartCol.Green := StartCol.Green + AddCol.Green;
+ StartCol.Blue := StartCol.Blue + AddCol.Blue;
+ EndColor := RGB(Round(StartCol.Red), Round(StartCol.Green), Round(StartCol.Blue));
+ if StartColor <> EndColor then
+ begin
+// Canvas.Pen.Color := EndColor;
+ pCanvas.SetColor(GetGUIColor(EndColor));
+ StartColor := EndColor;
+ end;
+ end; // for
+
+ finally
+// Canvas.Stop;
+ pCanvas.RestoreState;
+ end;
+*)
+end;
+
+
+function TOpenSoftStyle.GetGUIColor(Color: TColor): TGfxColor;
+begin
+ Result := inherited GetGUIColor(Color);
+ case Color of
+ // UI element colors
+ clScrollBar: Result := GetUIColor(clLightGrey); //rgbaWindow;
+ clMenu: Result := GetUIColor(clLightGrey); //rgbaWindow;
+// clWindow: Result := GetUIColor(clWhite);
+// clMenuText: Result := GetUIColor(clBlack);
+// clWindowText: Result := GetUIColor(clBlack);
+// clAppWorkSpace: Result := GetUIColor(clGray);
+// clHighlight: Result := GetUIColor(clNavy);
+// clHighlightText: Result := GetUIColor(clWhite);
+ cl3DFace: Result := GetUIColor(clLightGrey); //rgbaWindow;
+// cl3DShadow: Result := rgbaDkWhite;
+// clGrayText: Result := GetUIColor(clGray);
+// clBtnText: Result := GetUIColor(clBlack);
+// cl3DHighlight: Result := GetUIColor(clWhite);
+ cl3DDkShadow: Result := GetUIColor(clBlack);
+// cl3DLight: Result := GetUIColor(clDarkWhite);
+// clInfoText: Result := GetUIColor(clBlack);
+// clInfoBk: Result := GetUIColor(clLightYellow);
+//
+// else Result := GetUIColor(clWhite);
+ end;
+
+end;
+
+procedure TOpenSoftStyle.DrawButtonFace(Canvas: TFCanvas; const ARect: TRect;
+ Flags: TFButtonFlags);
+var
+ r: TRect;
+begin
+ r := ARect;
+
+ if btnIsSelected in Flags then
+ begin
+ SetUIColor(Canvas, cl3DDkShadow);
+ Canvas.DrawRect(r);
+ Inc(r.Left);
+ Inc(r.Top);
+ Dec(r.Right);
+ Dec(r.Bottom);
+ end;
+
+ if btnIsPressed in Flags then
+ begin
+ SetUIColor(Canvas, cl3DShadow);
+ Canvas.DrawRect(r);
+ Inc(r.Left);
+ Inc(r.Top);
+ Dec(r.Right);
+ Dec(r.Bottom);
+ end else
+ begin
+ if btnIsEmbedded in Flags then
+ Draw3DFrame(Canvas, r, cl3DLight, cl3DFace, cl3DDkShadow, cl3DShadow)
+ else
+ Draw3DFrame(Canvas, r, cl3DHighlight, cl3DFace, cl3DDkShadow, cl3DShadow);
+ Inc(r.Left, 2);
+ Inc(r.Top, 2);
+ Dec(r.Right, 2);
+ Dec(r.Bottom, 2);
+ end;
+
+ SetUIColor(Canvas, cl3DFace);
+ Canvas.FillRect(r);
+
+ if btnHasFocus in Flags then
+ begin
+ r.Left := ARect.Left + 4;
+ r.Top := ARect.Top + 4;
+ r.Right := ARect.Right - 4;
+ r.Bottom := ARect.Bottom - 4;
+ DrawFocusRect(Canvas, r);
+ end;
+end;
+
+function TOpenSoftStyle.GetButtonBorders: TRect;
+begin
+ Result := Rect(4, 4, 4, 4);
+end;
+
+procedure TOpenSoftStyle.DrawGroupBox(Canvas: TFCanvas; const ARect: TRect;
+ const ALabel: String; WidgetState: TFWidgetState);
+var
+ TitleWidth, TitleHeight, TopLine: Integer;
+begin
+ TitleWidth := Canvas.TextWidth(ALabel);
+ TitleHeight := Canvas.FontCellHeight;
+ TopLine := ARect.Top + TitleHeight div 3;
+
+ Canvas.SetColor(rgbaDkGrey);
+ // box outline
+ with ARect do
+ begin
+ // top
+ Canvas.DrawLine(Point(Left + 2, TopLine), Point(Left + 12, TopLine));
+ Canvas.DrawLine(Point(Left + TitleWidth + 16, TopLine), Point(Right - 2, TopLine));
+ // right
+ Canvas.DrawLine(Point(Right-1, TopLine + 2), Point(Right-1, Bottom - 2));
+ // bottom
+ Canvas.DrawLine(Point(Right - 3, Bottom-1), Point(Left + 1, Bottom-1));
+ // left
+ Canvas.DrawLine(Point(Left, Bottom - 3), Point(Left, TopLine + 1));
+ end;
+
+ // Text caption
+ SetUIColor(Canvas, clWindowText);
+ DrawText(Canvas, ARect.TopLeft + Point(14, 0), ALabel, WidgetState);
+
+ { Anti-Aliasing - Top/Left }
+ Canvas.SetColor(rgbaGbAALtGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(0, TopLine+1));
+ Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine));
+ Canvas.SetColor(rgbaGbAADkGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine+1));
+ { Anti-Aliasing - Top/Right }
+ Canvas.SetColor(rgbaGbAALtGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, TopLine+1));
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine));
+ Canvas.SetColor(rgbaGbAADkGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine+1));
+ { Anti-Aliasing - Bottom/Right }
+ Canvas.SetColor(rgbaGbAALtGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, ARect.Bottom-2));
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-1));
+ Canvas.SetColor(rgbaGbAADkGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-2));
+ { Anti-Aliasing - Bottom/Left }
+ Canvas.SetColor(rgbaGbAALtGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(0, ARect.Bottom-2));
+ Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-1));
+ Canvas.SetColor(rgbaGbAADkGrey);
+ Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-2));
+end;
+
+
+//initialization
+//finalization
+// gStyleManager.RegisterClass('OpenSoft', TOpenSoftStyle);
+
+end.
+
diff --git a/gui/stylemanager.pas b/gui/stylemanager.pas
index 7c66d839..1c5a82e5 100644
--- a/gui/stylemanager.pas
+++ b/gui/stylemanager.pas
@@ -207,8 +207,9 @@ end;
initialization
- gStyleManager.RegisterClass(cDefaultStyle, TWindowsStyle);
- gStyleManager.RegisterClass('Windows', TWindowsStyle);
+ gStyleManager.RegisterClass(cDefaultStyle, TWin2000Style);
+ gStyleManager.RegisterClass('Windows 9x', TWin9xStyle);
+ gStyleManager.RegisterClass('Windows 2000', TWin2000Style);
gStyleManager.RegisterClass('OpenSoft', TOpenSoftStyle);
gStyleManager.RegisterClass('Motif', TMotifStyle);
diff --git a/gui/windowsstyle.pas b/gui/windowsstyle.pas
index 550d490b..08eca3a0 100644
--- a/gui/windowsstyle.pas
+++ b/gui/windowsstyle.pas
@@ -24,6 +24,7 @@ uses
Classes
,SysUtils
,fpGUI
+ ,fpgfx
;
@@ -31,9 +32,80 @@ type
TWindowsStyle = class(TBasicStyle)
end;
+
+ // Win95 and Win98 look. ie: Buttons are different
+ TWin9xStyle = class(TWindowsStyle)
+ end;
+
+
+ // Win2000 look. ie: Again the buttons are different (more flat)
+ TWin2000Style = class(TWindowsStyle)
+ public
+ // Buttons
+ procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TFButtonFlags); override;
+ function GetButtonBorders: TRect; override;
+ end;
+
implementation
+{ TWin2000Style }
+
+procedure TWin2000Style.DrawButtonFace(Canvas: TFCanvas; const ARect: TRect;
+ Flags: TFButtonFlags);
+var
+ r: TRect;
+begin
+ r := ARect;
+
+ if btnIsSelected in Flags then
+ begin
+ SetUIColor(Canvas, cl3DDkShadow);
+ Canvas.DrawRect(r);
+ Inc(r.Left);
+ Inc(r.Top);
+ Dec(r.Right);
+ Dec(r.Bottom);
+ end;
+
+ if btnIsPressed in Flags then
+ begin
+ SetUIColor(Canvas, cl3DShadow);
+ Canvas.DrawRect(r);
+ Inc(r.Left);
+ Inc(r.Top);
+ Dec(r.Right);
+ Dec(r.Bottom);
+ end else
+ begin
+ if btnIsEmbedded in Flags then
+ Draw3DFrame(Canvas, r, cl3DLight, cl3DFace, cl3DDkShadow, cl3DShadow)
+ else
+ Draw3DFrame(Canvas, r, cl3DHighlight, cl3DFace, cl3DDkShadow, cl3DShadow);
+ Inc(r.Left, 2);
+ Inc(r.Top, 2);
+ Dec(r.Right, 2);
+ Dec(r.Bottom, 2);
+ end;
+
+ SetUIColor(Canvas, cl3DFace);
+ Canvas.FillRect(r);
+
+ if btnHasFocus in Flags then
+ begin
+ r.Left := ARect.Left + 4;
+ r.Top := ARect.Top + 4;
+ r.Right := ARect.Right - 4;
+ r.Bottom := ARect.Bottom - 4;
+ DrawFocusRect(Canvas, r);
+ end;
+end;
+
+function TWin2000Style.GetButtonBorders: TRect;
+begin
+ Result := Rect(4, 4, 4, 4);
+end;
+
end.