| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kmainwindowiface.cpp

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
    00003
    00004    This program is free software; you can redistribute it and/or
    00005    modify it under the terms of the Lesser GNU General Public
    00006    License as published by the Free Software Foundation; either
    00007    version 2 of the License, or (at your option) any later version.
    00008
    00009    This program is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     General Public License for more details.
    00013
    00014    You should have received a copy of the Lesser GNU General Public License
    00015    along with this program; see the file COPYING.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #include "kmainwindowiface.h"
    00021
    00022 #include <dcopclient.h>
    00023 #include <kapplication.h>
    00024 #include <kdcopactionproxy.h>
    00025 #include <kdcoppropertyproxy.h>
    00026 #include <kmainwindow.h>
    00027 #include <kaction.h>
    00028 #include <qclipboard.h>
    00029
    00030
    00031 KMainWindowInterface::KMainWindowInterface(KMainWindow * mainWindow)
    00032         : DCOPObject( mainWindow->name())
    00033 {
    00034         m_MainWindow = mainWindow;
    00035         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00036         m_dcopPropertyProxy = new KDCOPPropertyProxy(m_MainWindow);
    00037 }
    00038
    00039 KMainWindowInterface::~KMainWindowInterface()
    00040 {
    00041         delete m_dcopActionProxy;
    00042         delete m_dcopPropertyProxy;
    00043 }
    00044
    00045 QCStringList KMainWindowInterface::actions()
    00046 {
    00047         delete m_dcopActionProxy;
    00048         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00049         QCStringList tmp_actions;
    00050         QValueList<KAction *> lst = m_dcopActionProxy->actions();
    00051         QValueList<KAction *>::ConstIterator it = lst.begin();
    00052         QValueList<KAction *>::ConstIterator end = lst.end();
    00053         for (; it != end; ++it )
    00054                 if ((*it)->isPlugged())
    00055                         tmp_actions.append( (QCString)(*it)->name() );
    00056         return tmp_actions;
    00057 }
    00058 bool KMainWindowInterface::activateAction( QCString action)
    00059 {
    00060         delete m_dcopActionProxy;
    00061         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00062         KAction *tmp_Action = m_dcopActionProxy->action(action);
    00063         if (tmp_Action)
    00064         {
    00065                 tmp_Action->activate();
    00066                 return true;
    00067         }
    00068         else
    00069                 return false;
    00070 }
    00071 bool KMainWindowInterface::disableAction( QCString action)
    00072 {
    00073         delete m_dcopActionProxy;
    00074         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00075         KAction *tmp_Action = m_dcopActionProxy->action(action);
    00076         if (tmp_Action)
    00077         {
    00078                 tmp_Action->setEnabled(false);
    00079                 return true;
    00080         }
    00081         else
    00082                 return false;
    00083 }
    00084 bool KMainWindowInterface::enableAction( QCString action)
    00085 {
    00086         delete m_dcopActionProxy;
    00087         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00088         KAction *tmp_Action = m_dcopActionProxy->action(action);
    00089         if (tmp_Action)
    00090         {
    00091                 tmp_Action->setEnabled(true);
    00092                 return true;
    00093         }
    00094         else
    00095                 return false;
    00096 }
    00097 bool KMainWindowInterface::actionIsEnabled( QCString action)
    00098 {
    00099         delete m_dcopActionProxy;
    00100         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00101         KAction *tmp_Action = m_dcopActionProxy->action(action);
    00102         if (tmp_Action)
    00103         {
    00104                 return tmp_Action->isEnabled();
    00105         }
    00106         else
    00107                 return false;
    00108 }
    00109 QCString KMainWindowInterface::actionToolTip( QCString action)
    00110 {
    00111         delete m_dcopActionProxy;
    00112         m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
    00113         KAction *tmp_Action = m_dcopActionProxy->action(action);
    00114         if (tmp_Action)
    00115         {
    00116                 return tmp_Action->toolTip().utf8();
    00117         }
    00118         else
    00119                 return "Error no such object!";
    00120 }
    00121
    00122 DCOPRef KMainWindowInterface::action( const QCString &name )
    00123 {
    00124         return DCOPRef( kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
    00125 }
    00126
    00127 QMap<QCString,DCOPRef> KMainWindowInterface::actionMap()
    00128 {
    00129         return m_dcopActionProxy->actionMap();
    00130 }
    00131
    00132 int KMainWindowInterface::getWinID()
    00133 {
    00134         return (int) m_MainWindow->winId();
    00135 }
    00136 void KMainWindowInterface::grabWindowToClipBoard()
    00137 {
    00138         QClipboard *clipboard = QApplication::clipboard();
    00139         clipboard->setPixmap(QPixmap::grabWindow(m_MainWindow->winId()));
    00140 }
    00141 /*
    00142 bool KMainWindowInterface::isHidden()
    00143 {
    00144         return m_MainWindow->isHidden();
    00145 }
    00146 */
    00147 void KMainWindowInterface::hide()
    00148 {
    00149         m_MainWindow->hide();
    00150 }
    00151 /*bool KMainWindowInterface::isMaximized()
    00152 {
    00153         return m_MainWindow->isMaximized();
    00154 }
    00155 */
    00156 void KMainWindowInterface::maximize()
    00157 {
    00158         m_MainWindow->showMaximized();
    00159 }
    00160 /*
    00161 bool KMainWindowInterface::isMinimized()
    00162 {
    00163         return m_MainWindow->isMinimized();
    00164 }
    00165 */
    00166 void KMainWindowInterface::minimize()
    00167 {
    00168         m_MainWindow->showMinimized();
    00169 }
    00170 /*
    00171 int KMainWindowInterface::width()
    00172 {
    00173         return m_MainWindow->width();
    00174 }
    00175 int KMainWindowInterface::height()
    00176 {
    00177         return m_MainWindow->height();
    00178 }
    00179 */
    00180 void KMainWindowInterface::resize(int newX, int newY)
    00181 {
    00182         m_MainWindow->resize(newX, newY);
    00183 }
    00184 /*
    00185 int KMainWindowInterface::Xpos()
    00186 {
    00187         return m_MainWindow->x();
    00188 }
    00189 int KMainWindowInterface::Ypos()
    00190 {
    00191         return m_MainWindow->y();
    00192 }
    00193 */
    00194 void KMainWindowInterface::move(int newX, int newY)
    00195 {
    00196         m_MainWindow->move(newX, newY);
    00197 }
    00198 void KMainWindowInterface::setGeometry(int newX, int newY, int newWidth, int newHeight)
    00199 {
    00200         m_MainWindow->setGeometry(newX, newY, newWidth, newHeight);
    00201 }
    00202 void KMainWindowInterface::raise()
    00203 {
    00204         m_MainWindow->raise();
    00205 }
    00206 void KMainWindowInterface::lower()
    00207 {
    00208         m_MainWindow->lower();
    00209 }
    00210 void KMainWindowInterface::restore()
    00211 {
    00212         m_MainWindow->showNormal();
    00213 }
    00214 void KMainWindowInterface::show()
    00215 {
    00216         m_MainWindow->show();
    00217 }
    00218 /*
    00219 QCStringList KMainWindowInterface::getQTProperties()
    00220 {
    00221         return m_dcopPropertyProxy->functions();
    00222 }
    00223 */
    00224 QCStringList KMainWindowInterface::functionsDynamic()
    00225 {
    00226         return m_dcopPropertyProxy->functions();
    00227 }
    00228 bool KMainWindowInterface::processDynamic(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
    00229 {
    00230         return m_dcopPropertyProxy->processPropertyRequest( fun, data, replyType, replyData);
    00231
    00232 }
    00233

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:20 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001