/* mtip.cpp - A tip widget Copyright (C) 2003 Konrad Twardowski This program 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 2 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "miscutils.h" #include "mtip.h" #include #include // public MTip::MTip(const TipType tipType, TQWidget *parent) : KActiveLabel(parent, "MTip") { setFrameStyle(StyledPanel | Sunken); setTipType(tipType); setTipText(""); } MTip::~MTip() { } void MTip::setTipText(const TQString &value) { // valign and "center" ? TQString leftCell; if (_iconPath.isEmpty()) { leftCell = ""; } else { leftCell = ""; leftCell += ""; leftCell += ""; } setText(MiscUtils::HTML( "" \ "" + leftCell + "" \ "
" + value + "
" )); } void MTip::setTipType(const TipType value) { _type = value; switch (_type) { case Info: _iconPath = getIconPath("messagebox_info"); setPaletteBackgroundColor(white); setPaletteForegroundColor(blue); break; case Normal: _iconPath = getIconPath("messagebox_info"); setPaletteBackgroundColor(TQToolTip::palette().active().background()); setPaletteForegroundColor(black); break; case Warning: _iconPath = getIconPath("messagebox_warning"); setPaletteBackgroundColor(yellow); setPaletteForegroundColor(black); break; default: _iconPath = ""; } } // private TQString MTip::getIconPath(const TQString &name) const { return TDEGlobal::iconLoader()->iconPath(name, TDEIcon::NoGroup, TDEIcon::SizeLarge); }