Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
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 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19#pragma once
20
21#include <vstgui4/vstgui/lib/ccolor.h>
22#include <vstgui4/vstgui/lib/crect.h>
23
24namespace pongasoft {
25namespace VST {
26namespace GUI {
27
28using namespace VSTGUI;
29
30//------------------------------------------------------------------------
31// CColor related utils
32//------------------------------------------------------------------------
33namespace CColorUtils {
34
35// convenient call to check if a color is transparent
36inline bool isTransparent(CColor const &iColor) {
37 return iColor.alpha == 0;
38}
39
40}
41
42//------------------------------------------------------------------------
43// CRect related utils
44//------------------------------------------------------------------------
45namespace CRectUtils {
46
47// offsetTop
48inline CRect offsetTop(CRect const &iRect, CCoord iTop) {
49 CRect res = iRect;
50 res.top += iTop;
51 return res;
52}
53
54// offsetRight
55inline CRect offsetRight(CRect const &iRect, CCoord iRight) {
56 CRect res = iRect;
57 res.right += iRight;
58 return res;
59}
60
61// offsetLeft
62inline CRect offsetLeft(CRect const &iRect, CCoord iLeft) {
63 CRect res = iRect;
64 res.left += iLeft;
65 return res;
66}
67
68// offsetBottom
69inline CRect offsetBottom(CRect const &iRect, CCoord iBottom) {
70 CRect res = iRect;
71 res.bottom += iBottom;
72 return res;
73}
74
75}
76
77
78
79}
80}
81}
Definition GUIUtils.h:33
bool isTransparent(CColor const &iColor)
Definition GUIUtils.h:36
Definition GUIUtils.h:45
CRect offsetBottom(CRect const &iRect, CCoord iBottom)
Definition GUIUtils.h:69
CRect offsetRight(CRect const &iRect, CCoord iRight)
Definition GUIUtils.h:55
CRect offsetLeft(CRect const &iRect, CCoord iLeft)
Definition GUIUtils.h:62
CRect offsetTop(CRect const &iRect, CCoord iTop)
Definition GUIUtils.h:48
Definition DrawContext.cpp:25
Definition Clock.h:24
Definition Clock.h:23