author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kglobal.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | microkde/kglobal.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/microkde/kglobal.h b/microkde/kglobal.h new file mode 100644 index 0000000..1e03bea --- a/dev/null +++ b/microkde/kglobal.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef MINIKDE_KGLOBAL_H | ||
2 | #define MINIKDE_KGLOBAL_H | ||
3 | |||
4 | #include "klocale.h" | ||
5 | #include "kconfig.h" | ||
6 | #include "kiconloader.h" | ||
7 | #include <kstandarddirs.h> | ||
8 | #include <qevent.h> | ||
9 | class KStandardDirs; | ||
10 | class KGlobal { | ||
11 | public: | ||
12 | static KLocale *locale(); | ||
13 | static KConfig *config(); | ||
14 | static KIconLoader *iconLoader(); | ||
15 | static KStandardDirs *dirs(); | ||
16 | static int knumkeykonv( int ); | ||
17 | |||
18 | static void setAppName( const QString & ); | ||
19 | static QString formatMessage( QString mess, int maxlen ) ; | ||
20 | |||
21 | //US begin: added the following methods for convenience | ||
22 | static QString getAppName(); | ||
23 | static void setLocale(KLocale *); | ||
24 | |||
25 | enum Orientation { Portrait, Landscape }; | ||
26 | enum Size { Small, Medium, Desktop }; | ||
27 | |||
28 | static int getDesktopWidth(); | ||
29 | static int getDesktopHeight(); | ||
30 | static KGlobal::Size getDesktopSize(); | ||
31 | static KGlobal::Orientation getOrientation(); | ||
32 | |||
33 | |||
34 | private: | ||
35 | static KLocale *mLocale; | ||
36 | static KConfig *mConfig; | ||
37 | static KIconLoader *mIconLoader; | ||
38 | static KStandardDirs *mDirs; | ||
39 | |||
40 | static QString mAppName; | ||
41 | }; | ||
42 | |||
43 | |||
44 | /** @ref KGlobal | ||
45 | * A typesafe function to find the minimum of the two arguments. | ||
46 | */ | ||
47 | #define KMIN(a,b)kMin(a,b) | ||
48 | /** @ref KGlobal | ||
49 | * A typesafe function to find the maximum of the two arguments. | ||
50 | */ | ||
51 | #define KMAX(a,b)kMax(a,b) | ||
52 | /** @ref KGlobal | ||
53 | * A typesafe function to determine the absolute value of the argument. | ||
54 | */ | ||
55 | #define KABS(a)kAbs(a) | ||
56 | |||
57 | |||
58 | template<class T> | ||
59 | inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; } | ||
60 | |||
61 | template<class T> | ||
62 | inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; } | ||
63 | |||
64 | template<class T> | ||
65 | inline T kAbs (const T& a) { return a < 0 ? -a : a; } | ||
66 | |||
67 | |||
68 | #endif | ||