]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/dialog.h
Merge pull request #21 from merlin1991/Q3-gamepack-fix
[xonotic/netradiant.git] / radiant / dialog.h
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 #ifndef _DIALOG_H_
23 #define _DIALOG_H_
24
25 #include <gtk/gtk.h>
26 #include "str.h"
27 #include "gtkmisc.h"
28
29 typedef enum
30 {
31         DLG_CHECK_BOOL,
32         DLG_RADIO_INT,
33         DLG_ENTRY_TEXT,
34         DLG_ENTRY_FLOAT,
35         DLG_ENTRY_INT,
36         DLG_SPIN_FLOAT,
37         DLG_SPIN_INT,
38         DLG_ADJ_INT,
39         DLG_COMBO_INT,
40         DLG_COMBO_BOX_INT,
41 } DLG_DATA_TYPE;
42
43 class Dialog
44 {
45 public:
46 Dialog ();
47 virtual ~Dialog ();
48
49 /*!
50    start modal dialog box
51    you need to use AddModalButton to select IDOK IDCANCEL buttons
52  */
53 int DoModal();
54 void EndModal( int code );
55 virtual void BuildDialog() = 0;
56 virtual void UpdateData( bool retrieve );
57 virtual void PreModal() { };
58 virtual void PostModal( int code ) { };
59 virtual void ShowDlg();
60 virtual void HideDlg();
61 void Create();
62 void Destroy();
63 GtkWidget* GetDlgWidget( const char* name )
64 { return GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), name ) ); }
65 GtkWidget* GetWidget()
66 { return m_pWidget; }
67
68 protected:
69 GtkWidget *m_pWidget;
70 int m_nLoop;
71 int m_nReturn;
72
73 void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type )
74 { AddDialogData( GTK_OBJECT( widget ), buf, type ); };
75 void AddDialogData( GtkObject *object, void *buf, DLG_DATA_TYPE type );
76 /*!
77    used in overloaded BuildDialog implementations to configure modal behaviour easily
78  */
79 void AddModalButton( GtkWidget *widget, int ret );
80
81 private:
82 GSList* m_pDataList;
83 bool m_bNeedBuild;
84 };
85
86 #endif // _DIALOG_H_