~neon/juk/master

« back to all changes in this revision

Viewing changes to actioncollection.h

  • Committer: Scott Wheeler
  • Date: 2004-02-27 22:00:48 UTC
  • Revision ID: git-v1:5093e9f36a1c538350c43e2444bcee43cc7784b1
Add a global action collection to avoid some of the nasty hacks of trying
to get the one from the main window.

svn path=/trunk/kdemultimedia/juk/; revision=292027

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          actioncollection.h
 
3
                             -------------------
 
4
    begin                : Fri Feb 27 2004
 
5
    copyright            : (C) 2004 by Scott Wheeler
 
6
    email                : wheeler@kde.org
 
7
***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#ifndef JUK_ACTIONCOLLECTION_H
 
19
#define JUK_ACTIONCOLLECTION_H
 
20
 
 
21
class KActionCollection;
 
22
class KAction;
 
23
 
 
24
namespace ActionCollection
 
25
{
 
26
    /**
 
27
     * The global action collection for JuK.
 
28
     */
 
29
    KActionCollection *actions();
 
30
 
 
31
    /**
 
32
     * Returns the action for the associated key from the global action
 
33
     * collection.
 
34
     */
 
35
    KAction *action(const char *key);
 
36
 
 
37
    /**
 
38
     * Returns the action for the associated key but includes a cast to the
 
39
     * type \a T.  i.e. KSelectAction *a = action<KSelectAction>("chooser");
 
40
     */
 
41
    template <class T> T *action(const char *key)
 
42
    {
 
43
        return dynamic_cast<T *>(action(key));
 
44
    }
 
45
}
 
46
 
 
47
#endif