Diffstat (limited to 'libopie2/opiecore/oresource.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oresource.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/libopie2/opiecore/oresource.h b/libopie2/opiecore/oresource.h new file mode 100644 index 0000000..8c67ced --- a/dev/null +++ b/libopie2/opiecore/oresource.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2005 Dan Williams <drw@handhelds.org> | ||
5 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
6 | Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | */ | ||
32 | |||
33 | #ifndef ORESOURCE_H | ||
34 | #define ORESOURCE_H | ||
35 | |||
36 | #include <qimage.h> | ||
37 | #include <qpixmap.h> | ||
38 | |||
39 | namespace Opie { | ||
40 | namespace Core { | ||
41 | |||
42 | static int smallIconSize = -1; // Size of small icons (width & height) | ||
43 | static int bigIconSize = -1; // Size of large icons (width & height) | ||
44 | |||
45 | |||
46 | class OResource | ||
47 | { | ||
48 | public: | ||
49 | /** | ||
50 | * Image scaling options. | ||
51 | * | ||
52 | * NoScale - no scaling of image will be performed | ||
53 | * SmallIcon - image will be scaled based using SmallIconSize value | ||
54 | * for width and height | ||
55 | * BigIcon - image will be scaled based on BigIconSize value for | ||
56 | * width and height | ||
57 | * | ||
58 | * Note: SmallIconSize and BigIconSize are run-time configuration | ||
59 | * options defined in qpe.conf (Appearance section) | ||
60 | */ | ||
61 | enum Scale { NoScale = 0, SmallIcon, BigIcon }; | ||
62 | |||
63 | /** | ||
64 | * Constructor | ||
65 | */ | ||
66 | OResource() {} | ||
67 | |||
68 | /** | ||
69 | * Load specified image. | ||
70 | * | ||
71 | * @param name - name of pixmap image to load | ||
72 | * @param scale - scaling (if any) to preform on image | ||
73 | * | ||
74 | * @return QImage containing image loaded (and scaled if appropriate) | ||
75 | **/ | ||
76 | static QImage loadImage( const QString &name, Scale scale = NoScale ); | ||
77 | |||
78 | /** | ||
79 | * Load specified image. | ||
80 | * | ||
81 | * @param name - name of pixmap image to load | ||
82 | * @param scale - scaling (if any) to preform on image | ||
83 | * | ||
84 | * @return QPixmap containing image loaded (and scaled if appropriate) | ||
85 | **/ | ||
86 | static QPixmap loadPixmap( const QString &name, Scale scale = NoScale ); | ||
87 | }; | ||
88 | |||
89 | } // namespace Core | ||
90 | } // namespace Opie | ||
91 | |||
92 | #endif | ||