diff options
author | fluxgen <fluxgen> | 2003-07-28 12:11:57 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-07-28 12:11:57 (GMT) |
commit | 88c3562634b946523b55b9932e4f4044561c7276 (patch) | |
tree | 489444a827f4c816caeaf5ce3d59d4723260e675 /src/FbWinFrame.cc | |
parent | 7c76910844e8b6f13fe4b8eda1a37cb636e0e8c4 (diff) | |
download | fluxbox_pavel-88c3562634b946523b55b9932e4f4044561c7276.zip fluxbox_pavel-88c3562634b946523b55b9932e4f4044561c7276.tar.bz2 |
using list instead of vector so we can rearrange labels better
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 72 |
1 files changed, 55 insertions, 17 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index ada5f00..418efdb 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrame.cc,v 1.31 2003/07/26 16:17:01 rathnor Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.32 2003/07/28 12:11:57 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | #include "ImageControl.hh" | 25 | #include "ImageControl.hh" |
@@ -244,9 +244,9 @@ void FbWinFrame::removeAllButtons() { | |||
244 | } | 244 | } |
245 | 245 | ||
246 | void FbWinFrame::addLabelButton(FbTk::Button &btn) { | 246 | void FbWinFrame::addLabelButton(FbTk::Button &btn) { |
247 | ButtonList::iterator found_it = find(m_labelbuttons.begin(), | 247 | LabelList::iterator found_it = find(m_labelbuttons.begin(), |
248 | m_labelbuttons.end(), | 248 | m_labelbuttons.end(), |
249 | &btn); | 249 | &btn); |
250 | 250 | ||
251 | if (found_it != m_labelbuttons.end()) | 251 | if (found_it != m_labelbuttons.end()) |
252 | return; | 252 | return; |
@@ -255,19 +255,57 @@ void FbWinFrame::addLabelButton(FbTk::Button &btn) { | |||
255 | } | 255 | } |
256 | 256 | ||
257 | void FbWinFrame::removeLabelButton(FbTk::Button &btn) { | 257 | void FbWinFrame::removeLabelButton(FbTk::Button &btn) { |
258 | ButtonList::iterator erase_it = remove(m_labelbuttons.begin(), | 258 | LabelList::iterator erase_it = remove(m_labelbuttons.begin(), |
259 | m_labelbuttons.end(), | 259 | m_labelbuttons.end(), |
260 | &btn); | 260 | &btn); |
261 | if (erase_it == m_labelbuttons.end()) | 261 | if (erase_it == m_labelbuttons.end()) |
262 | return; | 262 | return; |
263 | 263 | ||
264 | m_labelbuttons.erase(erase_it); | 264 | m_labelbuttons.erase(erase_it); |
265 | } | 265 | } |
266 | 266 | ||
267 | void FbWinFrame::setLabelButtonFocus(FbTk::Button &btn) { | 267 | |
268 | ButtonList::iterator it = find(m_labelbuttons.begin(), | 268 | void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) { |
269 | LabelList::iterator it = find(m_labelbuttons.begin(), | ||
269 | m_labelbuttons.end(), | 270 | m_labelbuttons.end(), |
270 | &btn); | 271 | &btn); |
272 | // make sure we found it and we're not at the begining | ||
273 | if (it == m_labelbuttons.end() || it == m_labelbuttons.begin()) | ||
274 | return; | ||
275 | |||
276 | LabelList::iterator new_pos = it; | ||
277 | new_pos--; | ||
278 | FbTk::Button *item = *it; | ||
279 | // remove from list | ||
280 | m_labelbuttons.erase(it); | ||
281 | // insert on the new place | ||
282 | m_labelbuttons.insert(new_pos, item); | ||
283 | // update titlebar | ||
284 | redrawTitle(); | ||
285 | } | ||
286 | |||
287 | void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) { | ||
288 | LabelList::iterator it = find(m_labelbuttons.begin(), | ||
289 | m_labelbuttons.end(), | ||
290 | &btn); | ||
291 | // make sure we found it and we're not at the last item | ||
292 | if (it == m_labelbuttons.end() || *it == m_labelbuttons.back()) | ||
293 | return; | ||
294 | |||
295 | FbTk::Button *item = *it; | ||
296 | // remove from list | ||
297 | LabelList::iterator new_pos = m_labelbuttons.erase(it); | ||
298 | new_pos++; | ||
299 | // insert on the new place | ||
300 | m_labelbuttons.insert(new_pos, item); | ||
301 | // update titlebar | ||
302 | redrawTitle(); | ||
303 | } | ||
304 | |||
305 | void FbWinFrame::setLabelButtonFocus(FbTk::Button &btn) { | ||
306 | LabelList::iterator it = find(m_labelbuttons.begin(), | ||
307 | m_labelbuttons.end(), | ||
308 | &btn); | ||
271 | if (it == m_labelbuttons.end()) | 309 | if (it == m_labelbuttons.end()) |
272 | return; | 310 | return; |
273 | 311 | ||
@@ -410,8 +448,8 @@ void FbWinFrame::removeEventHandler() { | |||
410 | 448 | ||
411 | void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | 449 | void FbWinFrame::buttonPressEvent(XButtonEvent &event) { |
412 | // we can ignore which window the event was generated for | 450 | // we can ignore which window the event was generated for |
413 | ButtonList::iterator btn_it = m_labelbuttons.begin(); | 451 | LabelList::iterator btn_it = m_labelbuttons.begin(); |
414 | ButtonList::iterator btn_it_end = m_labelbuttons.end(); | 452 | LabelList::iterator btn_it_end = m_labelbuttons.end(); |
415 | for (; btn_it != btn_it_end; ++btn_it) { | 453 | for (; btn_it != btn_it_end; ++btn_it) { |
416 | if ((*btn_it)->window() == event.window) { | 454 | if ((*btn_it)->window() == event.window) { |
417 | (*btn_it)->buttonPressEvent(event); | 455 | (*btn_it)->buttonPressEvent(event); |
@@ -434,8 +472,8 @@ void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | |||
434 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { | 472 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { |
435 | // we can ignore which window the event was generated for | 473 | // we can ignore which window the event was generated for |
436 | 474 | ||
437 | ButtonList::iterator btn_it = m_labelbuttons.begin(); | 475 | LabelList::iterator btn_it = m_labelbuttons.begin(); |
438 | ButtonList::iterator btn_it_end = m_labelbuttons.end(); | 476 | LabelList::iterator btn_it_end = m_labelbuttons.end(); |
439 | for (; btn_it != btn_it_end; ++btn_it) { | 477 | for (; btn_it != btn_it_end; ++btn_it) { |
440 | if ((*btn_it)->window() == event.window) { | 478 | if ((*btn_it)->window() == event.window) { |
441 | (*btn_it)->buttonReleaseEvent(event); | 479 | (*btn_it)->buttonReleaseEvent(event); |
@@ -574,8 +612,8 @@ void FbWinFrame::redrawTitle() { | |||
574 | int border_width = m_labelbuttons.size() != 0 ? | 612 | int border_width = m_labelbuttons.size() != 0 ? |
575 | m_labelbuttons.front()->window().borderWidth() : 0; | 613 | m_labelbuttons.front()->window().borderWidth() : 0; |
576 | 614 | ||
577 | ButtonList::iterator btn_it = m_labelbuttons.begin(); | 615 | LabelList::iterator btn_it = m_labelbuttons.begin(); |
578 | ButtonList::iterator btn_it_end = m_labelbuttons.end(); | 616 | LabelList::iterator btn_it_end = m_labelbuttons.end(); |
579 | for (unsigned int last_x = 0; | 617 | for (unsigned int last_x = 0; |
580 | btn_it != btn_it_end; | 618 | btn_it != btn_it_end; |
581 | ++btn_it, last_x += button_width + border_width) { | 619 | ++btn_it, last_x += button_width + border_width) { |
@@ -888,8 +926,8 @@ void FbWinFrame::renderLabelButtons() { | |||
888 | getCurrentFocusPixmap(label_pm, not_used_pm, | 926 | getCurrentFocusPixmap(label_pm, not_used_pm, |
889 | label_color, not_used_color); | 927 | label_color, not_used_color); |
890 | 928 | ||
891 | ButtonList::iterator btn_it = m_labelbuttons.begin(); | 929 | LabelList::iterator btn_it = m_labelbuttons.begin(); |
892 | ButtonList::iterator btn_it_end = m_labelbuttons.end(); | 930 | LabelList::iterator btn_it_end = m_labelbuttons.end(); |
893 | for (; btn_it != btn_it_end; ++btn_it) { | 931 | for (; btn_it != btn_it_end; ++btn_it) { |
894 | 932 | ||
895 | (*btn_it)->setGC(theme().labelTextFocusGC()); | 933 | (*btn_it)->setGC(theme().labelTextFocusGC()); |