]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/dialoginfo.cpp
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / radiant / dialoginfo.cpp
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 //\r
23 // InfoDialog - non-modal, not derived from Dialog\r
24 //\r
25 // Leonardo Zide (leo@lokigames.com)\r
26 //\r
27 \r
28 #include "stdafx.h"\r
29 #include <gtk/gtk.h>\r
30 //#include "qe3.h"\r
31 \r
32 GtkWidget *g_dlgInfo;\r
33 GtkWidget *s_pEdit;\r
34 \r
35 // =============================================================================\r
36 // Global functions\r
37 \r
38 void ShowInfoDialog(const char* pText)\r
39 {\r
40   if (g_dlgInfo == NULL)\r
41   {\r
42     GtkWidget *dlg, *scr, *text;\r
43 \r
44     g_dlgInfo = dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);\r
45     gtk_window_set_title (GTK_WINDOW (dlg), "Information");\r
46     gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",\r
47                         GTK_SIGNAL_FUNC (gtk_widget_hide), NULL);\r
48     gtk_signal_connect (GTK_OBJECT (dlg), "destroy",\r
49                         GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);\r
50     gtk_window_set_default_size (GTK_WINDOW (dlg), 300, 150);\r
51 \r
52     scr = gtk_scrolled_window_new (NULL, NULL);\r
53     gtk_widget_show (scr);\r
54     gtk_container_add (GTK_CONTAINER (dlg), scr);\r
55     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);\r
56     gtk_container_set_border_width (GTK_CONTAINER (scr), 5);\r
57     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scr), GTK_SHADOW_IN);\r
58 \r
59     s_pEdit = text = gtk_text_view_new();\r
60     gtk_container_add (GTK_CONTAINER (scr), text);\r
61     gtk_widget_show (text);\r
62     gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);\r
63   }\r
64 \r
65   GtkTextBuffer* buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(s_pEdit));\r
66   gtk_text_buffer_set_text (buffer, pText, -1);\r
67   gtk_widget_show (g_dlgInfo);\r
68 }\r
69 \r
70 void HideInfoDialog()\r
71 {\r
72   if (g_dlgInfo)\r
73     gtk_widget_hide (g_dlgInfo);\r
74 }\r
75 \r