kivio

mousetoolaction.cpp

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2005 Peter Simonsson
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, Boston, MA  02110-1301, USA.
00018  */
00019 #include "mousetoolaction.h"
00020 
00021 #include <ktoolbar.h>
00022 #include <ktoolbarbutton.h>
00023 #include <kdebug.h>
00024 
00025 namespace Kivio {
00026 
00027 MouseToolAction::MouseToolAction(const QString& text, const KShortcut& cut,
00028                             QObject* parent, const char* name)
00029   : KRadioAction(text, cut, parent, name)
00030 {
00031 }
00032 
00033 MouseToolAction::MouseToolAction(const QString& text, const KShortcut& cut,
00034                             const QObject* receiver, const char* slot,
00035                             QObject* parent, const char* name)
00036   : KRadioAction(text, cut, receiver, slot, parent, name)
00037 {
00038 }
00039 
00040 MouseToolAction::MouseToolAction(const QString& text, const QIconSet& pix,
00041                             const KShortcut& cut,
00042                             QObject* parent, const char* name)
00043   : KRadioAction(text, pix, cut, parent, name)
00044 {
00045 }
00046 
00047 MouseToolAction::MouseToolAction(const QString& text, const QString& pix,
00048                             const KShortcut& cut,
00049                             QObject* parent, const char* name)
00050   : KRadioAction(text, pix, cut, parent, name)
00051 {
00052 }
00053 
00054 MouseToolAction::MouseToolAction(const QString& text, const QIconSet& pix,
00055                             const KShortcut& cut,
00056                             const QObject* receiver, const char* slot,
00057                             QObject* parent, const char* name)
00058   : KRadioAction(text, pix, cut, receiver, slot, parent, name)
00059 {
00060 }
00061 
00062 MouseToolAction::MouseToolAction(const QString& text, const QString& pix,
00063                             const KShortcut& cut,
00064                             const QObject* receiver, const char* slot,
00065                             QObject* parent, const char* name)
00066   : KRadioAction(text, pix, cut, receiver, slot, parent, name)
00067 {
00068 }
00069 
00070 MouseToolAction::MouseToolAction(QObject* parent, const char* name)
00071   : KRadioAction(parent, name)
00072 {
00073 }
00074 
00075 MouseToolAction::~MouseToolAction()
00076 {
00077 }
00078 
00079 int MouseToolAction::plug(QWidget* widget, int index)
00080 {
00081   int usedIndex = KRadioAction::plug(widget, index);
00082   
00083   if(usedIndex == -1) {
00084     return usedIndex;
00085   }
00086   
00087   if(::qt_cast<KToolBar*>(widget)) {
00088     KToolBar* toolBar = static_cast<KToolBar*>(widget);
00089     KToolBarButton* button = toolBar->getButton(itemId(usedIndex));
00090     connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL(doubleClicked()));
00091   }
00092   
00093   return usedIndex;
00094 }
00095 
00096 }
00097 
00098 #include "mousetoolaction.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys