kexi

KexiSharedActionHost Class Reference

#include <kexisharedactionhost.h>

Inheritance diagram for KexiSharedActionHost:

KexiMainWindow KexiMainWindowImpl List of all members.

Detailed Description

Acts as application-wide host that offers shared actions.

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

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

See also:
KexiActionProxy, KexiMainWindow

Definition at line 51 of file kexisharedactionhost.h.


Public Member Functions

 KexiSharedActionHost (KMainWindow *mainWin)
virtual ~KexiSharedActionHost ()
virtual bool acceptsSharedActions (QObject *o)
QWidget * focusWindow ()
void setAsDefaultHost ()
KActionPtrList sharedActions () const
void setActionVolatile (KAction *a, bool set)

Static Public Member Functions

static KexiSharedActionHostdefaultHost ()

Protected Member Functions

virtual void invalidateSharedActions (QObject *o)
void setActionAvailable (const char *action_name, bool avail)
void plugActionProxy (KexiActionProxy *proxy)
void updateActionAvailable (const char *action_name, bool avail, QObject *obj)
KMainWindow * mainWindow () const
KAction * createSharedAction (const QString &text, const QString &pix_name, const KShortcut &cut, const char *name, KActionCollection *col=0, const char *subclassName=0)
KAction * createSharedAction (KStdAction::StdAction id, const char *name, KActionCollection *col=0)
KexiActionProxyactionProxyFor (QObject *o) const
KexiActionProxytakeActionProxyFor (QObject *o)

Friends

class KexiActionProxy
class KexiPart::Part
class KexiViewBase
class KexiDialogBase

Constructor & Destructor Documentation

KexiSharedActionHost::KexiSharedActionHost KMainWindow *  mainWin  ) 
 

Constructs host for main window mainWin.

Definition at line 82 of file kexisharedactionhost.cpp.

KexiSharedActionHost::~KexiSharedActionHost  )  [virtual]
 

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

Definition at line 88 of file kexisharedactionhost.cpp.


Member Function Documentation

bool KexiSharedActionHost::acceptsSharedActions QObject *  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 192 of file kexisharedactionhost.cpp.

KexiActionProxy * KexiSharedActionHost::actionProxyFor QObject *  o  )  const [protected]
 

Returns:
action proxy for object o, or NULL if this object has no plugged shared actions.

Definition at line 180 of file kexisharedactionhost.cpp.

KAction * KexiSharedActionHost::createSharedAction KStdAction::StdAction  id,
const char *  name,
KActionCollection *  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 262 of file kexisharedactionhost.cpp.

KAction * KexiSharedActionHost::createSharedAction const QString &  text,
const QString &  pix_name,
const KShortcut &  cut,
const char *  name,
KActionCollection *  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 KAction subclass with subclassName (e.g. "KToggleAction") to have that subclass allocated instead just KAction (what is the default). Created action's data is owned by the main window.

Definition at line 240 of file kexisharedactionhost.cpp.

KexiSharedActionHost & KexiSharedActionHost::defaultHost  )  [static]
 

Returns:
default shared actions host, used when no host is explicity specified for shared actions. There can be exactly one deault shared actions host.

Definition at line 70 of file kexisharedactionhost.cpp.

QWidget * KexiSharedActionHost::focusWindow  ) 
 

Returns:
window widget that is currently focused (using QWidget::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 197 of file kexisharedactionhost.cpp.

void KexiSharedActionHost::invalidateSharedActions QObject *  o  )  [protected, virtual]
 

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 KActionCollection (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 139 of file kexisharedactionhost.cpp.

KMainWindow * KexiSharedActionHost::mainWindow  )  const [protected]
 

Returns:
main window for which this host is defined.

Definition at line 134 of file kexisharedactionhost.cpp.

void KexiSharedActionHost::plugActionProxy KexiActionProxy proxy  )  [protected]
 

Plugs shared actions proxy proxy for this host.

Definition at line 128 of file kexisharedactionhost.cpp.

void KexiSharedActionHost::setActionVolatile KAction *  a,
bool  set
 

PROTOTYPE, DO NOT USE YET

Definition at line 270 of file kexisharedactionhost.cpp.

void KexiSharedActionHost::setAsDefaultHost  ) 
 

Sets this host as default shared actions host.

Definition at line 75 of file kexisharedactionhost.cpp.

KActionPtrList KexiSharedActionHost::sharedActions  )  const
 

Returns:
shared actions list.

Definition at line 222 of file kexisharedactionhost.cpp.

KexiActionProxy * KexiSharedActionHost::takeActionProxyFor QObject *  o  )  [protected]
 

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

Definition at line 185 of file kexisharedactionhost.cpp.

void KexiSharedActionHost::updateActionAvailable const char *  action_name,
bool  avail,
QObject *  obj
[protected]
 

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

Definition at line 106 of file kexisharedactionhost.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys