LCL-GTK2&3: Add more "const" modifiers for string parameters for better performance.

git-svn-id: trunk@61370 -
This commit is contained in:
juha 2019-06-12 19:43:11 +00:00
parent e5212b707b
commit aad625b25e
3 changed files with 33 additions and 33 deletions

View File

@ -45,7 +45,7 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure Show; procedure Show;
function GetPosition: TPoint; function GetPosition: TPoint;
procedure Update(NewPixBuf: PGdkPixbuf; NewHint: String); procedure Update(NewPixBuf: PGdkPixbuf; const NewHint: String);
end; end;
const const
@ -479,7 +479,7 @@ begin
end; end;
end; end;
procedure TGtk2TrayIconHandle.Update(NewPixBuf: PGdkPixbuf; NewHint: String); procedure TGtk2TrayIconHandle.Update(NewPixBuf: PGdkPixbuf; const NewHint: String);
begin begin
{$ifdef UseStatusIcon} {$ifdef UseStatusIcon}
if FStatusIcon <> nil then if FStatusIcon <> nil then

View File

@ -94,7 +94,7 @@ type
function _Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; function _Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
function EatArrowKeys(const AKey: Word): Boolean; virtual; function EatArrowKeys(const AKey: Word): Boolean; virtual;
function getText: String; virtual; function getText: String; virtual;
procedure setText(AValue: String); virtual; procedure setText(const AValue: String); virtual;
function GetContext: HDC; virtual; function GetContext: HDC; virtual;
function CreateWidget(const Params: TCreateParams):PGtkWidget; virtual; function CreateWidget(const Params: TCreateParams):PGtkWidget; virtual;
procedure DestroyWidget; virtual; procedure DestroyWidget; virtual;
@ -209,7 +209,7 @@ type
protected protected
function EatArrowKeys(const AKey: Word): Boolean; override; function EatArrowKeys(const AKey: Word): Boolean; override;
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
public public
procedure InitializeWidget; override; procedure InitializeWidget; override;
@ -331,7 +331,7 @@ type
procedure SetStaticBorderStyle(AValue: TStaticBorderStyle); procedure SetStaticBorderStyle(AValue: TStaticBorderStyle);
protected protected
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
public public
property Alignment: TAlignment read GetAlignment write SetAlignment; property Alignment: TAlignment read GetAlignment write SetAlignment;
@ -351,7 +351,7 @@ type
private private
FPageLabel: PGtkLabel; FPageLabel: PGtkLabel;
protected protected
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function getText: String; override; function getText: String; override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
procedure DestroyWidget; override; procedure DestroyWidget; override;
@ -373,7 +373,7 @@ type
procedure SetPageIndex(AIndex: Integer); procedure SetPageIndex(AIndex: Integer);
procedure SetShowTabs(const AShowTabs: Boolean); procedure SetShowTabs(const AShowTabs: Boolean);
procedure SetTabPosition(const ATabPosition: TTabPosition); procedure SetTabPosition(const ATabPosition: TTabPosition);
procedure SetTabLabelText(AChild: TCustomPage; AText: String); procedure SetTabLabelText(AChild: TCustomPage; const AText: String);
function GetTabLabelText(AChild: TCustomPage): String; function GetTabLabelText(AChild: TCustomPage): String;
end; end;
@ -431,7 +431,7 @@ type
TGtk3MenuItem = class(TGtk3Bin) TGtk3MenuItem = class(TGtk3Bin)
private private
function GetCaption: string; function GetCaption: string;
procedure SetCaption(AValue: string); procedure SetCaption(const AValue: string);
protected protected
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
public public
@ -487,7 +487,7 @@ type
procedure SetWordWrap(AValue: Boolean); procedure SetWordWrap(AValue: Boolean);
protected protected
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
function EatArrowKeys(const AKey: Word): Boolean; override; function EatArrowKeys(const AKey: Word): Boolean; override;
public public
@ -605,7 +605,7 @@ type
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
procedure DoBeforeLCLPaint; override; procedure DoBeforeLCLPaint; override;
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
public public
property BevelInner: TBevelCut read FBevelInner write FBevelInner; property BevelInner: TBevelCut read FBevelInner write FBevelInner;
property BevelOuter: TBevelCut read FBevelOuter write FBevelOuter; property BevelOuter: TBevelCut read FBevelOuter write FBevelOuter;
@ -618,7 +618,7 @@ type
protected protected
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
public public
end; end;
@ -635,9 +635,9 @@ type
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
function EatArrowKeys(const AKey: Word): Boolean; override; function EatArrowKeys(const AKey: Word): Boolean; override;
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
public public
procedure DumpPrivateStructValues(ADbgEvent: String); procedure DumpPrivateStructValues(const ADbgEvent: String);
public public
function CanFocus: Boolean; override; function CanFocus: Boolean; override;
procedure SetFocus; override; procedure SetFocus; override;
@ -664,7 +664,7 @@ type
procedure SetSpacing(AValue: Integer); procedure SetSpacing(AValue: Integer);
protected protected
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
public public
function IsWidgetOk: Boolean; override; function IsWidgetOk: Boolean; override;
@ -746,12 +746,12 @@ type
function GetTitle: String; function GetTitle: String;
procedure SetIcon(AValue: PGdkPixBuf); procedure SetIcon(AValue: PGdkPixBuf);
procedure SetSkipTaskBarHint(AValue: Boolean); procedure SetSkipTaskBarHint(AValue: Boolean);
procedure SetTitle(AValue: String); procedure SetTitle(const AValue: String);
protected protected
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
function EatArrowKeys(const AKey: Word): Boolean; override; function EatArrowKeys(const AKey: Word): Boolean; override;
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
public public
// function getClientBounds: TRect; override; // function getClientBounds: TRect; override;
function getClientRect: TRect; override; function getClientRect: TRect; override;
@ -779,7 +779,7 @@ type
FText: String; FText: String;
protected protected
function getText: String; override; function getText: String; override;
procedure setText(AValue: String); override; procedure setText(const AValue: String); override;
function CreateWidget(const Params: TCreateParams):PGtkWidget; override; function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
end; end;
@ -2475,7 +2475,7 @@ begin
Result := ''; Result := '';
end; end;
procedure TGtk3Widget.setText(AValue: String); procedure TGtk3Widget.setText(const AValue: String);
begin begin
// DebugLn('WARNING: ',dbgsName(LCLObject),' self=',dbgsName(Self),' does not implement setText !'); // DebugLn('WARNING: ',dbgsName(LCLObject),' self=',dbgsName(Self),' does not implement setText !');
end; end;
@ -3067,7 +3067,7 @@ begin
Result := FText; Result := FText;
end; end;
procedure TGtk3Panel.setText(AValue: String); procedure TGtk3Panel.setText(const AValue: String);
begin begin
if FText = AValue then if FText = AValue then
exit; exit;
@ -3101,7 +3101,7 @@ begin
end; end;
end; end;
procedure TGtk3GroupBox.setText(AValue: String); procedure TGtk3GroupBox.setText(const AValue: String);
begin begin
if IsWidgetOK then if IsWidgetOK then
begin begin
@ -3311,7 +3311,7 @@ begin
Result := ''; Result := '';
end; end;
procedure TGtk3Entry.setText(AValue: String); procedure TGtk3Entry.setText(const AValue: String);
begin begin
if IsValidHandle and IsWidgetOK then if IsValidHandle and IsWidgetOK then
PGtkEntry(Widget)^.set_text(PgChar(AValue)); PGtkEntry(Widget)^.set_text(PgChar(AValue));
@ -3731,7 +3731,7 @@ begin
Result := PGtkLabel(getContainerWidget)^.get_text; Result := PGtkLabel(getContainerWidget)^.get_text;
end; end;
procedure TGtk3StaticText.setText(AValue: String); procedure TGtk3StaticText.setText(const AValue: String);
begin begin
if IsWidgetOk then if IsWidgetOk then
PGtkLabel(getContainerWidget)^.set_text(PgChar(AValue)); PGtkLabel(getContainerWidget)^.set_text(PgChar(AValue));
@ -3961,7 +3961,7 @@ end;
{ TGtk3Page } { TGtk3Page }
procedure TGtk3Page.setText(AValue: String); procedure TGtk3Page.setText(const AValue: String);
begin begin
if Assigned(FPageLabel) then if Assigned(FPageLabel) then
FPageLabel^.set_text(PChar(AValue)); FPageLabel^.set_text(PChar(AValue));
@ -4271,7 +4271,7 @@ begin
PGtkNoteBook(GetContainerWidget)^.set_tab_pos(GtkPositionTypeMap[ATabPosition]); PGtkNoteBook(GetContainerWidget)^.set_tab_pos(GtkPositionTypeMap[ATabPosition]);
end; end;
procedure TGtk3NoteBook.SetTabLabelText(AChild: TCustomPage; AText: String); procedure TGtk3NoteBook.SetTabLabelText(AChild: TCustomPage; const AText: String);
begin begin
if IsWidgetOK then if IsWidgetOK then
TGtk3Widget(AChild.Handle).setText(AText); TGtk3Widget(AChild.Handle).setText(AText);
@ -4362,7 +4362,7 @@ begin
Result := PGtkMenuItem(FWidget)^.get_label; Result := PGtkMenuItem(FWidget)^.get_label;
end; end;
procedure TGtk3MenuItem.SetCaption(AValue: string); procedure TGtk3MenuItem.SetCaption(const AValue: string);
begin begin
if IsWidgetOK then if IsWidgetOK then
PGtkMenuItem(FWidget)^.set_label(PgChar(AValue)); PGtkMenuItem(FWidget)^.set_label(PgChar(AValue));
@ -4782,7 +4782,7 @@ begin
// DebugLn('TGtk3Memo.getText Result=',Result); // DebugLn('TGtk3Memo.getText Result=',Result);
end; end;
procedure TGtk3Memo.setText(AValue: String); procedure TGtk3Memo.setText(const AValue: String);
var var
ABuffer: PGtkTextBuffer; ABuffer: PGtkTextBuffer;
AIter: PGtkTextIter; AIter: PGtkTextIter;
@ -6011,13 +6011,13 @@ begin
Result := StrPas(PGtkComboBox(GetContainerWidget)^.get_title); Result := StrPas(PGtkComboBox(GetContainerWidget)^.get_title);
end; end;
procedure TGtk3ComboBox.setText(AValue: String); procedure TGtk3ComboBox.setText(const AValue: String);
begin begin
if Gtk3IsComboBox(FWidget) then if Gtk3IsComboBox(FWidget) then
PGtkComboBox(GetContainerWidget)^.set_title(PgChar(AValue)); PGtkComboBox(GetContainerWidget)^.set_title(PgChar(AValue));
end; end;
procedure TGtk3ComboBox.DumpPrivateStructValues(ADbgEvent: String); procedure TGtk3ComboBox.DumpPrivateStructValues(const ADbgEvent: String);
var var
AComboWidget: PGtkComboBox; AComboWidget: PGtkComboBox;
APrivate: PGtkComboBoxPrivate; APrivate: PGtkComboBoxPrivate;
@ -6253,7 +6253,7 @@ begin
Result := ''; Result := '';
end; end;
procedure TGtk3Button.setText(AValue: String); procedure TGtk3Button.setText(const AValue: String);
begin begin
if IsWidgetOk then if IsWidgetOk then
PGtkButton(FWidget)^.set_label(PgChar(AValue)); PGtkButton(FWidget)^.set_label(PgChar(AValue));
@ -6557,7 +6557,7 @@ begin
PGtkWindow(Widget)^.set_skip_taskbar_hint(AValue); PGtkWindow(Widget)^.set_skip_taskbar_hint(AValue);
end; end;
procedure TGtk3Window.SetTitle(AValue: String); procedure TGtk3Window.SetTitle(const AValue: String);
begin begin
PGtkWindow(FWidget)^.set_title(PGChar(AValue)); PGtkWindow(FWidget)^.set_title(PGChar(AValue));
end; end;
@ -6692,7 +6692,7 @@ begin
Result := Title; Result := Title;
end; end;
procedure TGtk3Window.setText(AValue: String); procedure TGtk3Window.setText(const AValue: String);
begin begin
Title := AValue; Title := AValue;
end; end;
@ -6853,7 +6853,7 @@ begin
Result := FText; Result := FText;
end; end;
procedure TGtk3HintWindow.setText(AValue: String); procedure TGtk3HintWindow.setText(const AValue: String);
begin begin
FText := AValue; FText := AValue;
end; end;

View File

@ -230,7 +230,7 @@ var
end; end;
end; end;
procedure AddEntries(const Desc: string; MultiMask: string); procedure AddEntries(const Desc: string; const MultiMask: string);
var i: integer; var i: integer;
CurDesc: string; CurDesc: string;
begin begin