Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Opie::Ui::OWidgetStack Class Reference

Either a true stack or a list of top Level widgets. More...

#include </home/clem/local/src/opie/libopie2/opieui/big-screen/owidgetstack.h>

Collaboration diagram for Opie::Ui::OWidgetStack:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Mode { SmallScreen, BigScreen, NoForce }

Public Slots

void raiseWidget (int)
void raiseWidget (QWidget *)
void hideWidget (int)
void hideWidget (QWidget *)
void setMainWindow (QWidget *)
void setMainWindow (int)

Signals

void modeChanged (enum Mode mode)
void aboutToShow (QWidget *)
void aboutToShow (int)

Public Member Functions

 OWidgetStack (QWidget *parent, const char *name=0, WFlags fl=0)
 ~OWidgetStack ()
enum Mode mode () const
void forceMode (enum Mode)
void addWidget (QWidget *, int)
void removeWidget (QWidget *)
QWidget * widget (int) const
int id (QWidget *) const
QWidget * visibleWidget () const
bool eventFilter (QObject *, QEvent *)

Protected Member Functions

void resizeEvent (QResizeEvent *)

Private Member Functions

void switchStack ()
void switchTop ()

Private Attributes

QMap< int, QWidget * > m_list
QWidgetStack * m_stack
QWidget * m_mWidget
QWidget * m_last
enum Mode m_mode
bool m_forced: 1
Private * d

Detailed Description

Either a true stack or a list of top Level widgets.

OWidgetStack is the answer to the problem of using Opie at different screen sizes and to have a different behaviour. Most applications use a QWidgetStack to supply a view on click. And by clicking the (X) you go back but this behaviour feels strange on bigger screens. It's ok on smaller one because one can't determine the difference. This stack reads the default out of the size of the desktop widget but can be forced to have either the one or the other behaviour. The first widget added is considered the 'main' widget and its sizeHint will be taking if in BigScreen mode. In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen mode it'll use the MainWindow as child of this widget and arranges the others as hidden top level widgets.

Version:
0.1
Author:
hOlgAr F.

Definition at line 59 of file owidgetstack.h.


Member Enumeration Documentation

enum Opie::Ui::OWidgetStack::Mode
 

Enumeration values:
SmallScreen 
BigScreen 
NoForce 

Definition at line 62 of file owidgetstack.h.


Constructor & Destructor Documentation

Opie::Ui::OWidgetStack::OWidgetStack QWidget *  parent,
const char *  name = 0,
WFlags  fl = 0
 

This is the standard widget. For simple usage see the example. Normally this widget is the central widget of a QMainWindow. Use removeWidget before you delete a widget yourself. OWidgetStack does not yet recognize removal of children.

Parameters:
parent The parent widget. It maybe 0 but then you need to take care of deletion. Or you use QPEApplication::showMainWidget().
name Name will be passed on to QObject
fl Additional window flags passed to QFrame. see ::WFlags

Definition at line 55 of file owidgetstack.cpp.

References m_forced, m_last, m_mWidget, m_stack, and switchStack().

Opie::Ui::OWidgetStack::~OWidgetStack  ) 
 

The destructor. It deletes also all added widgets.

Definition at line 75 of file owidgetstack.cpp.

References QMap< Key, T >::begin(), BigScreen, QMap< Key, T >::clear(), QMap< Key, T >::end(), QMap< Key, T >::isEmpty(), m_list, and m_mode.


Member Function Documentation

void Opie::Ui::OWidgetStack::aboutToShow int   )  [signal]
 

void Opie::Ui::OWidgetStack::aboutToShow QWidget *   )  [signal]
 

These two signals are emitted whenever we're about to show one of the widgets

Referenced by raiseWidget(), and switchStack().

void Opie::Ui::OWidgetStack::addWidget QWidget *  wid,
int  id
 

Adds a widget to the stack. The first widget added is considered to be the mainwindow. This is important because if Opie is in BigScreen mode the sizeHint of the MainWindow will be returned. In Small Screen the sizeHint of the QWidgetStack is returned. See QWidgetStack::sizeHint. This widget takes ownership of the widget and may even reparent. All windows will be hidden

Parameters:
wid The QWidget to be added
id An ID for the Widget. If the ID is duplicated the last set widget will be related to the id
adding does not raise any widget But for our mainwidget we prepare the right position with the right parent

Definition at line 141 of file owidgetstack.cpp.

