• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Widgets Library
 

KDevelop Widgets Library

  • lib
  • widgets
resizablecombo.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#include "resizablecombo.h"
20
21#include "kcomboview.h"
22
23#include <tqevent.h>
24#include <tqlayout.h>
25#include <tqpixmap.h>
26#include <tqapplication.h>
27#include <tqwhatsthis.h>
28
29#include <tdelocale.h>
30
31static const char * resize_xpm[] = {
32"9 18 2 1",
33" c None",
34". c #000000",
35" . ",
36" ",
37" . ",
38" ",
39" . ",
40" ",
41" . . . ",
42" .. .. ",
43".........",
44" .. .. ",
45" . . . ",
46" ",
47" . ",
48" ",
49" . ",
50" ",
51" . ",
52" "};
53
54ResizableCombo::ResizableCombo(KComboView *view, TQWidget *parent, const char *name):
55 TQWidget(parent, name), m_sizer(0), m_combo(view)
56{
57 TQHBoxLayout *l = new TQHBoxLayout(this);
58 view->reparent(this, TQPoint(0,0));
59 l->addWidget(view);
60
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);
65}
66
67void MyPushButton::mousePressEvent( TQMouseEvent * e )
68{
69 m_resizing = true;
70 m_pressedPos = e->globalPos();
71 m_width = m_combo->m_combo->width();
72 TQPushButton::mousePressEvent(e);
73}
74
75void MyPushButton::mouseReleaseEvent( TQMouseEvent * e )
76{
77 m_resizing = false;
78 TQPushButton::mouseReleaseEvent(e);
79}
80
81void MyPushButton::mouseMoveEvent( TQMouseEvent * e )
82{
83 if (m_resizing)
84 m_combo->m_combo->setMinimumWidth(m_width + e->globalPos().x() - pressedPos().x());
85
86 TQPushButton::mouseMoveEvent(e);
87}
88
89MyPushButton::MyPushButton( ResizableCombo * parent, const char * name )
90 :TQPushButton(parent, name), m_resizing(false), m_combo(parent)
91{
92 setFocusPolicy(TQWidget::NoFocus);
93 setFlat(true);
94 m_width = m_combo->m_combo->width();
95}
96
97
98#include "resizablecombo.moc"
ResizableCombo
Resizable combo box.
Definition resizablecombo.h:38
kcomboview.h
KComboView class.
resizablecombo.h
Resizable combo box.

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Widgets Library by doxygen 1.15.0
This website is maintained by Timothy Pearson.