SpectMorph
|
00001 /* 00002 * Copyright (C) 2011 Stefan Westerfeld 00003 * 00004 * This library is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License as published by the 00006 * Free Software Foundation; either version 3 of the License, or (at your 00007 * option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00012 * for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef SPECTMORPH_COMBOBOX_OPERATOR_HH 00019 #define SPECTMORPH_COMBOBOX_OPERATOR_HH 00020 00021 #include "smmorphoperatorview.hh" 00022 #include "smmorphlinear.hh" 00023 00024 namespace SpectMorph 00025 { 00026 00027 struct OperatorFilter 00028 { 00029 virtual bool filter (MorphOperator *op) = 0; 00030 }; 00031 00032 class ComboBoxOperator : public Gtk::ComboBoxText 00033 { 00034 protected: 00035 MorphPlan *morph_plan; 00036 OperatorFilter *op_filter; 00037 MorphOperator *op; 00038 std::string str_choice; 00039 bool block_changed; 00040 00041 std::vector<std::string> str_choices; 00042 00043 void on_operators_changed(); 00044 void on_combobox_changed(); 00045 00046 public: 00047 ComboBoxOperator (MorphPlan *plan, OperatorFilter *op_filter); 00048 ~ComboBoxOperator(); 00049 00050 MorphOperator *active(); 00051 void set_active (MorphOperator *op); 00052 00053 void add_str_choice (const std::string& str); 00054 00055 std::string active_str_choice(); 00056 void set_active_str_choice (const std::string& str); 00057 00058 sigc::signal<void> signal_active_changed; 00059 }; 00060 00061 } 00062 00063 #endif