kexi

#include <kexisharedactionhost.h>

Inheritance diagram for KexiSharedActionHost:
KexiMainWindow KexiMainWindowImpl

Public Member Functions

 KexiSharedActionHost (TDEMainWindow *mainWin)
virtual ~KexiSharedActionHost ()
virtual bool acceptsSharedActions (TQObject *o)
TQWidget * focusWindow ()
void setAsDefaultHost ()
TDEActionPtrList sharedActions () const
void setActionVolatile (TDEAction *a, bool set)

Static Public Member Functions

static KexiSharedActionHost & defaultHost ()

Protected Member Functions

virtual void invalidateSharedActions (TQObject *o)
void setActionAvailable (const char *action_name, bool avail)
void plugActionProxy (KexiActionProxy *proxy)
void updateActionAvailable (const char *action_name, bool avail, TQObject *obj)
TDEMainWindow * mainWindow () const
TDEAction * createSharedAction (const TQString &text, const TQString &pix_name, const TDEShortcut &cut, const char *name, TDEActionCollection *col=0, const char *subclassName=0)
TDEAction * createSharedAction (KStdAction::StdAction id, const char *name, TDEActionCollection *col=0)
TDEAction * createSharedAction (const KGuiItem &guiItem, const TDEShortcut &cut, const char *name, TDEActionCollection *col=0)
KexiActionProxy * actionProxyFor (TQObject *o) const
KexiActionProxy * takeActionProxyFor (TQObject *o)

Friends

class KexiActionProxy
class KexiPart::Part
class KexiViewBase
class KexiDialogBase

Detailed Description

Acts as application-wide host that offers shared actions.

You can inherit this class together with TDEMainWindow (or any TDEMainWindow). Call setAsDefaultHost() to make the host default for all shared actions that have not explicitly specified host.

For example how all this is done, see KexiMainWindow implementation.

See also
KexiActionProxy, KexiMainWindow

Definition at line 52 of file kexisharedactionhost.h.

Constructor & Destructor Documentation

◆ KexiSharedActionHost()

KexiSharedActionHost::KexiSharedActionHost ( TDEMainWindow * mainWin)

Constructs host for main window mainWin.

Definition at line 83 of file kexisharedactionhost.cpp.

◆ ~KexiSharedActionHost()

KexiSharedActionHost::~KexiSharedActionHost ( )
virtual

to let takeActionProxyFor() know that we are almost dead :)

Definition at line 89 of file kexisharedactionhost.cpp.

Member Function Documentation

◆ acceptsSharedActions()

bool KexiSharedActionHost::acceptsSharedActions ( TQObject * o)
virtual
Returns
true if w can accept shared actions. This method is used by focusWindow() to look up widgets hierarchy for widget that can accept shared actions. Default implementation always returns false. You can reimplement it e.g. like in KexiMainWindowImpl::acceptsSharedActions():
return o->inherits("KexiDialogBase") || o->inherits("KexiViewBase");

Reimplemented in KexiMainWindowImpl.

Definition at line 193 of file kexisharedactionhost.cpp.

◆ actionProxyFor()

KexiActionProxy * KexiSharedActionHost::actionProxyFor ( TQObject * o) const
protected
Returns
action proxy for object o, or NULL if this object has no plugged shared actions.

Definition at line 181 of file kexisharedactionhost.cpp.

◆ createSharedAction() [1/3]

TDEAction * KexiSharedActionHost::createSharedAction ( const KGuiItem & guiItem,
const TDEShortcut & cut,
const char * name,
TDEActionCollection * col = 0 )
protected

Creates shared action with name name and shortcut cut by copying all properties of guiItem. If col action collection is null, main window's action will be used.

Definition at line 271 of file kexisharedactionhost.cpp.

◆ createSharedAction() [2/3]

TDEAction * KexiSharedActionHost::createSharedAction ( const TQString & text,
const TQString & pix_name,
const TDEShortcut & cut,
const char * name,
TDEActionCollection * col = 0,
const char * subclassName = 0 )
protected

Creates shared action using text, pix_name pixmap, shortcut cut, optional name. You can pass your own action collection as col. If col action collection is null, main window's action will be used. Pass desired TDEAction subclass with subclassName (e.g. "TDEToggleAction") to have that subclass allocated instead just TDEAction (what is the default). Created action's data is owned by the main window.

