unit OutputWindow;
interface
procedure CreateWindow();
implementation
uses glib2, gdk2pixbuf, gdk2, gtk2;
procedure BackgroundInit(var Pixbuf : PGdkPixbuf);
var
PathToBackG : array [0..100] of char;
error : PGError;
begin
PathToBackG := '/home/yarik/Desktop/Zhuzhculator/GUIZhuzh/Background.bmp';
error := nil;
Pixbuf := gdk_pixbuf_new_from_file(@PathToBackG , @error);
if error <> nil then
begin
if error^.domain = GDK_PIXBUF_ERROR then
begin
g_print('Pixbuf Related Error'#10);
halt(1)
end;
if error^.domain = G_FILE_ERROR then
begin
g_print('File Error: Check file permissions and state'#10);
halt(1)
end;
end;
end;
procedure SetStyle(var Style : PGtkStyle; Pixbuf : PGdkPixbuf);
var
Background : PGdkPixmap;
begin
gdk_pixbuf_render_pixmap_and_mask (Pixbuf, @Background, nil, 0);
Style := gtk_style_new();
Style^.bg_pixmap[0] := Background;
end;
procedure destroy (widget : pGtkWidget ; data : pgpointer); cdecl ;
begin
gtk_main_quit()
end;
procedure CreateWindow();
var
Window : PGtkWidget;
Background : PGtkWidget;
Style : PGtkStyle;
Pixbuf : PGdkPixbuf;
begin
gtk_init(@argc, @argv);
Window := gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(Window), 'Zhuzhculator');
gtk_widget_set_size_request(Window, 225, 425);
gtk_window_set_default_size(GTK_WINDOW(Window), 225, 425);
BackgroundInit(Pixbuf);
SetStyle(Style, Pixbuf);
gtk_widget_set_style(Window, GTK_STYLE(Style));
gtk_container_set_border_width(GTK_CONTAINER(Window), 0);
gtk_widget_show(Window);
gtk_signal_connect(PGtkObject(Window), 'destroy',
GTK_SIGNAL_FUNC (@destroy), NULL);
gtk_main();
end;
end.