00001 00005 /* 00006 Copyright (C) 2002-2010 UFO: Alien Invasion. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 See the GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00023 */ 00024 00025 #ifndef PARTICLEBROWSER_H_ 00026 #define PARTICLEBROWSER_H_ 00027 00028 #include "../ui/common/TexturePreviewCombo.h" 00029 #include "../ui/common/ModelPreview.h" 00030 #include "particles.h" 00031 00032 #include <gtk/gtkwidget.h> 00033 #include <gtk/gtktreestore.h> 00034 #include <gtk/gtkmenuitem.h> 00035 #include <gtk/gtktreeselection.h> 00036 00037 namespace ui 00038 { 00039 class ParticleBrowser 00040 { 00041 // Main widget 00042 GtkWidget* _widget; 00043 00044 // Main tree store, view and selection 00045 GtkTreeStore* _treeStore; 00046 GtkWidget* _treeView; 00047 GtkTreeSelection* _selection; 00048 00049 // Texture preview combo (GL widget and info table) 00050 TexturePreviewCombo _imagePreview; 00051 // Model preview 00052 ModelPreview _modelPreview; 00053 00054 private: 00055 00056 /* GTK CALLBACKS */ 00057 00058 static gboolean _onExpose (GtkWidget*, GdkEventExpose*, ParticleBrowser*); 00059 static bool _onRightClick (GtkWidget*, GdkEventButton*, ParticleBrowser*); 00060 static void _onSelectionChanged (GtkWidget*, ParticleBrowser*); 00061 00062 /* Tree selection query functions */ 00063 00064 ParticleDefinition* getSelectedParticle (); // return name of selection 00065 00066 public: 00067 00070 static ParticleBrowser& getInstance() { 00071 static ParticleBrowser _instance; 00072 return _instance; 00073 } 00074 00078 GtkWidget* getWidget () 00079 { 00080 gtk_widget_show_all(_widget); 00081 return _widget; 00082 } 00083 00086 ParticleBrowser (); 00087 }; 00088 } 00089 00090 #endif