From d884d5168984d36a5c08f4814e81b070d7c964d3 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 17 Nov 2009 16:18:15 +0100 Subject: Use getters instead of direct access to structures This will hopefully fix remaining GUI issues on PPC64. Needs further testing! Also, libgtk_kylix sources have been altered for use with gtk2forpascal-1.0.7 for Kylix compilation. --- libgtk_kylix/GTKMenus.pas | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'libgtk_kylix/GTKMenus.pas') diff --git a/libgtk_kylix/GTKMenus.pas b/libgtk_kylix/GTKMenus.pas index b01b6b3..7b1b9a8 100644 --- a/libgtk_kylix/GTKMenus.pas +++ b/libgtk_kylix/GTKMenus.pas @@ -149,7 +149,7 @@ uses GTKForms, GTKExtCtrls; constructor TGTKMenuBar.Create(AOwner: TComponent); begin inherited Create(AOwner); - FWidget := gtk_menu_bar_new; + FWidget := gtk_menu_bar_new(); Show; FItems := TGTKMenuItem.Create(Self); FItems.FParentMenu := Self; @@ -359,10 +359,17 @@ begin end; function TGTKMenuItem.GetTornOff: boolean; -begin - if FItemType = itTearOff then Result := Boolean(torn_off(PGTKTearOffMenuItem(FWidget)^)) else - if Assigned(FMenu) and (Count > 0) then Result := Boolean(torn_off(PGTKMenu(FMenu)^)) - else Result := False; +var b: gboolean; +begin + b := False; + if Application.GTKVersion_2_6_0_Up then begin + if FItemType = itTearOff then g_object_get(FWidget, 'tearoff-state', @b, nil) else + if Assigned(FMenu) and (Count > 0) then g_object_get(FMenu, 'tearoff-state', @b, nil); + end else begin + if FItemType = itTearOff then Result := Boolean(torn_off(PGTKTearOffMenuItem(FWidget)^)) else + if Assigned(FMenu) and (Count > 0) then Result := Boolean(torn_off(PGTKMenu(FMenu)^)); + end; + Result := b; end; procedure TGTKMenuItem.SetTornOff(Value: boolean); @@ -387,7 +394,7 @@ function TGTKMenuItem.GetChecked: boolean; begin Result := False; if (FItemType = itCheck) or (FItemType = itRadio) then - Result := Boolean(active(PGtkCheckMenuItem(FWidget)^)); + Result := gtk_check_menu_item_get_active(PGtkCheckMenuItem(FWidget)); end; procedure TGTKMenuItem.SetChecked(Value: boolean); -- cgit v1.2.3