References QMap< Key, T >::insert(), m_list, m_mode, m_mWidget, m_stack, and SmallScreen.

Referenced by PMainWindow::closeEvent(), PMainWindow::initT(), and PMainWindow::setupViewWindow().

bool Opie::Ui::OWidgetStack::eventFilter QObject *  ,
QEvent * 
 

Definition at line 312 of file owidgetstack.cpp.

References m_forced, Opie::Ui::mode_size, size, switchStack(), and switchTop().

void Opie::Ui::OWidgetStack::forceMode enum Mode  mode  ) 
 

You can also force one of the modes and then this widget stops on listening to size changes. You can revert to the scanning behaviour by setting mode to NoForce

Definition at line 102 of file owidgetstack.cpp.

References BigScreen, m_forced, m_mode, Opie::Ui::mode_size, NoForce, SmallScreen, switchStack(), switchTop(), and width.

Referenced by PMainWindow::slotForceSmall().

void Opie::Ui::OWidgetStack::hideWidget QWidget *  wid  )  [slot]
 

This is overloaded and only differs in the parameters it takes.

Definition at line 303 of file owidgetstack.cpp.

References BigScreen, m_last, m_mode, m_mWidget, and raiseWidget().

void Opie::Ui::OWidgetStack::hideWidget int  id  )  [slot]
 

This will hide the currently visible widget and raise the widget specified by the parameter. Note that this method does not use visibleWIdget but remembers the last raisedWidget

Definition at line 292 of file owidgetstack.cpp.

References BigScreen, m_last, m_mode, m_mWidget, and raiseWidget().

int Opie::Ui::OWidgetStack::id QWidget *  wid  )  const
 

Tries to find the assigned id for the widget or returns -1 if no widget could be found

Parameters:
wid The widget to look for

Definition at line 226 of file owidgetstack.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::end(), QMap< Key, T >::isEmpty(), and m_list.

enum OWidgetStack::Mode Opie::Ui::OWidgetStack::mode  )  const
 

return the mode of the desktop. There are currently two modes. SmallScreen with a normal PDA resolution and BigScreen with resolutions greater than 330 for width and height. You can also force the mode this widget is in with forceMode() Note that NoForce will be never returned from here

Definition at line 92 of file owidgetstack.cpp.

References m_mode.

Referenced by PMainWindow::polish(), PMainWindow::setupActions(), and PMainWindow::setupViewWindow().

void Opie::Ui::OWidgetStack::modeChanged enum Mode  mode  )  [signal]
 

OWidgetStack monitors the Desktop Widget for size changes if it recignizes a change size it'll send a signal and adjust its mode. After the signal was emitted. During the signal a call to mode() the old mode will be returned. Note that if a size change happens but no modeChange no signal will be emitted

Parameters:
mode The new mode of the desktop

void Opie::Ui::OWidgetStack::raiseWidget QWidget *  wid  )  [slot]
 

This is an overloaded function and only differs in its parameters.

See also:
raiseWidget( int )

Definition at line 269 of file owidgetstack.cpp.

References aboutToShow(), m_last, m_mode, m_stack, and SmallScreen.

void Opie::Ui::OWidgetStack::raiseWidget int  id  )  [slot]
 

This method raises the widget wit the specefic id. Note that in BigScreen mode the widget is made visible but the other ( previous) visible widget(s) will not be made invisible. If you need this use hideWidget().

Parameters:
id Raise the widget with id

Definition at line 261 of file owidgetstack.cpp.

References widget().

Referenced by StackExample::closeEvent(), hideWidget(), PMainWindow::raiseIconView(), PMainWindow::setupViewWindow(), PMainWindow::slotConfig(), PMainWindow::slotDisplay(), and PMainWindow::slotShowInfo().

void Opie::Ui::OWidgetStack::removeWidget QWidget *  wid  ) 
 

Remove the widget from the stack it'll be reparented to 0 and ownership is dropped. You need to delete it. If the removed widget was the mainwindow consider to call setMainWindow.

Parameters:
wid The QWidget to be removed

Definition at line 176 of file owidgetstack.cpp.

References m_list, m_mode, m_mWidget, m_stack, QMap< Key, T >::remove(), and SmallScreen.

Referenced by PMainWindow::initT().

void Opie::Ui::OWidgetStack::resizeEvent QResizeEvent *  ev  )  [protected]
 

Definition at line 328 of file owidgetstack.cpp.

