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: 17 июл. 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_LSPALIGN_H_
23 #define UI_TK_LSPALIGN_H_
24 
25 namespace lsp
26 {
27     namespace tk
28     {
29         class LSPAlign: public LSPWidgetContainer
30         {
31             public:
32                 static const w_class_t    metadata;
33 
34             protected:
35                 float           nVertPos;
36                 float           nHorPos;
37                 float           nVertScale;
38                 float           nHorScale;
39                 LSPWidget      *pWidget;
40 
41             protected:
42                 virtual LSPWidget      *find_widget(ssize_t x, ssize_t y);
43                 void                    do_destroy();
44 
45             public:
46                 explicit LSPAlign(LSPDisplay *dpy);
47                 virtual ~LSPAlign();
48 
49                 virtual status_t init();
50                 virtual void destroy();
51 
52             public:
vpos()53                 inline float            vpos() const            { return nVertPos; }
hpos()54                 inline float            hpos() const            { return nHorPos; }
vscale()55                 inline float            vscale() const          { return nVertScale; }
hscale()56                 inline float            hscale() const          { return nHorScale; }
57 
58             public:
59                 void                    set_vpos(float value);
60                 void                    set_hpos(float value);
61                 void                    set_pos(float h, float v);
set_position(float h,float v)62                 inline void             set_position(float h, float v) { set_pos(h, v); };
63                 void                    set_vscale(float value);
64                 void                    set_hscale(float value);
65                 void                    set_scale(float h, float v);
66 
67             public:
68                 virtual void render(ISurface *s, bool force);
69 
70                 virtual status_t add(LSPWidget *widget);
71 
72                 virtual status_t remove(LSPWidget *widget);
73 
74                 virtual void size_request(size_request_t *r);
75 
76                 virtual void realize(const realize_t *r);
77         };
78 
79     } /* namespace tk */
80 } /* namespace lsp */
81 
82 #endif /* UI_TK_LSPALIGN_H_ */
83