summaryrefslogtreecommitdiff
path: root/libgtk_kylix/GTKMenus.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2024-12-23 23:59:45 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-27 19:36:10 +0100
commitb9703b29819b619037cc282d719c187e51bacd30 (patch)
treebd6d73e5fb6bcb6eb307844103b3dff185f2ac9a /libgtk_kylix/GTKMenus.pas
parenta9634b933f71a9045e61d29c486f2d51d39fd1e2 (diff)
downloadtuxcmd-b9703b29819b619037cc282d719c187e51bacd30.tar.xz
Port to g-i generated glib2 bindings
Includes switch to FPC -Mobjfpc and related pointer style fixes.
Diffstat (limited to 'libgtk_kylix/GTKMenus.pas')
-rw-r--r--libgtk_kylix/GTKMenus.pas32
1 files changed, 15 insertions, 17 deletions
diff --git a/libgtk_kylix/GTKMenus.pas b/libgtk_kylix/GTKMenus.pas
index bf2c095..ed2bfba 100644
--- a/libgtk_kylix/GTKMenus.pas
+++ b/libgtk_kylix/GTKMenus.pas
@@ -24,9 +24,7 @@ unit GTKMenus;
interface
-uses gtk2, gdk2, glib2, Classes, GTKControls, GTKConsts, GTKUtils, GTKPixbuf;
- // Quick jump: QForms QControls QMenus
-
+uses gtk2, gdk2, glib2, lazglib2, lazgobject2, Classes, GTKControls, GTKConsts, GTKPixbuf;
type
(****************************************** TGDKSHORTCUTS ***********************************************************************)
@@ -142,7 +140,7 @@ function MakeGDKShortCut(Key: word; Locked, ModAlt, ModShift, ModCtrl : boolean)
(********************************************************************************************************************************)
implementation
-uses GTKForms, GTKExtCtrls;
+uses GTKForms;
(********************************************************************************************************************************)
(********************************************************************************************************************************)
@@ -236,9 +234,9 @@ begin
gtk_widget_show(FImageWidget);
gtk_image_menu_item_set_image(PGtkImageMenuItem(FWidget), FImageWidget);
end;
- itRadio: FWidget := gtk_radio_menu_item_new_with_mnemonic(AGroup, Pgchar(SCDefaultMenuItemCaption));
+ itRadio: FWidget := gtk_radio_menu_item_new_with_mnemonic(GLIB2.PGSList(AGroup), Pgchar(SCDefaultMenuItemCaption));
end;
- g_signal_connect(PGtkObject(FWidget), 'activate', G_CALLBACK(@TGTKMenuItem_activate), Self);
+ g_signal_connect_data(PGObject(FWidget), 'activate', TGCallback(@TGTKMenuItem_activate), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
@@ -264,7 +262,7 @@ function TGTKMenuItem.GetItem(Index: Integer): TGTKMenuItem;
begin
Result := nil;
if FItems = nil then Exit;
- Result := FItems[Index];
+ Result := TGTKMenuItem(FItems[Index]);
end;
procedure TGTKMenuItem.Delete(Index: Integer);
@@ -311,20 +309,20 @@ function TGTKMenuItem.GetCaption: string;
begin
Result := '';
if FItemType in [itSeparator, itTearOff] then Exit;
- if Assigned(ChildControl) then Result := PgcharToString(gtk_label_get_text(PGtkLabel(ChildControl)));
+ if Assigned(ChildControl) then Result := String(gtk_label_get_text(PGtkLabel(ChildControl)));
end;
procedure TGTKMenuItem.SetCaption(Value: string);
begin
if FItemType in [itSeparator, itTearOff] then Exit;
- gtk_label_set_markup_with_mnemonic(PGtkLabel(ChildControl), StringToPgchar(Value));
+ gtk_label_set_markup_with_mnemonic(PGtkLabel(ChildControl), PChar(Value));
if FTearOffTitle = '' then SetTearOffTitle(Value);
end;
procedure TGTKMenuItem.SetCaptionPlain(Value: string);
begin
if FItemType in [itSeparator, itTearOff] then Exit;
- gtk_label_set_markup(PGtkLabel(ChildControl), StringToPgchar(Value));
+ gtk_label_set_markup(PGtkLabel(ChildControl), PChar(Value));
if FTearOffTitle = '' then SetTearOffTitle(Value);
end;
@@ -333,8 +331,8 @@ begin
FTearOffTitle := Value;
if FItemType = itTearOff then begin
if Assigned(FParentMenu) and (FParentMenu is TGTKMenuItem) and Assigned((FParentMenu as TGTKMenuItem).FMenu)
- then gtk_menu_set_title(PGtkMenu((FParentMenu as TGTKMenuItem).FMenu), StringToPgchar(FTearOffTitle))
- end else if Assigned(FMenu) then gtk_menu_set_title(PGtkMenu(FMenu), StringToPgchar(FTearOffTitle));
+ then gtk_menu_set_title(PGtkMenu((FParentMenu as TGTKMenuItem).FMenu), PChar(FTearOffTitle))
+ end else if Assigned(FMenu) then gtk_menu_set_title(PGtkMenu(FMenu), PChar(FTearOffTitle));
end;
function TGTKMenuItem.GetRightJustified: boolean;
@@ -362,8 +360,8 @@ function TGTKMenuItem.GetTornOff: boolean;
var b: gboolean;
begin
b := False;
- 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);
+ if FItemType = itTearOff then g_object_get(PGObject(FWidget), 'tearoff-state', [@b, nil]) else
+ if Assigned(FMenu) and (Count > 0) then g_object_get(PGObject(FMenu), 'tearoff-state', [@b, nil]);
Result := b;
end;
@@ -421,12 +419,12 @@ end;
function TGTKMenuItem.GetGroup: TGTKMenuItemGroup;
begin
- Result := gtk_radio_menu_item_get_group(PGtkRadioMenuItem(FWidget));
+ Result := LAZGLIB2.PGSList(gtk_radio_menu_item_get_group(PGtkRadioMenuItem(FWidget)));
end;
procedure TGTKMenuItem.SetGroup(Value: TGTKMenuItemGroup);
begin
- gtk_radio_menu_item_set_group(PGtkRadioMenuItem(FWidget), Value);
+ gtk_radio_menu_item_set_group(PGtkRadioMenuItem(FWidget), GLIB2.PGSList(Value) );
end;
(********************************************************************************************************************************)
@@ -457,7 +455,7 @@ end;
procedure TGDKShortCuts.AddName(Item: string);
var Key, Modifiers: guint;
begin
- gtk_accelerator_parse(StringToPgchar(Item), @Key, @Modifiers);
+ gtk_accelerator_parse(PChar(Item), @Key, @Modifiers);
if Key <> 0 then Add(MakeGDKShortCut(Key, False, Modifiers and GDK_MOD1_MASK = GDK_MOD1_MASK, Modifiers and GDK_SHIFT_MASK = GDK_SHIFT_MASK, Modifiers and GDK_CONTROL_MASK = GDK_CONTROL_MASK));
end;