2003-10-13 23:35:54 +00:00
|
|
|
// GenericTool.cc for Fluxbox
|
2006-02-16 06:53:05 +00:00
|
|
|
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
2003-10-13 23:35:54 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
#include "GenericTool.hh"
|
|
|
|
#include "FbTk/FbWindow.hh"
|
2011-04-29 08:52:28 +00:00
|
|
|
#include "FbTk/MemFun.hh"
|
2007-12-30 06:44:11 +00:00
|
|
|
#include "ToolTheme.hh"
|
2003-10-13 23:35:54 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
2008-01-05 01:39:19 +00:00
|
|
|
FbTk::ThemeProxy<ToolTheme> &theme):
|
2003-10-13 23:35:54 +00:00
|
|
|
ToolbarItem(type),
|
|
|
|
m_window(new_window),
|
|
|
|
m_theme(theme) {
|
|
|
|
|
2011-04-29 08:52:28 +00:00
|
|
|
m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &GenericTool::themeReconfigured));
|
2003-10-13 23:35:54 +00:00
|
|
|
|
|
|
|
if (new_window == 0)
|
|
|
|
throw std::string("GenericTool: Error! Tried to create a tool with window = 0");
|
|
|
|
}
|
|
|
|
|
2003-10-26 20:11:27 +00:00
|
|
|
GenericTool::~GenericTool() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-10-13 23:35:54 +00:00
|
|
|
void GenericTool::move(int x, int y) {
|
|
|
|
m_window->move(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GenericTool::resize(unsigned int width, unsigned int height) {
|
|
|
|
m_window->resize(width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GenericTool::moveResize(int x, int y,
|
|
|
|
unsigned int width, unsigned int height) {
|
|
|
|
m_window->moveResize(x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GenericTool::show() {
|
|
|
|
m_window->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GenericTool::hide() {
|
|
|
|
m_window->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int GenericTool::width() const {
|
|
|
|
return m_window->width();
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int GenericTool::height() const {
|
|
|
|
return m_window->height();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int GenericTool::borderWidth() const {
|
|
|
|
return m_window->borderWidth();
|
|
|
|
}
|
|
|
|
|
2011-02-22 21:07:39 +00:00
|
|
|
void GenericTool::renderTheme(int alpha) {
|
2004-09-12 14:56:20 +00:00
|
|
|
m_window->setAlpha(alpha);
|
2003-10-13 23:35:54 +00:00
|
|
|
m_window->clear();
|
|
|
|
}
|
|
|
|
|
2011-04-29 08:52:28 +00:00
|
|
|
void GenericTool::themeReconfigured() {
|
2004-09-12 14:56:20 +00:00
|
|
|
m_window->clear();
|
2003-10-13 23:35:54 +00:00
|
|
|
}
|
2006-04-17 15:19:07 +00:00
|
|
|
|
|
|
|
void GenericTool::parentMoved() {
|
|
|
|
m_window->parentMoved();
|
|
|
|
}
|
|
|
|
|