diff options
author | simonb <simonb> | 2007-01-07 14:56:32 (GMT) |
---|---|---|
committer | simonb <simonb> | 2007-01-07 14:56:32 (GMT) |
commit | 5385eb9070aeab09abf474b36053bf5edfae2334 (patch) | |
tree | b88839e47a696c71e9a12fe43b63886edbaa38bc | |
parent | dae3ecf9f21f0a94813faf96c0a8afd9627c8e24 (diff) | |
download | fluxbox_pavel-5385eb9070aeab09abf474b36053bf5edfae2334.zip fluxbox_pavel-5385eb9070aeab09abf474b36053bf5edfae2334.tar.bz2 |
par tof per-window alpha changes
-rw-r--r-- | src/IntResMenuItem.cc | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/IntResMenuItem.cc b/src/IntResMenuItem.cc deleted file mode 100644 index f81e021..0000000 --- a/src/IntResMenuItem.cc +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | // IntResMenuItem.cc for Fluxbox Window Manager | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot 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$ | ||
23 | |||
24 | #include "FbTk/Menu.hh" | ||
25 | |||
26 | #include "IntResMenuItem.hh" | ||
27 | #include "PixmapWithMask.hh" | ||
28 | |||
29 | #ifdef HAVE_CSTDIO | ||
30 | #include <cstdio> | ||
31 | #else | ||
32 | #include <stdio.h> | ||
33 | #endif | ||
34 | |||
35 | namespace { | ||
36 | |||
37 | std::string appendIntValue(const std::string &label, int value) { | ||
38 | char *buff = new char[label.size() + 16]; | ||
39 | sprintf(buff, "%s: %d", label.c_str(), value); | ||
40 | std::string ret(buff); | ||
41 | delete [] buff; | ||
42 | return ret; | ||
43 | } | ||
44 | |||
45 | }; | ||
46 | |||
47 | IntResMenuItem::IntResMenuItem(const FbTk::FbString &label, FbTk::Resource<int> &res, int min_val, int max_val, FbTk::Menu &host_menu): | ||
48 | FbTk::MenuItem(label, host_menu), m_org_label(FbTk::MenuItem::label()), | ||
49 | m_max(max_val), m_min(min_val), m_res(res) { | ||
50 | setLabel(appendIntValue(m_org_label, *m_res)); | ||
51 | } | ||
52 | |||
53 | void IntResMenuItem::click(int button, int time) { | ||
54 | static int last_time = -201; | ||
55 | int inc_val = 1; | ||
56 | // check double click | ||
57 | //!! TODO: must have some sort of "global" double click time in FbTk | ||
58 | if (time - last_time <= 200) | ||
59 | inc_val = 5; | ||
60 | |||
61 | last_time = time; | ||
62 | |||
63 | if ((button == 4 || button == 3)&& *m_res < m_max) // scroll up | ||
64 | (*m_res) += inc_val; | ||
65 | else if ((button == 5 || button == 1) && *m_res > m_min) // scroll down | ||
66 | (*m_res) -= inc_val; | ||
67 | |||
68 | // clamp value | ||
69 | if (*m_res > m_max) | ||
70 | *m_res = m_max; | ||
71 | else if (*m_res < m_min) | ||
72 | *m_res = m_min; | ||
73 | |||
74 | // update label | ||
75 | setLabel(appendIntValue(m_org_label, *m_res)); | ||
76 | // call other commands | ||
77 | FbTk::MenuItem::click(button, time); | ||
78 | |||
79 | // show new value, which for us means forcing a full menu update | ||
80 | // since the text is drawn onto the background! | ||
81 | if (menu()) { | ||
82 | menu()->frameWindow().updateBackground(false); | ||
83 | menu()->clearWindow(); | ||
84 | } | ||
85 | } | ||