diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpgui_package.lpk | 6 | ||||
-rw-r--r-- | src/gui/fpgui_package.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_menu.pas | 130 |
3 files changed, 136 insertions, 2 deletions
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk index 7401add3..ee8e2d41 100644 --- a/src/gui/fpgui_package.lpk +++ b/src/gui/fpgui_package.lpk @@ -18,7 +18,7 @@ <Description Value="fpGUI - multi-handle redesign"/> <License Value="Modified LGPL"/> <Version Minor="5"/> - <Files Count="19"> + <Files Count="20"> <Item1> <Filename Value="gui_button.pas"/> <UnitName Value="gui_button"/> @@ -95,6 +95,10 @@ <Filename Value="gui_progressbar.pas"/> <UnitName Value="gui_progressbar"/> </Item19> + <Item20> + <Filename Value="gui_menu.pas"/> + <UnitName Value="gui_menu"/> + </Item20> </Files> <RequiredPkgs Count="2"> <Item1> diff --git a/src/gui/fpgui_package.pas b/src/gui/fpgui_package.pas index 0662071d..1c4ab693 100644 --- a/src/gui/fpgui_package.pas +++ b/src/gui/fpgui_package.pas @@ -10,7 +10,7 @@ uses gui_button, gui_combobox, gui_dialogs, gui_edit, gui_form, gui_label, gui_listbox, gui_memo, gui_popupwindow, gui_scrollbar, gui_bevel, gui_checkbox, gui_radiobutton, gui_trackbar, gui_tab, gui_basegrid, - gui_listview, gui_customgrid, gui_progressbar; + gui_listview, gui_customgrid, gui_progressbar, gui_menu; implementation diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas new file mode 100644 index 00000000..4429a941 --- /dev/null +++ b/src/gui/gui_menu.pas @@ -0,0 +1,130 @@ +unit gui_menu; + +{$mode objfpc}{$H+} + +{ + Still under construction!!!!! +} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget, + gui_form, + gui_popupwindow; + +type + THotKeyDef = string; + + TPopupMenu = class; + + TMenuItem = class(TComponent) + private + FEnabled: boolean; + FHotKeyDef: THotKeyDef; + FOnClick: TNotifyEvent; + FSeparator: boolean; + FSubMenu: TPopupMenu; + FText: string; + FVisible: boolean; + procedure SetEnabled(const AValue: boolean); + procedure SetHotKeyDef(const AValue: THotKeyDef); + procedure SetSeparator(const AValue: boolean); + procedure SetText(const AValue: string); + procedure SetVisible(const AValue: boolean); + public + constructor Create(AOwner: TComponent); override; + procedure Click; + function Selectable: boolean; + function GetAccelChar: string; + procedure DrawText(ACanvas: TfpgCanvas; x, y: TfpgCoord); + property Text: string read FText write SetText; + property HotKeyDef: THotKeyDef read FHotKeyDef write SetHotKeyDef; + property Separator: boolean read FSeparator write SetSeparator; + property Visible: boolean read FVisible write SetVisible; + property Enabled: boolean read FEnabled write SetEnabled; + property SubMenu: TPopupMenu read FSubMenu; + property OnClick: TNotifyEvent read FOnClick write FOnClick; + end; + + + TPopupMenu = class(TfpgForm) // this should actually descend from a popup window class + end; + + + TMenuBar = class(TfpgWidget) + end; + +implementation + +{ TMenuItem } + +procedure TMenuItem.SetText(const AValue: string); +begin + if FText=AValue then exit; + FText:=AValue; +end; + +procedure TMenuItem.SetVisible(const AValue: boolean); +begin + if FVisible=AValue then exit; + FVisible:=AValue; +end; + +procedure TMenuItem.SetHotKeyDef(const AValue: THotKeyDef); +begin + if FHotKeyDef=AValue then exit; + FHotKeyDef:=AValue; +end; + +procedure TMenuItem.SetEnabled(const AValue: boolean); +begin + if FEnabled=AValue then exit; + FEnabled:=AValue; +end; + +procedure TMenuItem.SetSeparator(const AValue: boolean); +begin + if FSeparator=AValue then exit; + FSeparator:=AValue; +end; + +constructor TMenuItem.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Text := ''; + HotKeyDef := ''; + FSeparator := False; + FVisible := True; + FEnabled := True; + FSubMenu := nil; + FOnClick := nil; +end; + +procedure TMenuItem.Click; +begin + if Assigned(FOnClick) then + FOnClick(self); +end; + +function TMenuItem.Selectable: boolean; +begin + Result := Enabled and Visible and (not Separator); +end; + +function TMenuItem.GetAccelChar: string; +begin + +end; + +procedure TMenuItem.DrawText(ACanvas: TfpgCanvas; x, y: TfpgCoord); +begin + +end; + +end. + |