summaryrefslogtreecommitdiff
path: root/libgtk_kylix
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
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')
-rw-r--r--libgtk_kylix/GTKClasses.pas14
-rw-r--r--libgtk_kylix/GTKConsts.pas2
-rw-r--r--libgtk_kylix/GTKControls.pas73
-rw-r--r--libgtk_kylix/GTKDialogs.pas18
-rw-r--r--libgtk_kylix/GTKExtCtrls.pas24
-rw-r--r--libgtk_kylix/GTKForms.pas47
-rw-r--r--libgtk_kylix/GTKMenus.pas32
-rw-r--r--libgtk_kylix/GTKPixbuf.pas3
-rw-r--r--libgtk_kylix/GTKStdCtrls.pas94
-rw-r--r--libgtk_kylix/GTKText.pas4
-rw-r--r--libgtk_kylix/GTKUtils.pas24
-rw-r--r--libgtk_kylix/GTKView.pas95
12 files changed, 194 insertions, 236 deletions
diff --git a/libgtk_kylix/GTKClasses.pas b/libgtk_kylix/GTKClasses.pas
index d668fb0..6071d74 100644
--- a/libgtk_kylix/GTKClasses.pas
+++ b/libgtk_kylix/GTKClasses.pas
@@ -24,7 +24,7 @@ unit GTKClasses;
interface
-uses gtk2, gdk2, glib2, Classes, SysUtils;
+uses gtk2, lazglib2, Classes, SysUtils;
type
@@ -73,10 +73,6 @@ type
(********************************************************************************************************************************)
implementation
-uses GTKUtils;
-
-(********************************************************************************************************************************)
-(********************************************************************************************************************************)
constructor TGList.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -98,14 +94,14 @@ end;
procedure TGList.Append(Data: string);
begin
- Append(Pointer(StringToPgchar(Data)));
+ Append(Pointer(PChar(Data)));
end;
procedure TGList.Delete(Index: integer);
-var El: PGSList;
+var El: PGList;
begin
El := g_list_nth_data(FList, Index);
- if El <> nil then FList := g_list_remove(FList, El);
+ if El <> nil then FList := g_list_remove(FList, gpointer(El));
end;
function TGList.Count: integer;
@@ -158,7 +154,7 @@ end;
procedure TGTKTimer.Start;
begin
if FHandlerID > 0 then Stop;
- if FEnabled then FHandlerID := gtk_timeout_add(FInterval, TGTKTimer_Timeout, Self);
+ if FEnabled then FHandlerID := gtk_timeout_add(FInterval, @TGTKTimer_Timeout, Self);
end;
procedure TGTKTimer.Stop;
diff --git a/libgtk_kylix/GTKConsts.pas b/libgtk_kylix/GTKConsts.pas
index 9b4e545..0b18b1c 100644
--- a/libgtk_kylix/GTKConsts.pas
+++ b/libgtk_kylix/GTKConsts.pas
@@ -24,7 +24,7 @@ unit GTKConsts;
interface
-uses glib2, gdk2, gtk2;
+uses lazglib2, gtk2;
const // copied from gdkkeysyms
GDK_BackSpace = $FF08;
diff --git a/libgtk_kylix/GTKControls.pas b/libgtk_kylix/GTKControls.pas
index ceafe18..82de154 100644
--- a/libgtk_kylix/GTKControls.pas
+++ b/libgtk_kylix/GTKControls.pas
@@ -24,8 +24,7 @@ unit GTKControls;
interface
-uses gtk2, gdk2, glib2, Classes;
- // Quick jump: QForms QControls
+uses gtk2, gdk2, lazglib2, lazgobject2, Classes;
const
@@ -416,7 +415,7 @@ function TGTKControl.GetEnabled: boolean;
var b: gboolean;
begin
b := False;
- if not (csDestroying in ComponentState) then g_object_get(FWidget, 'sensitive', @b, nil);
+ if not (csDestroying in ComponentState) then g_object_get(PGObject(FWidget), 'sensitive', [@b, nil]);
Result := b;
end;
@@ -454,29 +453,27 @@ begin
FPopupMenu := Value;
if not Assigned(Value) then begin
if not Assigned(FOnMouseDown) then begin
- g_signal_handler_disconnect(PGtkObject(FWidget), FButtonPressSignalHandler);
+ g_signal_handler_disconnect(PGObject(FWidget), FButtonPressSignalHandler);
FButtonPressSignalHandler := 0;
end;
end else
if FButtonPressSignalHandler = 0
- then FButtonPressSignalHandler := g_signal_connect(PGtkObject(FWidget), 'button-press-event', G_CALLBACK(@TGTKControl_button_press_event), Self)
+ then FButtonPressSignalHandler := g_signal_connect_data(PGObject(FWidget), 'button-press-event', TGCallback(@TGTKControl_button_press_event), Self, nil, G_CONNECT_DEFAULT)
end;
end;
function TGTKControl.GetTooltip: string;
-var TooltipsData : PGtkTooltipsData;
- text: PChar;
+var text: PChar;
begin
text := nil;
Result := '';
- g_object_get(FWidget, 'tooltip-text', @text, nil);
+ g_object_get(PGObject(FWidget), 'tooltip-text', [@text, nil]);
if text <> nil then Result := string(text);
end;
procedure TGTKControl.SetTooltip(Value: string);
-var FParentForm : TCustomGTKForm;
begin
- g_object_set(FWidget, 'tooltip-text', PChar(Value), nil)
+ g_object_set(PGObject(FWidget), 'tooltip-text', [PChar(Value), nil])
end;
procedure TGTKControl.SetFocus;
@@ -489,7 +486,7 @@ function TGTKControl.GetCanFocus: boolean;
var b: gboolean;
begin
b := False;
- if not (csDestroying in ComponentState) then g_object_get(FWidget, 'can-focus', @b, nil);
+ if not (csDestroying in ComponentState) then g_object_get(PGObject(FWidget), 'can-focus', [@b, nil]);
Result := b;
end;
@@ -497,7 +494,7 @@ procedure TGTKControl.SetCanFocus(Value: boolean);
begin
{ if Value then FWidget^.private_flags := FWidget^.private_flags or GTK_CAN_FOCUS
else FWidget^.private_flags := FWidget^.private_flags and (not GTK_CAN_FOCUS); }
- g_object_set(G_OBJECT(FWidget), 'can-focus', Ord(Value), nil);
+ g_object_set(PGObject(FWidget), 'can-focus', [Ord(Value), nil]);
end;
function TGTKControl.GetFocused: boolean;
@@ -507,7 +504,7 @@ begin
Result := False;
try
if (csDestroying in ComponentState) or (FWidget = nil) then Exit;
- g_object_get(FWidget, 'has-focus', @b, nil);
+ g_object_get(PGObject(FWidget), 'has-focus', [@b, nil]);
Result := b;
except end;
end;
@@ -549,8 +546,8 @@ begin
if @FOnKeyDown <> @Value then begin
FOnKeyDown := Value;
if Assigned(Value)
- then FKeyDownSignalHandler := g_signal_connect(PGtkObject(FWidget), 'key-press-event', G_CALLBACK(@TGTKControl_key_press_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FKeyDownSignalHandler);
+ then FKeyDownSignalHandler := g_signal_connect_data(PGObject(FWidget), 'key-press-event', TGCallback(@TGTKControl_key_press_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FKeyDownSignalHandler);
end;
end;
@@ -559,8 +556,8 @@ begin
if @FOnKeyUp <> @Value then begin
FOnKeyUp := Value;
if Assigned(Value)
- then FKeyUpSignalHandler := g_signal_connect(PGtkObject(FWidget), 'key-release-event', G_CALLBACK(@TGTKControl_key_release_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FKeyUpSignalHandler);
+ then FKeyUpSignalHandler := g_signal_connect_data(PGObject(FWidget), 'key-release-event', TGCallback(@TGTKControl_key_release_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FKeyUpSignalHandler);
end;
end;
@@ -585,8 +582,8 @@ begin
if @FOnEnter <> @Value then begin
FOnEnter := Value;
if Assigned(Value)
- then FFocusInSignalHandler := g_signal_connect(PGtkObject(FWidget), 'focus-in-event', G_CALLBACK(@TGTKControl_focus_in_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FFocusInSignalHandler);
+ then FFocusInSignalHandler := g_signal_connect_data(PGObject(FWidget), 'focus-in-event', TGCallback(@TGTKControl_focus_in_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FFocusInSignalHandler);
end;
end;
@@ -595,8 +592,8 @@ begin
if @FOnExit <> @Value then begin
FOnExit := Value;
if Assigned(Value)
- then FFocusOutSignalHandler := g_signal_connect(PGtkObject(FWidget), 'focus-out-event', G_CALLBACK(@TGTKControl_focus_out_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FFocusOutSignalHandler);
+ then FFocusOutSignalHandler := g_signal_connect_data(PGObject(FWidget), 'focus-out-event', TGCallback(@TGTKControl_focus_out_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FFocusOutSignalHandler);
end;
end;
@@ -666,12 +663,12 @@ begin
FOnMouseDown := Value;
if not Assigned(Value) then begin
if (not Assigned(FPopupMenu)) and (not Assigned(FOnDblClick)) then begin
- g_signal_handler_disconnect(PGtkObject(FWidget), FButtonPressSignalHandler);
+ g_signal_handler_disconnect(PGObject(FWidget), FButtonPressSignalHandler);
FButtonPressSignalHandler := 0;
end;
end else
if FButtonPressSignalHandler = 0
- then FButtonPressSignalHandler := g_signal_connect(PGtkObject(FWidget), 'button-press-event', G_CALLBACK(@TGTKControl_button_press_event), Self)
+ then FButtonPressSignalHandler := g_signal_connect_data(PGObject(FWidget), 'button-press-event', TGCallback(@TGTKControl_button_press_event), Self, nil, G_CONNECT_DEFAULT)
end;
end;
@@ -681,12 +678,12 @@ begin
FOnDblClick := Value;
if not Assigned(Value) then begin
if (not Assigned(FPopupMenu)) and (not Assigned(FOnMouseDown)) then begin
- g_signal_handler_disconnect(PGtkObject(FWidget), FButtonPressSignalHandler);
+ g_signal_handler_disconnect(PGObject(FWidget), FButtonPressSignalHandler);
FButtonPressSignalHandler := 0;
end;
end else
if FButtonPressSignalHandler = 0
- then FButtonPressSignalHandler := g_signal_connect(PGtkObject(FWidget), 'button-press-event', G_CALLBACK(@TGTKControl_button_press_event), Self)
+ then FButtonPressSignalHandler := g_signal_connect_data(PGObject(FWidget), 'button-press-event', TGCallback(@TGTKControl_button_press_event), Self, nil, G_CONNECT_DEFAULT)
end;
end;
@@ -708,8 +705,8 @@ procedure TGTKControl.SetOnMouseUp(Value: TGDKMouseEvent);
begin
if @FOnMouseUp <> @Value then begin
FOnMouseUp := Value;
- if Assigned(Value) then FButtonReleaseSignalHandler := g_signal_connect(PGtkObject(FWidget), 'button-release-event', G_CALLBACK(@TGTKControl_button_release_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FButtonReleaseSignalHandler);
+ if Assigned(Value) then FButtonReleaseSignalHandler := g_signal_connect_data(PGObject(FWidget), 'button-release-event', TGCallback(@TGTKControl_button_release_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FButtonReleaseSignalHandler);
end;
end;
@@ -738,8 +735,8 @@ procedure TGTKControl.SetOnMouseMove(Value: TGDKMouseEvent);
begin
if @FOnMouseMove <> @Value then begin
FOnMouseMove := Value;
- if Assigned(Value) then FMotionNotifyHandler := g_signal_connect(PGtkObject(FWidget), 'motion-notify-event', G_CALLBACK(@TGTKControl_motion_notify_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FMotionNotifyHandler);
+ if Assigned(Value) then FMotionNotifyHandler := g_signal_connect_data(PGObject(FWidget), 'motion-notify-event', TGCallback(@TGTKControl_motion_notify_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FMotionNotifyHandler);
end;
end;
@@ -747,14 +744,14 @@ function TGTKControl.GetDefault: boolean;
var b: gboolean;
begin
b := False;
- if not (csDestroying in ComponentState) then g_object_get(FWidget, 'has-default', @b, nil);
+ if not (csDestroying in ComponentState) then g_object_get(PGObject(FWidget), 'has-default', [@b, nil]);
Result := b;
end;
procedure TGTKControl.SetDefault(Value: boolean);
begin
if (csDestroying in ComponentState) then Exit;
- g_object_set(FWidget, 'can-default', Ord(Value), nil);
+ g_object_set(PGObject(FWidget), 'can-default', [Ord(Value), nil]);
end;
procedure TGTKControl.Invalidate;
@@ -787,8 +784,8 @@ begin
if @FOnExpose <> @Value then begin
FOnExpose := Value;
if Assigned(Value)
- then FExposeSignalHandler := g_signal_connect(PGtkObject(FWidget), 'expose-event', G_CALLBACK(@TGTKControl_expose_event), Self)
- else g_signal_handler_disconnect(PGtkObject(FWidget), FExposeSignalHandler);
+ then FExposeSignalHandler := g_signal_connect_data(PGObject(FWidget), 'expose-event', TGCallback(@TGTKControl_expose_event), Self, nil, G_CONNECT_DEFAULT)
+ else g_signal_handler_disconnect(PGObject(FWidget), FExposeSignalHandler);
end;
end;
@@ -804,12 +801,12 @@ end;
function TGTKControl.GetData(Key: string): Pointer;
begin
- Result := g_object_get_data(G_OBJECT(FWidget), PChar(Key));
+ Result := g_object_get_data(PGObject(FWidget), PChar(Key));
end;
procedure TGTKControl.SetData(Key: string; Value: Pointer);
begin
- g_object_set_data(G_OBJECT(FWidget), PChar(Key), Value);
+ g_object_set_data(PGObject(FWidget), PChar(Key), Value);
end;
(********************************************************************************************************************************)
@@ -847,7 +844,7 @@ end;
function TGTKContainer.GetChildrenCount: integer;
var List: PGList;
begin
- List := gtk_container_get_children(PGtkContainer(FWidget));
+ List := LAZGLIB2.PGList(gtk_container_get_children(PGtkContainer(FWidget)));
Result := g_list_length(List);
g_list_free(List);
end;
@@ -1020,7 +1017,7 @@ function TGTKTable.GetRowCount: integer;
var nrows: guint;
begin
nrows := 1;
- g_object_get(FWidget, 'n-rows', @nrows, nil);
+ g_object_get(PGObject(FWidget), 'n-rows', [@nrows, nil]);
Result := nrows;
end;
@@ -1033,7 +1030,7 @@ function TGTKTable.GetColCount: integer;
var ncols: guint;
begin
ncols := 1;
- g_object_get(FWidget, 'n-columns', @ncols, nil);
+ g_object_get(PGObject(FWidget), 'n-columns', [@ncols, nil]);
Result := ncols;
end;
diff --git a/libgtk_kylix/GTKDialogs.pas b/libgtk_kylix/GTKDialogs.pas
index e6e5c7e..17b32d0 100644
--- a/libgtk_kylix/GTKDialogs.pas
+++ b/libgtk_kylix/GTKDialogs.pas
@@ -24,7 +24,7 @@ unit GTKDialogs;
interface
-uses gtk2, gdk2, glib2, Classes, GTKControls, GTKConsts, GTKUtils, GTKClasses, GTKForms;
+uses gtk2, gdk2, lazglib2, lazgobject2, Classes, GTKControls, GTKUtils, GTKClasses, GTKForms;
type
@@ -105,7 +105,7 @@ end;
constructor TGTKFileSelectionDialog.CreateWithTitle(AOwner: TComponent; const Title: string);
begin
inherited Create(AOwner);
- FWidget := gtk_file_selection_new(StringToPgchar(Title));
+ FWidget := gtk_file_selection_new(PChar(Title));
Show;
end;
@@ -128,7 +128,7 @@ function TGTKFileSelectionDialog.GetShowFileOpButtons: boolean;
var b: Boolean;
begin
b := False;
- g_object_get(FWidget, 'show-fileops', @b, nil);
+ g_object_get(PGObject(FWidget), 'show-fileops', [@b, nil]);
Result := b;
end;
@@ -160,7 +160,7 @@ end;
constructor TGTKColorSelectionDialog.CreateWithTitle(AOwner: TComponent; const Title: string);
begin
inherited Create(AOwner);
- FWidget := gtk_color_selection_dialog_new(StringToPgchar(Title));
+ FWidget := gtk_color_selection_dialog_new(PChar(Title));
Show;
end;
@@ -216,7 +216,7 @@ end;
constructor TGTKFontSelectionDialog.CreateWithTitle(AOwner: TComponent; const Title: string);
begin
inherited Create(AOwner);
- FWidget := gtk_font_selection_dialog_new(StringToPgchar(Title));
+ FWidget := gtk_font_selection_dialog_new(PChar(Title));
Show;
end;
@@ -227,22 +227,22 @@ end;
function TGTKFontSelectionDialog.GetFontName: string;
begin
- Result := PgcharToString(gtk_font_selection_dialog_get_font_name(PGtkFontSelectionDialog(FWidget)));
+ Result := String(gtk_font_selection_dialog_get_font_name(PGtkFontSelectionDialog(FWidget)));
end;
procedure TGTKFontSelectionDialog.SetFontName(Value: string);
begin
- gtk_font_selection_dialog_set_font_name(PGtkFontSelectionDialog(FWidget), StringToPgchar(Value));
+ gtk_font_selection_dialog_set_font_name(PGtkFontSelectionDialog(FWidget), PChar(Value));
end;
function TGTKFontSelectionDialog.GetPreviewText: string;
begin
- Result := PgcharToString(gtk_font_selection_dialog_get_preview_text(PGtkFontSelectionDialog(FWidget)));
+ Result := String(gtk_font_selection_dialog_get_preview_text(PGtkFontSelectionDialog(FWidget)));
end;
procedure TGTKFontSelectionDialog.SetPreviewText(Value: string);
begin
- gtk_font_selection_dialog_set_preview_text(PGtkFontSelectionDialog(FWidget), StringToPgchar(Value));
+ gtk_font_selection_dialog_set_preview_text(PGtkFontSelectionDialog(FWidget), PChar(Value));
end;
(********************************************************************************************************************************)
diff --git a/libgtk_kylix/GTKExtCtrls.pas b/libgtk_kylix/GTKExtCtrls.pas
index 8ae5abc..777f8ed 100644
--- a/libgtk_kylix/GTKExtCtrls.pas
+++ b/libgtk_kylix/GTKExtCtrls.pas
@@ -24,9 +24,7 @@ unit GTKExtCtrls;
interface
-uses gtk2, gdk2, glib2, Classes, GTKControls, GTKConsts, GTKStdCtrls, GTKUtils, GTKMenus;
- // Quick jump: QForms QControls QStdCtrls QExtCtrls
-
+uses gtk2, lazglib2, lazgobject2, Classes, GTKControls, GTKStdCtrls, GTKMenus;
type
@@ -326,12 +324,12 @@ end;
function TGTKProgressBar.GetText: string;
begin
- Result := PgcharToString(gtk_progress_bar_get_text(PGtkProgressBar(FWidget)));
+ Result := String(gtk_progress_bar_get_text(PGtkProgressBar(FWidget)));
end;
procedure TGTKProgressBar.SetText(Value: string);
begin
- gtk_progress_bar_set_text(PGtkProgressbar(FWidget), StringToPgchar(Value));
+ gtk_progress_bar_set_text(PGtkProgressbar(FWidget), PChar(Value));
end;
function TGTKProgressBar.GetFraction: Double;
@@ -398,7 +396,7 @@ end;
procedure TGTKPaned.SetChild1(Value: TGTKControl);
begin
gtk_paned_pack1(PGtkPaned(FWidget), Value.FWidget, True, False);
- g_signal_connect(PGtkObject(Value.FWidget), 'size-allocate', G_CALLBACK(@TGTKPaned_resize), Self);
+ g_signal_connect_data(PGObject(Value.FWidget), 'size-allocate', TGCallback(@TGTKPaned_resize), Self, nil, G_CONNECT_DEFAULT);
end;
procedure TGTKPaned.SetChild2(Value: TGTKControl);
@@ -439,7 +437,7 @@ end;
procedure TGTKNotebook_switch_page(notebook: PGtkNotebook; page: PGtkNotebookPage; page_num: guint; user_data: gpointer); cdecl;
begin
- if Assigned(user_data) and Assigned(TGTKNotebook(user_data).FOnSwitchPage) then TGTKNotebook(user_data).FOnSwitchPage(user_data);
+ if Assigned(user_data) and Assigned(TGTKNotebook(user_data).FOnSwitchPage) then TGTKNotebook(user_data).FOnSwitchPage(TObject(user_data));
end;
constructor TGTKNotebook.Create(AOwner: TComponent);
@@ -447,7 +445,7 @@ begin
inherited Create(AOwner);
FWidget := gtk_notebook_new;
FOnSwitchPage := nil;
- g_signal_connect_after(PGtkObject(FWidget), 'switch-page', G_CALLBACK(@TGTKNotebook_switch_page), Self);
+ g_signal_connect_data(PGObject(FWidget), 'switch-page', TGCallback(@TGTKNotebook_switch_page), Self, nil, [G_CONNECT_AFTER]);
Show;
end;
@@ -461,17 +459,17 @@ function _gtk_notebook_append_page(notebook:PGtkNotebook; child:PGtkWidget; tab_
function TGTKNotebook.AppendPage(Child: TGTKControl; Caption: string): integer;
begin
Result := _gtk_notebook_append_page(PGtkNotebook(FWidget), Child.FWidget, nil);
- gtk_notebook_set_tab_label_text(PGtkNotebook(FWidget), Child.FWidget, StringToPgchar(Caption));
+ gtk_notebook_set_tab_label_text(PGtkNotebook(FWidget), Child.FWidget, PChar(Caption));
end;
function TGTKNotebook.GetCaption(PageNo: integer): string;
begin
- Result := PgcharToString(gtk_notebook_get_tab_label_text(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo)));
+ Result := String(gtk_notebook_get_tab_label_text(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo)));
end;
procedure TGTKNotebook.SetCaption(PageNo: integer; Caption: string);
begin
- gtk_notebook_set_tab_label_text(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), StringToPgchar(Caption));
+ gtk_notebook_set_tab_label_text(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), PChar(Caption));
end;
procedure TGTKNotebook.RemovePage(PageNo: integer);
@@ -584,11 +582,11 @@ begin
inherited Create(AOwner);
FOnChanged := nil;
FWidget := gtk_option_menu_new;
- g_signal_connect(PGtkObject(FWidget), 'changed', G_CALLBACK(@TGTKOptionMenu_changed), Self);
+ g_signal_connect_data(PGObject(FWidget), 'changed', TGCallback(@TGTKOptionMenu_changed), Self, nil, G_CONNECT_DEFAULT);
Show;
FItems := TGTKMenuItem.Create(Self);
FItems.FParentMenu := Self;
- FItems.Notify := ItemsChanged;
+ FItems.Notify := @ItemsChanged;
end;
destructor TGTKOptionMenu.Destroy;
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index 0224825..a3572b6 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -24,8 +24,7 @@ unit GTKForms;
interface
-uses gtk2, gdk2, glib2, Classes, SysUtils, GTKControls, GTKConsts;
-
+uses gtk2, gdk2, lazglib2, lazgobject2, Classes, SysUtils, GTKControls, GTKConsts;
type // Some basic types
PCharArray = array[0..0] of PChar;
@@ -118,7 +117,7 @@ type // Some basic types
procedure ShowModal; virtual;
function CloseQuery: Boolean; virtual;
procedure SetDefaultSize(DefaultWidth, DefaultHeight: integer);
- procedure SetTransientFor(Parent: TCustomGTKForm);
+ procedure SetTransientFor(AParent: TCustomGTKForm);
procedure Maximize;
procedure Unmaximize;
procedure Minimize;
@@ -225,10 +224,6 @@ function GetParentForm(Control: TGTKControl): TCustomGTKForm;
(********************************************************************************************************************************)
implementation
-uses GTKUtils;
-
-(********************************************************************************************************************************)
-(********************************************************************************************************************************)
constructor TGDKScreen.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -249,7 +244,7 @@ end;
function TGDKScreen.GetForm(Index: Integer): TCustomGTKForm;
begin
- Result := FForms[Index];
+ Result := TCustomGTKForm(FForms[Index]);
end;
function TGDKScreen.GetFormCount: Integer;
@@ -370,7 +365,7 @@ function TCustomGTKForm.GetWindowPosition: TWindowPosition;
var pos: TGtkWindowPosition;
begin
pos := GTK_WIN_POS_NONE;
- g_object_get(FWidget, 'window-position', @pos, nil);
+ g_object_get(PGObject(FWidget), 'window-position', [@pos, nil]);
Result := TWindowPosition(pos);
end;
@@ -394,10 +389,10 @@ begin
gtk_window_set_default_size(PGtkWindow(FWidget), DefaultWidth, DefaultHeight);
end;
-procedure TCustomGTKForm.SetTransientFor(Parent: TCustomGTKForm);
+procedure TCustomGTKForm.SetTransientFor(AParent: TCustomGTKForm);
begin
- if Assigned(Parent) and Assigned(Parent.FWidget) then
- gtk_window_set_transient_for(PGtkWindow(FWidget), PGtkWindow(Parent.FWidget));
+ if Assigned(AParent) and Assigned(AParent.FWidget) then
+ gtk_window_set_transient_for(PGtkWindow(FWidget), PGtkWindow(AParent.FWidget));
end;
procedure TCustomGTKForm.ShowModal;
@@ -527,9 +522,9 @@ begin
FMainForm := nil;
FMainFormSet := False;
if not Assigned(Classes.ApplicationHandleException) then
- Classes.ApplicationHandleException := HandleException;
+ Classes.ApplicationHandleException := @HandleException;
if not Assigned(Classes.ApplicationShowException) then
- Classes.ApplicationShowException := ShowException;
+ Classes.ApplicationShowException := @ShowException;
CreateHandle;
HookSynchronizeWakeup;
FThreadID := 0;
@@ -578,10 +573,10 @@ var
E: TExceptionEvent;
begin
UnhookSynchronizeWakeup;
- P := HandleException;
+ P := @HandleException;
if @P = @Classes.ApplicationHandleException then
Classes.ApplicationHandleException := nil;
- E := ShowException;
+ E := @ShowException;
if @E = @Classes.ApplicationShowException then
Classes.ApplicationShowException := nil;
inherited Destroy;
@@ -723,12 +718,12 @@ begin
Exit;
end;
Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
- GTK_BUTTONS_NONE, '%s', StringToPgchar(Text));
+ GTK_BUTTONS_NONE, '%s', PChar(Text));
for i := 1 to NumMessageButtons do
if TMessageButton(i - 1) in Buttons
then gtk_dialog_add_button(PGtkDialog(Dialog), MessageButtonID[i], i);
- if Escape <> mbNone then g_signal_connect(PGtkObject(Dialog), 'key-press-event', G_CALLBACK(@TGTKApplication_MessageBox_key_press_event),
- Pointer(Ord(Escape) + 1{MessageButtonID[Ord(Escape)]}));
+ if Escape <> mbNone then g_signal_connect_data(PGObject(Dialog), 'key-press-event', TGCallback(@TGTKApplication_MessageBox_key_press_event),
+ Pointer(Ord(Escape) + 1{MessageButtonID[Ord(Escape)]}), nil, G_CONNECT_DEFAULT);
if Default <> mbNone then gtk_dialog_set_default_response(PGtkDialog(Dialog), Ord(Default));
Result := TMessageButton(gtk_dialog_run(PGtkDialog(Dialog)) - 1);
gtk_widget_destroy(Dialog);
@@ -764,9 +759,9 @@ begin
inherited Create(AOwner);
FWidget := gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_add_accel_group(PGtkWindow(FWidget), FAccelGroup);
- g_signal_connect(PGtkObject(FWidget), 'delete-event', G_CALLBACK(@TCustomGTKForm_delete_event), Self);
- g_signal_connect(PGtkObject(FWidget), 'size-allocate', G_CALLBACK(@TCustomGTKForm_size_allocate), Self);
- g_signal_connect(PGtkObject(FWidget), 'show', G_CALLBACK(@TCustomGTKForm_show), Self);
+ g_signal_connect_data(PGObject(FWidget), 'delete-event', TGCallback(@TCustomGTKForm_delete_event), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'size-allocate', TGCallback(@TCustomGTKForm_size_allocate), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'show', TGCallback(@TCustomGTKForm_show), Self, nil, G_CONNECT_DEFAULT);
Visible := False;
SetResizeable(True);
FormCreate(Self);
@@ -797,9 +792,9 @@ begin
if Assigned(AOwner) and (AOwner is TCustomGTKForm) then SetTransientFor(AOwner as TCustomGTKForm);
FOnResponse := nil;
gtk_window_add_accel_group(PGtkWindow(FWidget), FAccelGroup);
- g_signal_connect(PGtkObject(FWidget), 'delete-event', G_CALLBACK(@TCustomGTKForm_delete_event), Self);
- g_signal_connect(PGtkObject(FWidget), 'show', G_CALLBACK(@TCustomGTKForm_show), Self);
- g_signal_connect(PGtkObject(FWidget), 'response', G_CALLBACK(@TGTKDialog_response_event), Self);
+ g_signal_connect_data(PGObject(FWidget), 'delete-event', TGCallback(@TCustomGTKForm_delete_event), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'show', TGCallback(@TCustomGTKForm_show), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'response', TGCallback(@TGTKDialog_response_event), Self, nil, G_CONNECT_DEFAULT);
ClientArea := TGTKVBox.CreateLinked(Self, PGtkDialog(FWidget)^.vbox);
ActionArea := TGTKHBox.CreateLinked(Self, PGtkDialog(FWidget)^.action_area);
FButtons := [];
@@ -845,7 +840,7 @@ end;
procedure TGTKDialog.AddButton(ButtonCaption: string; ButtonID: integer);
begin
- gtk_dialog_add_button(PGtkDialog(FWidget), StringToPgchar(ButtonCaption), ButtonID);
+ gtk_dialog_add_button(PGtkDialog(FWidget), PChar(ButtonCaption), ButtonID);
end;
procedure TGTKDialog.SetResponseSensitive(ButtonID: integer; Sensitive: boolean);
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;
diff --git a/libgtk_kylix/GTKPixbuf.pas b/libgtk_kylix/GTKPixbuf.pas
index a51bef2..c296add 100644
--- a/libgtk_kylix/GTKPixbuf.pas
+++ b/libgtk_kylix/GTKPixbuf.pas
@@ -24,8 +24,7 @@ unit GTKPixbuf;
interface
-uses glib2, gdk2, gdk2pixbuf, gtk2, Classes, GTKControls, GTKStdCtrls;
-
+uses lazglib2, gdk2pixbuf, gtk2, Classes, GTKControls, GTKStdCtrls;
type
TGTKIconSize = (isInvalid, isMenu, isSmallToolbar, isLargeToolbar, isButton, isDND, isDialog);
diff --git a/libgtk_kylix/GTKStdCtrls.pas b/libgtk_kylix/GTKStdCtrls.pas
index 8f53f50..33ca7a6 100644
--- a/libgtk_kylix/GTKStdCtrls.pas
+++ b/libgtk_kylix/GTKStdCtrls.pas
@@ -24,9 +24,7 @@ unit GTKStdCtrls;
interface
-uses gtk2, gdk2, glib2, Classes, GTKControls, GTKConsts, GTKClasses;
- // Quick jump: QForms QControls QStdCtrls
-
+uses gtk2, glib2, lazglib2, lazgobject2, Classes, GTKControls, GTKConsts, GTKClasses;
type
@@ -288,10 +286,6 @@ procedure TGTKButton_OnClick(button: PGtkButton; user_data: Pgpointer); cdecl;
(********************************************************************************************************************************)
implementation
-uses GTKUtils;
-
-(********************************************************************************************************************************)
-(********************************************************************************************************************************)
procedure TGTKButton_OnClick(button: PGtkButton; user_data: Pgpointer); cdecl;
begin
if Assigned(TGTKButton(user_data).FOnClick) then TGTKButton(user_data).FOnClick(TGTKButton(user_data));
@@ -302,8 +296,8 @@ begin
inherited Create(AOwner);
FOnClick := nil;
if ClassName = 'TGTKButton' then begin
- FWidget := gtk_button_new_with_mnemonic(StringToPgchar(SCDefaultButtonCaption));
- g_signal_connect(PGtkObject(FWidget), 'clicked', G_CALLBACK(@TGTKButton_OnClick), Self);
+ FWidget := gtk_button_new_with_mnemonic(PChar(SCDefaultButtonCaption));
+ g_signal_connect_data(PGObject(FWidget), 'clicked', TGCallback(@TGTKButton_OnClick), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -314,7 +308,7 @@ begin
FOnClick := nil;
if ClassName = 'TGTKButton' then begin
FWidget := gtk_button_new_from_stock(StockID);
- g_signal_connect(PGtkObject(FWidget), 'clicked', G_CALLBACK(@TGTKButton_OnClick), Self);
+ g_signal_connect_data(PGObject(FWidget), 'clicked', TGCallback(@TGTKButton_OnClick), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -326,12 +320,12 @@ end;
function TGTKButton.GetCaption: string;
begin
- Result := PgcharToString(gtk_label_get_text(PGtkLabel(ChildControl)));
+ Result := String(gtk_label_get_text(PGtkLabel(ChildControl)));
end;
procedure TGTKButton.SetCaption(Value: string);
begin
- gtk_label_set_text_with_mnemonic(PGtkLabel(ChildControl), StringToPgchar(Value));
+ gtk_label_set_text_with_mnemonic(PGtkLabel(ChildControl), PChar(Value));
end;
function TGTKButton.GetUseStock: boolean;
@@ -385,11 +379,11 @@ procedure _gtk_misc_get_alignment(misc:PGtkMisc; xalign:Pgfloat; yalign:Pgfloat)
procedure _gtk_misc_get_padding(misc:PGtkMisc; xpad:Pgint; ypad:Pgint); cdecl; external gtklib name 'gtk_misc_get_padding';
function TGTKMisc.GetXAlign: Single;
-var xalign: gfloat;
+var axalign: gfloat;
begin
- xalign := 0.0;
- _gtk_misc_get_alignment(PGtkMisc(FWidget), @xalign, nil);
- Result := xalign;
+ axalign := 0.0;
+ _gtk_misc_get_alignment(PGtkMisc(FWidget), @axalign, nil);
+ Result := axalign;
end;
procedure TGTKMisc.SetXAlign(Value: Single);
@@ -398,11 +392,11 @@ begin
end;
function TGTKMisc.GetYAlign: Single;
-var yalign: gfloat;
+var ayalign: gfloat;
begin
- yalign := 0.0;
- _gtk_misc_get_alignment(PGtkMisc(FWidget), nil, @yalign);
- Result := yalign;
+ ayalign := 0.0;
+ _gtk_misc_get_alignment(PGtkMisc(FWidget), nil, @ayalign);
+ Result := ayalign;
end;
procedure TGTKMisc.SetYAlign(Value: Single);
@@ -466,12 +460,12 @@ end;
function TGTKLabel.GetCaption: string;
begin
- Result := PgcharToString(gtk_label_get_text(PGtkLabel(FWidget)));
+ Result := String(gtk_label_get_text(PGtkLabel(FWidget)));
end;
procedure TGTKLabel.SetCaption(Value: string);
begin
- gtk_label_set_text(PGtkLabel(FWidget), StringToPgchar(Value));
+ gtk_label_set_text(PGtkLabel(FWidget), PChar(Value));
end;
function TGTKLabel.GetAlignment: TGTKAlignment;
@@ -546,8 +540,8 @@ begin
inherited Create(AOwner);
FOnToggled := nil;
if ClassName = 'TGTKToggleButton' then begin
- FWidget := gtk_toggle_button_new_with_label(StringToPgchar(SCDefaultToggleButtonCaption));
- g_signal_connect(PGtkObject(FWidget), 'toggled', G_CALLBACK(@TGTKToggleButton_OnToggled), Self);
+ FWidget := gtk_toggle_button_new_with_label(PChar(SCDefaultToggleButtonCaption));
+ g_signal_connect_data(PGObject(FWidget), 'toggled', TGCallback(@TGTKToggleButton_OnToggled), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -559,12 +553,12 @@ end;
function TGTKToggleButton.GetCaption: string;
begin
- Result := PgcharToString(gtk_label_get_text(PGtkLabel(ChildControl)));
+ Result := String(gtk_label_get_text(PGtkLabel(ChildControl)));
end;
procedure TGTKToggleButton.SetCaption(Value: string);
begin
- gtk_label_set_text(PGtkLabel(ChildControl), StringToPgchar(Value));
+ gtk_label_set_text(PGtkLabel(ChildControl), PChar(Value));
end;
function TGTKToggleButton.GetChecked: boolean;
@@ -603,8 +597,8 @@ constructor TGTKCheckButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if ClassName = 'TGTKCheckButton' then begin
- FWidget := gtk_check_button_new_with_mnemonic(StringToPgchar(SCDefaultCheckButtonCaption));
- g_signal_connect(PGtkObject(FWidget), 'toggled', G_CALLBACK(@TGTKToggleButton_OnToggled), Self);
+ FWidget := gtk_check_button_new_with_mnemonic(PChar(SCDefaultCheckButtonCaption));
+ g_signal_connect_data(PGObject(FWidget), 'toggled', TGCallback(@TGTKToggleButton_OnToggled), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -613,8 +607,8 @@ constructor TGTKCheckButton.CreateWithLabel(AOwner: TComponent; const ALabel: st
begin
inherited Create(AOwner);
if ClassName = 'TGTKCheckButton' then begin
- FWidget := gtk_check_button_new_with_mnemonic(StringToPgchar(ALabel));
- g_signal_connect(PGtkObject(FWidget), 'toggled', G_CALLBACK(@TGTKToggleButton_OnToggled), Self);
+ FWidget := gtk_check_button_new_with_mnemonic(PChar(ALabel));
+ g_signal_connect_data(PGObject(FWidget), 'toggled', TGCallback(@TGTKToggleButton_OnToggled), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -630,8 +624,8 @@ constructor TGTKRadioButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if ClassName = 'TGTKRadioButton' then begin
- FWidget := gtk_radio_button_new_with_label(nil, StringToPgchar(SCDefaultRadioButtonCaption));
- g_signal_connect(PGtkObject(FWidget), 'toggled', G_CALLBACK(@TGTKToggleButton_OnToggled), Self);
+ FWidget := gtk_radio_button_new_with_label(nil, PChar(SCDefaultRadioButtonCaption));
+ g_signal_connect_data(PGObject(FWidget), 'toggled', TGCallback(@TGTKToggleButton_OnToggled), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -640,8 +634,8 @@ constructor TGTKRadioButton.CreateWithLabel(AOwner: TComponent; const ALabel: st
begin
inherited Create(AOwner);
if ClassName = 'TGTKRadioButton' then begin
- FWidget := gtk_radio_button_new_with_mnemonic(nil, StringToPgchar(ALabel));
- g_signal_connect(PGtkObject(FWidget), 'toggled', G_CALLBACK(@TGTKToggleButton_OnToggled), Self);
+ FWidget := gtk_radio_button_new_with_mnemonic(nil, PChar(ALabel));
+ g_signal_connect_data(PGObject(FWidget), 'toggled', TGCallback(@TGTKToggleButton_OnToggled), Self, nil, G_CONNECT_DEFAULT);
Show;
end;
end;
@@ -662,7 +656,7 @@ end;
constructor TGTKFrame.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- FWidget := gtk_frame_new(StringToPgchar(SCDefaultFrameCaption));
+ FWidget := gtk_frame_new(PChar(SCDefaultFrameCaption));
Show;
end;
@@ -680,12 +674,12 @@ end;
function TGTKFrame.GetCaption: string;
begin
- Result := PgcharToString(gtk_frame_get_label(PGtkFrame(FWidget)));
+ Result := String(gtk_frame_get_label(PGtkFrame(FWidget)));
end;
procedure TGTKFrame.SetCaption(Value: string);
begin
- gtk_label_set_text(PGtkLabel(gtk_frame_get_label_widget(PGtkFrame(FWidget))), StringToPgchar(Value));
+ gtk_label_set_text(PGtkLabel(gtk_frame_get_label_widget(PGtkFrame(FWidget))), PChar(Value));
end;
function TGTKFrame.GetShadowType: TGTKShadowType;
@@ -750,7 +744,7 @@ procedure TGTKEditable.InsertText(AText: string; Position: integer);
var pos: gint;
begin
pos := Position;
- gtk_editable_insert_text(PGtkEditable(FWidget), StringToPgchar(AText), Length(AText), @pos);
+ gtk_editable_insert_text(PGtkEditable(FWidget), PChar(AText), Length(AText), @pos);
end;
procedure TGTKEditable.DeleteText(StartPosition, EndPosition: integer);
@@ -760,7 +754,7 @@ end;
function TGTKEditable.GetChars(StartPosition, EndPosition: integer): string;
begin
- Result := PgcharToString(gtk_editable_get_chars(PGtkEditable(FWidget), StartPosition, EndPosition));
+ Result := String(gtk_editable_get_chars(PGtkEditable(FWidget), StartPosition, EndPosition));
end;
procedure TGTKEditable.SelectRegion(StartPosition, EndPosition: integer);
@@ -786,7 +780,7 @@ begin
FLinked := False;
FWidget := gtk_entry_new;
Show;
- g_signal_connect(PGtkObject(FWidget), 'changed', G_CALLBACK(@TGTKEditable_Changed), Self);
+ g_signal_connect_data(PGObject(FWidget), 'changed', TGCallback(@TGTKEditable_Changed), Self, nil, G_CONNECT_DEFAULT);
end;
constructor TGTKEntry.CreateFromWidget(AOwner: TComponent; Widget: PGtkWidget);
@@ -794,7 +788,7 @@ begin
inherited Create(AOwner);
FLinked := True;
FWidget := Widget;
- g_signal_connect(PGtkObject(FWidget), 'changed', G_CALLBACK(@TGTKEditable_Changed), Self);
+ g_signal_connect_data(PGObject(FWidget), 'changed', TGCallback(@TGTKEditable_Changed), Self, nil, G_CONNECT_DEFAULT);
end;
destructor TGTKEntry.Destroy;
@@ -804,12 +798,12 @@ end;
function TGTKEntry.GetText: string;
begin
- Result := PgcharToString(gtk_entry_get_text(PGtkEntry(FWidget)));
+ Result := String(gtk_entry_get_text(PGtkEntry(FWidget)));
end;
procedure TGTKEntry.SetText(Value: string);
begin
- gtk_entry_set_text(PGtkEntry(FWidget), StringToPgchar(Value));
+ gtk_entry_set_text(PGtkEntry(FWidget), PChar(Value));
end;
function TGTKEntry.GetMaxLength: integer;
@@ -844,7 +838,7 @@ begin
inherited Create(AOwner);
FWidget := gtk_combo_new;
Items := TGList.Create(Self);
- Items.Notify := ItemsChanged;
+ Items.Notify := @ItemsChanged;
Entry := TGTKEntry.CreateFromWidget(Self, PGtkCombo(FWidget)^.entry);
Show;
end;
@@ -857,33 +851,33 @@ end;
procedure TGTKCombo.UpdateItems;
begin
- gtk_combo_set_popdown_strings(PGtkCombo(FWidget), Items.FList);
+ gtk_combo_set_popdown_strings(PGtkCombo(FWidget), GLIB2.PGList(Items.FList));
end;
function TGTKCombo.GetAllowEmpty: boolean;
var b: gboolean;
begin
b := False;
- g_object_get(FWidget, 'allow-empty', @b, nil);
+ g_object_get(PGObject(FWidget), 'allow-empty', [@b, nil]);
Result := b;
end;
procedure TGTKCombo.SetAllowEmpty(Value: boolean);
begin
- g_object_set(FWidget, 'allow-empty', Ord(Value), nil);
+ g_object_set(PGObject(FWidget), 'allow-empty', [Ord(Value), nil]);
end;
function TGTKCombo.GetMatchValue: boolean;
var b: gboolean;
begin
b := False;
- g_object_get(FWidget, 'value-in-list', @b, nil);
+ g_object_get(PGObject(FWidget), 'value-in-list', [@b, nil]);
Result := b;
end;
procedure TGTKCombo.SetMatchValue(Value: boolean);
begin
- g_object_set(FWidget, 'value-in-list', Ord(Value), nil);
+ g_object_set(PGObject(FWidget), 'value-in-list', [Ord(Value), nil]);
end;
procedure TGTKCombo.SetPolicy(MatchValue, AllowEmpty: boolean);
@@ -895,7 +889,7 @@ function TGTKCombo.GetCaseSensitive: boolean;
var b: gboolean;
begin
b := False;
- g_object_get(FWidget, 'case-sensitive', @b, nil);
+ g_object_get(PGObject(FWidget), 'case-sensitive', [@b, nil]);
Result := b;
end;
diff --git a/libgtk_kylix/GTKText.pas b/libgtk_kylix/GTKText.pas
index 127e399..d3152b1 100644
--- a/libgtk_kylix/GTKText.pas
+++ b/libgtk_kylix/GTKText.pas
@@ -24,7 +24,7 @@ unit GTKText;
interface
-uses gtk2, gdk2, glib2, Classes, GTKControls, GTKConsts, GTKUtils, GTKClasses, GTKForms;
+uses gtk2, lazgobject2, Classes, GTKControls, GTKForms;
type
@@ -88,7 +88,7 @@ begin
FTextBuffer := TGTKTextBuffer.Create(Self);
FWidget := gtk_text_view_new_with_buffer(FTextBuffer.FBuffer);
Show;
- g_object_unref(FTextBuffer.FBuffer);
+ g_object_unref(PGObject(FTextBuffer.FBuffer));
end;
destructor TGTKTextView.Destroy;
diff --git a/libgtk_kylix/GTKUtils.pas b/libgtk_kylix/GTKUtils.pas
index acc30ca..f893858 100644
--- a/libgtk_kylix/GTKUtils.pas
+++ b/libgtk_kylix/GTKUtils.pas
@@ -24,11 +24,9 @@ unit GTKUtils;
interface
-uses gtk2, gdk2, glib2, SysUtils, GTKControls, GTKClasses;
+uses gtk2, gdk2, lazglib2, SysUtils, GTKControls, GTKClasses;
(********************************************************************************************************************************)
-function PgcharToString(const S: Pgchar): string;
-function StringToPgchar(const S: string): Pgchar;
function AllocateColor(Widget: PGtkWidget; R, G, B: Word): PGdkColor; overload;
function AllocateColor(R, G, B: Word): TGDKColor; overload;
function KeyValToUnicode(const Key: word): guint32;
@@ -50,18 +48,6 @@ function StringToGDKColor(Str: string; var Color: TGDKColor): boolean;
implementation
(********************************************************************************************************************************)
-function PgcharToString(const S: Pgchar): string;
-begin
- Result := string(S);
-end;
-
-(********************************************************************************************************************************)
-function StringToPgchar(const S: string): Pgchar;
-begin
- Result := PChar(S);
-end;
-
-(********************************************************************************************************************************)
function AllocateColor(Widget: PGtkWidget; R, G, B: Word): PGdkColor;
begin
New(Result);
@@ -178,10 +164,10 @@ end;
(********************************************************************************************************************************)
function PGdkColorToGDKColor(Color: PGdkColor): TGDKColor;
begin
- Result.pixel := Color.pixel;
- Result.red := Color.red;
- Result.green := Color.green;
- Result.blue := Color.blue;
+ Result.pixel := Color^.pixel;
+ Result.red := Color^.red;
+ Result.green := Color^.green;
+ Result.blue := Color^.blue;
end;
(********************************************************************************************************************************)
diff --git a/libgtk_kylix/GTKView.pas b/libgtk_kylix/GTKView.pas
index 3b46fad..3cd00dc 100644
--- a/libgtk_kylix/GTKView.pas
+++ b/libgtk_kylix/GTKView.pas
@@ -21,13 +21,10 @@
*)
unit GTKView;
-{$O+} // Optimization needs to be enabled for this unit due to bug in compiler (fixed columns doesn't work)
interface
-uses gtk2, gdk2, gdk2pixbuf, glib2, Classes, GTKControls, GTKConsts, GTKUtils, GTKClasses, GTKForms, GTKPixbuf;
- // Quick jump: QForms QControls QStdCtrls QComCtrls
-
+uses gtk2, gdk2, gdk2pixbuf, glib2, lazglib2, lazgobject2, Classes, GTKControls, GTKForms;
type
TGTKListItem = class;
@@ -439,10 +436,9 @@ end;
function TGTKView.ConvertToSorted(Index: integer): integer;
var Path: PGtkTreePath;
- Iter: TGtkTreeIter;
begin
Result := Index;
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(Index)));
if not Assigned(Path) then Exit;
if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_child_path_to_path(FTreeModelSort, Path);
if not Assigned(Path) then Exit;
@@ -452,10 +448,9 @@ end;
function TGTKView.ConvertFromSorted(Index: integer): integer;
var Path: PGtkTreePath;
- Iter: TGtkTreeIter;
begin
Result := Index;
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(Index)));
if not Assigned(Path) then Exit;
if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_path_to_child_path(FTreeModelSort, Path);
if not Assigned(Path) then Exit;
@@ -520,9 +515,9 @@ begin
FWidget := gtk_tree_view_new_with_model(FTreeModelSort);
end;
FSelection := gtk_tree_view_get_selection(PGtkTreeView(FWidget));
- g_signal_connect(FSelection, 'changed', G_CALLBACK(@TGTKListView_changed), Self);
- g_signal_connect(FWidget, 'row-activated', G_CALLBACK(@TGTKListView_row_activated), Self);
- g_signal_connect_after(FWidget, 'columns-changed', G_CALLBACK(@TGTKListView_columns_changed), Self);
+ g_signal_connect_data(PGObject(FSelection), 'changed', TGCallback(@TGTKListView_changed), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'row-activated', TGCallback(@TGTKListView_row_activated), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FWidget), 'columns-changed', TGCallback(@TGTKListView_columns_changed), Self, nil, [G_CONNECT_AFTER]);
FTreeModel := gtk_tree_view_get_model(PGtkTreeView(FWidget));
Show;
end;
@@ -540,7 +535,6 @@ function TGTKListView.GetSelected: TGTKListItem;
var Iter: TGtkTreeIter;
Path: PGtkTreePath;
AIndex: integer;
- i: integer;
begin
Result := nil;
Path := nil;
@@ -560,7 +554,7 @@ end;
procedure TGTKListView.SetSelected(Value: TGTKListItem);
var Path: PGtkTreePath;
begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Value.FIndex)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(Value.FIndex)));
ConvertChildToPath(Path);
gtk_tree_selection_select_path(FSelection, Path);
gtk_tree_path_free(Path);
@@ -596,6 +590,8 @@ var Path: PGtkTreePath;
AIndex: integer;
begin
Result := nil;
+ Path := nil;
+ Column := nil;
if gtk_tree_view_get_path_at_pos(PGtkTreeView(FWidget), X, Y, Path, Column, nil, nil) then begin
if not Assigned(Path) then Exit;
ConvertPathToChild(Path);
@@ -698,7 +694,7 @@ var x: pointer;
Iter: TGtkTreeIter;
begin
x := FList[Index];
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel(FStore), @Iter, StringToPgchar(IntToStr(Index))) then begin
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel(FStore), @Iter, PChar(IntToStr(Index))) then begin
// (FOwner as TGTKView).CovertSortableIter(Iter);
gtk_list_store_remove(FStore, @Iter);
end;
@@ -839,12 +835,12 @@ end;
function TGTKTreeViewColumn.GetCaption: string;
begin
- Result := PgcharToString(gtk_tree_view_column_get_title(FColumn));
+ Result := String(gtk_tree_view_column_get_title(FColumn));
end;
procedure TGTKTreeViewColumn.SetCaption(Value: string);
begin
- gtk_tree_view_column_set_title(FColumn, StringToPgchar(Value));
+ gtk_tree_view_column_set_title(FColumn, PChar(Value));
end;
function TGTKTreeViewColumn.GetVisible: boolean;
@@ -979,7 +975,7 @@ var NewText: string;
Path: PGtkTreePath;
begin
if Assigned(TGTKTreeViewColumn(data).FOnEdited) then begin
- NewText := PgcharToString(new_text);
+ NewText := String(new_text);
AllowChange := True;
DataColumn := TGTKTreeViewColumn(data).FIndex;
Path := gtk_tree_path_new_from_string(path_string);
@@ -1027,19 +1023,19 @@ begin
end;
if Value = ctImageText then gtk_tree_view_column_pack_start(FColumn, FPixbufRenderer, False);
gtk_tree_view_column_pack_start(FColumn, FRenderer, True);
- if (Value = ctImageText) or (Value = ctText) then g_signal_connect(FRenderer, 'edited', G_CALLBACK(@TGTKTreeViewColumn_edited), Self);
- if Value = ctToggle then g_signal_connect(FRenderer, 'toggled', G_CALLBACK(@TGTKTreeViewColumn_toggled), Self);
- g_signal_connect_after(FColumn, 'clicked', G_CALLBACK(@TGTKTreeViewColumn_clicked), Self);
+ if (Value = ctImageText) or (Value = ctText) then g_signal_connect_data(PGObject(FRenderer), 'edited', TGCallback(@TGTKTreeViewColumn_edited), Self, nil, G_CONNECT_DEFAULT);
+ if Value = ctToggle then g_signal_connect_data(PGObject(FRenderer), 'toggled', TGCallback(@TGTKTreeViewColumn_toggled), Self, nil, G_CONNECT_DEFAULT);
+ g_signal_connect_data(PGObject(FColumn), 'clicked', TGCallback(@TGTKTreeViewColumn_clicked), Self, nil, [G_CONNECT_AFTER]);
end;
procedure TGTKTreeViewColumn.AddAttribute(Attribute: string; Value: integer);
begin
- gtk_tree_view_column_add_attribute(FColumn, FRenderer, StringToPgchar(Attribute), Value);
+ gtk_tree_view_column_add_attribute(FColumn, FRenderer, PChar(Attribute), Value);
end;
procedure TGTKTreeViewColumn.AddImageAttribute(Attribute: string; Value: integer);
begin
- gtk_tree_view_column_add_attribute(FColumn, FPixbufRenderer, StringToPgchar(Attribute), Value);
+ gtk_tree_view_column_add_attribute(FColumn, FPixbufRenderer, PChar(Attribute), Value);
end;
procedure TGTKTreeViewColumn.ClearAttributes;
@@ -1052,15 +1048,15 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_LONG;
AValue.data[0].v_long := Value;
- g_object_set_property(PGObject(FRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetProperty(AProperty: string; Value: string);
var AValue: TGValue;
begin
AValue.g_type := G_TYPE_STRING;
- AValue.data[0].v_pointer := StringToPgchar(Value);
- g_object_set_property(PGObject(FRenderer), StringToPgchar(AProperty), @AValue);
+ AValue.data[0].v_pointer := PChar(Value);
+ g_object_set_property(PGObject(FRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetProperty(AProperty: string; Value: Double);
@@ -1068,7 +1064,7 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_DOUBLE;
AValue.data[0].v_double := Value;
- g_object_set_property(PGObject(FRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetProperty(AProperty: string; Value: pointer);
@@ -1076,7 +1072,7 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_POINTER;
AValue.data[0].v_pointer := Value;
- g_object_set_property(PGObject(FRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetImageProperty(AProperty: string; Value: integer);
@@ -1084,15 +1080,15 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_LONG;
AValue.data[0].v_long := Value;
- g_object_set_property(PGObject(FPixbufRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FPixbufRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetImageProperty(AProperty: string; Value: string);
var AValue: TGValue;
begin
AValue.g_type := G_TYPE_STRING;
- AValue.data[0].v_pointer := StringToPgchar(Value);
- g_object_set_property(PGObject(FPixbufRenderer), StringToPgchar(AProperty), @AValue);
+ AValue.data[0].v_pointer := PChar(Value);
+ g_object_set_property(PGObject(FPixbufRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetImageProperty(AProperty: string; Value: Double);
@@ -1100,7 +1096,7 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_DOUBLE;
AValue.data[0].v_double := Value;
- g_object_set_property(PGObject(FPixbufRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FPixbufRenderer), PChar(AProperty), @AValue);
end;
procedure TGTKTreeViewColumn.SetImageProperty(AProperty: string; Value: pointer);
@@ -1108,7 +1104,7 @@ var AValue: TGValue;
begin
AValue.g_type := G_TYPE_POINTER;
AValue.data[0].v_pointer := Value;
- g_object_set_property(PGObject(FPixbufRenderer), StringToPgchar(AProperty), @AValue);
+ g_object_set_property(PGObject(FPixbufRenderer), PChar(AProperty), @AValue);
end;
(********************************************************************************************************************************)
@@ -1130,11 +1126,11 @@ var Iter: TGtkTreeIter;
AValue: TGValue;
begin
Result := '';
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then
begin
AValue.g_type := 0;
gtk_tree_model_get_value(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, @AValue);
- Result := PgcharToString(AValue.data[0].v_pointer);
+ Result := String(AValue.data[0].v_pointer);
end;
end;
@@ -1143,7 +1139,7 @@ var Iter: TGtkTreeIter;
AValue: TGValue;
begin
Result := 0;
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then
begin
AValue.g_type := 0;
gtk_tree_model_get_value(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, @AValue);
@@ -1156,7 +1152,7 @@ var Iter: TGtkTreeIter;
AValue: TGValue;
begin
Result := nil;
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then
begin
AValue.g_type := 0;
gtk_tree_model_get_value(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, @AValue);
@@ -1169,7 +1165,7 @@ var Iter: TGtkTreeIter;
AValue: TGValue;
begin
Result := False;
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then
begin
AValue.g_type := 0;
gtk_tree_model_get_value(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, @AValue);
@@ -1180,28 +1176,28 @@ end;
procedure TGTKListItem.SetValue(Index: longint; Value: string);
var Iter: TGtkTreeIter;
begin
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex)))
- then gtk_list_store_set(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, StringToPgchar(Value), -1);
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex)))
+ then gtk_list_store_set(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, PChar(Value), -1);
end;
procedure TGTKListItem.SetValue(Index: longint; Value: integer);
var Iter: TGtkTreeIter;
begin
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex)))
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex)))
then gtk_list_store_set(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, Value, -1);
end;
procedure TGTKListItem.SetValue(Index: longint; Value: pointer);
var Iter: TGtkTreeIter;
begin
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex)))
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex)))
then gtk_list_store_set(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, Value, -1);
end;
procedure TGTKListItem.SetValue(Index: longint; Value: boolean);
var Iter: TGtkTreeIter;
begin
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex)))
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex)))
then gtk_list_store_set(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, Index, Value, -1);
end;
@@ -1209,7 +1205,7 @@ function TGTKListItem.GetSelected: boolean;
var Iter: TGtkTreeIter;
begin
Result := False;
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then begin
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then begin
// ((FOwner as TGTKListItems).FOwner as TGTKView).ConvertSortableIter(Iter);
Result := gtk_tree_selection_iter_is_selected(((FOwner as TGTKListItems).FOwner as TGTKView).FSelection, @Iter);
end;
@@ -1217,10 +1213,9 @@ end;
procedure TGTKListItem.SetSelected(Value: boolean);
var Iter, NewIter: TGtkTreeIter;
- Path: PGtkTreePath;
begin
try
- if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then begin
+ if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, PChar(IntToStr(FIndex))) then begin
if Assigned(((FOwner as TGTKListItems).FOwner as TGTKView).FTreeModelSort) then begin
gtk_tree_model_sort_convert_child_iter_to_iter(((FOwner as TGTKListItems).FOwner as TGTKView).FTreeModelSort, @NewIter, @Iter);
Iter := NewIter;
@@ -1237,7 +1232,7 @@ var Path: PGtkTreePath;
// Renderer: PGtkCellRenderer;
i : integer;
begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(FIndex)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(FIndex)));
if not Assigned(Path) then Exit;
((FOwner as TGTKListItems).FOwner as TGTKView).ConvertChildToPath(Path);
if not Assigned(Path) then Exit;
@@ -1260,7 +1255,7 @@ var CellEditable: PGtkCellEditable;
Column: PGtkTreeViewColumn;
BackgroundRect, CellRect: TGdkRectangle;
begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(FIndex)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(FIndex)));
if not Assigned(Path) then Exit;
((FOwner as TGTKListItems).FOwner as TGTKView).ConvertChildToPath(Path);
if not Assigned(Path) then Exit;
@@ -1270,7 +1265,7 @@ begin
gtk_tree_view_column_focus_cell(Column, ((FOwner as TGTKListItems).FOwner as TGTKView).Columns[ColumnNo].FRenderer);
CellEditable := gtk_cell_renderer_start_editing(((FOwner as TGTKListItems).FOwner as TGTKView).Columns[ColumnNo].FRenderer,
- nil, ((FOwner as TGTKListItems).FOwner as TGTKView).FWidget, PChar(StringToPgchar(IntToStr(FIndex))),
+ nil, ((FOwner as TGTKListItems).FOwner as TGTKView).FWidget, PChar(PChar(IntToStr(FIndex))),
@BackgroundRect, @CellRect, {GTK_CELL_RENDERER_SELECTED or GTK_CELL_RENDERER_SORTED} 0);
gtk_widget_show(CellEditable);
// gtk_cell_editable_start_editing(CellEditable, nil);
@@ -1284,7 +1279,7 @@ var Rect, BackgroundRect: TGdkRectangle;
Path: PGtkTreePath;
Column: PGtkTreeViewColumn;
begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(FIndex)));
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(FIndex)));
if not Assigned(Path) then Exit;
((FOwner as TGTKListItems).FOwner as TGTKView).ConvertChildToPath(Path);
if not Assigned(Path) then Exit;
@@ -1306,8 +1301,8 @@ var CellRect, VisibleRect: TGdkRectangle;
begin
Result := False;
gtk_tree_view_get_visible_rect(PGtkTreeView(((FOwner as TGTKListItems).FOwner as TGTKView).FWidget), @VisibleRect);
+ Path := gtk_tree_path_new_from_string(PChar(IntToStr(FIndex)));
if not Assigned(Path) then Exit;
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(FIndex)));
((FOwner as TGTKListItems).FOwner as TGTKView).ConvertChildToPath(Path);
if not Assigned(Path) then Exit;
gtk_tree_view_get_background_area(PGtkTreeView(((FOwner as TGTKListItems).FOwner as TGTKView).FWidget), Path, nil, @CellRect);