|
|
|
#define __KVIRC__
|
|
|
|
|
|
|
|
|
|
|
|
#include <tqlayout.h>
|
|
|
|
#include <tqtoolbutton.h>
|
|
|
|
#include <tqobjectcleanuphandler.h>
|
|
|
|
#include <tqpushbutton.h>
|
|
|
|
#include "kvi_tal_vbox.h"
|
|
|
|
#include <tqpainter.h>
|
|
|
|
#include <tqapplication.h>
|
|
|
|
|
|
|
|
#include "kvi_toolwindows_container.h"
|
|
|
|
#include "kvi_iconmanager.h"
|
|
|
|
|
|
|
|
|
|
|
|
KviWindowToolWidget::KviWindowToolWidget(TQWidget * parent, KviWindowToolPageButton* button/*, const char * name, WFlags f*/ )
|
|
|
|
:TQWidget(parent/*,name,f*/)
|
|
|
|
{
|
|
|
|
// m_pContainer=parent;
|
|
|
|
m_pButton=button;
|
|
|
|
m_bAutoDelete=1;
|
|
|
|
m_bHidden=0;
|
|
|
|
if(m_pButton) m_pButton->setOn(!isHidden());
|
|
|
|
// m_ObjectHandler.add(button);
|
|
|
|
// setMinimumWidth(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
KviWindowToolWidget::~KviWindowToolWidget()
|
|
|
|
{
|
|
|
|
// unregisterSelf();
|
|
|
|
// m_ObjectHandler.remove(m_pButton);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void KviWindowToolWidget::registerSelf()
|
|
|
|
{
|
|
|
|
/* m_pContainer->registerWidget(this);
|
|
|
|
if(!m_ObjectHandler.isEmpty())
|
|
|
|
{
|
|
|
|
if(m_pButton)
|
|
|
|
m_pButton->setOn(true);
|
|
|
|
} else {
|
|
|
|
m_pButton=0;
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void KviWindowToolWidget::unregisterSelf()
|
|
|
|
{
|
|
|
|
/* if(!m_bHidden)
|
|
|
|
m_pContainer->unregisterWidget(this);
|
|
|
|
if(!m_ObjectHandler.isEmpty())
|
|
|
|
{
|
|
|
|
if(m_pButton)
|
|
|
|
m_pButton->setOn(false);
|
|
|
|
} else {
|
|
|
|
m_pButton=0;
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/*void KviWindowToolWidget::hide()
|
|
|
|
{
|
|
|
|
if(m_bAutoDelete==0)
|
|
|
|
{
|
|
|
|
unregisterSelf();
|
|
|
|
m_bHidden=1;
|
|
|
|
}
|
|
|
|
TQWidget::hide();
|
|
|
|
}*/
|
|
|
|
|
|
|
|
/*void KviWindowToolWidget::show()
|
|
|
|
{
|
|
|
|
if(m_bHidden)
|
|
|
|
{
|
|
|
|
registerSelf();
|
|
|
|
}
|
|
|
|
TQWidget::show();
|
|
|
|
m_bHidden=0;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
KviWindowToolPageButton::KviWindowToolPageButton ( int pixon,int pixoff, const TQString & text, TQWidget * parent,bool bOn, const char * name )
|
|
|
|
:TOOL_PAGE_PARENT(parent)
|
|
|
|
{
|
|
|
|
#ifdef COMPILE_USE_QT4
|
|
|
|
setFlat(true);
|
|
|
|
setObjectName("kvi_window_tool_button");
|
|
|
|
setIcon(TQIcon(*(g_pIconManager->getSmallIcon(pixon))));
|
|
|
|
#else
|
|
|
|
TQIconSet is1;
|
|
|
|
is1.setPixmap(*(g_pIconManager->getSmallIcon(pixon)),TQIconSet::Small,TQIconSet::Normal,TQIconSet::On);
|
|
|
|
is1.setPixmap(*(g_pIconManager->getSmallIcon(pixoff)),TQIconSet::Small,TQIconSet::Normal,TQIconSet::Off);
|
|
|
|
setIconSet(is1);
|
|
|
|
setUsesBigPixmap(false);
|
|
|
|
#endif
|
|
|
|
setToggleButton(true);
|
|
|
|
setOn(bOn);
|
|
|
|
|
|
|
|
// setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed,TQSizePolicy::Ignored));
|
|
|
|
}
|
|
|
|
|
|
|
|
KviWindowToolPageButton::~KviWindowToolPageButton()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*void KviWindowToolPageButton::drawButton ( TQPainter * p)
|
|
|
|
{
|
|
|
|
TQPixmap pixmap( height(), width() );
|
|
|
|
if(isOn())
|
|
|
|
pixmap.fill(colorGroup().mid());
|
|
|
|
else
|
|
|
|
pixmap.fill(colorGroup().button());
|
|
|
|
TQPainter painter( &pixmap );
|
|
|
|
|
|
|
|
TQPixmap icon;
|
|
|
|
if(isOn())
|
|
|
|
icon=iconSet()->pixmap(TQIconSet::Small,TQIconSet::Normal,TQIconSet::On);
|
|
|
|
else
|
|
|
|
icon=iconSet()->pixmap(TQIconSet::Small,TQIconSet::Normal,TQIconSet::Off);
|
|
|
|
|
|
|
|
// Draw the frame
|
|
|
|
//painter.setPen( colorGroup().mid() );
|
|
|
|
//if ( m_id != NUM_TABS - 1 ) painter.drawLine( 0, 0, 0, pixmap.height() - 1 );
|
|
|
|
//painter.drawLine( 0, pixmap.height() - 1, pixmap.width() - 1, pixmap.height() - 1 );
|
|
|
|
|
|
|
|
// Draw the text
|
|
|
|
TQFont font;
|
|
|
|
TQString str = text();
|
|
|
|
str.remove("&");
|
|
|
|
const int textX = pixmap.width() / 2 - TQFontMetrics( font ).width( str ) / 2;
|
|
|
|
painter.setPen( colorGroup().buttonText() );
|
|
|
|
const TQRect rect( textX + icon.width() / 2 + 2, 0, pixmap.width(), pixmap.height() );
|
|
|
|
painter.drawText( rect, TQt::AlignLeft | TQt::AlignVCenter, str );
|
|
|
|
|
|
|
|
// Draw the icon
|
|
|
|
painter.drawPixmap( textX - icon.width() / 2 - 2, pixmap.height() / 2 - icon.height() / 2, icon );
|
|
|
|
|
|
|
|
// Paint to widget
|
|
|
|
p->rotate( -90 );
|
|
|
|
p->drawPixmap( 1 - pixmap.width(), 0, pixmap );
|
|
|
|
}*/
|