summaryrefslogtreecommitdiffabout
path: root/microkde/kglobal.h
blob: a6c252785f011e1ae352c75e00af8bc459745da9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef MINIKDE_KGLOBAL_H
#define MINIKDE_KGLOBAL_H

#include "klocale.h"
#include "kconfig.h"
#include "kiconloader.h"
#include <kstandarddirs.h>
#include <qevent.h>
class KStandardDirs;
class KGlobal {
  public:
    static KLocale *locale();
    static KConfig *config();
    static KIconLoader *iconLoader();
    static KStandardDirs *dirs();
    static int knumkeykonv( int );

    static void setAppName( const QString & );
    static QString formatMessage( QString mess, int maxlen ) ;

//US begin: added the following methods for convenience
    static QString getAppName();
    static void setLocale(KLocale *);

    enum Orientation { Portrait, Landscape };
    enum Size { Small = 0, Medium = 1, Desktop = 2};

    static int getDesktopWidth();
    static int getDesktopHeight();
    static KGlobal::Size getDesktopSize();
    static KGlobal::Orientation getOrientation();


  private:
    static KLocale *mLocale;
    static KConfig *mConfig;
    static KIconLoader *mIconLoader;
    static KStandardDirs *mDirs;

    static QString mAppName;
};


/** @ref KGlobal
 * A typesafe function to find the minimum of the two arguments.
 */
#define KMIN(a,b)	kMin(a,b)
/** @ref KGlobal
 * A typesafe function to find the maximum of the two arguments.
 */
#define KMAX(a,b)	kMax(a,b)
/** @ref KGlobal
 * A typesafe function to determine the absolute value of the argument.
 */
#define KABS(a)	kAbs(a)


template<class T>
inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; }

template<class T>
inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; }

template<class T>
inline T kAbs (const T& a) { return a < 0 ? -a : a; }


#endif