/*************************************************************************** * Copyright (C) 2003-2005 by David Saxton * * david@bluehaze.org * * * * 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. * ***************************************************************************/ #include "cnitem.h" #include "cnitemgroup.h" #include "contexthelp.h" #include "itemlibrary.h" #include "katemdi.h" #include #include #include #include #include #include #include ContextHelp * ContextHelp::m_pSelf = 0l; ContextHelp * ContextHelp::self( KateMDI::ToolView * tqparent ) { if (!m_pSelf) { assert(tqparent); m_pSelf = new ContextHelp(tqparent); } return m_pSelf; } ContextHelp::ContextHelp( KateMDI::ToolView * tqparent ) : TQWidget( tqparent, "Context Help" ) { TQWhatsThis::add( this, i18n("Provides context-sensitive help relevant to the current editing being performed.") ); TQVBoxLayout *vtqlayout = new TQVBoxLayout( this, 0, 6 ); m_nameLbl = new TQLabel( this, "" ); vtqlayout->addWidget(m_nameLbl); vtqlayout->addSpacing(8); m_info = new TQTextBrowser( this, "" ); vtqlayout->addWidget(m_info); m_info->tqsetSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ); TQSpacerItem *spacer3 = new TQSpacerItem( 1, 1, TQSizePolicy::Preferred, TQSizePolicy::Preferred ); vtqlayout->addItem(spacer3); slotClear(); } ContextHelp::~ContextHelp() { } void ContextHelp::slotUpdate( Item *item ) { if (!item) { slotClear(); return; } m_nameLbl->setText("

"+item->name()+"

"); m_info->setText( ""+item->description() ); } void ContextHelp::slotClear() { m_nameLbl->setText(i18n("

No Item Selected

")); m_info->setText(""); } void ContextHelp::slotMultipleSelected() { m_nameLbl->setText(i18n("

Multiple Items

")); m_info->setText(""); } void ContextHelp::setContextHelp(const TQString& name, const TQString& help) { m_nameLbl->setText("

"+name+"

"); TQString parsed = help; parseInfo(parsed); m_info->setText( ""+parsed ); } void ContextHelp::parseInfo( TQString &info ) { info.tqreplace("","

Example:
"); info.tqreplace("","
"); } #include "contexthelp.moc"