diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-20 16:31:37 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-20 16:31:37 +0200 |
commit | 3bc2cdaed5cf71e429ee16788919f5d4a576bf54 (patch) | |
tree | b98912106cd6bccb6058c0b940f7d4173f032b67 | |
parent | fb8ac31c512a56abd5e4c3f2b5bd5172b926efb3 (diff) | |
download | fpGUI-3bc2cdaed5cf71e429ee16788919f5d4a576bf54.tar.xz |
PageControl: has a new property Options.
Two new Tab Options are available, but only one is implemented
so far.
to_PMenuClose : Show the 'Close Tab' in popup menu
to_PMenuShowAvailTabs : When implemented will list available tabs
and change active tab to the selected one.
By default the Options property is empty.
-rw-r--r-- | src/gui/fpg_tab.pas | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas index 459429f4..1dc272af 100644 --- a/src/gui/fpg_tab.pas +++ b/src/gui/fpg_tab.pas @@ -45,6 +45,9 @@ type TfpgTabStyle = (tsTabs, tsButtons, tsFlatButtons); TfpgTabPosition = (tpTop, tpBottom, tpLeft, tpRight, tpNone); + TfpgTabOption = (to_PMenuClose, to_PMenuShowAvailTabs); + + TfpgTabOptions = set of TfpgTabOption; TfpgTabSheet = class(TfpgWidget) @@ -95,6 +98,7 @@ type FStyle: TfpgTabStyle; FTabPosition: TfpgTabPosition; FPopupMenu: TfpgPopupMenu; + FTabOptions: TfpgTabOptions; function GetActivePageIndex: integer; function GetPage(AIndex: integer): TfpgTabSheet; function GetPageCount: Integer; @@ -144,6 +148,7 @@ type property FixedTabWidth: integer read FFixedTabWidth write SetFixedTabWidth default 0; property FixedTabHeight: integer read FFixedTabHeight write SetFixedTabHeight default 21; property Hint; + property Options: TfpgTabOptions read FTabOptions write FTabOptions; property ParentShowHint; property ShowHint; property SortPages: boolean read FSortPages write SetSortPages default False; @@ -1040,12 +1045,15 @@ procedure TfpgPageControl.HandleRMouseUp(x, y: integer; shiftstate: TShiftState) begin inherited HandleRMouseUp(x, y, shiftstate); // ShowDefaultPopupMenu(x, y, ShiftState); - if not Assigned(FPopupMenu) then + if to_PMenuClose in FTabOptions then begin - FPopupMenu := TfpgPopupMenu.Create(self); - FPopupMenu.AddMenuItem('Close Tab', '', @pmCloseTab); + if not Assigned(FPopupMenu) then + begin + FPopupMenu := TfpgPopupMenu.Create(self); + FPopupMenu.AddMenuItem('Close Tab', '', @pmCloseTab); + end; + FPopupMenu.ShowAt(self, x, y); end; - FPopupMenu.ShowAt(self, x, y); end; procedure TfpgPageControl.HandleKeyPress(var keycode: word; @@ -1088,6 +1096,7 @@ begin FWidth := 150; FHeight := 100; FIsContainer := True; + FTabOptions := []; FTextColor := Parent.TextColor; FBackgroundColor := Parent.BackgroundColor; |