/* * This file is part of RawTherapee. * * Copyright (c) 2004-2010 Gabor Horvath * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * RawTherapee is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ #include "lwbuttonset.h" LWButtonSet::LWButtonSet () : aw(0), ah(0) { } LWButtonSet::~LWButtonSet () { for (size_t i=0; igetSize (bw, bh); w+= bw; if (bh>h) h = bh; } } void LWButtonSet::arrangeButtons (int x, int y, int w, int h) { int mw, mh; getMinimalDimensions (mw, mh); if (w<0) w = mw; if (h<0) h = mh; int begx = x; int endx = x+w-1; for (size_t i=0; igetSize (bw, bh); buttons[i]->getAlignment (halign, valign); if (halign == LWButton::Left) { bx = begx; begx += bw; } else if (halign == LWButton::Right) { bx = endx-bw; endx -= bw; } if (valign == LWButton::Top) by = y; else if (valign == LWButton::Bottom) by = y+h-bh-1; else if (valign == LWButton::Center) by = y+(h-bh)/2; buttons[i]->setPosition (bx, by); } aw = w; ah = h; ax = x; ay = y; } void LWButtonSet::move (int nx, int ny) { for (size_t i=0; igetPosition (x, y); buttons[i]->setPosition (x+nx-ax, y+ny-ay); } ax = nx; ay = ny; } void LWButtonSet::redraw (Cairo::RefPtr context) { for (size_t i=0; iredraw (context); } bool LWButtonSet::motionNotify (int x, int y) { bool res = false; for (size_t i=0; imotionNotify (x, y); res = res || handled; } return res; } bool LWButtonSet::pressNotify (int x, int y) { bool res = false; for (size_t i=0; ipressNotify (x, y); res = res || handled; } return res; } bool LWButtonSet::releaseNotify (int x, int y) { bool res = false; for (size_t i=0; ireleaseNotify (x, y); res = res || handled; } return res; } bool LWButtonSet::inside (int x, int y) { for (size_t i=0; iinside (x, y)) return true; return false; } void LWButtonSet::setButtonListener (LWButtonListener* bl) { for (size_t i=0; isetButtonListener (bl); } void LWButtonSet::getAllocatedDimensions (int& w, int& h) { w = aw; h = ah; } void LWButtonSet::setColors (const Gdk::Color& bg, const Gdk::Color& fg) { for (size_t i=0; isetColors (bg, fg); } Glib::ustring LWButtonSet::getToolTip (int x, int y) { for (size_t i=0; igetToolTip (x, y); if (ttip!="") return ttip; } return ""; }