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: 9 июл. 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 #include <ui/ctl/ctl.h> 23 24 namespace lsp 25 { 26 namespace ctl 27 { 28 const ctl_class_t CtlSeparator::metadata = { "CtlSeparator", &CtlWidget::metadata }; 29 CtlSeparator(CtlRegistry * src,LSPSeparator * widget,ssize_t orientation)30 CtlSeparator::CtlSeparator(CtlRegistry *src, LSPSeparator *widget, ssize_t orientation): CtlWidget(src, widget) 31 { 32 pClass = &metadata; 33 nOrientation = orientation; 34 } 35 ~CtlSeparator()36 CtlSeparator::~CtlSeparator() 37 { 38 } 39 init()40 void CtlSeparator::init() 41 { 42 CtlWidget::init(); 43 44 // Initialize color controllers 45 LSPSeparator *sep = widget_cast<LSPSeparator>(pWidget); 46 if (sep != NULL) 47 sColor.init_hsl(pRegistry, sep, sep->color(), A_COLOR, A_HUE_ID, A_SAT_ID, A_LIGHT_ID); 48 } 49 set(widget_attribute_t att,const char * value)50 void CtlSeparator::set(widget_attribute_t att, const char *value) 51 { 52 LSPSeparator *sep = widget_cast<LSPSeparator>(pWidget); 53 54 switch (att) 55 { 56 case A_SIZE: 57 if (sep != NULL) 58 PARSE_INT(value, sep->set_size(__)); 59 break; 60 case A_WIDTH: 61 if (sep != NULL) 62 PARSE_INT(value, sep->set_line_width(__)); 63 break; 64 case A_BORDER: 65 if (sep != NULL) 66 PARSE_INT(value, sep->set_border(__)); 67 break; 68 case A_PADDING: 69 if (sep != NULL) 70 PARSE_INT(value, sep->set_padding(__)); 71 break; 72 case A_HORIZONTAL: 73 if ((sep != NULL) && (nOrientation < 0)) 74 PARSE_BOOL(value, sep->set_horizontal(__)); 75 break; 76 case A_VERTICAL: 77 if ((sep != NULL) && (nOrientation < 0)) 78 PARSE_BOOL(value, sep->set_vertical(__)); 79 break; 80 default: 81 { 82 sColor.set(att, value); 83 CtlWidget::set(att, value); 84 break; 85 } 86 } 87 } 88 89 } /* namespace ctl */ 90 } /* namespace lsp */ 91