Diffstat (limited to 'libopie2/opiecore/oapplication.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oapplication.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h new file mode 100644 index 0000000..736e786 --- a/dev/null +++ b/libopie2/opiecore/oapplication.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | #ifndef OAPPLICATION_H | ||
32 | #define OAPPLICATION_H | ||
33 | |||
34 | #define oApp OApplication::oApplication() | ||
35 | |||
36 | #ifdef QWS | ||
37 | #include <qpe/qpeapplication.h> | ||
38 | #define OApplicationBaseClass QPEApplication | ||
39 | #else | ||
40 | #include <qapplication.h> | ||
41 | #define OApplicationBaseClass QApplication | ||
42 | #endif | ||
43 | |||
44 | class OApplicationPrivate; | ||
45 | class OConfig; | ||
46 | |||
47 | class OApplication: public OApplicationBaseClass | ||
48 | { | ||
49 | public: | ||
50 | |||
51 | /** | ||
52 | * Constructor. Parses command-line arguments and sets the window caption. | ||
53 | * | ||
54 | * @param rAppName application name. Will be used for finding the | ||
55 | * associated message, icon and configuration files | ||
56 | * | ||
57 | */ | ||
58 | OApplication( int& argc, char** argv, const QCString& rAppName ); | ||
59 | /** | ||
60 | * Destructor. Destroys the application object and its children. | ||
61 | */ | ||
62 | virtual ~OApplication(); | ||
63 | |||
64 | /** | ||
65 | * Returns the current application object. | ||
66 | * | ||
67 | * This is similar to the global @ref QApplication pointer qApp. It | ||
68 | * allows access to the single global OApplication object, since | ||
69 | * more than one cannot be created in the same application. It | ||
70 | * saves you the trouble of having to pass the pointer explicitly | ||
71 | * to every function that may require it. | ||
72 | * @return the current application object | ||
73 | */ | ||
74 | static const OApplication* oApplication() { return _instance; }; | ||
75 | |||
76 | /** | ||
77 | * Returns the application name as given during creation. | ||
78 | * | ||
79 | * @return A reference to the application name | ||
80 | */ | ||
81 | const QCString& appName() const { return _appname; }; | ||
82 | |||
83 | /** | ||
84 | * Returns the application session config object. | ||
85 | * | ||
86 | * @return A pointer to the application's instance specific | ||
87 | * @ref OConfig object. | ||
88 | * @see OConfig | ||
89 | */ | ||
90 | OConfig* config(); | ||
91 | |||
92 | /** | ||
93 | * Sets the main widget - reimplemented to call showMainWidget() | ||
94 | * on Qt/Embedded. | ||
95 | */ | ||
96 | virtual void setMainWidget( QWidget *mainWidget ); | ||
97 | |||
98 | /** | ||
99 | * Shows the main widget - reimplemented to call setMainWidget() | ||
100 | * on platforms other than Qt/Embedded. | ||
101 | */ | ||
102 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); | ||
103 | |||
104 | protected: | ||
105 | void init(); | ||
106 | |||
107 | private: | ||
108 | const QCString _appname; | ||
109 | static OApplication* _instance; | ||
110 | OConfig* _config; | ||
111 | OApplicationPrivate* d; | ||
112 | }; | ||
113 | |||
114 | #endif // OAPPLICATION_H | ||