vmap/plugins/prtview/AboutDialog.cpp

99 lines
2.9 KiB
C++
Raw Normal View History

2020-11-17 11:16:16 +00:00
/*
PrtView plugin for GtkRadiant
Copyright (C) 2001 Geoffrey Dewan, Loki software and qeradiant.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "AboutDialog.h"
#include <gtk/gtk.h>
#include <gtkutil/pointer.h>
#include <uilib/uilib.h>
#include "gtkutil/pointer.h"
#include "prtview.h"
#include "ConfigDialog.h"
static void dialog_button_callback(ui::Widget widget, gpointer data)
{
2021-08-04 20:23:18 +00:00
int *loop, *ret;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
auto parent = widget.window();
loop = (int *) g_object_get_data(G_OBJECT(parent), "loop");
ret = (int *) g_object_get_data(G_OBJECT(parent), "ret");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
*loop = 0;
*ret = gpointer_to_int(data);
2020-11-17 11:16:16 +00:00
}
static gint dialog_delete_callback(ui::Widget widget, GdkEvent *event, gpointer data)
{
2021-08-04 20:23:18 +00:00
widget.hide();
int *loop = (int *) g_object_get_data(G_OBJECT(widget), "loop");
*loop = 0;
return TRUE;
2020-11-17 11:16:16 +00:00
}
void DoAboutDlg()
{
2021-08-04 20:23:18 +00:00
int loop = 1, ret = IDCANCEL;
auto dlg = ui::Window(ui::window_type::TOP);
gtk_window_set_title(dlg, "About Portal Viewer");
dlg.connect("delete_event", G_CALLBACK(dialog_delete_callback), NULL);
dlg.connect("destroy", G_CALLBACK(gtk_widget_destroy), NULL);
g_object_set_data(G_OBJECT(dlg), "loop", &loop);
g_object_set_data(G_OBJECT(dlg), "ret", &ret);
auto hbox = ui::HBox(FALSE, 10);
hbox.show();
dlg.add(hbox);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
char const *label_text = "Version 1.000\n\n"
"Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
"Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
"Built against WorldSpawn\n"
__DATE__;
auto label = ui::Label(label_text);
label.show();
hbox.pack_start(label, TRUE, TRUE, 0);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
auto vbox = ui::VBox(FALSE, 0);
vbox.show();
hbox.pack_start(vbox, FALSE, FALSE, 0);
auto button = ui::Button("OK");
button.show();
vbox.pack_start(button, FALSE, FALSE, 0);
button.connect("clicked", G_CALLBACK(dialog_button_callback), GINT_TO_POINTER(IDOK));
button.dimensions(60, -1);
gtk_grab_add(dlg);
dlg.show();
while (loop) {
gtk_main_iteration();
}
gtk_grab_remove(dlg);
dlg.destroy();
2020-11-17 11:16:16 +00:00
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDialog message handlers