Jamba C++ API  4.0.0
LookAndFeel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 pongasoft
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  *
16  * @author Yan Pujante
17  */
18 #pragma once
19 
20 #include <vstgui4/vstgui/lib/vstguibase.h>
21 #include <vstgui4/vstgui/lib/crect.h>
22 
23 namespace pongasoft {
24 namespace VST {
25 namespace GUI {
26 
27 using namespace VSTGUI;
28 
32 struct Margin
33 {
34  // Empty constructor (no margin)
35  Margin() = default;
36 
37  // Constructor. Assign same value to all components
38  explicit Margin(CCoord iValue) noexcept :
39  fTop{iValue}, fRight{iValue}, fBottom{iValue}, fLeft{iValue} {}
40 
41  // Constructor
42  Margin(CCoord iTop, CCoord iRight, CCoord iBottom, CCoord iLeft) noexcept :
43  fTop{iTop}, fRight{iRight}, fBottom{iBottom}, fLeft{iLeft} {}
44 
48  CRect apply(CRect const &iRect) const {
49  CRect res(iRect);
50  res.top += fTop;
51  res.left += fLeft;
52  res.right -= fRight;
53  res.bottom -= fBottom;
54  return res;
55  }
56 
57 public:
58  CCoord fTop{};
59  CCoord fRight{};
60  CCoord fBottom{};
61  CCoord fLeft{};
62 };
63 
64 }
65 }
66 }
Margin(CCoord iTop, CCoord iRight, CCoord iBottom, CCoord iLeft) noexcept
Definition: LookAndFeel.h:42
Definition: Clock.h:22
Margin is a similar concept to css: used to create space around elements, outside of any defined bord...
Definition: LookAndFeel.h:32
Definition: Types.h:29
Margin(CCoord iValue) noexcept
Definition: LookAndFeel.h:38
CRect apply(CRect const &iRect) const
Apply this margin to the provided rect.
Definition: LookAndFeel.h:48