author | mickeyl <mickeyl> | 2005-05-03 21:53:57 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-03 21:53:57 (UTC) |
commit | 1daea169fcc0007727f0752251ca4546817999b7 (patch) (unidiff) | |
tree | f6b03f5b44bc2debe43d8d1ba7c4c39f2cc70518 /libopie2/opieui/big-screen/olayout.cpp | |
parent | e9d35f23f81915ee62cb41b4ed82115826a4f9dd (diff) | |
download | opie-1daea169fcc0007727f0752251ca4546817999b7.zip opie-1daea169fcc0007727f0752251ca4546817999b7.tar.gz opie-1daea169fcc0007727f0752251ca4546817999b7.tar.bz2 |
add OAutoBoxLayout, a descendant of QBoxLayout which, depending on
Desktop-Height > Desktop-Width acts as a QHBoxLayout respectively a QVBoxLayout
Diffstat (limited to 'libopie2/opieui/big-screen/olayout.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/big-screen/olayout.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/libopie2/opieui/big-screen/olayout.cpp b/libopie2/opieui/big-screen/olayout.cpp new file mode 100644 index 0000000..bbe6f6c --- a/dev/null +++ b/libopie2/opieui/big-screen/olayout.cpp | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; version 2 of the License. | ||
10 | ._= =} : | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "olayout.h" | ||
30 | |||
31 | /* OPIE */ | ||
32 | #include <opie2/odebug.h> | ||
33 | |||
34 | /* QT */ | ||
35 | #include <qapplication.h> | ||
36 | |||
37 | namespace Opie { | ||
38 | namespace Ui { | ||
39 | |||
40 | OAutoBoxLayout::OAutoBoxLayout( QWidget *parent, int border, int space, const char *name ) | ||
41 | :QBoxLayout( parent, LeftToRight, border, space, name ) | ||
42 | { | ||
43 | fixDirection(); | ||
44 | } | ||
45 | |||
46 | |||
47 | OAutoBoxLayout::OAutoBoxLayout( QLayout *parentLayout, int space, const char *name ) | ||
48 | :QBoxLayout( parentLayout, LeftToRight, space, name ) | ||
49 | { | ||
50 | fixDirection(); | ||
51 | } | ||
52 | |||
53 | |||
54 | OAutoBoxLayout::OAutoBoxLayout( int space, const char *name ) | ||
55 | :QBoxLayout( LeftToRight, space, name ) | ||
56 | { | ||
57 | fixDirection(); | ||
58 | } | ||
59 | |||
60 | |||
61 | void OAutoBoxLayout::fixDirection() | ||
62 | { | ||
63 | QWidget* desktop = QApplication::desktop(); | ||
64 | int w = desktop->width(); | ||
65 | int h = desktop->height(); | ||
66 | if ( h > w ) | ||
67 | { | ||
68 | odebug << "OAutoBoxLayout: h > w, setting orientation to TopToBottom" << oendl; | ||
69 | setDirection( TopToBottom ); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | |||
74 | OAutoBoxLayout::~OAutoBoxLayout() | ||
75 | { | ||
76 | } | ||
77 | |||
78 | |||
79 | }; // namespace Ui | ||
80 | }; // namespace Opie | ||
81 | |||
82 | |||
83 | |||