summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmactions.h
blob: f4f8e9e4f6059b3c0c0251d844e641b110e0969c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2000-2002 by Andreas Zehender
    email                : zehender@kde.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.                                   *
*                                                                        *
**************************************************************************/


#ifndef PMACTIONS_H
#define PMACTIONS_H

#include <qguardedptr.h>
#include <kaction.h>

class QComboBox;
class QSpinBox;
class QLabel;
class QToolButton;

/**
 * Combobox action for the toolbar.
 *
 * Copied from konq_actions.h, author: Simon Hausmann <hausmann@kde.org>
 */
class PMComboAction : public KAction
{
   Q_OBJECT
public:
   PMComboAction( const QString& text, int accel, const QObject* receiver, const char* member, QObject* parent, const char* name );
   ~PMComboAction( );
   
   virtual int plug( QWidget* w, int index = -1 );
   
   virtual void unplug( QWidget* w );
   
   QGuardedPtr<QComboBox> combo( ) { return m_combo; }

   void setMaximumWidth( int w ) { m_maxWidth = w; }
   void setMinimumWidth( int w ) { m_minWidth = w; }
   
signals:
   void plugged( );
   
private:
   QGuardedPtr<QComboBox> m_combo;
   const QObject* m_receiver;
   const char* m_member;
   int m_minWidth, m_maxWidth;
};

/**
 * Label action for the toolbar.
 *
 * Copied from konq_actions.h, author: Simon Hausmann <hausmann@kde.org>
 */
class PMLabelAction : public KAction
{
   Q_OBJECT
public:
   PMLabelAction( const QString &text, QObject *parent = 0, const char *name = 0 );
   
   virtual int plug( QWidget *widget, int index = -1 );
   virtual void unplug( QWidget *widget );
   QToolButton* button( ) { return m_button; }
   
private:
   QToolButton* m_button;
};

/**
 * Spinbox action for the toolbar.
 */
class PMSpinBoxAction : public KAction
{
   Q_OBJECT
public:
   PMSpinBoxAction( const QString& text, int accel, const QObject* receiver, const char* member, QObject* parent, const char* name );
   ~PMSpinBoxAction( );
   
   virtual int plug( QWidget* w, int index = -1 );
   virtual void unplug( QWidget* w );
   
   QGuardedPtr<QSpinBox> spinBox( ) { return m_spinBox; }

signals:
   void plugged( );
   
private:
   QGuardedPtr<QSpinBox> m_spinBox;
   const QObject* m_receiver;
   const char* m_member;
};


#endif