configpagestack.h

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file configpagestack.h
00024  * \version $Id: configpagestack.h 1238 2006-09-25 17:50:57Z edmanm $
00025  * \brief A collection of configuration pages
00026  */
00027 
00028 #ifndef _CONFIGPAGESTACK_H
00029 #define _CONFIGPAGESTACK_H
00030 
00031 #include <QStackedWidget>
00032 #include <QHash>
00033 
00034 #include "configpage.h"
00035 
00036 
00037 class ConfigPageStack : public QStackedWidget
00038 {
00039   Q_OBJECT
00040 
00041 public:
00042   /** Constructor. */
00043   ConfigPageStack(QWidget *parent = 0);
00044 
00045   /** Adds a configuration page to the stack. */
00046   void add(ConfigPage *page, QAction *action);
00047   /** Sets the current config page and checks its action. */
00048   void setCurrentPage(ConfigPage *page);
00049   /** Sets the current config page index and checks its action. */
00050   void setCurrentIndex(int index);
00051 
00052   /** Returns a list of all pages in the stack. */
00053   QList<ConfigPage*> pages() { return _pages.values(); }
00054   
00055 public slots:
00056   /** Displays the page associated with the activated action. */
00057   void showPage(QAction *pageAction);
00058   
00059 private:
00060   /** Maps an action to a config page. */
00061   QHash<QAction*, ConfigPage*> _pages;
00062 };
00063 
00064 #endif
00065 

Generated on Mon Oct 23 20:08:15 2006 for Vidalia by  doxygen 1.5.0