aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbWindow.hh7
-rw-r--r--src/FbTk/Makefile.am1
-rw-r--r--src/FbTk/RelCalcHelper.cc38
-rw-r--r--src/FbTk/RelCalcHelper.hh43
4 files changed, 89 insertions, 0 deletions
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index e03083c..9d335fa 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -28,6 +28,12 @@
28#include <string> 28#include <string>
29#include <set> 29#include <set>
30 30
31#ifdef HAVE_CMATH
32 #include <cmath>
33#else
34 #include <math.h>
35#endif
36
31namespace FbTk { 37namespace FbTk {
32 38
33class Color; 39class Color;
@@ -259,6 +265,7 @@ public:
259}; 265};
260 266
261 267
268
262} // end namespace FbTk 269} // end namespace FbTk
263 270
264#endif // FBTK_FBWINDOW_HH 271#endif // FBTK_FBWINDOW_HH
diff --git a/src/FbTk/Makefile.am b/src/FbTk/Makefile.am
index 4c38f84..171f27d 100644
--- a/src/FbTk/Makefile.am
+++ b/src/FbTk/Makefile.am
@@ -64,6 +64,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
64 CachedPixmap.hh CachedPixmap.cc \ 64 CachedPixmap.hh CachedPixmap.cc \
65 Slot.hh Signal.hh MemFun.hh SelectArg.hh \ 65 Slot.hh Signal.hh MemFun.hh SelectArg.hh \
66 Util.hh \ 66 Util.hh \
67 RelCalcHelper.hh RelCalcHelper.cc \
67 ${xpm_SOURCE} \ 68 ${xpm_SOURCE} \
68 ${xft_SOURCE} \ 69 ${xft_SOURCE} \
69 ${xmb_SOURCE} \ 70 ${xmb_SOURCE} \
diff --git a/src/FbTk/RelCalcHelper.cc b/src/FbTk/RelCalcHelper.cc
new file mode 100644
index 0000000..a537de4
--- /dev/null
+++ b/src/FbTk/RelCalcHelper.cc
@@ -0,0 +1,38 @@
1// RelCalcHelper.hh for Fluxbox - an X11 Window manager
2// Copyright (c) 2012 Lajos Koszti (ajnasz at ajnasz.hu)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#include "RelCalcHelper.hh"
23
24namespace FbTk {
25
26 namespace RelCalcHelper {
27
28 int calPercentageValueOf(int i, int j) {
29 return floor(i * j / 100 + 0.5);
30 }
31
32 int calPercentageOf(int i, int j) {
33 return floor((float) i / (float) j * 100 + 0.5);
34 }
35
36 }
37
38}
diff --git a/src/FbTk/RelCalcHelper.hh b/src/FbTk/RelCalcHelper.hh
new file mode 100644
index 0000000..67d85e9
--- /dev/null
+++ b/src/FbTk/RelCalcHelper.hh
@@ -0,0 +1,43 @@
1// RelCalcHelper.cc for Fluxbox - an X11 Window manager
2// Copyright (c) 2012 Lajos Koszti (ajnasz at ajnasz.hu)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef FBTK_RELCALCHELPER_HH
23#define FBTK_RELCALCHELPER_HH
24
25#ifdef HAVE_CMATH
26 #include <cmath>
27#else
28 #include <math.h>
29#endif
30
31namespace FbTk {
32
33namespace RelCalcHelper {
34
35 int calPercentageOf(int i, int j);
36
37 int calPercentageValueOf(int i, int j);
38
39}
40
41}
42
43#endif // FBTK_RELCALCHELPER_HH