diff options
Diffstat (limited to 'libgtk_kylix/GTKMenus.pas')
| -rw-r--r-- | libgtk_kylix/GTKMenus.pas | 19 |
1 files changed, 13 insertions, 6 deletions
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); |
