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