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

tdeui

  • tdeui
tdemainwindowiface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the Lesser GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the Lesser GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "tdemainwindowiface.h"
21
22#include <dcopclient.h>
23#include <tdeapplication.h>
24#include <kdcopactionproxy.h>
25#include <kdcoppropertyproxy.h>
26#include <tdemainwindow.h>
27#include <tdeaction.h>
28#include <tqclipboard.h>
29
30#include <twin.h>
31
32TDEMainWindowInterface::TDEMainWindowInterface(TDEMainWindow * mainWindow)
33 : DCOPObject( mainWindow->name())
34{
35 m_MainWindow = mainWindow;
36 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
37 m_dcopPropertyProxy = new KDCOPPropertyProxy(m_MainWindow);
38}
39
40TDEMainWindowInterface::~TDEMainWindowInterface()
41{
42 delete m_dcopActionProxy;
43 delete m_dcopPropertyProxy;
44}
45
46QCStringList TDEMainWindowInterface::actions()
47{
48 delete m_dcopActionProxy;
49 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
50 QCStringList tmp_actions;
51 TQValueList<TDEAction *> lst = m_dcopActionProxy->actions();
52 TQValueList<TDEAction *>::ConstIterator it = lst.begin();
53 TQValueList<TDEAction *>::ConstIterator end = lst.end();
54 for (; it != end; ++it )
55 if ((*it)->isPlugged())
56 tmp_actions.append( (TQCString)(*it)->name() );
57 return tmp_actions;
58}
59bool TDEMainWindowInterface::activateAction( TQCString action)
60{
61 delete m_dcopActionProxy;
62 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
63 TDEAction *tmp_Action = m_dcopActionProxy->action(action);
64 if (tmp_Action)
65 {
66 tmp_Action->activate();
67 return true;
68 }
69 else
70 return false;
71}
72bool TDEMainWindowInterface::disableAction( TQCString action)
73{
74 delete m_dcopActionProxy;
75 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
76 TDEAction *tmp_Action = m_dcopActionProxy->action(action);
77 if (tmp_Action)
78 {
79 tmp_Action->setEnabled(false);
80 return true;
81 }
82 else
83 return false;
84}
85bool TDEMainWindowInterface::enableAction( TQCString action)
86{
87 delete m_dcopActionProxy;
88 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
89 TDEAction *tmp_Action = m_dcopActionProxy->action(action);
90 if (tmp_Action)
91 {
92 tmp_Action->setEnabled(true);
93 return true;
94 }
95 else
96 return false;
97}
98bool TDEMainWindowInterface::actionIsEnabled( TQCString action)
99{
100 delete m_dcopActionProxy;
101 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
102 TDEAction *tmp_Action = m_dcopActionProxy->action(action);
103 if (tmp_Action)
104 {
105 return tmp_Action->isEnabled();
106 }
107 else
108 return false;
109}
110TQCString TDEMainWindowInterface::actionToolTip( TQCString action)
111{
112 delete m_dcopActionProxy;
113 m_dcopActionProxy = new KDCOPActionProxy( m_MainWindow->actionCollection(), this );
114 TDEAction *tmp_Action = m_dcopActionProxy->action(action);
115 if (tmp_Action)
116 {
117 return tmp_Action->toolTip().utf8();
118 }
119 else
120 return "Error no such object!";
121}
122
123DCOPRef TDEMainWindowInterface::action( const TQCString &name )
124{
125 return DCOPRef( tdeApp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
126}
127
128TQMap<TQCString,DCOPRef> TDEMainWindowInterface::actionMap()
129{
130 return m_dcopActionProxy->actionMap();
131}
132
133int TDEMainWindowInterface::getWinID()
134{
135 return (int) m_MainWindow->winId();
136}
137void TDEMainWindowInterface::grabWindowToClipBoard()
138{
139 TQClipboard *clipboard = TQApplication::clipboard();
140 clipboard->setPixmap(TQPixmap::grabWidget(m_MainWindow));
141}
142void TDEMainWindowInterface::hide()
143{
144 m_MainWindow->hide();
145}
146void TDEMainWindowInterface::maximize()
147{
148 m_MainWindow->showMaximized();
149}
150void TDEMainWindowInterface::minimize()
151{
152 m_MainWindow->showMinimized();
153}
154void TDEMainWindowInterface::resize(int newX, int newY)
155{
156 m_MainWindow->resize(newX, newY);
157}
158void TDEMainWindowInterface::move(int newX, int newY)
159{
160 m_MainWindow->move(newX, newY);
161}
162void TDEMainWindowInterface::setGeometry(int newX, int newY, int newWidth, int newHeight)
163{
164 m_MainWindow->setGeometry(newX, newY, newWidth, newHeight);
165}
166void TDEMainWindowInterface::raise()
167{
168 m_MainWindow->raise();
169}
170void TDEMainWindowInterface::lower()
171{
172 m_MainWindow->lower();
173}
174void TDEMainWindowInterface::restore()
175{
176 m_MainWindow->showNormal();
177}
178void TDEMainWindowInterface::close()
179{
180 m_MainWindow->close();
181}
182void TDEMainWindowInterface::show()
183{
184 m_MainWindow->show();
185}
186void TDEMainWindowInterface::setActiveWindow()
187{
188 m_MainWindow->setActiveWindow();
189}
190void TDEMainWindowInterface::setActiveWindowFocused()
191{
192 // just in case we don't have a WM running
193 m_MainWindow->raise();
194 m_MainWindow->setActiveWindow();
195
196 // activate window (try to work around focus-stealing prevention)
197 KWin::forceActiveWindow(m_MainWindow->winId());
198}
199QCStringList TDEMainWindowInterface::functionsDynamic()
200{
201 return m_dcopPropertyProxy->functions();
202}
203bool TDEMainWindowInterface::processDynamic(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
204{
205 return m_dcopPropertyProxy->processPropertyRequest( fun, data, replyType, replyData);
206
207}
208
DCOPObject
DCOPRef
KDCOPActionProxy
A proxy class publishing a DCOP interface for actions.
Definition: kdcopactionproxy.h:40
KDCOPActionProxy::actionObjectId
virtual TQCString actionObjectId(const TQCString &name) const
Use this method to retrieve a DCOP object id for an action with the given name.
Definition: kdcopactionproxy.cpp:86
KDCOPActionProxy::actionMap
virtual TQMap< TQCString, DCOPRef > actionMap(const TQCString &appId=TQCString()) const
Returns a map of all exported actions, with the action name as keys and a global DCOP reference as da...
Definition: kdcopactionproxy.cpp:91
KDCOPActionProxy::action
virtual TDEAction * action(const char *name) const
Returns an action object with the given name.
Definition: kdcopactionproxy.cpp:78
KDCOPActionProxy::actions
virtual TQValueList< TDEAction * > actions() const
Returns a list of exportable actions.
Definition: kdcopactionproxy.cpp:70
KDCOPPropertyProxy
KDCOPPropertyProxy::functions
TQValueList< TQCString > functions()
KDCOPPropertyProxy::processPropertyRequest
bool processPropertyRequest(const TQCString &fun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData)
KWin::forceActiveWindow
static void forceActiveWindow(WId win, long time=0)
KXMLGUIClient::actionCollection
virtual TDEActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:107
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:203
TDEAction::activate
virtual void activate()
Emulate user's interaction programmatically, by activating the action.
Definition: tdeaction.cpp:1104
TDEAction::setEnabled
virtual void setEnabled(bool enable)
Enables or disables this action.
Definition: tdeaction.cpp:832
TDEAction::isEnabled
virtual bool isEnabled() const
Returns true if this action is enabled.
Definition: tdeaction.cpp:596
TDEAction::toolTip
virtual TQString toolTip() const
Get the tooltip text for the action.
Definition: tdeaction.cpp:623
TDEMainWindowInterface::getWinID
int getWinID()
Returns the ID of the current main window.
Definition: tdemainwindowiface.cpp:133
TDEMainWindowInterface::disableAction
bool disableAction(TQCString action)
Disables the requested action.
Definition: tdemainwindowiface.cpp:72
TDEMainWindowInterface::~TDEMainWindowInterface
~TDEMainWindowInterface()
Destructor Cleans up the dcop action proxy object.
Definition: tdemainwindowiface.cpp:40
TDEMainWindowInterface::grabWindowToClipBoard
void grabWindowToClipBoard()
Copies a pixmap representation of the current main window to the clipboard.
Definition: tdemainwindowiface.cpp:137
TDEMainWindowInterface::TDEMainWindowInterface
TDEMainWindowInterface(TDEMainWindow *mainWindow)
Construct a new interface object.
Definition: tdemainwindowiface.cpp:32
TDEMainWindowInterface::actions
QCStringList actions()
Return a list of actions available to the application's window.
Definition: tdemainwindowiface.cpp:46
TDEMainWindowInterface::actionMap
TQMap< TQCString, DCOPRef > actionMap()
Returns and action map.
Definition: tdemainwindowiface.cpp:128
TDEMainWindowInterface::enableAction
bool enableAction(TQCString action)
Enables the requested action.
Definition: tdemainwindowiface.cpp:85
TDEMainWindowInterface::activateAction
bool activateAction(TQCString action)
Activates the requested action.
Definition: tdemainwindowiface.cpp:59
TDEMainWindowInterface::actionToolTip
TQCString actionToolTip(TQCString action)
Returns the tool tip text of the requested action.
Definition: tdemainwindowiface.cpp:110
TDEMainWindowInterface::actionIsEnabled
bool actionIsEnabled(TQCString action)
Returns the status of the requested action.
Definition: tdemainwindowiface.cpp:98
TDEMainWindowInterface::action
DCOPRef action(const TQCString &name)
Returns a dcop reference to the selected TDEAction.
Definition: tdemainwindowiface.cpp:123
TDEMainWindow
KDE top level main window
Definition: tdemainwindow.h:99
TDEMainWindow::hide
virtual void hide()
Reimplementation of TQMainWindow::hide()
Definition: tdemainwindow.cpp:400
TDEMainWindow::show
virtual void show()
Reimplementation of TQMainWindow::show()
Definition: tdemainwindow.cpp:390
TDEShortcut::append
bool append(const KKeySequence &keySeq)

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.