diff options
author | fluxgen <fluxgen> | 2005-05-02 01:17:08 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2005-05-02 01:17:08 (GMT) |
commit | d3362370f5e8f440d2233629cc57e6f355b17b11 (patch) | |
tree | f6df824ebb52664c4061afc563f83bc4d116fee1 /src/FbWinFrame.cc | |
parent | 55f62bc5cc64f0b8c41f7db343ecd871c250ae8f (diff) | |
download | fluxbox-d3362370f5e8f440d2233629cc57e6f355b17b11.zip fluxbox-d3362370f5e8f440d2233629cc57e6f355b17b11.tar.bz2 |
cleaning, create and delete tabs with FbWinFrame createTab/removeTab
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index a1745ef..fe33c09 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -331,33 +331,41 @@ void FbWinFrame::removeAllButtons() { | |||
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | void FbWinFrame::addLabelButton(FbTk::TextButton &btn) { | 334 | FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Command *command) { |
335 | LabelList::iterator found_it = find(m_labelbuttons.begin(), | 335 | FbTk::TextButton *button = new FbTk::TextButton(label(), |
336 | m_labelbuttons.end(), | 336 | theme().font(), |
337 | &btn); | 337 | title); |
338 | button->show(); | ||
339 | button->setEventMask(ExposureMask | ButtonPressMask | | ||
340 | ButtonReleaseMask | ButtonMotionMask | | ||
341 | EnterWindowMask); | ||
338 | 342 | ||
339 | if (found_it != m_labelbuttons.end()) | 343 | FbTk::RefCount<FbTk::Command> refcmd(command); |
340 | return; | 344 | button->setOnClick(refcmd); |
341 | 345 | ||
342 | btn.setTextPadding(Fluxbox::instance()->getTabsPadding()); | 346 | button->setTextPadding(Fluxbox::instance()->getTabsPadding()); |
343 | m_labelbuttons.push_back(&btn); | 347 | button->setJustify(theme().justify()); |
348 | |||
349 | m_labelbuttons.push_back(button); | ||
344 | 350 | ||
345 | if (currentLabel() == 0) | 351 | if (currentLabel() == 0) |
346 | setLabelButtonFocus(btn); | 352 | setLabelButtonFocus(*button); |
353 | |||
354 | return button; | ||
347 | } | 355 | } |
348 | 356 | ||
349 | void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) { | 357 | void FbWinFrame::removeTab(ButtonId btn) { |
350 | LabelList::iterator erase_it = remove(m_labelbuttons.begin(), | 358 | LabelList::iterator erase_it = remove(m_labelbuttons.begin(), |
351 | m_labelbuttons.end(), | 359 | m_labelbuttons.end(), |
352 | &btn); | 360 | btn); |
353 | if (erase_it == m_labelbuttons.end()) | 361 | if (erase_it == m_labelbuttons.end()) |
354 | return; | 362 | return; |
355 | 363 | ||
356 | if (&btn == m_current_label) | 364 | if (btn == m_current_label) |
357 | m_current_label = 0; | 365 | m_current_label = 0; |
358 | 366 | ||
359 | m_labelbuttons.erase(erase_it); | 367 | m_labelbuttons.erase(erase_it); |
360 | 368 | delete btn; | |
361 | } | 369 | } |
362 | 370 | ||
363 | 371 | ||
@@ -550,6 +558,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { | |||
550 | m_clientarea.raise(); | 558 | m_clientarea.raise(); |
551 | win.raise(); | 559 | win.raise(); |
552 | m_window.showSubwindows(); | 560 | m_window.showSubwindows(); |
561 | |||
553 | } | 562 | } |
554 | 563 | ||
555 | bool FbWinFrame::hideTitlebar() { | 564 | bool FbWinFrame::hideTitlebar() { |