mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 12:40:02 +02:00
fixes for gtk2
added more wrappers for gtk1/gtk2 converstion and sanity removed pointless version $Ifdef GTK2 etc IDE now "runs" Tcontrol drawing/using problems renders it unuseable however git-svn-id: trunk@4578 -
This commit is contained in:
parent
fca9ba5dcd
commit
066215c115
@ -92,9 +92,13 @@ type
|
|||||||
GDIBrushPixMap: PGdkPixmap;
|
GDIBrushPixMap: PGdkPixmap;
|
||||||
);
|
);
|
||||||
gdiFont: (
|
gdiFont: (
|
||||||
|
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
||||||
|
GDIFontObject: PPangoFont;
|
||||||
|
{$else}
|
||||||
GDIFontObject: PGdkFont;
|
GDIFontObject: PGdkFont;
|
||||||
LogFont: TLogFont;// for now font info is stored as well, later query font params
|
LogFont: TLogFont;// for now font info is stored as well, later query font params
|
||||||
);
|
{$EndIf}
|
||||||
|
);
|
||||||
gdiPen: (
|
gdiPen: (
|
||||||
IsNullPen : Boolean;//GDK will bomb with a NULL Pen Hatch
|
IsNullPen : Boolean;//GDK will bomb with a NULL Pen Hatch
|
||||||
GDIPenColor: TGDIColor;
|
GDIPenColor: TGDIColor;
|
||||||
@ -456,6 +460,13 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.43 2003/09/06 20:23:53 ajgenius
|
||||||
|
fixes for gtk2
|
||||||
|
added more wrappers for gtk1/gtk2 converstion and sanity
|
||||||
|
removed pointless version $Ifdef GTK2 etc
|
||||||
|
IDE now "runs" Tcontrol drawing/using problems
|
||||||
|
renders it unuseable however
|
||||||
|
|
||||||
Revision 1.42 2003/08/29 21:21:07 mattias
|
Revision 1.42 2003/08/29 21:21:07 mattias
|
||||||
fixes for gtk2
|
fixes for gtk2
|
||||||
|
|
||||||
|
@ -511,8 +511,7 @@ begin
|
|||||||
if (List^.Data <> nil)
|
if (List^.Data <> nil)
|
||||||
then begin
|
then begin
|
||||||
gdk_window_get_user_data(PGDKWindow(List^.Data), @Window);
|
gdk_window_get_user_data(PGDKWindow(List^.Data), @Window);
|
||||||
if GtkWidgetIsA(PGtkWidget(Window),
|
if GtkWidgetIsA(PGtkWidget(Window), GTK_TYPE_WINDOW)
|
||||||
{$IFDEF Gtk2}GTK_TYPE_WINDOW{$ELSE}GTK_WINDOW_TYPE{$ENDIF})
|
|
||||||
then begin
|
then begin
|
||||||
// visible window found -> add to list
|
// visible window found -> add to list
|
||||||
New(ATransientWindow);
|
New(ATransientWindow);
|
||||||
@ -1067,13 +1066,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if GtkWidgetIsA(Widget,
|
if GtkWidgetIsA(Widget,GTK_TYPE_SCROLLBAR) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_SCROLLBAR{$ELSE}GTK_SCROLLBAR_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
// the width of a scrollbar is fixed and depends only on the theme
|
// the width of a scrollbar is fixed and depends only on the theme
|
||||||
gtk_widget_size_request (widget, @Requisition);
|
gtk_widget_size_request (widget, @Requisition);
|
||||||
if GtkWidgetIsA(Widget,
|
if GtkWidgetIsA(Widget, GTK_TYPE_HSCROLLBAR) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_HSCROLLBAR{$ELSE}GTK_HSCROLLBAR_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
NewHeight:=Requisition.height;
|
NewHeight:=Requisition.height;
|
||||||
end else begin
|
end else begin
|
||||||
@ -1084,8 +1081,7 @@ begin
|
|||||||
|
|
||||||
gtk_widget_set_usize(Widget, NewWidth, NewHeight);
|
gtk_widget_set_usize(Widget, NewWidth, NewHeight);
|
||||||
|
|
||||||
if GtkWidgetIsA(Widget,
|
if GtkWidgetIsA(Widget, GTK_TYPE_COMBO) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_COMBO{$ELSE}GTK_COMBO_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
// the combobox has an entry, which height is not resized
|
// the combobox has an entry, which height is not resized
|
||||||
// automatically. Do it manually.
|
// automatically. Do it manually.
|
||||||
@ -1144,8 +1140,7 @@ var
|
|||||||
// check if window belongs to another LCL control
|
// check if window belongs to another LCL control
|
||||||
gdk_window_get_user_data(PaintWindow,@UserData);
|
gdk_window_get_user_data(PaintWindow,@UserData);
|
||||||
if (UserData<>nil)
|
if (UserData<>nil)
|
||||||
and (GtkWidgetIsA(PGtkWidget(UserData),
|
and (GtkWidgetIsA(PGtkWidget(UserData), GTK_TYPE_WIDGET))
|
||||||
{$IFDEF Gtk2}GTK_TYPE_WIDGET{$ELSE}GTK_WIDGET_TYPE{$ENDIF}))
|
|
||||||
then begin
|
then begin
|
||||||
LCLObject:=GetLCLObject(UserData);
|
LCLObject:=GetLCLObject(UserData);
|
||||||
if (LCLObject<>nil) and (LCLObject<>AWinControl) then exit;
|
if (LCLObject<>nil) and (LCLObject<>AWinControl) then exit;
|
||||||
@ -1199,8 +1194,7 @@ var
|
|||||||
SendPaintMessageForGDkWindow(GetControlWindow(PaintWidget));
|
SendPaintMessageForGDkWindow(GetControlWindow(PaintWidget));
|
||||||
|
|
||||||
// search all child widgets
|
// search all child widgets
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_CONTAINER) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_CONTAINER{$ELSE}GTK_CONTAINER_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
// this is a container widget -> go through all childs
|
// this is a container widget -> go through all childs
|
||||||
{$IFDEF Gtk2}
|
{$IFDEF Gtk2}
|
||||||
@ -1219,24 +1213,20 @@ var
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_SCROLLED_WINDOW)
|
||||||
{$IFDEF Gtk2}GTK_TYPE_SCROLLED_WINDOW{$ELSE}GTK_SCROLLED_WINDOW_TYPE{$ENDIF})
|
|
||||||
then begin
|
then begin
|
||||||
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.hscrollbar);
|
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.hscrollbar);
|
||||||
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.vscrollbar);
|
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.vscrollbar);
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_BIN) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_BIN{$ELSE}GTK_BIN_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
ForAllChilds(PGtkBin(PaintWidget)^.child);
|
ForAllChilds(PGtkBin(PaintWidget)^.child);
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_COMBO) then begin
|
||||||
{$IFDEF Gtk2}GTK_TYPE_COMBO{$ELSE}GTK_COMBO_TYPE{$ENDIF}) then begin
|
|
||||||
ForAllChilds(PGtkCombo(PaintWidget)^.entry);
|
ForAllChilds(PGtkCombo(PaintWidget)^.entry);
|
||||||
ForAllChilds(PGtkCombo(PaintWidget)^.button);
|
ForAllChilds(PGtkCombo(PaintWidget)^.button);
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_RANGE)
|
||||||
{$IFDEF Gtk2}GTK_TYPE_RANGE{$ELSE}GTK_RANGE_TYPE{$ENDIF})
|
|
||||||
then begin
|
then begin
|
||||||
{$IFDEF Gtk2}
|
{$IFDEF Gtk2}
|
||||||
// Gtk2ToDo
|
// Gtk2ToDo
|
||||||
@ -1248,13 +1238,11 @@ var
|
|||||||
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.step_back);
|
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.step_back);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_TEXT) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_TEXT{$ELSE}GTK_TEXT_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
SendPaintMessageForGDkWindow(PGtkText(PaintWidget)^.text_area);
|
SendPaintMessageForGDkWindow(PGtkText(PaintWidget)^.text_area);
|
||||||
end;
|
end;
|
||||||
if GtkWidgetIsA(PaintWidget,
|
if GtkWidgetIsA(PaintWidget, GTK_TYPE_ENTRY) then
|
||||||
{$IFDEF Gtk2}GTK_TYPE_ENTRY{$ELSE}GTK_ENTRY_TYPE{$ENDIF}) then
|
|
||||||
begin
|
begin
|
||||||
SendPaintMessageForGDkWindow(PGtkEntry(PaintWidget)^.text_area);
|
SendPaintMessageForGDkWindow(PGtkEntry(PaintWidget)^.text_area);
|
||||||
end;
|
end;
|
||||||
@ -6524,11 +6512,7 @@ begin
|
|||||||
|
|
||||||
if fWindow<>nil then begin
|
if fWindow<>nil then begin
|
||||||
gdk_draw_pixmap(fwindow,
|
gdk_draw_pixmap(fwindow,
|
||||||
{$IfDef GTK2}
|
gtk_widget_get_style(widget)^.fg_gc[GTK_WIDGET_STATE (widget)],
|
||||||
PGtkStyle(widget^.Style)^.fg_gc[GTK_WIDGET_STATE (widget)],
|
|
||||||
{$Else}
|
|
||||||
PGtkStyle(widget^.TheStyle)^.fg_gc[GTK_WIDGET_STATE (widget)],
|
|
||||||
{$EndIf}
|
|
||||||
pixmap,
|
pixmap,
|
||||||
0,0,
|
0,0,
|
||||||
0,0,
|
0,0,
|
||||||
@ -7181,7 +7165,7 @@ var
|
|||||||
var MenuClass: PGtkWidgetClass;
|
var MenuClass: PGtkWidgetClass;
|
||||||
begin
|
begin
|
||||||
if GtkWidgetIsA(ContainerMenu,GTK_TYPE_MENU) then begin
|
if GtkWidgetIsA(ContainerMenu,GTK_TYPE_MENU) then begin
|
||||||
MenuClass:=GTK_WIDGET_CLASS(PGtkTypeObject(ContainerMenu)^.{$IfDef GTK2}g_Class{$Else}klass{$EndIf});
|
MenuClass:=GTK_WIDGET_CLASS(gtk_object_get_class(ContainerMenu));
|
||||||
if OldMenuSizeRequestProc=nil then begin
|
if OldMenuSizeRequestProc=nil then begin
|
||||||
OldMenuSizeRequestProc:=MenuClass^.size_request;
|
OldMenuSizeRequestProc:=MenuClass^.size_request;
|
||||||
end;
|
end;
|
||||||
@ -7683,7 +7667,7 @@ var
|
|||||||
GDIObject: PGDIObject;
|
GDIObject: PGDIObject;
|
||||||
begin
|
begin
|
||||||
GDIObject := NewGDIObject(gdiRegion);
|
GDIObject := NewGDIObject(gdiRegion);
|
||||||
GDIObject^.GDIRegionObject:=CopyGDKRegion(PGdiObject(SrcRGN)^.GDIRegionObject);
|
GDIObject^.GDIRegionObject:=gdk_region_copy(PGdiObject(SrcRGN)^.GDIRegionObject);
|
||||||
Result := hRgn(GDIObject);
|
Result := hRgn(GDIObject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8164,6 +8148,13 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.409 2003/09/06 20:23:53 ajgenius
|
||||||
|
fixes for gtk2
|
||||||
|
added more wrappers for gtk1/gtk2 converstion and sanity
|
||||||
|
removed pointless version $Ifdef GTK2 etc
|
||||||
|
IDE now "runs" Tcontrol drawing/using problems
|
||||||
|
renders it unuseable however
|
||||||
|
|
||||||
Revision 1.408 2003/09/06 17:24:52 ajgenius
|
Revision 1.408 2003/09/06 17:24:52 ajgenius
|
||||||
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
||||||
|
|
||||||
|
@ -65,6 +65,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{$Ifdef GTK1}
|
{$Ifdef GTK1}
|
||||||
|
function gtk_class_get_type(aclass : Pointer) : TGtkType;
|
||||||
|
begin
|
||||||
|
If (aclass <> nil) then
|
||||||
|
result := PGtkTypeClass(aclass)^.thetype
|
||||||
|
else
|
||||||
|
result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gtk_object_get_class(anobject : Pointer) : Pointer;
|
||||||
|
begin
|
||||||
|
If (anobject <> nil) then
|
||||||
|
result := PGtkTypeObject(anobject)^.klass
|
||||||
|
else
|
||||||
|
result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
||||||
|
begin
|
||||||
|
if assigned(Window) then
|
||||||
|
result := (Window^.flag0 and bm_modal)<>0
|
||||||
|
else
|
||||||
|
result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
||||||
begin
|
begin
|
||||||
@ -74,11 +97,6 @@ begin
|
|||||||
result := nil;
|
result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
|
||||||
begin
|
|
||||||
result := (Window^.flag0 and bm_modal)<>0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
||||||
begin
|
begin
|
||||||
if right_justified then
|
if right_justified then
|
||||||
@ -107,6 +125,24 @@ begin
|
|||||||
result := gdk_regions_xor(source1, source2);
|
result := gdk_regions_xor(source1, source2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function gdk_region_copy(region: PGDKRegion): PGDKRegion;
|
||||||
|
var
|
||||||
|
EmptyRegion: PGdkRegion;
|
||||||
|
begin
|
||||||
|
EmptyRegion := gdk_region_new;
|
||||||
|
Result := gdk_regions_union(region, EmptyRegion);
|
||||||
|
gdk_region_destroy(EmptyRegion);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdk_region_rectangle(rect: PGdkRectangle): PGDKRegion;
|
||||||
|
var
|
||||||
|
EmptyRegion: PGdkRegion;
|
||||||
|
begin
|
||||||
|
EmptyRegion := gdk_region_new;
|
||||||
|
Result := gdk_region_union_with_rect(EmptyRegion,Rect);
|
||||||
|
gdk_region_destroy(EmptyRegion);
|
||||||
|
end;
|
||||||
|
|
||||||
Function gdk_drawable_get_depth(Drawable : PGDKDrawable) : gint;
|
Function gdk_drawable_get_depth(Drawable : PGDKDrawable) : gint;
|
||||||
begin
|
begin
|
||||||
gdk_window_get_geometry(Drawable, nil, nil, nil, nil, @result);
|
gdk_window_get_geometry(Drawable, nil, nil, nil, nil, @result);
|
||||||
@ -116,10 +152,33 @@ Procedure gdk_drawable_get_size(Drawable : PGDKDrawable; Width, Height : PGInt);
|
|||||||
begin
|
begin
|
||||||
gdk_window_get_geometry(Drawable, nil, nil, Width, Height, nil);
|
gdk_window_get_geometry(Drawable, nil, nil, Width, Height, nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
{$Ifdef GTK2}
|
{$Ifdef GTK2}
|
||||||
|
function gtk_class_get_type(aclass : Pointer) : TGtkType;
|
||||||
|
begin
|
||||||
|
If (aclass <> nil) then
|
||||||
|
result := PGtkTypeClass(aclass)^.g_Type
|
||||||
|
else
|
||||||
|
result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gtk_object_get_class(anobject : Pointer) : Pointer;
|
||||||
|
begin
|
||||||
|
If (anobject <> nil) then
|
||||||
|
result := PGtkTypeObject(anobject)^.g_Class
|
||||||
|
else
|
||||||
|
result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
||||||
|
begin
|
||||||
|
if assigned(Window) then
|
||||||
|
result := GTK2.gtk_window_get_modal(window)
|
||||||
|
else
|
||||||
|
result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure gtk_signal_handlers_destroy(anObject : PGtkObject);
|
Procedure gtk_signal_handlers_destroy(anObject : PGtkObject);
|
||||||
begin
|
begin
|
||||||
g_signal_handlers_destroy(PGObject(anObject));
|
g_signal_handlers_destroy(PGObject(anObject));
|
||||||
@ -232,17 +291,9 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function GtkWidgetIsA(Widget: PGtkWidget; AType: TGtkType): boolean;
|
function GtkWidgetIsA(Widget: PGtkWidget; AType: TGtkType): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF GTK2}
|
|
||||||
Result:=(Widget<>nil)
|
Result:=(Widget<>nil)
|
||||||
and (PGtkTypeObject(Widget)^.g_class<>nil)
|
and (gtk_object_get_class(Widget)<>nil)
|
||||||
and gtk_type_is_a(PGtkTypeClass(PGtkTypeObject(Widget)^.g_class)^.g_type,
|
and gtk_type_is_a(gtk_class_get_type(gtk_object_get_class(Widget)), AType);
|
||||||
AType);
|
|
||||||
{$ELSE}
|
|
||||||
Result:=(Widget<>nil)
|
|
||||||
and (PGtkTypeObject(Widget)^.klass<>nil)
|
|
||||||
and gtk_type_is_a(PGtkTypeClass(PGtkTypeObject(Widget)^.klass)^.thetype,
|
|
||||||
AType);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -477,7 +528,6 @@ Function RegionType(RGN: PGDKRegion) : Longint;
|
|||||||
var
|
var
|
||||||
aRect : TGDKRectangle;
|
aRect : TGDKRectangle;
|
||||||
SimpleRGN: PGdkRegion;
|
SimpleRGN: PGdkRegion;
|
||||||
EmptyRGN: PGdkRegion;
|
|
||||||
begin
|
begin
|
||||||
If RGN = nil then
|
If RGN = nil then
|
||||||
Result := ERROR
|
Result := ERROR
|
||||||
@ -486,20 +536,12 @@ begin
|
|||||||
Result := NULLREGION
|
Result := NULLREGION
|
||||||
else begin
|
else begin
|
||||||
gdk_region_get_clipbox(RGN,@aRect);
|
gdk_region_get_clipbox(RGN,@aRect);
|
||||||
EmptyRGN:=gdk_region_new;
|
SimpleRGN := gdk_region_rectangle(@aRect);
|
||||||
{$IFDEF GTK2}
|
|
||||||
SimpleRGN:=EmptyRGN;
|
|
||||||
gdk_region_union_with_rect(SimpleRGN,@aRect);
|
|
||||||
{$ELSE}
|
|
||||||
SimpleRGN:=gdk_region_union_with_rect(EmptyRGN,@aRect);
|
|
||||||
{$ENDIF}
|
|
||||||
if gdk_region_equal(SimpleRGN, RGN) then
|
if gdk_region_equal(SimpleRGN, RGN) then
|
||||||
Result := SIMPLEREGION
|
Result := SIMPLEREGION
|
||||||
else
|
else
|
||||||
Result := COMPLEXREGION;
|
Result := COMPLEXREGION;
|
||||||
if SimpleRGN<>EmptyRGN then
|
gdk_region_destroy(SimpleRGN);
|
||||||
gdk_region_destroy(SimpleRGN);
|
|
||||||
gdk_region_destroy(EmptyRGN);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -528,21 +570,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CopyGDKRegion(RGN: PGDKRegion): PGDKRegion;
|
|
||||||
{$IFDEF GTK2}
|
|
||||||
begin
|
|
||||||
Result:=gdk_region_copy(RGN);
|
|
||||||
end;
|
|
||||||
{$ELSE}
|
|
||||||
var
|
|
||||||
EmptyRegion: PGdkRegion;
|
|
||||||
begin
|
|
||||||
EmptyRegion := gdk_region_new;
|
|
||||||
Result := gdk_regions_union(RGN, EmptyRegion);
|
|
||||||
gdk_region_destroy(EmptyRegion);
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
function GDKRegionAsString(RGN: PGDKRegion): string;
|
function GDKRegionAsString(RGN: PGDKRegion): string;
|
||||||
var
|
var
|
||||||
aRect: TGDKRectangle;
|
aRect: TGDKRectangle;
|
||||||
@ -556,22 +583,13 @@ end;
|
|||||||
|
|
||||||
function CreateRectGDKRegion(const ARect: TRect): PGDKRegion;
|
function CreateRectGDKRegion(const ARect: TRect): PGDKRegion;
|
||||||
var
|
var
|
||||||
{$IFNDEF Gtk2}
|
|
||||||
EmptyRegion: PGdkRegion;
|
|
||||||
{$ENDIF}
|
|
||||||
GDkRect: TGDKRectangle;
|
GDkRect: TGDKRectangle;
|
||||||
begin
|
begin
|
||||||
GDkRect.x:=ARect.Left;
|
GDkRect.x:=ARect.Left;
|
||||||
GDkRect.y:=ARect.Top;
|
GDkRect.y:=ARect.Top;
|
||||||
GDkRect.Width:=ARect.Right-ARect.Left;
|
GDkRect.Width:=ARect.Right-ARect.Left;
|
||||||
GDkRect.Height:=ARect.Bottom-ARect.Top;
|
GDkRect.Height:=ARect.Bottom-ARect.Top;
|
||||||
{$IFDEF GTK2}
|
|
||||||
Result:=gdk_region_rectangle(@GDKRect);
|
Result:=gdk_region_rectangle(@GDKRect);
|
||||||
{$ELSE}
|
|
||||||
EmptyRegion := gdk_region_new;
|
|
||||||
Result := gdk_region_union_with_rect(EmptyRegion,@GDkRect);
|
|
||||||
gdk_region_destroy(EmptyRegion);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure FreeGDIColor(GDIColor: PGDIColor);
|
Procedure FreeGDIColor(GDIColor: PGDIColor);
|
||||||
@ -1980,19 +1998,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GtkWindowIsModal(GtkWindow: PGtkWindow): boolean;
|
|
||||||
begin
|
|
||||||
writeln('GtkWindowIsModal This test is buggy');
|
|
||||||
Result := False;
|
|
||||||
{$IfDef GTK2}
|
|
||||||
if assigned(GtkWindow) then
|
|
||||||
result := gtk_window_get_modal(GtkWindow);
|
|
||||||
{$else}
|
|
||||||
if assigned(GtkWindow) then
|
|
||||||
Result:=(GtkWindow^.flag0 and bm_modal)<>0;
|
|
||||||
{$EndIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
procedure ConnectSignal(const AnObject:PGTKObject; const ASignal: PChar;
|
procedure ConnectSignal(const AnObject:PGTKObject; const ASignal: PChar;
|
||||||
const ACallBackProc: Pointer; const ReqSignalMask: TGdkEventMask;
|
const ACallBackProc: Pointer; const ReqSignalMask: TGdkEventMask;
|
||||||
@ -2311,6 +2316,8 @@ begin
|
|||||||
gtk_menu_set_accel_group(PGtkMenu(Widget), AnAccelGroup)
|
gtk_menu_set_accel_group(PGtkMenu(Widget), AnAccelGroup)
|
||||||
else begin
|
else begin
|
||||||
{$IfDef GTK2}
|
{$IfDef GTK2}
|
||||||
|
// Gtk2ToDo
|
||||||
|
writeln('ToDo: gtkproc.inc SetAccelGroup');
|
||||||
{$else}
|
{$else}
|
||||||
gtk_accel_group_attach(AnAccelGroup, PGtkObject(Widget));
|
gtk_accel_group_attach(AnAccelGroup, PGtkObject(Widget));
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -2584,6 +2591,7 @@ begin
|
|||||||
'');
|
'');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$Ifdef GTK2}
|
{$Ifdef GTK2}
|
||||||
|
writeln('ToDo: gtkproc.inc UnrealizeAccelerator');
|
||||||
{$else}
|
{$else}
|
||||||
gtk_widget_remove_accelerators(Widget, PChar(AccelKey^.Signal), false);
|
gtk_widget_remove_accelerators(Widget, PChar(AccelKey^.Signal), false);
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
@ -2698,11 +2706,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function MENU_ITEM_CLASS(widget: PGtkWidget): PGtkMenuItemClass;
|
function MENU_ITEM_CLASS(widget: PGtkWidget): PGtkMenuItemClass;
|
||||||
begin
|
begin
|
||||||
{$ifdef GTK2}
|
|
||||||
Result:=GTK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
Result:=GTK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
||||||
{$else}
|
|
||||||
Result:=GTK_MENU_ITEM_CLASS(PGtkObject(widget)^.klass);
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -2712,11 +2716,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function CHECK_MENU_ITEM_CLASS(widget: PGtkWidget): PGtkCheckMenuItemClass;
|
function CHECK_MENU_ITEM_CLASS(widget: PGtkWidget): PGtkCheckMenuItemClass;
|
||||||
begin
|
begin
|
||||||
{$ifdef GTK2}
|
|
||||||
Result:=GTK_CHECK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
Result:=GTK_CHECK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
||||||
{$else}
|
|
||||||
Result:=GTK_CHECK_MENU_ITEM_CLASS(PGtkObject(widget)^.klass);
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MenuItemChecked(MenuWidget: PGtkCheckMenuItem): boolean;
|
function MenuItemChecked(MenuWidget: PGtkCheckMenuItem): boolean;
|
||||||
@ -3783,10 +3783,10 @@ begin
|
|||||||
NoName:=nil;
|
NoName:=nil;
|
||||||
StyleObject^.Widget :=
|
StyleObject^.Widget :=
|
||||||
// GTK2 does not allow to instantiate the abstract base Widget
|
// GTK2 does not allow to instantiate the abstract base Widget
|
||||||
// so we use the invisible HBOX, which is hopefully not defined in the
|
// so we use the "invisible" widget, which should never be defined
|
||||||
// theme
|
// by the theme
|
||||||
GTK_WIDGET_NEW(
|
GTK_WIDGET_NEW(
|
||||||
{$IFDEF Gtk2}GTK_TYPE_HBOX{$ELSE}GTK_WIDGET_TYPE{$ENDIF},
|
{$IFDEF Gtk2}GTK_TYPE_INVISIBLE{$ELSE}GTK_WIDGET_TYPE{$ENDIF},
|
||||||
NoName,[]);
|
NoName,[]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -4380,10 +4380,9 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function GDKPixel2GDIRGB(Pixel: Longint; Visual: PGDKVisual;
|
Function GDKPixel2GDIRGB(Pixel: Longint; Visual: PGDKVisual;
|
||||||
Colormap: PGDKColormap) : TGDIRGB;
|
Colormap: PGDKColormap) : TGDIRGB;
|
||||||
{$IFDEF Gtk2}
|
|
||||||
{$ELSE}
|
|
||||||
var
|
var
|
||||||
Color: TGDKColor;
|
Color: TGDKColor;
|
||||||
|
{$IFDEF Gtk1}
|
||||||
GdkColorContext: PGdkColorContext;
|
GdkColorContext: PGdkColorContext;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
@ -4394,25 +4393,22 @@ begin
|
|||||||
Colormap := GDK_Colormap_Get_System;
|
Colormap := GDK_Colormap_Get_System;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF Gtk2}
|
|
||||||
// Gtk2ToDo
|
|
||||||
writeln('ToDo: GDKPixel2GDIRGB');
|
|
||||||
if Pixel=0 then ;
|
|
||||||
FillChar(Result,SizeOf(Result),0);
|
|
||||||
{$ELSE}
|
|
||||||
gdk_error_trap_push;
|
gdk_error_trap_push;
|
||||||
|
|
||||||
|
{$IFDEF Gtk2}
|
||||||
|
gdk_colormap_query_color(colormap, pixel, @color);
|
||||||
|
{$ELSE}
|
||||||
Color.Pixel := Pixel;
|
Color.Pixel := Pixel;
|
||||||
GdkColorContext := gdk_color_context_new(Visual,Colormap);
|
GdkColorContext := gdk_color_context_new(Visual,Colormap);
|
||||||
gdk_color_context_query_color(GdkColorContext,@Color);
|
gdk_color_context_query_color(GdkColorContext,@Color);
|
||||||
gdk_color_context_free(GdkColorContext);
|
gdk_color_context_free(GdkColorContext);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
Result.Red := Color.Red shr 8;
|
Result.Red := Color.Red shr 8;
|
||||||
Result.Green := Color.Green shr 8;
|
Result.Green := Color.Green shr 8;
|
||||||
Result.Blue := Color.Blue shr 8;
|
Result.Blue := Color.Blue shr 8;
|
||||||
|
|
||||||
gdk_error_trap_pop;
|
gdk_error_trap_pop;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -4534,6 +4530,13 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.198 2003/09/06 20:23:53 ajgenius
|
||||||
|
fixes for gtk2
|
||||||
|
added more wrappers for gtk1/gtk2 converstion and sanity
|
||||||
|
removed pointless version $Ifdef GTK2 etc
|
||||||
|
IDE now "runs" Tcontrol drawing/using problems
|
||||||
|
renders it unuseable however
|
||||||
|
|
||||||
Revision 1.197 2003/09/06 17:24:52 ajgenius
|
Revision 1.197 2003/09/06 17:24:52 ajgenius
|
||||||
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
||||||
|
|
||||||
|
@ -61,6 +61,12 @@ uses
|
|||||||
function GTK_TYPE_MENU_BAR : TGTKType; cdecl; external gtkdll name 'gtk_menu_bar_get_type';
|
function GTK_TYPE_MENU_BAR : TGTKType; cdecl; external gtkdll name 'gtk_menu_bar_get_type';
|
||||||
function GTK_TYPE_RADIO_MENU_ITEM : TGTKType; cdecl; external gtkdll name 'gtk_radio_menu_item_get_type';
|
function GTK_TYPE_RADIO_MENU_ITEM : TGTKType; cdecl; external gtkdll name 'gtk_radio_menu_item_get_type';
|
||||||
function GTK_TYPE_CHECK_MENU_ITEM : TGTKType; cdecl; external gtkdll name 'gtk_check_menu_item_get_type';
|
function GTK_TYPE_CHECK_MENU_ITEM : TGTKType; cdecl; external gtkdll name 'gtk_check_menu_item_get_type';
|
||||||
|
function GTK_TYPE_TEXT : TGTKType; cdecl; external gtkdll name 'gtk_text_get_type';
|
||||||
|
function GTK_TYPE_ENTRY : TGTKType; cdecl; external gtkdll name 'gtk_entry_get_type';
|
||||||
|
function GTK_TYPE_RANGE : TGTKType; cdecl; external gtkdll name 'gtk_range_get_type';
|
||||||
|
function GTK_TYPE_SCROLLBAR : TGTKType; cdecl; external gtkdll name 'gtk_scrollbar_get_type';
|
||||||
|
function GTK_TYPE_HSCROLLBAR : TGTKType; cdecl; external gtkdll name 'gtk_hscrollbar_get_type';
|
||||||
|
function GTK_TYPE_VSCROLLBAR : TGTKType; cdecl; external gtkdll name 'gtk_vscrollbar_get_type';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
procedure laz_gdk_gc_set_dashes(gc:PGdkGC; dash_offset:gint;
|
procedure laz_gdk_gc_set_dashes(gc:PGdkGC; dash_offset:gint;
|
||||||
@ -281,7 +287,6 @@ function CopyDCData(DestinationDC, SourceDC: TDeviceContext): Boolean;
|
|||||||
|
|
||||||
Function RegionType(RGN: PGDKRegion): Longint;
|
Function RegionType(RGN: PGDKRegion): Longint;
|
||||||
Procedure SelectGDIRegion(const DC: HDC);
|
Procedure SelectGDIRegion(const DC: HDC);
|
||||||
function CopyGDKRegion(RGN: PGDKRegion): PGDKRegion;
|
|
||||||
function GDKRegionAsString(RGN: PGDKRegion): string;
|
function GDKRegionAsString(RGN: PGDKRegion): string;
|
||||||
function CreateRectGDKRegion(const ARect: TRect): PGDKRegion;
|
function CreateRectGDKRegion(const ARect: TRect): PGDKRegion;
|
||||||
|
|
||||||
@ -331,7 +336,6 @@ function TranslateGdkPointToClientArea(SourceWindow: PGdkWindow;
|
|||||||
procedure ReleaseMouseCapture(OnlyIfCapturedByLCL: boolean);
|
procedure ReleaseMouseCapture(OnlyIfCapturedByLCL: boolean);
|
||||||
procedure UpdateMouseCaptureControl;
|
procedure UpdateMouseCaptureControl;
|
||||||
procedure SetCursor(AWinControl : TWinControl; Data: Pointer);
|
procedure SetCursor(AWinControl : TWinControl; Data: Pointer);
|
||||||
function GtkWindowIsModal(GtkWindow: PGtkWindow): boolean;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TConnectSignalFlag = (
|
TConnectSignalFlag = (
|
||||||
@ -477,6 +481,7 @@ Procedure FillScreenFonts(ScreenFonts : TStrings);
|
|||||||
function GetGDKMouseCursor(Cursor: TCursor): PGdkCursor;
|
function GetGDKMouseCursor(Cursor: TCursor): PGdkCursor;
|
||||||
Procedure FreeGDKCursors;
|
Procedure FreeGDKCursors;
|
||||||
|
|
||||||
|
// functions for easier GTK2<->GTK1 Compatibility/Consistancy ---->
|
||||||
function gtk_widget_get_xthickness(Style : PGTKStyle) : gint; overload;
|
function gtk_widget_get_xthickness(Style : PGTKStyle) : gint; overload;
|
||||||
function gtk_widget_get_ythickness(Style : PGTKStyle) : gint; overload;
|
function gtk_widget_get_ythickness(Style : PGTKStyle) : gint; overload;
|
||||||
|
|
||||||
@ -487,24 +492,36 @@ function gtk_widget_get_ythickness(Style : PGTKWidget) : gint; overload;
|
|||||||
type
|
type
|
||||||
PGtkOldEditable = PGtkEditable;
|
PGtkOldEditable = PGtkEditable;
|
||||||
|
|
||||||
Function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
function gtk_class_get_type(aclass : Pointer) : TGtkType;
|
||||||
|
|
||||||
|
//routines to mimic similar GTK2 routines-->
|
||||||
|
function gtk_object_get_class(anobject : Pointer) : Pointer;
|
||||||
Function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
Function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
||||||
|
Function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
||||||
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
||||||
|
|
||||||
|
//Wrapper around misnamed "regions" routines -->
|
||||||
Function gdk_region_intersect(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_intersect(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
Function gdk_region_union(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_union(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
Function gdk_region_subtract(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_subtract(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
Function gdk_region_xor(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_xor(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
|
function gdk_region_copy(region: PGDKRegion): PGDKRegion;
|
||||||
|
function gdk_region_rectangle(rect: PGdkRectangle): PGDKRegion;
|
||||||
|
|
||||||
|
//Wrapper around window geometry like gtk2 -->
|
||||||
Function gdk_drawable_get_depth(Drawable : PGDKDrawable) : gint;
|
Function gdk_drawable_get_depth(Drawable : PGDKDrawable) : gint;
|
||||||
Procedure gdk_drawable_get_size(Drawable : PGDKDrawable; Width, Height : PGInt);
|
Procedure gdk_drawable_get_size(Drawable : PGDKDrawable; Width, Height : PGInt);
|
||||||
{$EndIF}
|
{$EndIF}
|
||||||
|
|
||||||
{$Ifdef GTK2}
|
{$Ifdef GTK2}
|
||||||
Procedure gtk_signal_handlers_destroy(anObject : PGtkObject);
|
Procedure gtk_signal_handlers_destroy(anObject : PGtkObject);
|
||||||
|
function gtk_class_get_type(aclass : Pointer) : TGtkType;
|
||||||
|
|
||||||
|
//we wrap our own versions to handle nil tests -->
|
||||||
|
function gtk_object_get_class(anobject : Pointer) : Pointer;
|
||||||
|
Function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
||||||
|
|
||||||
|
//we wrap our own versions to do gtk1 style result = new region -->
|
||||||
Function gdk_region_union_with_rect(region:PGdkRegion; rect:PGdkRectangle) : PGdkRegion;
|
Function gdk_region_union_with_rect(region:PGdkRegion; rect:PGdkRectangle) : PGdkRegion;
|
||||||
Function gdk_region_intersect(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_intersect(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
Function gdk_region_union(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
Function gdk_region_union(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
||||||
|
@ -1852,7 +1852,7 @@ begin
|
|||||||
RGN_AND :
|
RGN_AND :
|
||||||
D := PGDKRegion(gdk_region_intersect(S1, S2));
|
D := PGDKRegion(gdk_region_intersect(S1, S2));
|
||||||
RGN_COPY :
|
RGN_COPY :
|
||||||
D := CopyGDKRegion(S1);
|
D := gdk_region_copy(S1);
|
||||||
RGN_DIFF :
|
RGN_DIFF :
|
||||||
D := PGDKRegion(gdk_region_subtract(S1, S2));
|
D := PGDKRegion(gdk_region_subtract(S1, S2));
|
||||||
RGN_OR :
|
RGN_OR :
|
||||||
@ -1936,7 +1936,7 @@ function TgtkObject.ComboBoxDropDown(Handle: HWND; DropDown: boolean): boolean;
|
|||||||
if ((not show_hscroll) and (alloc_width < list_requisition^.width)) then
|
if ((not show_hscroll) and (alloc_width < list_requisition^.width)) then
|
||||||
begin
|
begin
|
||||||
work_height := work_height + popup^.hscrollbar^.requisition.height +
|
work_height := work_height + popup^.hscrollbar^.requisition.height +
|
||||||
GTK_SCROLLED_WINDOW_CLASS(PGtkTypeObject(combo^.popup)^.{$IfDef GTK2}g_Class{$Else}klass{$EndIf})^.scrollbar_spacing;
|
GTK_SCROLLED_WINDOW_CLASS(gtk_object_get_class(combo^.popup))^.scrollbar_spacing;
|
||||||
show_hscroll := TRUE;
|
show_hscroll := TRUE;
|
||||||
okay_to_exit := False;
|
okay_to_exit := False;
|
||||||
end;
|
end;
|
||||||
@ -1949,7 +1949,7 @@ function TgtkObject.ComboBoxDropDown(Handle: HWND; DropDown: boolean): boolean;
|
|||||||
end;
|
end;
|
||||||
alloc_width := alloc_width -
|
alloc_width := alloc_width -
|
||||||
popup^.vscrollbar^.requisition.width +
|
popup^.vscrollbar^.requisition.width +
|
||||||
GTK_SCROLLED_WINDOW_CLASS(PGtkTypeObject(combo^.popup)^.{$IfDef GTK2}g_Class{$Else}klass{$EndIf})^.scrollbar_spacing;
|
GTK_SCROLLED_WINDOW_CLASS(gtk_object_get_class(combo^.popup))^.scrollbar_spacing;
|
||||||
show_vscroll := TRUE;
|
show_vscroll := TRUE;
|
||||||
okay_to_exit := False;
|
okay_to_exit := False;
|
||||||
end;
|
end;
|
||||||
@ -3685,8 +3685,7 @@ begin
|
|||||||
else with TDeviceContext(DC) do
|
else with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
// create a copy of the current clipregion
|
// create a copy of the current clipregion
|
||||||
ClipRegionWithDCOffset:=
|
ClipRegionWithDCOffset:= gdk_region_copy(PGdiObject(ClipRegion)^.GDIRegionObject);
|
||||||
CopyGDKRegion(PGdiObject(ClipRegion)^.GDIRegionObject);
|
|
||||||
// move it to the DC offset
|
// move it to the DC offset
|
||||||
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
||||||
// then the ClipRegion must be moved to 0,0
|
// then the ClipRegion must be moved to 0,0
|
||||||
@ -8711,6 +8710,13 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.275 2003/09/06 20:23:53 ajgenius
|
||||||
|
fixes for gtk2
|
||||||
|
added more wrappers for gtk1/gtk2 converstion and sanity
|
||||||
|
removed pointless version $Ifdef GTK2 etc
|
||||||
|
IDE now "runs" Tcontrol drawing/using problems
|
||||||
|
renders it unuseable however
|
||||||
|
|
||||||
Revision 1.274 2003/09/06 17:24:52 ajgenius
|
Revision 1.274 2003/09/06 17:24:52 ajgenius
|
||||||
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
||||||
|
|
||||||
|
@ -33,9 +33,20 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
{$IfNDef GTK2_2}
|
{$IfNDef GTK2_2}
|
||||||
X, XLib, XUtil,
|
{$IfNDef Win32}
|
||||||
|
X, XLib, XUtil,
|
||||||
|
{$EndIf}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
gdk2pixbuf, gtk2, gdk2, glib2, gtkInt;
|
|
||||||
|
gdk2pixbuf, gtk2, gdk2, glib2,
|
||||||
|
|
||||||
|
LMessages, Controls, Forms, VclGlobals, LCLProc,
|
||||||
|
LCLStrConsts, LCLLinux, LCLType, DynHashArray, LazLinkedList,
|
||||||
|
GraphType, GraphMath, Graphics, Buttons, Menus, GTKWinApiWindow, StdCtrls,
|
||||||
|
ComCtrls, CListBox, KeyMap, Calendar, Arrow, Spin, CommCtrl, ExtCtrls,
|
||||||
|
Dialogs, ExtDlgs, FileCtrl, LResources, Math, GTKGlobals,
|
||||||
|
|
||||||
|
gtkDef, gtkProc, gtkInt;
|
||||||
|
|
||||||
type
|
type
|
||||||
TGtk2Object = class(TGtkObject)
|
TGtk2Object = class(TGtkObject)
|
||||||
@ -48,8 +59,10 @@ type
|
|||||||
Procedure gdk_display_get_pointer(display : PGdkDisplay; screen :PGdkScreen; x :Pgint; y : Pgint; mask : PGdkModifierType); cdecl; external gdklib;
|
Procedure gdk_display_get_pointer(display : PGdkDisplay; screen :PGdkScreen; x :Pgint; y : Pgint; mask : PGdkModifierType); cdecl; external gdklib;
|
||||||
function gdk_display_get_default:PGdkDisplay; cdecl; external gdklib;
|
function gdk_display_get_default:PGdkDisplay; cdecl; external gdklib;
|
||||||
{$Else}
|
{$Else}
|
||||||
Function gdk_x11_drawable_get_xdisplay(drawable : PGdkDrawable) : PDisplay; cdecl; external gdklib;
|
{$IfNDef Win32}
|
||||||
Function gdk_x11_drawable_get_xid(drawable : PGdkDrawable) : Integer; cdecl; external gdklib;
|
Function gdk_x11_drawable_get_xdisplay(drawable : PGdkDrawable) : PDisplay; cdecl; external gdklib;
|
||||||
|
Function gdk_x11_drawable_get_xid(drawable : PGdkDrawable) : Integer; cdecl; external gdklib;
|
||||||
|
{$EndIf}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
|
|
||||||
@ -63,11 +76,13 @@ implementation
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function Tgtk2Object.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
function Tgtk2Object.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
||||||
{$IfnDef GTK2_2} //we need a GTK2_2 FLAG somehow
|
{$IfnDef GTK2_2} //we need a GTK2_2 FLAG somehow
|
||||||
var
|
{$IfNDef Win32}
|
||||||
root, child: pointer;
|
var
|
||||||
winx, winy: Integer;
|
root, child: pointer;
|
||||||
xmask: Cardinal;
|
winx, winy: Integer;
|
||||||
TopList, List: PGList;
|
xmask: Cardinal;
|
||||||
|
TopList, List: PGList;
|
||||||
|
{$EndIf}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -75,25 +90,30 @@ begin
|
|||||||
gdk_display_get_pointer(gdk_display_get_default(), nil, @lpPoint.X, @lpPoint.Y, nil);
|
gdk_display_get_pointer(gdk_display_get_default(), nil, @lpPoint.X, @lpPoint.Y, nil);
|
||||||
Result := True;
|
Result := True;
|
||||||
{$Else}
|
{$Else}
|
||||||
TopList := gdk_window_get_toplevels;
|
{$IfNDef Win32}
|
||||||
List := TopList;
|
TopList := gdk_window_get_toplevels;
|
||||||
while List <> nil do
|
List := TopList;
|
||||||
begin
|
while List <> nil do
|
||||||
if (List^.Data <> nil)
|
begin
|
||||||
and gdk_window_is_visible(List^.Data)
|
if (List^.Data <> nil)
|
||||||
then begin
|
and gdk_window_is_visible(List^.Data)
|
||||||
XQueryPointer(gdk_x11_drawable_get_xdisplay (List^.Data),
|
then begin
|
||||||
gdk_x11_drawable_get_xid(List^.Data),
|
XQueryPointer(gdk_x11_drawable_get_xdisplay (List^.Data),
|
||||||
@root, @child, @lpPoint.X, @lpPoint.Y, @winx, @winy, @xmask);
|
gdk_x11_drawable_get_xid(List^.Data),
|
||||||
|
@root, @child, @lpPoint.X, @lpPoint.Y, @winx, @winy, @xmask);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
List := g_list_next(List);
|
List := g_list_next(List);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if TopList <> nil
|
if TopList <> nil
|
||||||
then g_list_free(TopList);
|
then g_list_free(TopList);
|
||||||
|
{$Else}
|
||||||
|
// Win32 Todo
|
||||||
|
writeln('ToDo(Win32): Tgtk2object.GetCursorPos');
|
||||||
|
{$EndIf}
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -101,6 +121,13 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.4 2003/09/06 20:23:53 ajgenius
|
||||||
|
fixes for gtk2
|
||||||
|
added more wrappers for gtk1/gtk2 converstion and sanity
|
||||||
|
removed pointless version $Ifdef GTK2 etc
|
||||||
|
IDE now "runs" Tcontrol drawing/using problems
|
||||||
|
renders it unuseable however
|
||||||
|
|
||||||
Revision 1.3 2003/09/06 17:24:52 ajgenius
|
Revision 1.3 2003/09/06 17:24:52 ajgenius
|
||||||
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
gtk2 changes for pixmap, getcursorpos, mouse events workaround
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user