1 |
// Renegade Map Selector |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// MapSelector.h |
6 |
|
7 |
#ifndef _WIN32 |
8 |
#ifndef _MapSelector_h_ |
9 |
#define _MapSelector_h_ |
10 |
|
11 |
#include "RenegadeConfig.h" |
12 |
#include <sys/types.h> |
13 |
#include <sys/param.h> |
14 |
#include <unistd.h> |
15 |
#include <dirent.h> |
16 |
#include <gtk/gtk.h> |
17 |
|
18 |
extern RenegadeConfig* config; |
19 |
|
20 |
inline void message(GtkWindow* parent, const string& text, const string& title, |
21 |
GtkMessageType type) |
22 |
{ |
23 |
GtkWidget* box = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, type, |
24 |
GTK_BUTTONS_OK, text.c_str()); |
25 |
|
26 |
gtk_window_set_title(GTK_WINDOW(box), title.c_str()); |
27 |
|
28 |
gtk_dialog_run(GTK_DIALOG(box)); |
29 |
gtk_widget_destroy(box); |
30 |
} |
31 |
|
32 |
class MapSelector |
33 |
{ |
34 |
private: |
35 |
GtkWidget* window; |
36 |
GtkWidget* available; |
37 |
GtkWidget* selected; |
38 |
GtkWidget* add; |
39 |
GtkWidget* remove; |
40 |
GtkWidget* up; |
41 |
GtkWidget* down; |
42 |
void setupAvailable(); |
43 |
void setupSelected(); |
44 |
unsigned counter; |
45 |
unsigned insert; |
46 |
public: |
47 |
MapSelector(); |
48 |
~MapSelector() {} |
49 |
// friends: |
50 |
friend void destruct(GtkWidget* widget, MapSelector* data); |
51 |
friend void done(GtkWidget* widget, MapSelector* data); |
52 |
friend void changeAvailable(GtkTreeSelection* selection, MapSelector* data); |
53 |
friend void changeSelected(GtkTreeSelection* selection, MapSelector* data); |
54 |
friend void mapAdd(GtkWidget* widget, MapSelector* data); |
55 |
friend void mapAddEach(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* |
56 |
iter, MapSelector* data); |
57 |
friend void mapRemove(GtkWidget* widget, MapSelector* data); |
58 |
friend void mapRemoveEach(GtkTreePath* path, MapSelector* data); |
59 |
friend void mapUp(GtkWidget* widget, MapSelector* data); |
60 |
friend void mapUpEach(GtkTreePath* path, MapSelector* data); |
61 |
friend void mapDown(GtkWidget* widget, MapSelector* data); |
62 |
friend void mapDownEach(GtkTreePath* path, MapSelector* data); |
63 |
}; |
64 |
|
65 |
#endif // _MapSelector_h_ |
66 |
#endif |