Definition at line 241 of file kexisharedactionhost.cpp.

◆ createSharedAction() [3/3]

TDEAction * KexiSharedActionHost::createSharedAction ( KStdAction::StdAction id,
const char * name,
TDEActionCollection * col = 0 )
protected

Like above - creates shared action, but from standard action identified by id. Action's data is owned by the main window.

Definition at line 263 of file kexisharedactionhost.cpp.

◆ defaultHost()

KexiSharedActionHost & KexiSharedActionHost::defaultHost ( )
static
Returns
default shared actions host, used when no host is explicitly specified for shared actions. There can be exactly one deault shared actions host.

Definition at line 71 of file kexisharedactionhost.cpp.

◆ focusWindow()

TQWidget * KexiSharedActionHost::focusWindow ( )
Returns
window widget that is currently focused (using TQWidget::focusWidget()) and matches acceptsSharedActions(). If focused widget does not match, it's parent, grandparent, and so on is checked. If all this fails, or no widget has focus, NULL is returned. Also works if currently focused window is detached (as in KMDI).

Definition at line 198 of file kexisharedactionhost.cpp.

◆ invalidateSharedActions()

void KexiSharedActionHost::invalidateSharedActions ( TQObject * o)
protectedvirtual

Invalidates all shared actions declared using createSharedAction(). Any shared action will be enabled if o (typically: a child window or a dock window) has this action plugged and it is available (i.e. enabled). Otherwise the action is disabled.

If o is not KexiDialogBase or its child, actions are only invalidated if these come from mainwindow's TDEActionCollection (thus part-actions are untouched when the focus is e.g. in the Property Editor.

Call this method when it is known that some actions need invalidation (e.g. when new window is activated). See how it is used in KexiMainWindowImpl.

Reimplemented in KexiMainWindowImpl.

Definition at line 140 of file kexisharedactionhost.cpp.

◆ mainWindow()

TDEMainWindow * KexiSharedActionHost::mainWindow ( ) const
protected
Returns
main window for which this host is defined.

Definition at line 135 of file kexisharedactionhost.cpp.

◆ plugActionProxy()

void KexiSharedActionHost::plugActionProxy ( KexiActionProxy * proxy)
protected

Plugs shared actions proxy proxy for this host.

Definition at line 129 of file kexisharedactionhost.cpp.

◆ setActionAvailable()

void KexiSharedActionHost::setActionAvailable ( const char * action_name,
bool avail )
protected

Definition at line 99 of file kexisharedactionhost.cpp.

◆ setActionVolatile()

void KexiSharedActionHost::setActionVolatile ( TDEAction * a,
bool set )

PROTOTYPE, DO NOT USE YET

Definition at line 279 of file kexisharedactionhost.cpp.

◆ setAsDefaultHost()

void KexiSharedActionHost::setAsDefaultHost ( )

Sets this host as default shared actions host.

Definition at line 76 of file kexisharedactionhost.cpp.

◆ sharedActions()

TDEActionPtrList KexiSharedActionHost::sharedActions ( ) const
Returns
shared actions list.

Definition at line 223 of file kexisharedactionhost.cpp.

◆ takeActionProxyFor()

KexiActionProxy * KexiSharedActionHost::takeActionProxyFor ( TQObject * o)
protected

Like actionProxyFor(), but takes the proxy from the host completely. This is called by KExiActionProxy on its destruction.

Definition at line 186 of file kexisharedactionhost.cpp.

◆ updateActionAvailable()

void KexiSharedActionHost::updateActionAvailable ( const char * action_name,
bool avail,
TQObject * obj )
protected

Updates availability of action action_name for object obj. Object is mainly the window.

Definition at line 107 of file kexisharedactionhost.cpp.

◆ KexiActionProxy

friend class KexiActionProxy
friend

Definition at line 158 of file kexisharedactionhost.h.

◆ KexiDialogBase

friend class KexiDialogBase
friend

Definition at line 161 of file kexisharedactionhost.h.

◆ KexiPart::Part

friend class KexiPart::Part
friend

Definition at line 159 of file kexisharedactionhost.h.

◆ KexiViewBase

friend class KexiViewBase
friend

Definition at line 160 of file kexisharedactionhost.h.


The documentation for this class was generated from the following files: