ConfigPageStack.h

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file ConfigPageStack.h
00013 ** \version $Id: ConfigPageStack.h 3735 2009-04-28 20:28:01Z edmanm $
00014 ** \brief A collection of configuration pages
00015 */
00016 
00017 #ifndef _CONFIGPAGESTACK_H
00018 #define _CONFIGPAGESTACK_H
00019 
00020 #include "ConfigPage.h"
00021 
00022 #include <QStackedWidget>
00023 #include <QHash>
00024 
00025 
00026 class ConfigPageStack : public QStackedWidget
00027 {
00028   Q_OBJECT
00029 
00030 public:
00031   /** Constructor. */
00032   ConfigPageStack(QWidget *parent = 0);
00033 
00034   /** Adds a configuration page to the stack. */
00035   void add(ConfigPage *page, QAction *action);
00036   /** Sets the current config page and checks its action. */
00037   void setCurrentPage(ConfigPage *page);
00038   /** Sets the current config page index and checks its action. */
00039   void setCurrentIndex(int index);
00040   
00041   /** Returns a list of all pages in the stack. The order of the pages in the
00042    * returned QList is the same as the order in which the pages were
00043    * initially added to the stack. */
00044   QList<ConfigPage *> pages() const;
00045 
00046 public slots:
00047   /** Displays the page associated with the activated action. */
00048   void showPage(QAction *pageAction);
00049   
00050 private:
00051   /** Maps an action to a config page. */
00052   QHash<QAction*, ConfigPage*> _pages;
00053 };
00054 
00055 #endif
00056 
Generated on Mon Aug 30 22:58:54 2010 for Vidalia by  doxygen 1.6.3