LCL: gtk2: fixed access to private variables of TWinControl

git-svn-id: trunk@38638 -
This commit is contained in:
mattias 2012-09-13 09:42:10 +00:00
parent 5d52baefc5
commit 882516cfb1
2 changed files with 15 additions and 13 deletions

View File

@ -29,6 +29,9 @@
This unit manages the command line parameters for lazarus and startlazarus,
but not lazbuild.
ToDo:
Linux: try pidof
}
unit IDEGuiCmdLine;
@ -41,10 +44,10 @@ uses
LazarusIDEStrConsts, IDECmdLine;
procedure ParseGuiCmdLineParams(var SkipAutoLoadingLastProject,
StartedByStartLazarus,
EnableRemoteControl,
ShowSplashScreen,
Setup: Boolean);
StartedByStartLazarus,
EnableRemoteControl,
ShowSplashScreen,
Setup: Boolean);
// remote control
const
@ -74,6 +77,7 @@ uses MacOSAll, CarbonProc;
function IsLazarusPIDRunning(aPID: int64): boolean;
{$IFDEF UseProcFileSystem}
function CheckProcFileSystem: boolean;
var
sl: TStringList;
@ -95,6 +99,7 @@ function IsLazarusPIDRunning(aPID: int64): boolean;
sl.Free;
end;
end;
{$ENDIF}
{$IFDEF UseFreeBSDKernProc}
function CheckFreeBSDKernProc: boolean;

View File

@ -38,6 +38,7 @@ type
TBitBtnWidgetInfo = record
ImageWidget: Pointer;
LabelWidget: Pointer;
SetLayoutCalled: boolean;
end;
{ TGtk2WSBitBtn }
@ -95,9 +96,6 @@ type
TCustomBitBtnAccess = class(TCustomBitBtn)
end;
TWinControlAccess = class(TWinControl)
end;
procedure GtkWSBitBtn_StateChanged(AWidget: PGtkWidget; {%H-}AState: TGtkStateType; AInfo: PWidgetInfo); cdecl;
var
BitBtn: TCustomBitBtnAccess;
@ -233,8 +231,7 @@ begin
WidgetInfo := GetWidgetInfo(MainWidget);
BitBtnInfo := WidgetInfo^.UserData;
BuildNeeded := UpdateGlyph(ABitBtn, BitBtnInfo, AValue, GtkStateToButtonState[GTK_WIDGET_STATE(MainWidget)]);
// at initialization widget will be built in SetLayout
if not (wcfInitializing in {%H-}TWinControlAccess(ABitBtn).FWinControlFlags) and BuildNeeded then
if BuildNeeded and BitBtnInfo^.SetLayoutCalled then
BuildWidget(ABitBtn, MainWidget, BitBtnInfo, ABitBtn.Caption);
end;
@ -250,6 +247,7 @@ begin
MainWidget := {%H-}Pointer(ABitBtn.Handle);
WidgetInfo := GetWidgetInfo(MainWidget);
BitBtnInfo := WidgetInfo^.UserData;
BitBtnInfo^.SetLayoutCalled:=true;
BuildWidget(ABitBtn, MainWidget, BitBtnInfo, ABitBtn.Caption);
end;
@ -294,13 +292,12 @@ var
BitBtnInfo: PBitBtnWidgetInfo;
BuildNeeded: Boolean;
begin
// at initialization widget will be built in SetLayout
if (wcfInitializing in TWinControlAccess(AWinControl).FWinControlFlags)
or not WSCheckHandleAllocated(AWincontrol, 'SetText') then
Exit;
MainWidget := {%H-}Pointer(AWinControl.Handle);
WidgetInfo := GetWidgetInfo(MainWidget);
BitBtnInfo := WidgetInfo^.UserData;
if (not BitBtnInfo^.SetLayoutCalled)
or not WSCheckHandleAllocated(AWincontrol, 'SetText') then
Exit;
LabelWidget := BitBtnInfo^.LabelWidget;
BuildNeeded := (LabelWidget = nil) xor (AText = '');
if BuildNeeded then