Jamba C++ API  5.1.1
GUIUtils.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/ccolor.h>
21 #include <vstgui4/vstgui/lib/crect.h>
22 
23 namespace pongasoft {
24 namespace VST {
25 namespace GUI {
26 
27 using namespace VSTGUI;
28 
29 //------------------------------------------------------------------------
30 // CColor related utils
31 //------------------------------------------------------------------------
32 namespace CColorUtils {
33 
34 // convenient call to check if a color is transparent
35 inline bool isTransparent(CColor const &iColor) {
36  return iColor.alpha == 0;
37 }
38 
39 }
40 
41 //------------------------------------------------------------------------
42 // CRect related utils
43 //------------------------------------------------------------------------
44 namespace CRectUtils {
45 
46 // offsetTop
47 inline CRect offsetTop(CRect const &iRect, CCoord iTop) {
48  CRect res = iRect;
49  res.top += iTop;
50  return res;
51 }
52 
53 // offsetRight
54 inline CRect offsetRight(CRect const &iRect, CCoord iRight) {
55  CRect res = iRect;
56  res.right += iRight;
57  return res;
58 }
59 
60 // offsetLeft
61 inline CRect offsetLeft(CRect const &iRect, CCoord iLeft) {
62  CRect res = iRect;
63  res.left += iLeft;
64  return res;
65 }
66 
67 // offsetBottom
68 inline CRect offsetBottom(CRect const &iRect, CCoord iBottom) {
69  CRect res = iRect;
70  res.bottom += iBottom;
71  return res;
72 }
73 
74 }
75 
76 
77 
78 }
79 }
80 }
CRect offsetRight(CRect const &iRect, CCoord iRight)
Definition: GUIUtils.h:54
CRect offsetTop(CRect const &iRect, CCoord iTop)
Definition: GUIUtils.h:47
Definition: Clock.h:22
bool isTransparent(CColor const &iColor)
Definition: GUIUtils.h:35
CRect offsetBottom(CRect const &iRect, CCoord iBottom)
Definition: GUIUtils.h:68
Definition: Types.h:29
CRect offsetLeft(CRect const &iRect, CCoord iLeft)
Definition: GUIUtils.h:61