lib

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., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 #ifndef TKACTION_H
00021 #define TKACTION_H
00022 
00023 #include <kaction.h>
00024 #include <qstringlist.h>
00025 #include <koffice_export.h>
00026 namespace TK {
00027   enum IconMode { IconOnly, IconAndText, TextOnly };
00028 }
00029 
00030 class TKToolBarButton;
00031 class TKComboBox;
00032 
00033 class KOFFICEUI_EXPORT TKAction : public KAction
00034 { Q_OBJECT
00035 public:
00036   TKAction(QObject* parent, const char* name);
00037   ~TKAction();
00038 
00039   virtual int plug(QWidget* widget, int index = -1);
00040 
00041   TK::IconMode iconMode();
00042 
00043 protected:
00044   virtual void initToolBarButton(TKToolBarButton*);
00045 
00046   QWidget* createLayout(QWidget* parent, QWidget* children);
00047   void updateLayout();
00048   virtual void updateLayout(QWidget*);
00049 
00050 public slots:
00051   virtual void setIconMode(TK::IconMode);
00052   void setText(const QString&);
00053   void setIcon(const QString&);
00054 
00055 private:
00056   TK::IconMode m_imode;
00057   class TKActionPrivate;
00058   TKActionPrivate *d;
00059 };
00060 /******************************************************************************/
00061 class KOFFICEUI_EXPORT TKBaseSelectAction : public TKAction
00062 { Q_OBJECT
00063 friend class TKSelectAction;
00064 public:
00065   TKBaseSelectAction(QObject* parent, const char* name);
00066   ~TKBaseSelectAction();
00067 
00068   virtual int plug(QWidget* widget, int index = -1);
00069 
00070   int currentItem();
00071   bool isEditable();
00072 
00073   void activate(int);
00074 
00075 protected:
00076   virtual void initComboBox(TKComboBox*);
00077 
00078 public slots:
00079   virtual void setCurrentItem(int index);
00080   virtual void setEditable(bool);
00081 
00082 protected slots:
00083   virtual void slotActivated(int);
00084 
00085 signals:
00086   void activated(int);
00087 
00088 private:
00089   int m_current;
00090   bool m_editable;
00091   class TKBaseSelectActionPrivate;
00092   TKBaseSelectActionPrivate *d;
00093 };
00094 /******************************************************************************/
00095 class KOFFICEUI_EXPORT TKSelectAction : public TKBaseSelectAction
00096 { Q_OBJECT
00097 public:
00098   TKSelectAction(QObject* parent, const char* name);
00099   ~TKSelectAction();
00100 
00101   QStringList items() const;
00102 
00103 public slots:
00104   virtual void setItems(const QStringList& );
00105   virtual void setEditText(const QString&);
00106   virtual void clear();
00107 
00108 protected:
00109   virtual void initComboBox(TKComboBox*);
00110 
00111 protected slots:
00112   void slotActivated(const QString&);
00113 
00114 signals:
00115   void activated(const QString&);
00116 
00117 private:
00118   QStringList m_list;
00119   class TKSelectActionPrivate;
00120   TKSelectActionPrivate *d;
00121 };
00122 /******************************************************************************/
00123 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys