1 /* 2 * Author: Harry van Haaren 2013 3 * harryhaaren@gmail.com 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef LUPPP_OPTIONS_H 20 #define LUPPP_OPTIONS_H 21 22 #include "config.hxx" 23 24 #include <string> 25 26 #include <FL/Fl.H> 27 #include <FL/Fl_Box.H> 28 #include <FL/Fl_Tabs.H> 29 #include <FL/Fl_Pack.H> 30 #include <FL/Fl_Table.H> 31 #include <FL/Fl_Group.H> 32 #include <FL/Fl_Double_Window.H> 33 34 #include "controller/genericmidi.hxx" 35 36 #include "avtk/bindings.h" 37 #include "avtk/avtk_button.h" 38 #include "avtk/avtk_light_button.h" 39 40 class Binding; 41 class OptionsWindow; 42 43 /// contains UI elements to represent one controller 44 class ControllerUI 45 { 46 public: 47 ControllerUI( int x, int y, int w, int h, std::string name,int id); 48 ~ControllerUI(); 49 50 void setAuthor(std::string author); 51 void setLink (std::string link ); getAuthor()52 std::string getAuthor() 53 { 54 return author; 55 } getLink()56 std::string getLink() 57 { 58 return link; 59 } 60 61 void setTarget(const char* n); 62 void setBindEnable( bool b ); 63 64 void addBinding( Binding* b ); 65 void addBindings( GenericMIDI* c ); 66 67 // the ControllerID this UI class represents 68 int controllerID; 69 70 // for adding to GOptions tabs 71 Fl_Group* widget; 72 73 std::string name; 74 75 OptionsWindow* optionsWindow; 76 77 // public to redraw when removing from static 78 Fl_Scroll* scroll; 79 Fl_Pack* bindingsPack; 80 81 private: 82 // bindings 83 std::string target; 84 std::string author; 85 std::string link; 86 87 Avtk::Button* authorLabel; 88 Avtk::Button* linkLabel; 89 90 std::vector<int> bindingID; 91 92 Fl_Box* targetLabel; 93 Fl_Box* targetLabelStat; 94 //Avtk::Bindings* bindings; 95 Avtk::LightButton* bindEnable; 96 Avtk::Button* removeController; 97 Avtk::Button* writeControllerBtn; 98 }; 99 100 class OptionsWindow 101 { 102 public: 103 OptionsWindow(); 104 ~OptionsWindow(); 105 106 void show(); 107 void hide(); 108 109 void setTarget(const char* n); 110 ControllerUI* getControllerUI(int id); 111 112 // public for static methods only 113 Fl_Tabs* tabs; 114 std::vector<ControllerUI*> controllers; 115 Fl_Group* addGroup; 116 #ifdef BUILD_TESTS 117 int runTests(); 118 #endif 119 120 private: 121 Fl_Double_Window* window; 122 Avtk::Button* newButton; 123 Avtk::Button* loadButton; 124 }; 125 126 #endif // LUPPP_OPTIONS_H 127