References m_mode, m_mWidget, m_stack, and SmallScreen.

void Opie::Ui::OWidgetStack::setMainWindow int  id  )  [slot]
 

this is an overloaded member and only differs in the type of arguments.

See also:
setMainWindow(QWidget*)

Definition at line 375 of file owidgetstack.cpp.

References setMainWindow(), and widget().

void Opie::Ui::OWidgetStack::setMainWindow QWidget *  wid  )  [slot]
 

setMainWindow gives the OWidgetStack a hint which window should always stay inside the stack. Normally the first added widget is considered to be the mainwindow but you can change this with this function. If in BigScreen mode the current mainwindow will be reparented and hidden. The position will be taken by the new one. If the old MainWindow was hidden the new window will also be hidden. If the window was visible the new mainwindow will be made visible too and the old one hidden. If there was no mainwindow it will be hidden as well.

Parameters:
wid The new mainwindow

Definition at line 353 of file owidgetstack.cpp.

References BigScreen, m_mode, and m_mWidget.

Referenced by setMainWindow().

void Opie::Ui::OWidgetStack::switchStack  )  [private]
 

Definition at line 383 of file owidgetstack.cpp.

References aboutToShow(), QMap< Key, T >::begin(), QMap< Key, T >::end(), QMap< Key, T >::isEmpty(), m_list, m_mode, m_mWidget, m_stack, and SmallScreen.

Referenced by eventFilter(), forceMode(), and OWidgetStack().

void Opie::Ui::OWidgetStack::switchTop  )  [private]
 

Definition at line 417 of file owidgetstack.cpp.

References QMap< Key, T >::begin(), BigScreen, QMap< Key, T >::end(), QMap< Key, T >::isEmpty(), m_list, m_mode, and m_stack.

Referenced by eventFilter(), and forceMode().

QWidget * Opie::Ui::OWidgetStack::visibleWidget  )  const
 

This function returns the currently visible widget. In BigScreen mode the mainwindow is returned

Definition at line 245 of file owidgetstack.cpp.

References m_mode, m_mWidget, m_stack, and SmallScreen.

Referenced by StackExample::closeEvent(), PMainWindow::closeEvent(), and PMainWindow::slotConfig().

QWidget * Opie::Ui::OWidgetStack::widget int  id  )  const
 

This function tries to find the widget with the id. You supplied a possible id in addWIdget. Note that not QWidget::winId() is used.

Parameters:
id The id to search for
Returns:
The widget or null
See also:
addWidget

Definition at line 217 of file owidgetstack.cpp.

References m_list.

Referenced by raiseWidget(), and setMainWindow().


Member Data Documentation

Private* Opie::Ui::OWidgetStack::d [private]
 

Definition at line 126 of file owidgetstack.h.

bool Opie::Ui::OWidgetStack::m_forced [private]
 

Definition at line 124 of file owidgetstack.h.

Referenced by eventFilter(), forceMode(), and OWidgetStack().

QWidget* Opie::Ui::OWidgetStack::m_last [private]
 

Definition at line 121 of file owidgetstack.h.

Referenced by hideWidget(), OWidgetStack(), and raiseWidget().

QMap<int, QWidget*> Opie::Ui::OWidgetStack::m_list [private]
 

Definition at line 118 of file owidgetstack.h.

Referenced by addWidget(), id(), removeWidget(), switchStack(), switchTop(), widget(), and ~OWidgetStack().

enum Mode Opie::Ui::OWidgetStack::m_mode [private]
 

Definition at line 123 of file owidgetstack.h.

Referenced by addWidget(), forceMode(), hideWidget(), mode(), raiseWidget(), removeWidget(), resizeEvent(), setMainWindow(), switchStack(), switchTop(), visibleWidget(), and ~OWidgetStack().

QWidget* Opie::Ui::OWidgetStack::m_mWidget [private]
 

Definition at line 120 of file owidgetstack.h.

Referenced by addWidget(), hideWidget(), OWidgetStack(), removeWidget(), resizeEvent(), setMainWindow(), switchStack(), and visibleWidget().

QWidgetStack* Opie::Ui::OWidgetStack::m_stack [private]
 

Definition at line 119 of file owidgetstack.h.

Referenced by addWidget(), OWidgetStack(), raiseWidget(), removeWidget(), resizeEvent(), switchStack(), switchTop(), and visibleWidget().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 18:01:50 2005 for OPIE by  doxygen 1.4.2