1 /* -----------------------------------------------------------------------------
2  *
3  * Giada - Your Hardcore Loopmachine
4  *
5  * geScroll
6  * Custom scroll with nice scrollbars and something else.
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * Copyright (C) 2010-2020 Giovanni A. Zuliani | Monocasual
11  *
12  * This file is part of Giada - Your Hardcore Loopmachine.
13  *
14  * Giada - Your Hardcore Loopmachine is free software: you can
15  * redistribute it and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation, either
17  * version 3 of the License, or (at your option) any later version.
18  *
19  * Giada - Your Hardcore Loopmachine is distributed in the hope that it
20  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
21  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22  * See the GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with Giada - Your Hardcore Loopmachine. If not, see
26  * <http://www.gnu.org/licenses/>.
27  *
28  * -------------------------------------------------------------------------- */
29 
30 
31 #include "core/const.h"
32 #include "pack.h"
33 
34 
35 namespace giada {
36 namespace v
37 {
gePack(int x,int y,Direction d,int gutter)38 gePack::gePack(int x, int y, Direction d, int gutter)
39 : geGroup    (x, y)
40 , m_direction(d)
41 , m_gutter   (gutter)
42 {
43     end();
44 }
45 
46 
47 /* -------------------------------------------------------------------------- */
48 
49 
add(Fl_Widget * widget)50 void gePack::add(Fl_Widget* widget)
51 {
52     if (countChildren() == 0)
53         widget->position(0, 0);
54     else
55     if (m_direction == Direction::HORIZONTAL)
56         widget->position((getLastChild()->x() + getLastChild()->w() + m_gutter) - x(), 0);
57     else
58         widget->position(0, (getLastChild()->y() + getLastChild()->h() + m_gutter) - y());
59 
60     geGroup::add(widget);
61 }
62 }}