]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/prtview/AboutDialog.cpp
more eol-style
[xonotic/netradiant.git] / contrib / prtview / AboutDialog.cpp
1 /*
2 PrtView plugin for GtkRadiant
3 Copyright (C) 2001 Geoffrey Dewan, Loki software and qeradiant.com
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20 // AboutDialog.cpp : implementation file
21 //
22
23 #include "stdafx.h"
24
25 #ifdef _DEBUG
26 #define new DEBUG_NEW
27 #undef THIS_FILE
28 //static char THIS_FILE[] = __FILE__;
29 #endif
30
31 /////////////////////////////////////////////////////////////////////////////
32 // CAboutDialog dialog
33
34 #ifdef GTK_PLUGIN
35
36 static void dialog_button_callback (GtkWidget *widget, gpointer data)
37 {
38   GtkWidget *parent;
39   int *loop, *ret;
40
41   parent = gtk_widget_get_toplevel (widget);
42   loop = (int*)g_object_get_data (G_OBJECT (parent), "loop");
43   ret = (int*)g_object_get_data (G_OBJECT (parent), "ret");
44
45   *loop = 0;
46   *ret = (int)data;
47 }
48
49 static gint dialog_delete_callback (GtkWidget *widget, GdkEvent* event, gpointer data)
50 {
51   int *loop;
52
53   gtk_widget_hide (widget);
54   loop = (int*)g_object_get_data (G_OBJECT (widget), "loop");
55   *loop = 0;
56
57   return TRUE;
58 }
59
60 void DoAboutDlg ()
61 {
62   GtkWidget *dlg, *hbox, *vbox, *button, *label;
63   int loop = 1, ret = IDCANCEL;
64
65   dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
66   gtk_window_set_title (GTK_WINDOW (dlg), "About Portal Viewer");
67   gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
68                       GTK_SIGNAL_FUNC (dialog_delete_callback), NULL);
69   gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
70                       GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
71   g_object_set_data (G_OBJECT (dlg), "loop", &loop);
72   g_object_set_data (G_OBJECT (dlg), "ret", &ret);
73
74   hbox = gtk_hbox_new (FALSE, 10);
75   gtk_widget_show (hbox);
76   gtk_container_add (GTK_CONTAINER (dlg), hbox);
77   gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
78
79   label = gtk_label_new ("Version 1.000\n\n"
80                          "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
81                          "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
82        "Built against GtkRadiant " RADIANT_VERSION "\n"
83        __DATE__
84        );
85   gtk_widget_show (label);
86   gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
87   gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
88
89   vbox = gtk_vbox_new (FALSE, 0);
90   gtk_widget_show (vbox);
91   gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
92
93   button = gtk_button_new_with_label ("OK");
94   gtk_widget_show (button);
95   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
96   gtk_signal_connect (GTK_OBJECT (button), "clicked",
97                       GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
98   gtk_widget_set_usize (button, 60, -2);
99
100   gtk_grab_add (dlg);
101   gtk_widget_show (dlg);
102
103   while (loop)
104     gtk_main_iteration ();
105
106   gtk_grab_remove (dlg);
107   gtk_widget_destroy (dlg);
108 }
109
110 #else // GTK_PLUGIN
111
112 CAboutDialog::CAboutDialog(CWnd* pParent /*=NULL*/)
113         : CDialog(CAboutDialog::IDD, pParent)
114 {
115         //{{AFX_DATA_INIT(CAboutDialog)
116                 // NOTE: the ClassWizard will add member initialization here
117         //}}AFX_DATA_INIT
118 }
119
120
121 void CAboutDialog::DoDataExchange(CDataExchange* pDX)
122 {
123         CDialog::DoDataExchange(pDX);
124         //{{AFX_DATA_MAP(CAboutDialog)
125                 // NOTE: the ClassWizard will add DDX and DDV calls here
126         //}}AFX_DATA_MAP
127 }
128
129
130 BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
131         //{{AFX_MSG_MAP(CAboutDialog)
132                 // NOTE: the ClassWizard will add message map macros here
133         //}}AFX_MSG_MAP
134 END_MESSAGE_MAP()
135
136 #endif // GTK_PLUGIN
137
138 /////////////////////////////////////////////////////////////////////////////
139 // CAboutDialog message handlers