AJ: rearranged GTK init stuff for proper GNOME init & less duplication between interfaces

git-svn-id: trunk@1308 -
This commit is contained in:
lazarus 2002-02-09 01:48:15 +00:00
parent 82911c499e
commit c3330d755b

View File

@ -47,7 +47,11 @@ uses
type
TGnomeObject = class(TGtkObject)
protected
procedure InitStockItems; override;
procedure FreeStockItems; override;
procedure CreateComponent(Sender : TObject); override;
procedure Init; override;
public
{$I gnomewinapih.inc}
end;
@ -60,6 +64,14 @@ const
LAZARUS_STOCK_BUTTON_RETRY = 'lazarus_button_retry';
LAZARUS_STOCK_BUTTON_IGNORE = 'lazarus_button_ignore';
var
LAZBTNALL,
LAZBTNYESALL,
LAZBTNNOALL,
LAZBTNABORT,
LAZBTNRETRY,
LAZBTNIGNORE : PGnomeStockPixmapEntryData;
implementation
uses
@ -90,6 +102,117 @@ begin
gnome_icon_text_info_free(Layout);
end;
Procedure TGnomeObject.InitStockItems;
begin
Inherited InitStockItems;
New(LAZBTNAll);
With LAZBTNAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbALL));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_ALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNALL));
New(LAZBTNYESAll);
With LAZBTNYESAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbYesToAll));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_YESALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNYESALL));
New(LAZBTNNOAll);
With LAZBTNNOAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbNOToAll));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_NOALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNNOALL));
New(LAZBTNABORT);
With LAZBTNABORT^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbAbort));
xpm_data := PPgchar(@IMGCancel_X[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_ABORT, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNABORT));
New(LAZBTNRETRY);
With LAZBTNRETRY^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbRetry));
xpm_data := PPgchar(@IMGOK_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_RETRY, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNRETRY));
New(LAZBTNIGNORE);
With LAZBTNIGNORE^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbIgnore));
xpm_data := PPgchar(@IMGOK_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_IGNORE, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNIGNORE));
end;
Procedure TGnomeObject.FreeStockItems;
begin
Inherited FreeStockItems;
Dispose(LAZBTNALL);
Dispose(LAZBTNYESALL);
Dispose(LAZBTNNOALL);
Dispose(LAZBTNABORT);
Dispose(LAZBTNRETRY);
Dispose(LAZBTNIGNORE);
end;
procedure TGnomeObject.Init;
begin
// initialize app level gtk engine
gtk_set_locale ();
// call init and pass cmd line args
gnome_init('lazarus', '0.8.5a', argc, argv);
If Assigned(Screen) then
FillScreenFonts(Screen.Fonts);
// read gtk rc file
FRCFileParsed:=true;
ParseRCFile;
// Initialize Stringlist for holding styles
Styles := TStringlist.Create;
LoadGDKCursors;
gtk_key_snooper_install(@GTKKeySnooper, @FKeyStateList);
// Init tooltips
FGTKToolTips := gtk_tooltips_new;
gtk_object_ref(PGTKObject(FGTKToolTips));
gtk_toolTips_Enable(FGTKToolTips);
// Init stock objects;
InitStockItems;
// clipboard
ClipboardTypeAtoms[ctPrimarySelection]:=GDK_SELECTION_PRIMARY;
ClipboardTypeAtoms[ctSecondarySelection]:=GDK_SELECTION_SECONDARY;
ClipboardTypeAtoms[ctClipboard]:=gdk_atom_intern('CLIPBOARD',0);
end;
procedure TGnomeObject.CreateComponent(Sender : TObject);
var
StrTemp : PChar; // same as "caption" but as PChar
@ -176,97 +299,13 @@ end;
{$I gnomewinapi.inc}
var
LAZBTNALL,
LAZBTNYESALL,
LAZBTNNOALL,
LAZBTNABORT,
LAZBTNRETRY,
LAZBTNIGNORE : PGnomeStockPixmapEntryData;
Procedure InitGnome;
begin
gnome_init('lazarus', '0.8.5a', argc, argv);
New(LAZBTNAll);
With LAZBTNAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbALL));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_ALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNALL));
New(LAZBTNYESAll);
With LAZBTNYESAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbYesToAll));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_YESALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNYESALL));
New(LAZBTNNOAll);
With LAZBTNNOAll^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbNOToAll));
xpm_data := PPgchar(@IMGALL_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_NOALL, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNNOALL));
New(LAZBTNABORT);
With LAZBTNABORT^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbAbort));
xpm_data := PPgchar(@IMGCancel_X[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_ABORT, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNABORT));
New(LAZBTNRETRY);
With LAZBTNRETRY^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbRetry));
xpm_data := PPgchar(@IMGOK_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_RETRY, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNRETRY));
New(LAZBTNIGNORE);
With LAZBTNIGNORE^ do begin
thetype := GNOME_STOCK_PIXMAP_TYPE_DATA;
Width := 20;
Height := 18;
theLabel := Ampersands2Underscore(PChar(rsMbIgnore));
xpm_data := PPgchar(@IMGOK_Check[0]);
end;
gnome_stock_pixmap_register(LAZARUS_STOCK_BUTTON_IGNORE, GNOME_STOCK_PIXMAP_REGULAR,PGnomeStockPixmapEntry(LAZBTNIGNORE));
end;
Procedure CleanupGnome;
begin
Dispose(LAZBTNALL);
Dispose(LAZBTNYESALL);
Dispose(LAZBTNNOALL);
Dispose(LAZBTNABORT);
Dispose(LAZBTNRETRY);
Dispose(LAZBTNIGNORE);
end;
initialization
InitGnome;
finalization
CleanupGnome;
end.
{
$Log$
Revision 1.7 2002/10/21 03:23:34 lazarus
AJ: rearranged GTK init stuff for proper GNOME init & less duplication between interfaces
Revision 1.6 2002/10/15 22:28:04 lazarus
AJ: added forcelinebreaks