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: 12 июл. 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_LSPPADDING_H_
23 #define UI_TK_LSPPADDING_H_
24 
25 namespace lsp
26 {
27     namespace tk
28     {
29         class LSPWidget;
30 
31         class LSPPadding
32         {
33             protected:
34                 LSPWidget      *pWidget;
35                 padding_t       sPadding;
36 
37             public:
38                 explicit LSPPadding(LSPWidget *widget);
39                 ~LSPPadding();
40 
left()41                 inline size_t left() const          { return sPadding.nLeft;     }
right()42                 inline size_t right() const         { return sPadding.nRight;    }
top()43                 inline size_t top() const           { return sPadding.nTop;      }
bottom()44                 inline size_t bottom() const        { return sPadding.nBottom;   }
horizontal()45                 inline size_t horizontal()  const   { return sPadding.nLeft + sPadding.nRight; }
vertical()46                 inline size_t vertical()  const     { return sPadding.nTop + sPadding.nBottom; }
get(padding_t * p)47                 inline void get(padding_t *p) const { *p = sPadding; }
48 
49                 size_t set_left(size_t value);
50                 size_t set_right(size_t value);
51                 size_t set_top(size_t value);
52                 size_t set_bottom(size_t value);
53                 void   set_all(size_t value);
54                 void   set_horizontal(size_t left, size_t right);
55                 void   set_vertical(size_t top, size_t bottom);
56 
57                 void set(size_t left, size_t right, size_t top, size_t bottom);
58                 void set(const padding_t *p);
59                 void set(const LSPPadding *p);
60         };
61 
62     } /* namespace tk */
63 } /* namespace lsp */
64 
65 #endif /* UI_TK_LSPPADDING_H_ */
66