LCL: added TNotebookCapabilities from Benito van der Zander (part of issue #11563)

git-svn-id: trunk@16000 -
This commit is contained in:
vincents 2008-08-08 14:31:54 +00:00
parent cedc3fdcad
commit 11038348f3
5 changed files with 49 additions and 0 deletions

View File

@ -131,6 +131,8 @@ type
TNoteBookOption = (nboShowCloseButtons, nboMultiLine);
TNoteBookOptions = set of TNoteBookOption;
TNoteBookCapability = (nbcShowCloseButtons, nbcMultiLine, nbcPageListPopup);
TNoteBookCapabilities = set of TNoteBookCapability;
TCustomNotebook = class(TWinControl)
private
@ -204,6 +206,7 @@ type
function CanChangePageIndex: boolean; virtual;
function GetMinimumTabWidth: integer; virtual;
function GetMinimumTabHeight: integer; virtual;
function GetCapabilities: TNoteBookCapabilities; virtual;
public
//property MultiLine: boolean read fMultiLine write SetMultiLine default false;
procedure DoCloseTabClicked(APage: TCustomPage); virtual;

View File

@ -341,6 +341,11 @@ begin
//debugln('TCustomNotebook.GetMinimumTabHeight A ',dbgs(Result));
end;
function TCustomNotebook.GetCapabilities: TNoteBookCapabilities;
begin
Result:=TWSCustomNotebookClass(WidgetSetClass).GetCapabilities;
end;
{------------------------------------------------------------------------------
method TCustomNotebook DoCloseTabClicked
Params: APage: TCustomPage
@ -414,6 +419,8 @@ begin
FOptions:=AValue;
if nboShowCloseButtons in ChangedOptions then
UpdateTabProperties;
if nboMultiLine in ChangedOptions then
TWSCustomNotebookClass(WidgetSetClass).GetCapabilities;
end;
{------------------------------------------------------------------------------

View File

@ -69,6 +69,7 @@ type
class procedure RemovePage(const ANotebook: TCustomNotebook;
const AIndex: integer); override;
class function GetCapabilities: TNoteBookCapabilities; override;
class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override;
class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override;
class function GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer; override;
@ -489,6 +490,11 @@ begin
gtk_widget_hide(PageWidget);
end;
class function TGtkWSCustomNotebook.GetCapabilities: TNoteBookCapabilities;
begin
Result:=[nbcPageListPopup, nbcShowCloseButtons];
end;
class function TGtkWSCustomNotebook.GetNotebookMinTabHeight(
const AWinControl: TWinControl): integer;
var

View File

@ -76,11 +76,13 @@ type
class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; override;
class function GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer; override;
class function GetCapabilities: TNoteBookCapabilities;override;
class function GetDesignInteractive(const AWinControl: TWinControl; AClientPos: TPoint): Boolean; override;
class procedure SetImageList(const ANotebook: TCustomNotebook; const AImageList: TCustomImageList); override;
class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); override;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override;
class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override;
class procedure UpdateProperties(const ANotebook: TCustomNotebook); override;
end;
{ TWin32WSPage }
@ -437,6 +439,8 @@ begin
tpRight:
Flags := Flags or (TCS_VERTICAL or TCS_RIGHT or TCS_MULTILINE);
end;
if nboMultiLine in TCustomNotebook(AWinControl).Options then
Flags := Flags or TCS_MULTILINE;
pClassName := WC_TABCONTROL;
end;
// create window
@ -621,6 +625,11 @@ begin
Result := Windows.SendMessage(ANotebook.Handle, TCM_HITTEST, 0, LPARAM(@hittestInfo));
end;
class function TWin32WSCustomNotebook.GetCapabilities: TNoteBookCapabilities;
begin
Result:=[nbcMultiLine];
end;
class function TWin32WSCustomNotebook.GetDesignInteractive(
const AWinControl: TWinControl; AClientPos: TPoint): Boolean;
var
@ -687,6 +696,17 @@ begin
end;
end;
class procedure TWin32WSCustomNotebook.UpdateProperties(
const ANotebook: TCustomNotebook);
var currentStyle: cardinal;
begin
currentStyle:=GetWindowLong(ANotebook.Handle,GWL_STYLE);
if nboMultiLine in ANotebook.Options then
SetWindowLong(ANotebook.Handle,GWL_STYLE,currentStyle or TCS_MULTILINE)
else
SetWindowLong(ANotebook.Handle,GWL_STYLE,currentStyle and not TCS_MULTILINE)
end;
{ TWin32WSCustomPanel }
class function TWin32WSCustomPanel.CreateHandle(const AWinControl: TWinControl;

View File

@ -67,11 +67,13 @@ type
class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; virtual;
class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; virtual;
class function GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer; virtual;
class function GetCapabilities: TNoteBookCapabilities; virtual;
class procedure SetImageList(const ANotebook: TCustomNotebook; const AImageList: TCustomImageList); virtual;
class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); virtual;
class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); virtual;
class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); virtual;
class procedure UpdateProperties(const ANotebook: TCustomNotebook); virtual;
end;
TWSCustomNotebookClass = class of TWSCustomNotebook;
@ -262,6 +264,11 @@ begin
Result := -1;
end;
class function TWSCustomNotebook.GetCapabilities: TNoteBookCapabilities;
begin
Result:=[];
end;
class procedure TWSCustomNotebook.SetImageList(
const ANotebook: TCustomNotebook; const AImageList: TCustomImageList);
begin
@ -287,6 +294,12 @@ class procedure TWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook;
begin
end;
class procedure TWSCustomNotebook.UpdateProperties(
const ANotebook: TCustomNotebook);
begin
end;
{ TWSCustomTrayIcon }
class function TWSCustomTrayIcon.Hide(const ATrayIcon: TCustomTrayIcon): Boolean;