26 #include <tqapplication.h> 27 #include <tqwhatsthis.h> 29 #include <tdelocale.h> 31 static const char * resize_xpm[] = {
54 ResizableCombo::ResizableCombo(KComboView *view, TQWidget *parent,
const char *name):
55 TQWidget(parent, name), m_sizer(0), m_combo(view)
57 TQHBoxLayout *l =
new TQHBoxLayout(
this);
58 view->reparent(
this, TQPoint(0,0));
61 m_sizer =
new MyPushButton(
this);
62 m_sizer->setPixmap(TQPixmap(resize_xpm));
63 TQWhatsThis::add(m_sizer, i18n(
"Drag this to resize the combobox."));
64 l->addWidget(m_sizer);
67 void MyPushButton::mousePressEvent( TQMouseEvent * e )
70 m_pressedPos = e->globalPos();
71 m_width = m_combo->m_combo->width();
72 TQPushButton::mousePressEvent(e);
75 void MyPushButton::mouseReleaseEvent( TQMouseEvent * e )
78 TQPushButton::mouseReleaseEvent(e);
81 void MyPushButton::mouseMoveEvent( TQMouseEvent * e )
84 m_combo->m_combo->setMinimumWidth(m_width + e->globalPos().x() - pressedPos().x());
86 TQPushButton::mouseMoveEvent(e);
89 MyPushButton::MyPushButton(
ResizableCombo * parent,
const char * name )
90 :TQPushButton(parent, name), m_resizing(false), m_combo(parent)
92 setFocusPolicy(TQ_NoFocus);
94 m_width = m_combo->m_combo->width();
98 #include "resizablecombo.moc"