• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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 <tqclipboard.h>
00029 
00030 #include <kwin.h>
00031 
00032 KMainWindowInterface::KMainWindowInterface(KMainWindow * mainWindow)
00033     : DCOPObject( mainWindow->name()) 
00034 {
00035     m_MainWindow = mainWindow;
00036     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00037     m_dcopPropertyProxy = new KDCOPPropertyProxy(TQT_TQOBJECT(m_MainWindow));
00038 }
00039 
00040 KMainWindowInterface::~KMainWindowInterface()
00041 {
00042     delete m_dcopActionProxy;
00043         delete m_dcopPropertyProxy;
00044 }
00045 
00046 QCStringList KMainWindowInterface::actions()
00047 {
00048     delete m_dcopActionProxy;
00049     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00050     QCStringList tmp_actions;
00051     TQValueList<KAction *> lst = m_dcopActionProxy->actions();
00052     TQValueList<KAction *>::ConstIterator it = lst.begin();
00053     TQValueList<KAction *>::ConstIterator end = lst.end();
00054     for (; it != end; ++it )
00055         if ((*it)->isPlugged())
00056             tmp_actions.append( (TQCString)(*it)->name() );
00057     return tmp_actions;
00058 }
00059 bool KMainWindowInterface::activateAction( TQCString action)
00060 {
00061     delete m_dcopActionProxy;
00062     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00063     KAction *tmp_Action = m_dcopActionProxy->action(action);
00064     if (tmp_Action)
00065     {
00066         tmp_Action->activate();
00067         return true;
00068     }
00069     else
00070         return false;
00071 }
00072 bool KMainWindowInterface::disableAction( TQCString action)
00073 {
00074     delete m_dcopActionProxy;
00075     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00076     KAction *tmp_Action = m_dcopActionProxy->action(action);
00077     if (tmp_Action)
00078     {
00079         tmp_Action->setEnabled(false);
00080         return true;
00081     }
00082     else
00083         return false;
00084 }
00085 bool KMainWindowInterface::enableAction( TQCString action)
00086 {
00087     delete m_dcopActionProxy;
00088     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00089     KAction *tmp_Action = m_dcopActionProxy->action(action);
00090     if (tmp_Action)
00091     {
00092         tmp_Action->setEnabled(true);
00093         return true;
00094     }
00095     else
00096         return false;
00097 }
00098 bool KMainWindowInterface::actionIsEnabled( TQCString action)
00099 {
00100     delete m_dcopActionProxy;
00101     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00102     KAction *tmp_Action = m_dcopActionProxy->action(action);
00103     if (tmp_Action)
00104     {
00105         return tmp_Action->isEnabled();
00106     }
00107     else
00108         return false;
00109 }
00110 TQCString KMainWindowInterface::actionToolTip( TQCString action)
00111 {
00112     delete m_dcopActionProxy;
00113     m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
00114     KAction *tmp_Action = m_dcopActionProxy->action(action);
00115     if (tmp_Action)
00116     {
00117         return tmp_Action->toolTip().utf8();
00118     }
00119     else
00120         return "Error no such object!";
00121 }
00122 
00123 DCOPRef KMainWindowInterface::action( const TQCString &name )
00124 {
00125     return DCOPRef( kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
00126 }
00127 
00128 TQMap<TQCString,DCOPRef> KMainWindowInterface::actionMap()
00129 {
00130     return m_dcopActionProxy->actionMap();
00131 }
00132 
00133 int KMainWindowInterface::getWinID()
00134 {
00135     return (int) m_MainWindow->winId();
00136 }
00137 void KMainWindowInterface::grabWindowToClipBoard()
00138 {
00139     TQClipboard *clipboard = TQApplication::clipboard();
00140     clipboard->setPixmap(TQPixmap::grabWidget(m_MainWindow));
00141 }
00142 void KMainWindowInterface::hide()
00143 {
00144     m_MainWindow->hide();
00145 }
00146 void KMainWindowInterface::maximize()
00147 {
00148     m_MainWindow->showMaximized();
00149 }
00150 void KMainWindowInterface::minimize()
00151 {
00152     m_MainWindow->showMinimized();
00153 }
00154 void KMainWindowInterface::resize(int newX, int newY)
00155 {
00156     m_MainWindow->resize(newX, newY);
00157 }
00158 void KMainWindowInterface::move(int newX, int newY)
00159 {
00160     m_MainWindow->move(newX, newY);
00161 }
00162 void KMainWindowInterface::setGeometry(int newX, int newY, int newWidth, int newHeight)
00163 {
00164     m_MainWindow->setGeometry(newX, newY, newWidth, newHeight);
00165 }
00166 void KMainWindowInterface::raise()
00167 {
00168     m_MainWindow->raise();
00169 }
00170 void KMainWindowInterface::lower()
00171 {
00172     m_MainWindow->lower();
00173 }
00174 void KMainWindowInterface::restore()
00175 {
00176     m_MainWindow->showNormal();
00177 }
00178 void KMainWindowInterface::close()
00179 {
00180     m_MainWindow->close();
00181 }
00182 void KMainWindowInterface::show()
00183 {
00184     m_MainWindow->show();
00185 }
00186 void KMainWindowInterface::setActiveWindow()
00187 {
00188     m_MainWindow->setActiveWindow();
00189 }
00190 void KMainWindowInterface::setActiveWindowFocused()
00191 {
00192     // just in case we don't have a WM running
00193     m_MainWindow->raise();
00194     m_MainWindow->setActiveWindow();
00195 
00196     // activate window (try to work around focus-stealing prevention)
00197     KWin::forceActiveWindow(m_MainWindow->winId());
00198 }
00199 QCStringList KMainWindowInterface::functionsDynamic()
00200 {
00201     return m_dcopPropertyProxy->functions();
00202 }
00203 bool KMainWindowInterface::processDynamic(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
00204 {
00205     return m_dcopPropertyProxy->processPropertyRequest( fun, data, replyType, replyData);
00206 
00207 }
00208 

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |