]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/dialog.h
* use CMD_SEP in sample plugin (minor cleanup)
[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_DATA_TYPE;
41
42 class Dialog
43 {
44  public:
45   Dialog ();
46   virtual ~Dialog ();
47
48   /*! 
49   start modal dialog box
50   you need to use AddModalButton to select IDOK IDCANCEL buttons
51   */
52   int DoModal ();
53   void EndModal (int code);
54   virtual void BuildDialog () = 0;
55   virtual void UpdateData (bool retrieve);
56   virtual void PreModal () { };
57   virtual void PostModal (int code) { };
58   virtual void ShowDlg ();
59   virtual void HideDlg ();
60   void Create ();
61   void Destroy ();
62   GtkWidget* GetDlgWidget (const char* name)
63     { return GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), name)); }
64   GtkWidget* GetWidget ()
65     { return m_pWidget; }
66
67  protected:
68   GtkWidget *m_pWidget;
69   int m_nLoop;
70   int m_nReturn;
71
72   void AddDialogData (GtkWidget *widget, void *buf, DLG_DATA_TYPE type)
73     { AddDialogData (GTK_OBJECT (widget), buf, type); };
74   void AddDialogData (GtkObject *object, void *buf, DLG_DATA_TYPE type);
75   /*!
76   used in overloaded BuildDialog implementations to configure modal behaviour easily
77   */
78   void AddModalButton( GtkWidget *widget, int ret );
79
80  private:
81   GSList* m_pDataList;
82   bool    m_bNeedBuild;
83 };
84
85 #endif // _DIALOG_H_