Main Page   Class Hierarchy   Compound List   File List   Compound Members  

actions.h

00001 // -*- c++ -*-
00002 
00003 /*
00004  *
00005  * Copyright (C) 2002 Richard Moore <rich@kde.org>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #ifndef ACTIONS_H
00024 #define ACTIONS_H
00025 
00026 #include <qptrlist.h>
00027 #include <qwidget.h>
00028 #include <kaction.h>
00029 
00030 class QSlider;
00031 class QDockWindow;
00032 class QLCDNumber;
00033 class KMainWindow;
00034 
00035 //
00036 // Actions for displaying custom QWidgets.
00037 //
00038 
00045 class LCDNumberAction : public KAction
00046 {
00047     Q_OBJECT
00048 
00049 public:
00056     LCDNumberAction( const QString &text, int accel,
00057                      QObject *receiver, const char *slot,
00058                      QObject *parent = 0, const char *name = 0 );
00059 
00060     virtual int plug( QWidget *widget, int index = -1 );
00061     virtual void unplug( QWidget *widget );
00062 
00063     int intValue() const { return val.toInt(); }
00064     QString value() const { return val; }
00065 
00066     int numDigits() const { return numDig; }
00067 
00068 public slots:
00069     void display( int num );
00070     void display( const QString &s );
00071 
00072     void setNumDigits( int nDigits );
00073 
00074 signals:
00075     void valueChanged( const QString & );
00076 
00077 protected:
00078     virtual QLCDNumber *createWidget( QWidget *parent, const char *name=0 );
00079 
00080 private:
00081     int numDig;
00082     QString val;
00083 };
00084 
00093 class SliderAction : public KAction
00094 {
00095     Q_OBJECT
00096 
00097 public:
00098     SliderAction( int min, int max, int step, int val,
00099                   const QString &text,
00100                   QObject *parent = 0, const char *name = 0 );
00101 
00102     virtual int plug( QWidget *widget, int index = -1 );
00103     virtual void unplug( QWidget *widget );
00104 
00108     QSlider *widget() const { return slide; }
00109 
00113     int value() const;
00114 
00118     virtual QSlider *createWidget( QWidget *parent, const char *name=0 );
00119 
00120 public slots:
00124     void setValue( int num );
00125 
00131     void setTickInterval( int ticks );
00132 
00136     void setOrientation( Orientation o );
00137 
00141     void dockChange( QDockWindow* );
00142 
00143 signals:
00149     void valueChanged( int );    
00150 
00151 protected slots:
00157     void setValueInternal( int num );
00158 
00165     void setInverseInternal( int num );
00166     
00167 private:
00168     QSlider *slide;
00169     int min;
00170     int max;
00171     int step;
00172     int val;
00173     int tickStep;
00174 };
00175 
00182 class ToggleViewAction : public KRadioAction
00183 {
00184     Q_OBJECT
00185 
00186 public:
00190     ToggleViewAction( const QString &text, const QString &icon,
00191                       const KShortcut &cut,
00192                       QObject *parent, const char *name );
00193 
00194     ~ToggleViewAction() {}
00195 
00196 public slots:
00200     void setView( QWidget *w );
00201 
00205     void update();
00206 
00210     void toggleView();
00211 
00215     void showView();
00216 
00220     void hideView();
00221 
00222 protected slots:
00223     void slotActivated();
00224 
00225 private:
00226     QWidget *win;
00227 };
00228 
00229 #endif // ACTIONS_H
00230 

Generated at Thu Jan 30 02:56:02 2003 for QtVision by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001