= moved some types to gtkdef
  + added WinWidgetInfo
  + added some initialization to Application.Create

git-svn-id: trunk@135 -
This commit is contained in:
lazarus 2001-01-24 23:26:40 +00:00
parent 033fc13f37
commit 2661a323d9
8 changed files with 233 additions and 91 deletions

1
.gitattributes vendored
View File

@ -190,6 +190,7 @@ lcl/include/wincontrol.inc svneol=native#text/pascal
lcl/interfacebase.pp svneol=native#text/pascal
lcl/interfaces/gtk/dragicons.inc svneol=native#text/pascal
lcl/interfaces/gtk/gtkcallback.inc svneol=native#text/pascal
lcl/interfaces/gtk/gtkdef.pp svneol=native#text/pascal
lcl/interfaces/gtk/gtkdragcallback.inc svneol=native#text/pascal
lcl/interfaces/gtk/gtkint.pp svneol=native#text/pascal
lcl/interfaces/gtk/gtklistsl.inc svneol=native#text/pascal

View File

@ -129,6 +129,9 @@ var
procedure SetCaptureGrabber(AGrabber:TGrabber);
begin
Write('SETCAPTUREGRABBER to.... ');
if AGrabber <> nil then Writeln(Format('0x%x', [AGrabber.handle])) else writeln('nil');
CaptureGrabber:=AGrabber;
end;

View File

