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