1 /* 2 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> 3 * (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com> 4 * 5 * This file is part of lsp-plugins 6 * Created on: 10 июл. 2017 г. 7 * 8 * lsp-plugins is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * any later version. 12 * 13 * lsp-plugins is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22 #ifndef UI_TK_LSPLED_H_ 23 #define UI_TK_LSPLED_H_ 24 25 namespace lsp 26 { 27 namespace tk 28 { 29 class LSPLed: public LSPWidget 30 { 31 public: 32 static const w_class_t metadata; 33 34 protected: 35 LSPColor sColor; 36 LSPColor sHoleColor; 37 LSPColor sGlassColor; 38 size_t nSize; 39 bool bOn; 40 41 public: 42 explicit LSPLed(LSPDisplay *dpy); 43 virtual ~LSPLed(); 44 45 virtual status_t init(); 46 47 public: color()48 inline LSPColor *color() { return &sColor; } 49 hole_color()50 inline LSPColor *hole_color() { return &sHoleColor; } 51 glass_color()52 inline LSPColor *glass_color() { return &sGlassColor; } 53 on()54 inline bool on() const { return bOn; } 55 off()56 inline bool off() const { return !bOn; } 57 size()58 inline size_t size() const { return nSize; } 59 60 public: 61 void set_on(bool on = true); 62 63 void set_off(bool off = true); 64 65 void set_size(size_t size); 66 67 public: 68 virtual void draw(ISurface *s); 69 70 virtual void size_request(size_request_t *r); 71 }; 72 73 } /* namespace tk */ 74 } /* namespace lsp */ 75 76 #endif /* UI_TK_LSPLED_H_ */ 77