@ -7,12 +7,14 @@
{------------------------------------------------------------------------------}
constructor TApplication.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTerminate := False;
FMainForm := nil;
FMouseControl := nil;
FHandle := 0;
FList := nil;
FOnIdle := nil;
inherited Create(AOwner);
end;
{------------------------------------------------------------------------------}
@ -20,7 +22,7 @@ end;
{------------------------------------------------------------------------------}
destructor TApplication.Destroy;
begin
if FList <> nil then FList.Free;
FList.Free;
inherited Destroy;
end;
@ -238,6 +240,12 @@ end;
{ =============================================================================
$Log$
Revision 1.3 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
Revision 1.2 2000/09/10 19:58:47 lazarus
MWE:
* Updated makefiles for FPC release 1.0 binary units

View File

@ -297,12 +297,18 @@ end;
function gtkdestroyCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
var
Mess : TLMessage;
Mess: TLMessage;
Info: PWinWidgetInfo;
begin
Result := True;
EventTrace('destroy', data);
Mess.msg := LM_DESTROY;
Result := DeliverMessage(Data, Mess) = 0;
// NOTE: if the destroy message is posted
// we should post a info destroy message as well
Info := GetWidgetInfo(widget, False);
if Info <> nil then Dispose(Info);
end;
function gtkdeleteCB( widget : PGtkWidget; event : PGdkEvent; data : gPointer) : GBoolean; cdecl;
@ -1092,6 +1098,12 @@ end;
{ =============================================================================
$Log$
Revision 1.18 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
Revision 1.17 2001/01/24 03:21:03 lazarus
Removed gtkDrawDefualt signal function from gtkcallback.inc
It was no longer used.

View File

@ -0,0 +1,120 @@
{ $Id$
------------------------------
gtkdef.pp - Type definitions
------------------------------
@created(Wed Jan 24st WET 2001)
@lastmod($Date$)
@author(Marc Weustink <marc@@lazarus.dommelstein.net>)
This unit contains type definitions needed in the GTK <-> LCL interface
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
unit gtkdef;
{$mode objfpc}
interface
uses
gtk, gdk, LCLLinux, VclGlobals, Classes;
type
TGDIType = (gdiBitmap, gdiBrush, gdiFont, gdiPen, gdiRegion);
TGDIBitmapType = (gbBitmap, gbPixmap, gbImage);
PGDIRGB = ^TGDIRGB;
TGDIRGB = record
Red,
Green,
Blue: Byte;
end;
PGDIRawImage = ^TGDIRawImage;
TGDIRawImage = record
Height,
Width: Integer;
Depth: Byte;
Data: array[0..0] of TGDIRGB;
end;
PGDIObject = ^TGDIObject;
TGDIObject = record
case GDIType: TGDIType of
gdiBitmap: (
GDIBitmapMaskObject: PGdkPixmap;
case GDIBitmapType: TGDIBitmapType of
gbBitmap: (GDIBitmapObject: PGdkBitmap);
gbPixmap: (GDIPixmapObject: PGdkPixmap);
gbImage : (GDIRawImageObject: PGDIRawImage);
);
gdiBrush: (
GDIBrushColor: TGdkColor;
GDIBrushFill: TGdkFill;
GDIBrushPixMap: PGdkPixmap;
);
gdiFont: (
GDIFontObject: PGdkFont;
LogFont: TLogFont; // for now font info is stored as well, later query font params
);
gdiPen: (
GDIPenColor: TGdkColor;
GDIPenWidth: Integer;
GDIPenStyle: Word;
);
gdiRegion: (
);
end;
// move to class ??
PDeviceContext = ^TDeviceContext;
TDeviceContext = record
hWnd: HWND;
GC: pgdkGC;
Drawable: PGDKDrawable;
PenPos: TPoint;
CurrentBitmap: PGdiObject;
CurrentFont: PGdiObject;
CurrentPen: PGdiObject;
CurrentBrush: PGdiObject;
CurrentTextColor: TGdkColor;
CurrentBackColor: TGdkColor;
SavedContext: PDeviceContext; // linked list of saved DCs
end;
// Info needed by the API of a HWND (=Widget)
PWinWidgetInfo = ^TWinWidgetInfo;
TWinWidgetInfo = record
ImplementationWidget: PGTKWidget; // used to be "fixed" or "core-child"
UpdateRect: TRect; // used by LM_Paint, beginpaint etc
WndProc: Integer; // window data
Style: Integer;
ExStyle: Integer;
UserData: Integer;
end;
implementation
end.
{ =============================================================================
$Log$
Revision 1.1 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
}

View File

@ -30,76 +30,9 @@ interface
uses
InterfaceBase, gtk, gdk, glib, sysutils, lmessages, Classes, Controls,
extctrls, forms,dialogs, VclGlobals,stdctrls, comctrls, LCLLinux;
extctrls, forms,dialogs, VclGlobals,stdctrls, comctrls, LCLLinux, gtkdef;
type
TGDIType = (gdiBitmap, gdiBrush, gdiFont, gdiPen, gdiRegion);
TGDIBitmapType = (gbBitmap, gbPixmap, gbImage);
PGDIRGB = ^TGDIRGB;
TGDIRGB = record
Red,
Green,
Blue: Byte;
end;
PGDIRawImage = ^TGDIRawImage;
TGDIRawImage = record
Height,
Width: Integer;
Depth: Byte;
Data: array[0..0] of TGDIRGB;
end;
PGDIObject = ^TGDIObject;
TGDIObject = record
case GDIType: TGDIType of
gdiBitmap: (
GDIBitmapMaskObject: PGdkPixmap;
case GDIBitmapType: TGDIBitmapType of
gbBitmap: (GDIBitmapObject: PGdkBitmap);
gbPixmap: (GDIPixmapObject: PGdkPixmap);
gbImage : (GDIRawImageObject: PGDIRawImage);
);
gdiBrush: (
GDIBrushColor: TGdkColor;
GDIBrushFill: TGdkFill;
GDIBrushPixMap: PGdkPixmap;
);
gdiFont: (
GDIFontObject: PGdkFont;
LogFont: TLogFont; // for now font info is stored as well, later query font params
);
gdiPen: (
GDIPenColor: TGdkColor;
GDIPenWidth: Integer;
GDIPenStyle: Word;
);
gdiRegion: (
);
end;
// move to class ??
PDeviceContext = ^TDeviceContext;
TDeviceContext = record
hWnd: HWND;
GC: pgdkGC;
Drawable: PGDKDrawable;
PenPos: TPoint;
CurrentBitmap: PGdiObject;
CurrentFont: PGdiObject;
CurrentPen: PGdiObject;
CurrentBrush: PGdiObject;
CurrentTextColor: TGdkColor;
CurrentBackColor: TGdkColor;
SavedContext: PDeviceContext; // linked list of saved DCs
end;
type
TgtkObject = class(TInterfaceBase)
private
FKeyStateList: TList; // Keeps track of which keys are pressed
@ -162,21 +95,18 @@ type
procedure HandleEvents; override;
procedure AppTerminate; override;
procedure Init; override;
function UpdateHint(Sender: TObject): Integer; override;
function UpdateHint(Sender: TObject): Integer; override;
{$I gtkwinapih.inc}
end;
//procedure EventTrace(message : string; data : pointer);
{$I gtklistslh.inc}
implementation
Implementation
uses Graphics, buttons, Menus, GTKWinApiWindow, CListBox;
uses
Graphics, buttons, Menus, GTKWinApiWindow, CListBox;
{$I gtklistsl.inc}
@ -185,7 +115,7 @@ const
TARGET_ENTRYS = 3;
var
target_table : Array[0..TARGET_ENTRYS - 1] of TgtkTargetEntry;
target_table : array[0..TARGET_ENTRYS - 1] of TgtkTargetEntry;
//drag icons
TrashCan_Open : PgdkPixmap;
@ -308,6 +238,12 @@ end.
{ =============================================================================
$Log$
Revision 1.4 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
Revision 1.3 2001/01/23 23:33:55 lazarus
MWE:
- Removed old LM_InvalidateRect

View File

@ -1449,22 +1449,22 @@ const
//unused: Tpixdata = Array[1..20] of String;
var
caption : string; // the caption of "Sender"
StrTemp : PChar; // same as "caption" but as PChar
TempWidget : PGTKWidget; // pointer to gtk-widget (local use when neccessary)
p : pointer; // ptr to the newly created GtkWidget
CompStyle, // componentstyle (type) of GtkWidget which will be created
TempInt : Integer; // local use when neccessary
Adjustment: PGTKAdjustment; // currently only used for csFixed
caption : string; // the caption of "Sender"
StrTemp : PChar; // same as "caption" but as PChar
TempWidget : PGTKWidget; // pointer to gtk-widget (local use when neccessary)
p : pointer; // ptr to the newly created GtkWidget
CompStyle, // componentstyle (type) of GtkWidget which will be created
TempInt : Integer; // local use when neccessary
Adjustment: PGTKAdjustment; // currently only used for csFixed
// - for csBitBtn
box1 : pgtkWidget; // currently only used for TBitBtn
pixmap : pGdkPixMap; // TBitBtn - the default pixmap
pixmapwid : pGtkWidget; // currently only used for TBitBtn
mask : pGDKBitmap; // currently only used for TBitBtn
style : pgtkStyle; // currently only used for TBitBtn
style : pgtkStyle; // currently only used for TBitBtn
label1 : pgtkwidget; // currently only used for TBitBtn
TempStr : String; // currently only used for TBitBtn to load default pixmap
pStr : PChar; // currently only used for TBitBtn to load default pixmap
TempStr : String; // currently only used for TBitBtn to load default pixmap
pStr : PChar; // currently only used for TBitBtn to load default pixmap
begin
Assert(False, 'Trace:In CreateComponet');
@ -1518,6 +1518,7 @@ begin
style := gtk_widget_get_style(pGTKWidget(p));
// is this neccessary?
// MWE: nope, if needeid, it should be done static
TempStr := './images/menu.xpm';
pStr := StrAlloc(length(TempStr) + 1);
StrPCopy(pStr, TempStr);
@ -1573,7 +1574,12 @@ begin
gtk_container_set_focus_hadjustment(PGtkContainer(TempWidget),
gtk_scrolled_window_get_hadjustment(PGtkScrolledWindow(p)));
gtk_widget_show(TempWidget);
//--------------------------
// MWE: will be obsoleted
SetCoreChildWidget(p, TempWidget);
//--------------------------
GetWidgetInfo(p, True)^.ImplementationWidget := TempWidget;
SetMainWidget(p, TempWidget);
end;
@ -1600,7 +1606,11 @@ begin
end;
gtk_widget_show(TempWidget);
//--------------------------
// MWE: will be obsoleted
SetCoreChildWidget(p, TempWidget);
//--------------------------
GetWidgetInfo(p, True)^.ImplementationWidget := TempWidget;
SetMainWidget(p, TempWidget);
end;
@ -1710,7 +1720,11 @@ begin
gtk_box_pack_start(PGtkBox(P), TempWidget, true, true, 0);
gtk_widget_show(TempWidget);
//--------------------------
// MWE: will be obsoleted
SetCoreChildWidget(p, TempWidget);
//--------------------------
GetWidgetInfo(p, True)^.ImplementationWidget := TempWidget;
SetMainWidget(p, TempWidget);
case (Sender as TCustomMemo).Scrollbars of
@ -1917,7 +1931,7 @@ begin
else if (Sender is TCommonDialog)
then TCommonDialog(Sender).Handle:= THandle(p);
// MWE: next will be obsoleted by WinWidgetInfo
//Set these for functions like GetWindowLong Added 01/07/2000
{}
SetLCLObject(p, Sender);
@ -1929,6 +1943,8 @@ begin
{}
//--------------------------
StrDispose(StrTemp);
Assert(False, 'Trace:Leaving CreateComponent');
@ -2571,6 +2587,12 @@ end;
{ =============================================================================
$Log$
Revision 1.21 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
Revision 1.20 2001/01/24 03:21:03 lazarus
Removed gtkDrawDefualt signal function from gtkcallback.inc
It was no longer used.

View File

@ -524,6 +524,40 @@ end;
(***********************************************************************
Widget member functions
************************************************************************)
// ----------------------------------------------------------------------
// Creates a WinWidget info structure for the given widget
// Info needed by the API of a HWND (=Widget)
//
// This structure obsoletes:
// "core-child", "fixed", "class"
// ----------------------------------------------------------------------
function CreateWidgetInfo(const Widget: Pointer): PWinWidgetInfo;
begin
if Widget = nil
then begin
Result := nil;
end
else begin
New(Result);
FillChar(Result, SizeOf(Result^), 0);
gtk_object_set_data(Widget, 'widgetinfo', Result);
end;
end;
function GetWidgetInfo(const Widget: Pointer; const Create: Boolean): PWinWidgetInfo;
begin
if Widget = nil
then begin
Result := nil;
end
else begin
Result := gtk_object_get_data(Widget, 'widgetinfo');
if (Result = nil) and Create
then Result := CreateWidgetInfo(Widget);
end;
end;
// ----------------------------------------------------------------------
// the core_child widget points to the actual widget which implements the
// functionality we needed. It is mainly used in composed controls like
@ -689,6 +723,12 @@ end;
{ =============================================================================
$Log$
Revision 1.9 2001/01/24 23:26:40 lazarus
MWE:
= moved some types to gtkdef
+ added WinWidgetInfo
+ added some initialization to Application.Create
Revision 1.8 2001/01/23 23:33:55 lazarus
MWE:
- Removed old LM_InvalidateRect