00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Mike Polan * 00003 * kanadakid@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 // casecombobox.h: convenience comboboxes 00021 00022 #ifndef CASECOMBOBOX_H 00023 #define CASECOMBOBOX_H 00024 00025 #include <gtkmm/comboboxtext.h> 00026 00027 #include "case.h" 00028 00031 class CharComboBox: public Gtk::ComboBoxText { 00032 public: 00036 CharComboBox(const CharacterMap &characters); 00037 00041 bool empty() const { return m_Characters.empty(); } 00042 00046 void set_active_internal(const Glib::ustring &name); 00047 00051 Glib::ustring get_selected_name() const; 00052 00056 Glib::ustring get_selected_internal() const; 00057 00061 Character* get_selected_character(); 00062 00063 protected: 00065 CharacterMap m_Characters; 00066 }; 00067 00068 /***************************************************************************/ 00069 00072 class LocationComboBox: public Gtk::ComboBoxText { 00073 public: 00077 LocationComboBox(const LocationMap &locations); 00078 00082 bool empty() const { return m_Locations.empty(); } 00083 00087 void set_active_internal(const Glib::ustring &id); 00088 00092 Glib::ustring get_selected_name() const; 00093 00097 Glib::ustring get_selected_internal(); 00098 00102 Case::Location* get_selected_location(); 00103 00104 protected: 00109 Glib::ustring is_court_location(const Glib::ustring &str); 00110 00115 Glib::ustring internal_is_court_location(const Glib::ustring &str); 00116 00118 LocationMap m_Locations; 00119 }; 00120 00121 /***************************************************************************/ 00122 00125 class EvidenceComboBox: public Gtk::ComboBoxText { 00126 public: 00130 EvidenceComboBox(const EvidenceMap &ev); 00131 00135 bool empty() const { return m_Evidence.empty(); } 00136 00140 void set_active_internal(const Glib::ustring &id); 00141 00145 Glib::ustring get_selected_name() const; 00146 00150 Glib::ustring get_selected_internal() const; 00151 00155 Case::Evidence* get_selected_evidence(); 00156 00157 protected: 00159 EvidenceMap m_Evidence; 00160 }; 00161 00162 /***************************************************************************/ 00163 00166 class BlockComboBox: public Gtk::ComboBoxText { 00167 public: 00171 BlockComboBox(const BufferMap &blocks); 00172 00176 bool empty() const { return m_Buffers.empty(); } 00177 00181 Glib::ustring get_selected_internal() const; 00182 00186 Glib::RefPtr<Gtk::TextBuffer> get_selected_block(); 00187 00188 protected: 00190 BufferMap m_Buffers; 00191 }; 00192 00193 /***************************************************************************/ 00194 00197 class AudioComboBox: public Gtk::ComboBoxText { 00198 public: 00200 enum Filter { FILTER_NONE, FILTER_SFX, FILTER_MUSIC }; 00201 00206 AudioComboBox(const AudioMap &map, const Filter &filter=FILTER_NONE); 00207 00211 bool empty() const { return m_Audio.empty(); } 00212 00216 Glib::ustring get_selected_internal() const; 00217 00221 Case::Audio* get_selected_audio(); 00222 00223 protected: 00225 AudioMap m_Audio; 00226 }; 00227 00228 /***************************************************************************/ 00229 00232 class ImgComboBox: public Gtk::ComboBoxText { 00233 public: 00237 ImgComboBox(const ImageMap &map); 00238 00242 bool empty() const { return m_Images.empty(); } 00243 00247 void set_active_internal(const Glib::ustring &id); 00248 00252 Glib::ustring get_selected_internal() const; 00253 00257 Case::Image* get_selected_image(); 00258 00259 protected: 00261 ImageMap m_Images; 00262 }; 00263 00264 #endif