2 Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef DCPOMATIC_FULL_LANGUAGE_TAG_DIALOG_H
23 #define DCPOMATIC_FULL_LANGUAGE_TAG_DIALOG_H
26 #include <dcp/language_tag.h>
27 #include <dcp/warnings.h>
28 LIBDCP_DISABLE_WARNINGS
30 LIBDCP_ENABLE_WARNINGS
34 class LanguageSubtagPanel;
37 /** A dialog in which the user can make a full new language tag, made up of
38 * language, script, region, variant and external.
40 class FullLanguageTagDialog : public wxDialog
46 Subtag (dcp::LanguageTag::SubtagType type_, boost::optional<dcp::LanguageTag::SubtagData> subtag_)
51 dcp::LanguageTag::SubtagType type;
52 boost::optional<dcp::LanguageTag::SubtagData> subtag;
53 std::string last_search;
56 FullLanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag = dcp::LanguageTag("en"));
58 dcp::LanguageTag get () const;
59 void set (dcp::LanguageTag tag);
63 std::string subtag_type_name (dcp::LanguageTag::SubtagType type);
64 void search_changed (std::string search);
65 void add_to_current_tag (dcp::LanguageTag::SubtagType type, boost::optional<dcp::LanguageTag::SubtagData> subtag);
66 void remove_from_current_tag ();
67 void current_tag_selection_changed ();
68 void chosen_subtag_changed (boost::optional<dcp::LanguageTag::SubtagData> selection);
69 void setup_sensitivity ();
71 std::vector<Subtag> _current_tag_subtags;
72 wxListCtrl* _current_tag_list;
73 LanguageSubtagPanel* _choose_subtag_panel;
74 wxButton* _add_script;
75 wxButton* _add_region;
76 wxButton* _add_variant;
77 wxButton* _add_external;