]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/prtview/AboutDialog.cpp
apply patch from Martin Gerhardy - more quake2 related modules compiled and misc...
[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 #include "AboutDialog.h"
25
26 #ifdef _DEBUG
27 #define new DEBUG_NEW
28 #undef THIS_FILE
29 //static char THIS_FILE[] = __FILE__;
30 #endif
31
32 /////////////////////////////////////////////////////////////////////////////
33 // CAboutDialog dialog
34
35 #ifdef GTK_PLUGIN
36
37 static void dialog_button_callback (GtkWidget *widget, gpointer data)
38 {
39   GtkWidget *parent;
40   int *loop, *ret;
41
42   parent = gtk_widget_get_toplevel (widget);
43   loop = (int*)g_object_get_data (G_OBJECT (parent), "loop");
44   ret = (int*)g_object_get_data (G_OBJECT (parent), "ret");
45
46   *loop = 0;
47   *ret = (int)data;
48 }
49
50 static gint dialog_delete_callback (GtkWidget *widget, GdkEvent* event, gpointer data)
51 {
52   int *loop;
53
54   gtk_widget_hide (widget);
55   loop = (int*)g_object_get_data (G_OBJECT (widget), "loop");
56   *loop = 0;
57
58   return TRUE;
59 }
60
61 void DoAboutDlg ()
62 {
63   GtkWidget *dlg, *hbox, *vbox, *button, *label;
64   int loop = 1, ret = IDCANCEL;
65
66   dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
67   gtk_window_set_title (GTK_WINDOW (dlg), "About Portal Viewer");
68   gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
69                       GTK_SIGNAL_FUNC (dialog_delete_callback), NULL);
70   gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
71                       GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
72   g_object_set_data (G_OBJECT (dlg), "loop", &loop);
73   g_object_set_data (G_OBJECT (dlg), "ret", &ret);
74
75   hbox = gtk_hbox_new (FALSE, 10);
76   gtk_widget_show (hbox);
77   gtk_container_add (GTK_CONTAINER (dlg), hbox);
78   gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
79
80   label = gtk_label_new ("Version 1.000\n\n"
81                          "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
82                          "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
83        "Built against GtkRadiant " RADIANT_VERSION "\n"
84        __DATE__
85        );
86   gtk_widget_show (label);
87   gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
88   gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
89
90   vbox = gtk_vbox_new (FALSE, 0);
91   gtk_widget_show (vbox);
92   gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
93
94   button = gtk_button_new_with_label ("OK");
95   gtk_widget_show (button);
96   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
97   gtk_signal_connect (GTK_OBJECT (button), "clicked",
98                       GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
99   gtk_widget_set_usize (button, 60, -2);
100
101   gtk_grab_add (dlg);
102   gtk_widget_show (dlg);
103
104   while (loop)
105     gtk_main_iteration ();
106
107   gtk_grab_remove (dlg);
108   gtk_widget_destroy (dlg);
109 }
110
111 #else // GTK_PLUGIN
112
113 CAboutDialog::CAboutDialog(CWnd* pParent /*=NULL*/)
114         : CDialog(CAboutDialog::IDD, pParent)
115 {
116         //{{AFX_DATA_INIT(CAboutDialog)
117                 // NOTE: the ClassWizard will add member initialization here
118         //}}AFX_DATA_INIT
119 }
120
121
122 void CAboutDialog::DoDataExchange(CDataExchange* pDX)
123 {
124         CDialog::DoDataExchange(pDX);
125         //{{AFX_DATA_MAP(CAboutDialog)
126                 // NOTE: the ClassWizard will add DDX and DDV calls here
127         //}}AFX_DATA_MAP
128 }
129
130
131 BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
132         //{{AFX_MSG_MAP(CAboutDialog)
133                 // NOTE: the ClassWizard will add message map macros here
134         //}}AFX_MSG_MAP
135 END_MESSAGE_MAP()
136
137 #endif // GTK_PLUGIN
138
139 /////////////////////////////////////////////////////////////////////////////
140 // CAboutDialog message handlers