~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/gtk4ex/frmabout.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
unit frmabout;
 
2
 
 
3
{$mode objfpc}
 
4
 
 
5
Interface
 
6
 
 
7
uses glib,gdk,gtk;
 
8
 
 
9
Type
 
10
  TAboutForm = Record
 
11
    Window : PGtkDialog;
 
12
    OkButton : PgtkButton;
 
13
    InfoLabel : PGtkLabel;
 
14
  end;
 
15
  PAboutForm = ^TAboutForm;
 
16
 
 
17
Function NewAboutForm : PAboutForm;
 
18
Procedure ShowAboutForm(Form : PAboutForm);
 
19
 
 
20
Implementation
 
21
 
 
22
Const
 
23
  SInfo : PChar = 'File explorer demo'#10'Florian Klaempfl'#10'Michael Van Canneyt';
 
24
  SAboutTitle : Pchar = 'About File explorer';
 
25
 
 
26
procedure DestroyAbout(Widget : PGtkWidget; About : PAboutForm);cdecl;
 
27
 
 
28
begin
 
29
  Dispose(About);
 
30
end;
 
31
 
 
32
Function NewAboutForm : PAboutForm;
 
33
 
 
34
begin
 
35
  Result:=New(PAboutForm);
 
36
  With Result^ do
 
37
    begin
 
38
    Window:=PgtkDialog(gtk_dialog_new);
 
39
    gtk_window_set_modal(PgtkWindow(Window),True);
 
40
    gtk_window_set_title(PgtkWindow(Window),SAboutTitle);
 
41
    gtk_widget_set_usize(PGtkWidget(Window),250,150);
 
42
    gtk_window_set_policy(PgtkWindow(Window),0,0,0);
 
43
    gtk_window_set_position(PGtkWindow(Window),GTK_WIN_POS_CENTER);
 
44
    OkButton:=PGtkButton(gtk_button_new_with_label(' Ok '));
 
45
    gtk_box_pack_start(PgtkBox(Window^.action_area),PGtkWidget(Okbutton),False,False,5);
 
46
    gtk_window_set_focus(PGtkWindow(Window),PGtkWidget(OkButton));
 
47
    gtk_widget_show(PGtkWidget(OkButton));
 
48
    InfoLabel:=PgtkLabel(gtk_label_new(SInfo));
 
49
    gtk_box_pack_start(PGtkBox(Window^.vbox),PGtkWidget(InfoLabel),True,True,10);
 
50
    gtk_widget_show(PGtkWidget(InfoLabel));
 
51
    gtk_signal_connect(PGtkObject(Window),'destroy',
 
52
                       TGTKSignalFunc(@DestroyAbout),Result);
 
53
    gtk_signal_connect_object(PgtkObject(OKButton),'clicked',
 
54
                      GTK_SIGNAL_FUNC(@gtk_widget_destroy),
 
55
                      PGTKOBJECT(Window));
 
56
    end;
 
57
end;
 
58
 
 
59
Procedure ShowAboutForm(Form : PAboutForm);
 
60
 
 
61
begin
 
62
  gtk_window_set_modal(PgtkWindow(Form^.Window),True);
 
63
  gtk_widget_show(PgtkWidget(Form^.Window));
 
64
end;
 
65
 
 
66
end.
 
 
b'\\ No newline at end of file'