diff options
Diffstat (limited to 'src/DrawUtil.cc')
-rw-r--r-- | src/DrawUtil.cc | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/DrawUtil.cc b/src/DrawUtil.cc deleted file mode 100644 index 46ce8d9..0000000 --- a/src/DrawUtil.cc +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | // DrawUtil.cc for fluxbox | ||
2 | // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
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 | // $Id: DrawUtil.cc,v 1.11 2002/12/01 13:41:55 rathnor Exp $ | ||
23 | |||
24 | #include "DrawUtil.hh" | ||
25 | |||
26 | namespace DrawUtil { | ||
27 | |||
28 | int doAlignment(int max_width, int bevel, Font::FontJustify justify, | ||
29 | const FbTk::Font &font, const char * const text, size_t textlen, size_t &newlen) { | ||
30 | |||
31 | if (text == 0 || textlen == 0) | ||
32 | return 0; | ||
33 | |||
34 | int l = font.textWidth(text, textlen) + bevel; | ||
35 | size_t dlen = textlen; | ||
36 | int dx = bevel; | ||
37 | if (l > max_width) { | ||
38 | for (; dlen > 0; dlen--) { | ||
39 | l = font.textWidth(text, dlen) + bevel; | ||
40 | if (l<=max_width) | ||
41 | break; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | newlen = dlen; | ||
46 | |||
47 | switch (justify) { | ||
48 | case DrawUtil::Font::RIGHT: | ||
49 | dx = max_width - l - bevel; | ||
50 | break; | ||
51 | case DrawUtil::Font::CENTER: | ||
52 | dx = (max_width - l)/2; | ||
53 | break; | ||
54 | case DrawUtil::Font::LEFT: | ||
55 | break; | ||
56 | } | ||
57 | |||
58 | return dx; | ||
59 | } | ||
60 | |||
61 | }; //end namespace DrawUtil | ||