diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-04-19 00:03:15 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-04-19 00:03:15 +0200 |
commit | f6f77bdef527a82c6b1152d21222c6f51df7663b (patch) | |
tree | 0fe54818f7b052dd3130901cabbde89943d1fe0c /src/gui | |
parent | 3bda1adcbccf80c1ad66bd32224dcdd6937af5ba (diff) | |
download | fpGUI-f6f77bdef527a82c6b1152d21222c6f51df7663b.tar.xz |
PageControl: New OnClosingTabSheet event added.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpg_tab.pas | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas index bf20a79e..741d0bb3 100644 --- a/src/gui/fpg_tab.pas +++ b/src/gui/fpg_tab.pas @@ -73,6 +73,7 @@ type TTabSheetChange = procedure(Sender: TObject; NewActiveSheet: TfpgTabSheet) of object; + TTabSheetClosing = procedure(Sender: TObject; ATabSheet: TfpgTabSheet) of object; TfpgPageControl = class(TfpgWidget) @@ -82,6 +83,7 @@ type FMargin: integer; FFixedTabWidth: integer; FFixedTabHeight: Integer; + FOnClosingTabSheet: TTabSheetClosing; FPages: TList; FActivePageIndex: integer; FOnChange: TTabSheetChange; @@ -91,6 +93,7 @@ type FSortPages: boolean; FStyle: TfpgTabStyle; FTabPosition: TfpgTabPosition; + FPopupMenu: TfpgPopupMenu; function GetActivePageIndex: integer; function GetPage(AIndex: integer): TfpgTabSheet; function GetPageCount: Integer; @@ -113,6 +116,7 @@ type procedure SetStyle(const AValue: TfpgTabStyle); procedure SetTabPosition(const AValue: TfpgTabPosition); procedure DoPageChange(ATabSheet: TfpgTabSheet); + procedure DoTabSheetClosing(ATabSheet: TfpgTabSheet); function DrawTab(const rect: TfpgRect; const Selected: Boolean = False; const Mode: Integer = 1): TfpgRect; protected procedure OrderSheets; // currently using bubblesort @@ -130,6 +134,7 @@ type property ActivePage: TfpgTabSheet read FActivePage write SetActivePage; property Pages[AIndex: integer]: TfpgTabSheet read GetPage; property OnChange: TTabSheetChange read FOnChange write FOnChange; + property OnClosingTabSheet: TTabSheetClosing read FOnClosingTabSheet write FOnClosingTabSheet; published property ActivePageIndex: integer read GetActivePageIndex write SetActivePageIndex; property BackgroundColor; @@ -514,6 +519,16 @@ begin FOnChange(self, ATabSheet); end; +procedure TfpgPageControl.DoTabSheetClosing(ATabSheet: TfpgTabSheet); +begin + if (csLoading in ComponentState) then + Exit; + if (csDesigning in ComponentState) then + Exit; + if Assigned(FOnClosingTabSheet) then + FOnClosingTabSheet(self, ATabSheet); +end; + function TfpgPageControl.DrawTab(const rect: TfpgRect; const Selected: Boolean = False; const Mode: Integer = 1): TfpgRect; var r: TfpgRect; |