summaryrefslogtreecommitdiff
path: root/libgtk_kylix
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-11-17 16:18:15 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-11-17 16:18:15 +0100
commitd884d5168984d36a5c08f4814e81b070d7c964d3 (patch)
tree9743d99642487bececce0093866e71196a0731ba /libgtk_kylix
parentcb5cb517c068a470662bd1d08bef61265376c802 (diff)
downloadtuxcmd-d884d5168984d36a5c08f4814e81b070d7c964d3.tar.xz
Use getters instead of direct access to structuresv0.6.71
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.
Diffstat (limited to 'libgtk_kylix')
-rw-r--r--libgtk_kylix/GTKControls.pas64
-rw-r--r--libgtk_kylix/GTKDialogs.pas2
-rw-r--r--libgtk_kylix/GTKExtCtrls.pas22
-rw-r--r--libgtk_kylix/GTKForms.pas28
-rw-r--r--libgtk_kylix/GTKMenus.pas19
-rw-r--r--libgtk_kylix/GTKStdCtrls.pas82
-rw-r--r--libgtk_kylix/GTKUtils.pas16
-rw-r--r--libgtk_kylix/GTKView.pas2
8 files changed, 148 insertions, 87 deletions
diff --git a/libgtk_kylix/GTKControls.pas b/libgtk_kylix/GTKControls.pas
index c55f2a1..35719a8 100644
--- a/libgtk_kylix/GTKControls.pas
+++ b/libgtk_kylix/GTKControls.pas
@@ -413,10 +413,11 @@ begin
end;
function TGTKControl.GetEnabled: boolean;
+var b: gboolean;
begin
- Result := False;
- if (csDestroying in ComponentState) then Exit;
- Result := GTK_WIDGET_SENSITIVE(FWidget);
+ b := False;
+ if not (csDestroying in ComponentState) then g_object_get(FWidget, 'sensitive', @b, nil);
+ Result := b;
end;
procedure TGTKControl.SetEnabled(const Value: boolean);
@@ -464,17 +465,28 @@ end;
function TGTKControl.GetTooltip: string;
var TooltipsData : PGtkTooltipsData;
+ text: PChar;
begin
+ text := nil;
Result := '';
- TooltipsData := gtk_tooltips_data_get(FWidget);
- if Assigned(TooltipsData) then Result := PgcharToString(TooltipsData^.tip_text);
+ if Application.GTKVersion_2_12_0_Up then begin
+ g_object_get(FWidget, 'tooltip-text', @text, nil);
+ if text <> nil then Result := string(text);
+ end else begin
+ TooltipsData := gtk_tooltips_data_get(FWidget);
+ if Assigned(TooltipsData) then Result := PgcharToString(TooltipsData^.tip_text);
+ end;
end;
procedure TGTKControl.SetTooltip(Value: string);
var FParentForm : TCustomGTKForm;
begin
- FParentForm := GetParentForm(Self);
- if FParentForm <> nil then gtk_tooltips_set_tip(FParentForm.Tooltips.FObject, FWidget, StringToPgchar(Value), nil);
+ if Application.GTKVersion_2_12_0_Up then
+ g_object_set(FWidget, 'tooltip-text', PChar(Value), nil)
+ else begin
+ FParentForm := GetParentForm(Self);
+ if FParentForm <> nil then gtk_tooltips_set_tip(FParentForm.Tooltips.FObject, FWidget, StringToPgchar(Value), nil);
+ end;
end;
procedure TGTKControl.SetFocus;
@@ -484,10 +496,11 @@ begin
end;
function TGTKControl.GetCanFocus: boolean;
+var b: gboolean;
begin
- Result := False;
- if (csDestroying in ComponentState) then Exit;
- Result := GTK_WIDGET_CAN_FOCUS(FWidget);
+ b := False;
+ if not (csDestroying in ComponentState) then g_object_get(FWidget, 'can-focus', @b, nil);
+ Result := b;
end;
procedure TGTKControl.SetCanFocus(Value: boolean);
@@ -498,11 +511,14 @@ begin
end;
function TGTKControl.GetFocused: boolean;
+var b: boolean;
begin
+ b := False;
Result := False;
try
if (csDestroying in ComponentState) or (FWidget = nil) then Exit;
- Result := GTK_WIDGET_HAS_FOCUS(FWidget);
+ g_object_get(FWidget, 'has-focus', @b, nil);
+ Result := b;
except end;
end;
@@ -738,17 +754,17 @@ begin
end;
function TGTKControl.GetDefault: boolean;
+var b: gboolean;
begin
- Result := False;
- if (csDestroying in ComponentState) then Exit;
- Result := GTK_WIDGET_HAS_DEFAULT(FWidget);
+ b := False;
+ if not (csDestroying in ComponentState) then g_object_get(FWidget, 'has-default', @b, nil);
+ Result := b;
end;
procedure TGTKControl.SetDefault(Value: boolean);
begin
if (csDestroying in ComponentState) then Exit;
- GTK_WIDGET_SET_FLAGS(FWidget, GTK_CAN_DEFAULT);
-// gtk_widget_grab_default(FWidget);
+ g_object_set(FWidget, 'can-default', Ord(Value), nil);
end;
procedure TGTKControl.Invalidate;
@@ -839,8 +855,11 @@ begin
end;
function TGTKContainer.GetChildrenCount: integer;
+var List: PGList;
begin
- Result := g_list_length(gtk_container_get_children(PGtkContainer(FWidget)));
+ List := gtk_container_get_children(PGtkContainer(FWidget));
+ Result := g_list_length(List);
+ g_list_free(List);
end;
(********************************************************************************************************************************)
@@ -968,6 +987,7 @@ end;
function TGTKTooltips.GetEnabled: boolean;
begin
+ // FIXME: This is horrible expression
Result := Boolean(gtk2.enabled(FObject^));
end;
@@ -1007,8 +1027,11 @@ begin
end;
function TGTKTable.GetRowCount: integer;
+var nrows: guint;
begin
- Result := PGtkTable(FWidget)^.nrows;
+ nrows := 1;
+ g_object_get(FWidget, 'n-rows', @nrows, nil);
+ Result := nrows;
end;
procedure TGTKTable.SetRowCount(Value: integer);
@@ -1017,8 +1040,11 @@ begin
end;
function TGTKTable.GetColCount: integer;
+var ncols: guint;
begin
- Result := PGtkTable(FWidget)^.ncols;
+ ncols := 1;
+ g_object_get(FWidget, 'n-columns', @ncols, nil);
+ Result := ncols;
end;
procedure TGTKTable.SetColCount(Value: integer);
diff --git a/libgtk_kylix/GTKDialogs.pas b/libgtk_kylix/GTKDialogs.pas
index 4a9b892..e6e5c7e 100644
--- a/libgtk_kylix/GTKDialogs.pas
+++ b/libgtk_kylix/GTKDialogs.pas
@@ -127,6 +127,7 @@ end;
function TGTKFileSelectionDialog.GetShowFileOpButtons: boolean;
var b: Boolean;
begin
+ b := False;
g_object_get(FWidget, 'show-fileops', @b, nil);
Result := b;
end;
@@ -191,6 +192,7 @@ end;
function TGTKColorSelectionDialog.GetColor: TGDKColor;
var Col: gdk2.TGDkColor;
begin
+ FillChar(Col, sizeof(gdk2.TGDkColor), 0);
gtk_color_selection_get_current_color(PGtkColorSelection(PGtkColorSelectionDialog(FWidget)^.colorsel), @Col);
Result := PGdkColorToGDKColor(@Col);
end;
diff --git a/libgtk_kylix/GTKExtCtrls.pas b/libgtk_kylix/GTKExtCtrls.pas
index 13ea30f..8ae5abc 100644
--- a/libgtk_kylix/GTKExtCtrls.pas
+++ b/libgtk_kylix/GTKExtCtrls.pas
@@ -456,9 +456,11 @@ begin
inherited Destroy;
end;
+function _gtk_notebook_append_page(notebook:PGtkNotebook; child:PGtkWidget; tab_label:PGtkWidget): gint; cdecl; external gtklib name 'gtk_notebook_append_page';
+
function TGTKNotebook.AppendPage(Child: TGTKControl; Caption: string): integer;
begin
- Result := gtk_notebook_append_page(PGtkNotebook(FWidget), Child.FWidget, nil);
+ Result := _gtk_notebook_append_page(PGtkNotebook(FWidget), Child.FWidget, nil);
gtk_notebook_set_tab_label_text(PGtkNotebook(FWidget), Child.FWidget, StringToPgchar(Caption));
end;
@@ -537,12 +539,14 @@ begin
gtk_notebook_set_scrollable(PGtkNotebook(FWidget), Value);
end;
+procedure _gtk_notebook_query_tab_label_packing(notebook:PGtkNotebook;child:PGtkWidget;expand:Pgboolean;fill:Pgboolean;pack_type:PGtkPackType); cdecl; external gtklib name 'gtk_notebook_query_tab_label_packing';
+
function TGTKNotebook.GetExpandTab(PageNo: integer): boolean;
-var expand, fill: Pgboolean;
- packtype: PGtkPackType;
+var expand: gboolean;
begin
- gtk_notebook_query_tab_label_packing(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), expand, fill, packtype);
- Result := expand <> nil;
+ expand := False;
+ _gtk_notebook_query_tab_label_packing(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), @expand, nil, nil);
+ Result := expand;
end;
procedure TGTKNotebook.SetExpandTab(PageNo: integer; Value: boolean);
@@ -551,11 +555,11 @@ begin
end;
function TGTKNotebook.GetFillTab(PageNo: integer): boolean;
-var expand, fill: Pgboolean;
- packtype: PGtkPackType;
+var fill: gboolean;
begin
- gtk_notebook_query_tab_label_packing(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), expand, fill, packtype);
- Result := fill <> nil;
+ fill := False;
+ _gtk_notebook_query_tab_label_packing(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo), nil, @fill, nil);
+ Result := fill;
end;
procedure TGTKNotebook.SetFillTab(PageNo: integer; Value: boolean);
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index f1f5440..ad623b3 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -178,7 +178,7 @@ type // Some basic types
FTerminated: Boolean;
FOnException: TExceptionEvent;
FMainForm: TCustomGTKForm;
- FMainFormSet, FGTK205Up, FGTK220Up, FGTK240Up, FGTK260Up, FGTK280Up: Boolean;
+ FMainFormSet, FGTK205Up, FGTK220Up, FGTK240Up, FGTK260Up, FGTK280Up, FGTK212Up: Boolean;
FThreadID: __pthread_t;
procedure Quit;
protected
@@ -210,6 +210,7 @@ type // Some basic types
property GTKVersion_2_4_0_Up: boolean read FGTK240Up;
property GTKVersion_2_6_0_Up: boolean read FGTK260Up;
property GTKVersion_2_8_0_Up: boolean read FGTK280Up;
+ property GTKVersion_2_12_0_Up: boolean read FGTK212Up;
property ThreadID: __pthread_t read FThreadID;
end;
@@ -269,12 +270,12 @@ end;
function TGDKScreen.GetHeight: Integer;
begin
- Result := gdk_screen_height;
+ Result := gdk_screen_height();
end;
function TGDKScreen.GetWidth: Integer;
begin
- Result := gdk_screen_width;
+ Result := gdk_screen_width();
end;
@@ -372,8 +373,11 @@ begin
end;
function TCustomGTKForm.GetWindowPosition: TWindowPosition;
+var pos: TGtkWindowPosition;
begin
- Result := TWindowPosition(position(PGtkWindow(FWidget)^));
+ pos := GTK_WIN_POS_NONE;
+ g_object_get(FWidget, 'window-position', @pos, nil);
+ Result := TWindowPosition(pos);
end;
procedure TCustomGTKForm.SetWindowPosition(Value: TWindowPosition);
@@ -462,6 +466,7 @@ end;
function TCustomGTKForm.GetLeft: integer;
var PosLeft, PosTop: integer;
begin
+ PosLeft := 0;
gtk_window_get_position(PGtkWindow(FWidget), @PosLeft, @PosTop);
Result := PosLeft;
end;
@@ -469,21 +474,24 @@ end;
function TCustomGTKForm.GetTop: integer;
var PosLeft, PosTop: integer;
begin
+ PosTop := 0;
gtk_window_get_position(PGtkWindow(FWidget), @PosLeft, @PosTop);
Result := PosTop;
end;
function TCustomGTKForm.GetWidth: integer;
-var AWidth, AHeight: integer;
+var AWidth: integer;
begin
- gtk_window_get_size(PGtkWindow(FWidget), @AWidth, @AHeight);
+ AWidth := 100;
+ gtk_window_get_size(PGtkWindow(FWidget), @AWidth, nil);
Result := AWidth;
end;
function TCustomGTKForm.GetHeight: integer;
-var AWidth, AHeight: integer;
+var AHeight: integer;
begin
- gtk_window_get_size(PGtkWindow(FWidget), @AWidth, @AHeight);
+ AHeight := 100;
+ gtk_window_get_size(PGtkWindow(FWidget), nil, @AHeight);
Result := AHeight;
end;
@@ -556,7 +564,9 @@ begin
{$R+}
// Check for correct version of GTK+ library
- Ver := gtk_check_version(2, 8, 0);
+ Ver := gtk_check_version(2, 12, 0);
+ FGTK212Up := Ver = nil;
+ if not FGTK212Up then Ver := gtk_check_version(2, 8, 0);
FGTK280Up := Ver = nil;
if not FGTK280Up then Ver := gtk_check_version(2, 6, 0);
FGTK260Up := Ver = nil;
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);
diff --git a/libgtk_kylix/GTKStdCtrls.pas b/libgtk_kylix/GTKStdCtrls.pas
index 34ab7bc..8f53f50 100644
--- a/libgtk_kylix/GTKStdCtrls.pas
+++ b/libgtk_kylix/GTKStdCtrls.pas
@@ -378,18 +378,18 @@ end;
procedure TGTKMisc.SetAlignment(XAlign, YAlign : Single);
begin
-// Writeln('gtk_misc_set_alignment, FWidget = ', integer(FWidget), ', XAlign = ', XAlign, ', YAlign = ', YAlign);
gtk_misc_set_alignment(PGtkMisc(FWidget), XAlign, YAlign);
end;
+procedure _gtk_misc_get_alignment(misc:PGtkMisc; xalign:Pgfloat; yalign:Pgfloat); cdecl; external gtklib name 'gtk_misc_get_alignment';
+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, yalign: pgfloat; }
+var xalign: gfloat;
begin
-{ gtk_misc_get_alignment(PGtkMisc(FWidget), xalign, yalign);
- if Assigned(xalign) then Result := Single(xalign^)
- else Result := 0; }
- if Assigned(FWidget) then Result := PGtkMisc(FWidget)^.xalign
- else Result := 0;
+ xalign := 0.0;
+ _gtk_misc_get_alignment(PGtkMisc(FWidget), @xalign, nil);
+ Result := xalign;
end;
procedure TGTKMisc.SetXAlign(Value: Single);
@@ -398,15 +398,11 @@ begin
end;
function TGTKMisc.GetYAlign: Single;
-{var xalign, yalign: Extended;
- x: Extended; }
+var yalign: gfloat;
begin
-{ gtk_misc_get_alignment(PGtkMisc(FWidget), @xalign, @yalign);
- writeln('yalign = ', integer(yalign));
- if Assigned(yalign) then Result := yalign
- else Result := 0; }
- if Assigned(FWidget) then Result := PGtkMisc(FWidget)^.yalign
- else Result := 0;
+ yalign := 0.0;
+ _gtk_misc_get_alignment(PGtkMisc(FWidget), nil, @yalign);
+ Result := yalign;
end;
procedure TGTKMisc.SetYAlign(Value: Single);
@@ -419,12 +415,11 @@ begin
gtk_misc_set_padding(PGtkMisc(FWidget), XPadding, YPadding);
end;
-procedure x_gtk_misc_get_padding(misc:PGtkMisc; xpad:Pgint; ypad:Pgint); cdecl; external gtklib name 'gtk_misc_get_padding';
-
function TGTKMisc.GetXPadding: integer;
-var xpad, ypad: gint;
+var xpad: gint;
begin
- x_gtk_misc_get_padding(PGtkMisc(FWidget), @xpad, @ypad);
+ xpad := 0;
+ _gtk_misc_get_padding(PGtkMisc(FWidget), @xpad, nil);
Result := xpad;
end;
@@ -434,9 +429,10 @@ begin
end;
function TGTKMisc.GetYPadding: integer;
-var xpad, ypad: gint;
+var ypad: gint;
begin
- x_gtk_misc_get_padding(PGtkMisc(FWidget), @xpad, @ypad);
+ ypad := 0;
+ _gtk_misc_get_padding(PGtkMisc(FWidget), nil, @ypad);
Result := ypad;
end;
@@ -751,8 +747,10 @@ begin
end;
procedure TGTKEditable.InsertText(AText: string; Position: integer);
+var pos: gint;
begin
- gtk_editable_insert_text(PGtkEditable(FWidget), StringToPgchar(AText), Length(AText), @Position);
+ pos := Position;
+ gtk_editable_insert_text(PGtkEditable(FWidget), StringToPgchar(AText), Length(AText), @pos);
end;
procedure TGTKEditable.DeleteText(StartPosition, EndPosition: integer);
@@ -831,7 +829,6 @@ end;
procedure TGTKEntry.SetVisibility(Value: boolean);
begin
-// g_object_set(FWidget, 'visibility', gboolean(Value), nil);
gtk_entry_set_visibility(PGtkEntry(FWidget), Value);
end;
@@ -864,23 +861,29 @@ begin
end;
function TGTKCombo.GetAllowEmpty: boolean;
+var b: gboolean;
begin
- Result := Boolean(ok_if_empty(PGtkCombo(FWidget)^));
+ b := False;
+ g_object_get(FWidget, 'allow-empty', @b, nil);
+ Result := b;
end;
procedure TGTKCombo.SetAllowEmpty(Value: boolean);
begin
- SetPolicy(GetMatchValue, Value);
+ g_object_set(FWidget, 'allow-empty', Ord(Value), nil);
end;
function TGTKCombo.GetMatchValue: boolean;
+var b: gboolean;
begin
- Result := Boolean(value_in_list(PGtkCombo(FWidget)^));
+ b := False;
+ g_object_get(FWidget, 'value-in-list', @b, nil);
+ Result := b;
end;
procedure TGTKCombo.SetMatchValue(Value: boolean);
begin
- SetPolicy(Value, GetAllowEmpty);
+ g_object_set(FWidget, 'value-in-list', Ord(Value), nil);
end;
procedure TGTKCombo.SetPolicy(MatchValue, AllowEmpty: boolean);
@@ -889,8 +892,11 @@ begin
end;
function TGTKCombo.GetCaseSensitive: boolean;
+var b: gboolean;
begin
- Result := Boolean(gtk2.case_sensitive(PGtkCombo(FWidget)^));
+ b := False;
+ g_object_get(FWidget, 'case-sensitive', @b, nil);
+ Result := b;
end;
procedure TGTKCombo.SetCaseSensitive(Value: boolean);
@@ -934,9 +940,10 @@ begin
end;
function TGTKSpinEdit.GetMin: Double;
-var amin, amax: Double;
+var amin: Double;
begin
- gtk_spin_button_get_range(PGtkSpinButton(FWidget), @amin, @amax);
+ amin := 0;
+ gtk_spin_button_get_range(PGtkSpinButton(FWidget), @amin, nil);
Result := amin;
end;
@@ -946,9 +953,10 @@ begin
end;
function TGTKSpinEdit.GetMax: Double;
-var amin, amax: Double;
+var amax: Double;
begin
- gtk_spin_button_get_range(PGtkSpinButton(FWidget), @amin, @amax);
+ amax := 1;
+ gtk_spin_button_get_range(PGtkSpinButton(FWidget), nil, @amax);
Result := amax;
end;
@@ -958,9 +966,10 @@ begin
end;
function TGTKSpinEdit.GetIncrementStep: Double;
-var astep, apage: Double;
+var astep: Double;
begin
- gtk_spin_button_get_increments(PGtkSpinButton(FWidget), @astep, @apage);
+ astep := 1;
+ gtk_spin_button_get_increments(PGtkSpinButton(FWidget), @astep, nil);
Result := astep;
end;
@@ -970,9 +979,10 @@ begin
end;
function TGTKSpinEdit.GetIncrementPage: Double;
-var astep, apage: Double;
+var apage: Double;
begin
- gtk_spin_button_get_increments(PGtkSpinButton(FWidget), @astep, @apage);
+ apage := 1;
+ gtk_spin_button_get_increments(PGtkSpinButton(FWidget), nil, @apage);
Result := apage;
end;
diff --git a/libgtk_kylix/GTKUtils.pas b/libgtk_kylix/GTKUtils.pas
index 3f92168..288aee3 100644
--- a/libgtk_kylix/GTKUtils.pas
+++ b/libgtk_kylix/GTKUtils.pas
@@ -101,7 +101,7 @@ var Widget: PGtkWidget;
begin
Widget := gtk_window_new(GTK_WINDOW_TOPLEVEL);
Style := gtk_rc_get_style(Widget);
- Result := @Style^.fg[State];
+ Result := @(Style^.fg[State]);
gtk_widget_destroy(Widget);
end;
@@ -109,7 +109,7 @@ function GetDefaultForegroundColor(Widget: TGTKControl; State: integer): PGdkCol
var Style: PGtkStyle;
begin
Style := gtk_rc_get_style(Widget.FWidget);
- Result := @Style^.fg[State];
+ Result := @(Style^.fg[State]);
end;
(********************************************************************************************************************************)
@@ -119,7 +119,7 @@ var Widget: PGtkWidget;
begin
Widget := gtk_window_new(GTK_WINDOW_TOPLEVEL);
Style := gtk_rc_get_style(Widget);
- Result := @Style^.bg[State];
+ Result := @(Style^.bg[State]);
gtk_widget_destroy(Widget);
end;
@@ -127,7 +127,7 @@ function GetDefaultBackgroundColor(Widget: TGTKControl; State: integer): PGdkCol
var Style: PGtkStyle;
begin
Style := gtk_rc_get_style(Widget.FWidget);
- Result := @Style^.bg[State];
+ Result := @(Style^.bg[State]);
end;
(********************************************************************************************************************************)
@@ -137,7 +137,7 @@ var Widget: PGtkWidget;
begin
Widget := gtk_window_new(GTK_WINDOW_TOPLEVEL);
Style := gtk_rc_get_style(Widget);
- Result := @Style^.base[State];
+ Result := @(Style^.base[State]);
gtk_widget_destroy(Widget);
end;
@@ -145,7 +145,7 @@ function GetDefaultBaseColor(Widget: TGTKControl; State: integer): PGdkColor;
var Style: PGtkStyle;
begin
Style := gtk_rc_get_style(Widget.FWidget);
- Result := @Style^.base[State];
+ Result := @(Style^.base[State]);
end;
(********************************************************************************************************************************)
@@ -155,7 +155,7 @@ var Widget: PGtkWidget;
begin
Widget := gtk_window_new(GTK_WINDOW_TOPLEVEL);
Style := gtk_rc_get_style(Widget);
- Result := @Style^.text[State];
+ Result := @(Style^.text[State]);
gtk_widget_destroy(Widget);
end;
@@ -163,7 +163,7 @@ function GetDefaultTextColor(Widget: TGTKControl; State: integer): PGdkColor;
var Style: PGtkStyle;
begin
Style := gtk_rc_get_style(Widget.FWidget);
- Result := @Style^.text[State];
+ Result := @(Style^.text[State]);
end;
(********************************************************************************************************************************)
diff --git a/libgtk_kylix/GTKView.pas b/libgtk_kylix/GTKView.pas
index 85a13a0..db1dc93 100644
--- a/libgtk_kylix/GTKView.pas
+++ b/libgtk_kylix/GTKView.pas
@@ -378,6 +378,7 @@ var sort_column_id: gint;
order: TGtkSortType;
begin
Result := -1;
+ sort_column_id := -1;
if (FTreeModelSort <> nil) and gtk_tree_sortable_get_sort_column_id(PGtkTreeSortable(FTreeModelSort), @sort_column_id, @order)
then Result := sort_column_id;
end;
@@ -419,6 +420,7 @@ var sort_column_id: gint;
order: TGtkSortType;
begin
Result := soNone;
+ order := 0;
if (FTreeModelSort <> nil) and gtk_tree_sortable_get_sort_column_id(PGtkTreeSortable(FTreeModelSort), @sort_column_id, @order)
then Result := TGTKTreeViewSortOrder(order);
end;