summaryrefslogtreecommitdiff
path: root/libopie2/opieui
authormickeyl <mickeyl>2005-05-03 21:53:57 (UTC)
committer mickeyl <mickeyl>2005-05-03 21:53:57 (UTC)
commit1daea169fcc0007727f0752251ca4546817999b7 (patch) (unidiff)
treef6b03f5b44bc2debe43d8d1ba7c4c39f2cc70518 /libopie2/opieui
parente9d35f23f81915ee62cb41b4ed82115826a4f9dd (diff)
downloadopie-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') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/big-screen.pro13
-rw-r--r--libopie2/opieui/big-screen/olayout.cpp83
-rw-r--r--libopie2/opieui/big-screen/olayout.h57
3 files changed, 151 insertions, 2 deletions
diff --git a/libopie2/opieui/big-screen/big-screen.pro b/libopie2/opieui/big-screen/big-screen.pro
index f324d3c..b08ad5a 100644
--- a/libopie2/opieui/big-screen/big-screen.pro
+++ b/libopie2/opieui/big-screen/big-screen.pro
@@ -1,2 +1,11 @@
1HEADERS += big-screen/obigscreen_p.h big-screen/osplitter.h big-screen/owidgetstack.h #big-screen/omodalhelper.h 1HEADERS += \
2SOURCES += big-screen/osplitter.cpp big-screen/owidgetstack.cpp #big-screen/omodalhelper.cpp 2 big-screen/obigscreen_p.h\
3 big-screen/osplitter.h \
4 big-screen/owidgetstack.h\
5 big-screen/olayout.h
6
7SOURCES += \
8 big-screen/osplitter.cpp\
9 big-screen/owidgetstack.cpp\
10 big-screen/olayout.cpp
11
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
37namespace Opie {
38namespace Ui {
39
40OAutoBoxLayout::OAutoBoxLayout( QWidget *parent, int border, int space, const char *name )
41 :QBoxLayout( parent, LeftToRight, border, space, name )
42{
43 fixDirection();
44}
45
46
47OAutoBoxLayout::OAutoBoxLayout( QLayout *parentLayout, int space, const char *name )
48 :QBoxLayout( parentLayout, LeftToRight, space, name )
49{
50 fixDirection();
51}
52
53
54OAutoBoxLayout::OAutoBoxLayout( int space, const char *name )
55 :QBoxLayout( LeftToRight, space, name )
56{
57 fixDirection();
58}
59
60
61void 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
74OAutoBoxLayout::~OAutoBoxLayout()
75{
76}
77
78
79}; // namespace Ui
80}; // namespace Opie
81
82
83
diff --git a/libopie2/opieui/big-screen/olayout.h b/libopie2/opieui/big-screen/olayout.h
new file mode 100644
index 0000000..03c8d4a
--- a/dev/null
+++ b/libopie2/opieui/big-screen/olayout.h
@@ -0,0 +1,57 @@
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#ifndef OLAYOUT_H
30#define OLAYOUT_H
31
32/* QT */
33
34#include <qlayout.h>
35
36namespace Opie {
37namespace Ui {
38
39class OAutoBoxLayout : public QBoxLayout
40{
41 Q_OBJECT
42public:
43 OAutoBoxLayout( QWidget *parent, int border=0, int space = -1, const char *name=0 );
44 OAutoBoxLayout( QLayout *parentLayout, int space = -1, const char *name=0 );
45 OAutoBoxLayout( int space = -1, const char *name=0 );
46 ~OAutoBoxLayout();
47
48private:
49 void fixDirection();
50};
51
52}; // namespace Ui
53}; // namespace Opie
54
55#endif
56
57