aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTool.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-11-27 14:30:11 (GMT)
committerfluxgen <fluxgen>2003-11-27 14:30:11 (GMT)
commit5ce35d9fa811358162ae44ee1ca514270d7da466 (patch)
tree10be8c9296136cb1dd265e3a01f937f1491405cc /src/IconbarTool.cc
parent258cb10be2dc5a7b932ee4bebb9833d597b3cb18 (diff)
downloadfluxbox-5ce35d9fa811358162ae44ee1ca514270d7da466.zip
fluxbox-5ce35d9fa811358162ae44ee1ca514270d7da466.tar.bz2
toggle pixmap for IconButton
Diffstat (limited to 'src/IconbarTool.cc')
-rw-r--r--src/IconbarTool.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index 6bcc6b8..faccc62 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: IconbarTool.cc,v 1.15 2003/10/26 20:13:11 fluxgen Exp $ 23// $Id: IconbarTool.cc,v 1.16 2003/11/27 14:30:11 fluxgen Exp $
24 24
25#include "IconbarTool.hh" 25#include "IconbarTool.hh"
26 26
@@ -31,12 +31,15 @@
31#include "Workspace.hh" 31#include "Workspace.hh"
32#include "fluxbox.hh" 32#include "fluxbox.hh"
33#include "FbMenu.hh" 33#include "FbMenu.hh"
34#include "BoolMenuItem.hh"
35#include "CommandParser.hh"
34 36
35#include "FbTk/Menu.hh" 37#include "FbTk/Menu.hh"
36#include "FbTk/MenuItem.hh" 38#include "FbTk/MenuItem.hh"
37#include "FbTk/RefCount.hh" 39#include "FbTk/RefCount.hh"
38#include "FbTk/SimpleCommand.hh" 40#include "FbTk/SimpleCommand.hh"
39#include "FbTk/ImageControl.hh" 41#include "FbTk/ImageControl.hh"
42#include "FbTk/MacroCommand.hh"
40 43
41#include <typeinfo> 44#include <typeinfo>
42#include <string> 45#include <string>
@@ -181,11 +184,26 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr
181 m_empty_pm(0), 184 m_empty_pm(0),
182 m_rc_mode(screen.resourceManager(), WORKSPACE, 185 m_rc_mode(screen.resourceManager(), WORKSPACE,
183 screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), 186 screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"),
187 m_rc_use_pixmap(screen.resourceManager(), true,
188 screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"),
184 m_menu(*screen.menuTheme(), menu.screenNumber(), screen.imageControl(), 189 m_menu(*screen.menuTheme(), menu.screenNumber(), screen.imageControl(),
185 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { 190 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) {
186 191
187 // setup menu 192 // setup mode menu
188 setupModeMenu(m_menu, *this); 193 setupModeMenu(m_menu, *this);
194
195 using namespace FbTk;
196 // setup use pixmap item to reconfig iconbar and save resource on click
197 MacroCommand *save_and_reconfig = new MacroCommand();
198 RefCount<Command> reconfig(new SimpleCommand<IconbarTool>(*this, &IconbarTool::renderTheme));
199 RefCount<Command> save(CommandParser::instance().parseLine("saverc"));
200 save_and_reconfig->add(reconfig);
201 save_and_reconfig->add(save);
202 RefCount<Command> s_and_reconfig(save_and_reconfig);
203 m_menu.insert(new BoolMenuItem("Use Pixmap", *m_rc_use_pixmap, s_and_reconfig));
204 m_menu.update();
205
206 // add iconbar menu to toolbar menu
189 menu.insert(m_menu.label().c_str(), &m_menu); 207 menu.insert(m_menu.label().c_str(), &m_menu);
190 208
191 // setup signals 209 // setup signals
@@ -445,6 +463,8 @@ void IconbarTool::renderTheme() {
445 463
446void IconbarTool::renderButton(IconButton &button) { 464void IconbarTool::renderButton(IconButton &button) {
447 465
466 button.setPixmap(*m_rc_use_pixmap);
467
448 if (button.win().isFocused()) { // focused texture 468 if (button.win().isFocused()) { // focused texture
449 button.setGC(m_theme.focusedText().textGC()); 469 button.setGC(m_theme.focusedText().textGC());
450 button.setFont(m_theme.focusedText().font()); 470 button.setFont(m_theme.focusedText().font());
@@ -517,6 +537,7 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
517 return; 537 return;
518 538
519 IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win); 539 IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win);
540 button->setPixmap(*m_rc_use_pixmap);
520 m_icon_container.insertItem(button); 541 m_icon_container.insertItem(button);
521 m_icon_list.push_back(button); 542 m_icon_list.push_back(button);
522 543
@@ -527,7 +548,6 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
527 win.stateSig().attach(this); 548 win.stateSig().attach(this);
528} 549}
529 550
530
531void IconbarTool::updateIcons() { 551void IconbarTool::updateIcons() {
532 std::list<FluxboxWindow *> itemlist; 552 std::list<FluxboxWindow *> itemlist;
533 // add icons to the itemlist 553 // add icons to the itemlist