lib Library API Documentation

tkaction.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000 theKompany.com
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 #ifndef TKACTION_H
00020 #define TKACTION_H
00021 
00022 #include <kaction.h>
00023 #include <qstringlist.h>
00024 
00025 namespace TK {
00026   enum IconMode { IconOnly, IconAndText, TextOnly };
00027 }
00028 
00029 class TKToolBarButton;
00030 class TKComboBox;
00031 
00032 class TKAction : public KAction
00033 { Q_OBJECT
00034 public:
00035   TKAction(QObject* parent, const char* name);
00036   ~TKAction();
00037 
00038   virtual int plug(QWidget* widget, int index = -1);
00039 
00040   TK::IconMode iconMode();
00041 
00042 protected:
00043   virtual void initToolBarButton(TKToolBarButton*);
00044 
00045   QWidget* createLayout(QWidget* parent, QWidget* children);
00046   void updateLayout();
00047   virtual void updateLayout(QWidget*);
00048 
00049 public slots:
00050   virtual void setIconMode(TK::IconMode);
00051   void setText(const QString&);
00052   void setIcon(const QString&);
00053 
00054 private:
00055   TK::IconMode m_imode;
00056   class TKActionPrivate;
00057   TKActionPrivate *d;
00058 };
00059 /******************************************************************************/
00060 class TKBaseSelectAction : public TKAction
00061 { Q_OBJECT
00062 friend class TKSelectAction;
00063 public:
00064   TKBaseSelectAction(QObject* parent, const char* name);
00065   ~TKBaseSelectAction();
00066 
00067   virtual int plug(QWidget* widget, int index = -1);
00068 
00069   int currentItem();
00070   bool isEditable();
00071 
00072   void activate(int);
00073 
00074 protected:
00075   virtual void initComboBox(TKComboBox*);
00076 
00077 public slots:
00078   virtual void setCurrentItem(int index);
00079   virtual void setEditable(bool);
00080 
00081 protected slots:
00082   virtual void slotActivated(int);
00083 
00084 signals:
00085   void activated(int);
00086 
00087 private:
00088   int m_current;
00089   bool m_editable;
00090   class TKBaseSelectActionPrivate;
00091   TKBaseSelectActionPrivate *d;
00092 };
00093 /******************************************************************************/
00094 class TKSelectAction : public TKBaseSelectAction
00095 { Q_OBJECT
00096 public:
00097   TKSelectAction(QObject* parent, const char* name);
00098   ~TKSelectAction();
00099 
00100   QStringList items() const;
00101 
00102 public slots:
00103   virtual void setItems(const QStringList& );
00104   virtual void setEditText(const QString&);
00105   virtual void clear();
00106 
00107 protected:
00108   virtual void initComboBox(TKComboBox*);
00109 
00110 protected slots:
00111   void slotActivated(const QString&);
00112 
00113 signals:
00114   void activated(const QString&);
00115 
00116 private:
00117   QStringList m_list;
00118   class TKSelectActionPrivate;
00119   TKSelectActionPrivate *d;
00120 };
00121 /******************************************************************************/
00122 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:28 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003