summaryrefslogtreecommitdiff
path: root/libgtk_kylix/GTKControls.pas
diff options
context:
space:
mode:
Diffstat (limited to 'libgtk_kylix/GTKControls.pas')
-rw-r--r--libgtk_kylix/GTKControls.pas73
1 files changed, 35 insertions, 38 deletions
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;