Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

cmdselector.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  File:    cmdselector.h
00004  Created: by Aidan Lane, November 25, 2003
00005  Updated: by Aidan Lane, February 15, 2004
00006  
00007  This file is part of Glitch
00008  Copyright (C) 2003-2004  Monash University, Clayton Campus, Australia
00009  Created by Aidan Lane, under the supervision of Jon McCormack.
00010  
00011  This program was developed to aid the students studying the CSE3313
00012  Computer Graphics course at Monash University.
00013  
00014  This software may contain portions that are copyright (C) 1993,
00015  Silicon Graphics, Inc. All Rights Reserved.
00016  
00017  Glitch is free software; you can redistribute it and/or modify
00018  it under the terms of the GNU General Public License as published by
00019  the Free Software Foundation, version 2.
00020  
00021  Glitch is distributed in the hope that it will be useful,
00022  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  GNU General Public License for more details.
00025  
00026  You should have received a copy of the GNU General Public License
00027  along with this program; if not, write to the Free Software
00028  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00029 
00030 *****************************************************************************/
00031 
00032 #ifndef __CMDSELECTOR_H__
00033 #define __CMDSELECTOR_H__
00034 
00035 
00036 #include <qapplication.h>
00037 #include <qpushbutton.h>
00038 #include <qlayout.h>
00039 #include <qlistview.h>
00040 #include <qframe.h>
00041 #include <qhgroupbox.h>
00042 #include <qptrlist.h>
00043 #include <qmap.h>
00044 
00045 #include "cmdtreenode.h"
00046 
00047 
00054 class CmdSelector : public QFrame
00055 {
00056     Q_OBJECT    // make QT's signal/slot system work
00057 
00058 public:
00059     CmdSelector( QWidget* parent=0, const char* name=0,
00060                     int width=-1, int height=-1 );
00061     
00062     void popup( QWidget* parent=0);
00063     void setCmdTree( QPtrList<CmdTreeNode>* tree );
00064     void selectItem( QListViewItem* item );
00065     void selectItem( CmdTreeNode* cmd );
00066 
00067 signals:
00068     void closed();
00069     void cmdSelected( CmdTreeNode* );
00070 
00071 private slots:
00072     void listItemClicked( QListViewItem* item );    // will emit cmdSelected
00073     
00074 private:
00075     template<class ParentT> void insertSubtree( ParentT* parent, QPtrList<CmdTreeNode>* );
00076     
00077     QWidget* popupParent;
00078     QListView* cmdList;
00079     CmdTreeNode* currentCmd;
00080     // Yes, I KNOW... there is redundancy here, but it is worth it...
00081     QMap<QListViewItem*, CmdTreeNode*> listItemToCmd;
00082     QMap<CmdTreeNode*, QListViewItem*> cmdToListItem;
00083 };
00084 
00085 
00086 #endif  // __CMDSELECTOR_H__

Generated on Fri Feb 27 12:01:39 2004 for Glitch by doxygen 1.3.2