/* $Id$ */ /* * Cantus Tag Editor * Copyright © 2002-2004 by Samuel Abels * Copyright © 2007 by Tim Huetz * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see **/ #ifdef HAVE_CONFIG_H # include #endif #ifndef HAVE_GENRESELECTOR_H #define HAVE_GENRESELECTOR_H #include #include #include #include #include #include #define _(String) gettext (String) #define gettext_noop(String) (String) #define N_(String) gettext_noop (String) using namespace std; using namespace Gtk; class GenreSelector : public Gtk::Window { public: GenreSelector(bool allow_multiple = TRUE); ~GenreSelector(); /* Triggered whenever the Close button has been clicked. */ SigC::Signal0 signal_button_close_clicked; /* Triggered whenever the genre selection has been changed. */ SigC::Signal1 > signal_selection_changed; /* Defines all genres that are in the list. */ void set_genres(char **genrelist); /* Updates all genres in the GUI. */ void update(void); /* Clears the genrelist. */ void clear(void); /* Defines all genres that are selected. */ void set_selected_genres(list selectedgenres); /* Defines all genres that are selected. The argument is a string listing all * Genre names separated by commas. Spaces trailing or leading a comma will be * stripped automagically. */ void set_selected_genres(string genrestring); /* Select the Genre with the given name. Returns TRUE if anything was * selected. */ bool select_genre(string genre); /* Unselect all genres. */ void unselect_all(void); /* Returns an string, containing a comma-separated list of all selected * genres. */ string get_selected_genres(void); /* Defines whether or not multiple genres can be selected at once. */ void set_select_multiple(bool allowed); /* Defines whether or not the widgets are sensitive. */ void set_sensitive(bool allowed); private: void on_selection_changed(string genre); Table toplevel; ScrolledWindow scrolled; VBox genrebox; Button button; bool select_multiple; bool lock_events; std::map genres; // Map Genre <-> Widget. std::list selected; // All selected genres. }; #endif