00001 #ifndef SOUNDCHOOSER_H_ 00002 #define SOUNDCHOOSER_H_ 00003 00004 #include <gtk/gtkwidget.h> 00005 #include <gtk/gtktreestore.h> 00006 #include <gtk/gtktreeselection.h> 00007 00008 #include "SoundPreview.h" 00009 #include <string> 00010 00011 namespace ui 00012 { 00013 00017 class SoundChooser 00018 { 00019 // Main dialog widget 00020 GtkWidget* _widget; 00021 00022 // Tree store for shaders, and the tree selection 00023 GtkTreeStore* _treeStore; 00024 GtkTreeSelection* _treeSelection; 00025 00026 // The preview widget group 00027 SoundPreview _preview; 00028 00029 // Last selected soundfile 00030 std::string _selectedSound; 00031 00032 private: 00033 00034 // Widget construction 00035 GtkWidget* createTreeView (); 00036 GtkWidget* createButtons (); 00037 00038 /* GTK CALLBACKS */ 00039 static gboolean _onDelete (GtkWidget* w, GdkEvent* e, SoundChooser* self); 00040 static void _onOK (GtkWidget*, SoundChooser*); 00041 static void _onCancel (GtkWidget*, SoundChooser*); 00042 static void _onSelectionChange (GtkTreeSelection*, SoundChooser*); 00043 00044 public: 00045 00051 SoundChooser (); 00052 00056 std::string chooseSound (); 00057 00058 }; 00059 00060 } 00061 00062 #endif /*SOUNDCHOOSER_H_*/