summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-20 17:24:37 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-20 17:24:37 +0000
commit7cdac92f2dc9b03d6a007a60cc33346d3380a13e (patch)
treeeabceaf7090cc4809635fb0334c516be55206591
parent7162ddf3447586b1255438ce4961119feaa5d9ef (diff)
downloadfpGUI-7cdac92f2dc9b03d6a007a60cc33346d3380a13e.tar.xz
* I commit this menu changes for reference in a future theme.
* Extended the Menu Example * Changed Popup menus to be activated on MouseUp and not MouseDown. * Implemented a Bluecurve theme look in the menu. See the first point for reason.
-rw-r--r--examples/gui/menutest/menutest.lpi1
-rw-r--r--examples/gui/menutest/menutest.lpr1
-rw-r--r--src/gui/gui_menu.pas50
3 files changed, 43 insertions, 9 deletions
diff --git a/examples/gui/menutest/menutest.lpi b/examples/gui/menutest/menutest.lpi
index 0385d9f4..a50e8ba9 100644
--- a/examples/gui/menutest/menutest.lpi
+++ b/examples/gui/menutest/menutest.lpi
@@ -9,6 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
diff --git a/examples/gui/menutest/menutest.lpr b/examples/gui/menutest/menutest.lpr
index a6864544..56a37470 100644
--- a/examples/gui/menutest/menutest.lpr
+++ b/examples/gui/menutest/menutest.lpr
@@ -71,6 +71,7 @@ begin
FMenuBar.AddMenuItem('&File', nil).SubMenu := FFileSubMenu;
FMenuBar.AddMenuItem('&Edit', nil).SubMenu := FEditSubMenu;
FMenuBar.AddMenuItem('&Windows', nil);
+ FMenuBar.AddMenuItem('&Disabled', nil).Enabled := False;
FMenuBar.AddMenuItem('&Help', nil).SubMenu := FHelpSubMenu;
end;
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index 3bc195f8..eb02c2fc 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -79,7 +79,7 @@ type
FItems: TList;
FFocusItem: integer;
procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
- procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandlePaint; override;
procedure HandleShow; override;
@@ -121,7 +121,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function ItemWidth(mi: TfpgMenuItem): integer;
- procedure DrawColumn(col: integer; focus: boolean);
+ procedure DrawColumn(col: integer; focus: boolean); virtual;
function CalcMouseCol(x: integer): integer;
function GetItemPosX(index: integer): integer;
procedure DoSelect;
@@ -423,29 +423,61 @@ begin
begin
if MenuFocused then
begin
- Canvas.SetColor(clSelection);
+ r2 := r;
+ Canvas.GradientFill(r2, FDarkColor, FLightColor, gdVertical);
+// Canvas.SetColor(clSelection);
Canvas.SetTextColor(clSelectionText);
+ Canvas.SetTextColor(clMenuText);
end
else
begin
- Canvas.SetColor(clInactiveSel);
+// Canvas.SetColor(clInactiveSel);
Canvas.SetTextColor(clInactiveSelText);
+// Canvas.FillRectangle(r);
+
+ // Bluecurve theme - will be removed later
+ r2 := r;
+ // outer dark border
+ Canvas.SetColor(TfpgColor($3b4c71));
+ Canvas.SetLineStyle(1, lsSolid);
+ Canvas.DrawRectangle(r2);
+ InflateRect(r2, -1, -1);
+ // left top
+ Canvas.SetColor(TfpgColor($98b2ed));
+ Canvas.DrawLine(r2.Left, r2.Bottom, r2.Left, r2.Top); // left
+ Canvas.DrawLine(r2.Left, r2.Top, r2.Right, r2.Top); // top
+ // right bottom
+ Canvas.SetColor(TfpgColor($4468b8));
+ Canvas.DrawLine(r2.Right, r2.Top, r2.Right, r2.Bottom); // right
+ Canvas.DrawLine(r2.Right, r2.Bottom, r2.Left-1, r2.Bottom); // bottom
+ // inside gradient fill
+ InflateRect(r2, -1, -1);
+ Canvas.GradientFill(r2, TfpgColor($435e9a), TfpgColor($5476c4), gdVertical);
+ // reset rectangle
+ InflateRect(r2, 2, 2);
end;
end
else
begin
if mi.Enabled then
begin
- Canvas.SetColor(BackgroundColor);
+// Canvas.SetColor(BackgroundColor);
Canvas.SetTextColor(clMenuText);
+// Canvas.FillRectangle(r);
+ r2.SetRect(r.Left, r.Top-1, r.Width, Height);
+ Canvas.GradientFill(r2, FLightColor, FDarkColor, gdVertical);
+
end
else
begin
- Canvas.SetColor(BackgroundColor);
+ r2.SetRect(r.Left, r.Top-1, r.Width, Height);
+ Canvas.GradientFill(r2, FLightColor, FDarkColor, gdVertical);
+// Canvas.SetColor(BackgroundColor);
Canvas.SetTextColor(clMenuDisabled);
+// Canvas.FillRectangle(r);
end;
end; { if/else }
- Canvas.FillRectangle(r);
+// Canvas.FillRectangle(r);
mi.DrawText(Canvas, r.left+4, r.top+1);
Canvas.EndDraw;
Exit; //==>
@@ -671,12 +703,12 @@ begin
DrawRow(FFocusItem,true);
end;
-procedure TfpgPopupMenu.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
+procedure TfpgPopupMenu.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
var
newf: integer;
mi: TfpgMenuItem;
begin
- inherited HandleLMouseDown(x, y, shiftstate);
+ inherited HandleLMouseUp(x, y, shiftstate);
newf := CalcMouseRow(y);