Debian Codegraph @

Source/Widgets/SoundTypeAndPath.h

raw
1 /*
2 * SoundTypeAndPath.h
3 *
4 * Created on: 6 Dec 2016
5 * Author: jeremy
6 */
7
8 #ifndef SOURCE_WIDGETS_SOUNDTYPEANDPATH_H_
9 #define SOURCE_WIDGETS_SOUNDTYPEANDPATH_H_
10
11 #include <glibmm/refptr.h>
12
13 #include <gtkmm/adjustment.h>
14 #include <gtkmm/grid.h>
15 #include <gtkmm/spinbutton.h>
16 #include <gtkmm/comboboxtext.h>
17 #include <gtkmm/label.h>
18 #include <gtkmm/filechooserdialog.h>
19 #include <gtkmm/button.h>
20
21 #include <vector>
22 #include <string>
23 #include <memory>
24
25 namespace Widgets
26 {
27
28 class SoundTypeAndPath : public Gtk::Grid
29 {
30
31 public:
32
33 SoundTypeAndPath(const std::vector<std::string>& types, const std::string& dataFolder, Gtk::FileChooserDialog* soundChooser);
34 virtual ~SoundTypeAndPath() = default;
35
36
37 void ShowSoundChooser(Gtk::FileChooserDialog* soundChooser, const std::string& dataFolder);
38
39 void SetSoundType(const std::string& t) { typesList.set_active_text(t); }
40 void SetSound(const std::string& t) { soundName.set_text(t); }
41 void SetSoundChanged() { changingSound = false; }
42 void SetMidiNote(uint8_t note) { midiNote.set_value(note); }
43
44 std::string GetSoundType() const { return typesList.get_entry_text(); }
45 std::string GetSound() const { return soundName.get_text(); }
46 bool GetChangingSound() const noexcept { return changingSound; }
47 auto GetMidiNote() const { return midiNote.get_value_as_int(); }
48
49 private:
50
51 Gtk::Label soundTypeLabel{"Sound type: "};
52 Gtk::Label soundLabel{"Sound: "};
53 Gtk::ComboBoxText typesList{true};
54 Gtk::Label soundName{""};
55 Gtk::Button soundChange{Gtk::StockID("gtk-edit")};
56 Gtk::Label midiLabel{"Midi Note: "};
57 Glib::RefPtr<Gtk::Adjustment> midiNoteAdj{Gtk::Adjustment::create(0, 0, 127)};
58 Gtk::SpinButton midiNote{midiNoteAdj};
59
60 bool changingSound{false};
61
62 };
63
64 typedef std::shared_ptr<SoundTypeAndPath> SoundTypeAndPathPtr;
65
66 } /* namespace Widgets */
67
68 #endif /* SOURCE_WIDGETS_SOUNDTYPEANDPATH_H_ */