summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-30 12:51:48 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-30 12:51:48 +0000
commit37a180859483a5a6bdd49c55c4a2eeaaa2c36e3c (patch)
tree21354757fbf6abcccb9c963327a9f3b866e22686 /src
parent0f38d3a24d0a60e642377a120b0933ac3d0aedb9 (diff)
downloadfpGUI-37a180859483a5a6bdd49c55c4a2eeaaa2c36e3c.tar.xz
* Changed the unit output path of the CoreLib and GUI (Lazarus) packages to the lib directory in the root of fpGUI. They are now the same as when you compile from the comand line.
* Implemented the TfpgMenuBar keyboard shortcut feature. For example you can now press Alt+F to open the File menu. * Modified the menutest example to show the above change.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gdi/fpgfx_package.lpk2
-rw-r--r--src/corelib/x11/fpgfx_package.lpk2
-rw-r--r--src/gui/fpgui_package.lpk10
-rw-r--r--src/gui/gui_form.pas34
-rw-r--r--src/gui/gui_menu.pas19
-rw-r--r--src/gui/gui_trackbar.pas7
6 files changed, 60 insertions, 14 deletions
diff --git a/src/corelib/gdi/fpgfx_package.lpk b/src/corelib/gdi/fpgfx_package.lpk
index 66963c07..8b6d510d 100644
--- a/src/corelib/gdi/fpgfx_package.lpk
+++ b/src/corelib/gdi/fpgfx_package.lpk
@@ -10,7 +10,7 @@
<SearchPaths>
<IncludeFiles Value="..\"/>
<OtherUnitFiles Value="..\;..\..\gui\"/>
- <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="..\..\..\lib\"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
diff --git a/src/corelib/x11/fpgfx_package.lpk b/src/corelib/x11/fpgfx_package.lpk
index 222667ee..887a3443 100644
--- a/src/corelib/x11/fpgfx_package.lpk
+++ b/src/corelib/x11/fpgfx_package.lpk
@@ -8,7 +8,7 @@
<SearchPaths>
<IncludeFiles Value="../"/>
<OtherUnitFiles Value="../;../../gui/"/>
- <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="../../../lib/"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk
index f6cab529..d6f2e0ae 100644
--- a/src/gui/fpgui_package.lpk
+++ b/src/gui/fpgui_package.lpk
@@ -6,7 +6,7 @@
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
- <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="../../lib/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
@@ -106,12 +106,12 @@
</Files>
<RequiredPkgs Count="2">
<Item1>
- <PackageName Value="fpgfx_package"/>
- <MinVersion Minor="5" Valid="True"/>
- </Item1>
- <Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="fpgfx_package"/>
+ <MinVersion Minor="5" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 10de2a44..d4fb9ace 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -41,6 +41,7 @@ type
procedure HandleClose; virtual;
procedure HandleHide; override;
procedure HandleShow; override;
+ procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
public
@@ -72,7 +73,14 @@ function WidgetParentForm(wg: TfpgWidget): TfpgForm;
implementation
uses
- fpgfx;
+ fpgfx,
+ gui_menu;
+
+type
+ // to access protected methods
+ TfpgMenuBarFriend = class(TfpgMenuBar)
+ end;
+
function WidgetParentForm(wg: TfpgWidget): TfpgForm;
var
@@ -226,6 +234,30 @@ begin
FOnShow(self);
end;
+procedure TfpgForm.HandleKeyPress(var keycode: word;
+ var shiftstate: TShiftState; var consumed: boolean);
+var
+ i: integer;
+ wg: TfpgWidget;
+begin
+// writeln(Classname, '.Keypress');
+ // find the TfpgMenuBar
+ if not consumed then
+ begin
+ for i := 0 to ComponentCount-1 do
+ begin
+ wg := TfpgWidget(Components[i]);
+ if (wg <> nil) and (wg <> self) and (wg is TfpgMenuBar) then
+ begin
+ TfpgMenuBarFriend(wg).HandleKeyPress(keycode, shiftstate, consumed);
+ Break; //==>
+ end;
+ end;
+ end; { if }
+
+ inherited HandleKeyPress(keycode, shiftstate, consumed);
+end;
+
procedure TfpgForm.AfterConstruction;
begin
inherited AfterConstruction;
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index c34d40a9..74ab2d6f 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -365,7 +365,26 @@ end;
procedure TfpgMenuBar.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
+var
+ s: string;
+ i: integer;
begin
+// writeln(Classname, '.Keypress');
+ s := KeycodeToText(keycode, shiftstate);
+// writeln('s: ', s);
+ // handle MenuBar (Alt+?) shortcuts only - for now!
+ if (length(s) = 5) and (copy(s, 1, 4) = 'Alt+') then
+ begin
+ s := KeycodeToText(keycode, []);
+ i := SearchItemByAccel(s);
+ if i <> -1 then
+ begin
+ consumed := True;
+// writeln('Selected ', VisibleItem(i).Text);
+ FFocusItem := i;
+ DoSelect;
+ end;
+ end;
inherited HandleKeyPress(keycode, shiftstate, consumed);
end;
diff --git a/src/gui/gui_trackbar.pas b/src/gui/gui_trackbar.pas
index 1ff04486..39d8ffe3 100644
--- a/src/gui/gui_trackbar.pas
+++ b/src/gui/gui_trackbar.pas
@@ -22,8 +22,7 @@ uses
SysUtils,
gfxbase,
fpgfx,
- gfx_widget,
- gui_scrollbar;
+ gfx_widget;
type
TTrackBarChange = procedure(Sender: TObject; APosition: integer) of object;
@@ -75,11 +74,8 @@ type
FSliderPos: TfpgCoord;
FSliderLength: TfpgCoord;
FSliderDragging: boolean;
- FStartBtnPressed,
- FEndBtnPressed: Boolean;
FSliderDragPos: TfpgCoord;
FSliderDragStart: TfpgCoord;
- FActiveButtonRect: TfpgRect;
FMousePosition: TPoint;
FOnChange: TTrackBarChange;
FFont: TfpgFont;
@@ -281,7 +277,6 @@ end;
procedure TfpgTrackBarExtra.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
var
- p: integer;
linepos: double;
drawwidth: integer;
OldPos: integer;