Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Selection.h

00001 /*
00002 Copyright (C) 2000,2001 Stefan Duffner 
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef SELECTION_H
00020 #define SELECTION_H
00021 
00022 #include <qlist.h>
00023 #include <qobject.h>
00024 
00025 #include "ScrollView.h"
00026 #include "Machine.h"
00027 
00028 class GState;
00029 
00030 
00036 class Selection : public QObject
00037 {
00038   Q_OBJECT
00039   public:
00040     Selection(QWidget*, const char* name=0);
00041     ~Selection();
00042 
00044     QList<GState>& getSList() { return ssel_list; };
00046     QList<GTransition>& getTList() { return tsel_list; };
00048     bool isITransSelected() { return itrans; };
00050     void selectITrans(bool s=TRUE) { itrans = s; };
00051     bool isStateSelected(State* );
00052     bool isTransitionSelected(Transition* );
00053 
00054     GObject* select(ScrollView* , Machine* , QPoint , double, int& );
00055     void select(GState*, bool sel=TRUE);
00056     void select(GTransition*, bool sel=TRUE);
00057     void select(GITransition*, bool sel=TRUE);
00058     bool selectRect(Machine*, DRect& , bool add);
00059     bool selectAdd(ScrollView* , Machine*, QPoint, double );
00060 //    bool selectRectAdd(ScrollView*, Machine*, QPoint, double );
00061     int selectControl(Machine* , QPoint, double, GTransition*&);
00062     bool selectAll(Machine*, DRect& bound);
00063     bool deselect(GState*);
00064     bool deselect(GTransition*);
00065     bool deselect(GITransition*);
00066     void deselectAll(Machine* );
00067 
00068     bool onSelection(QPoint, double);
00069     void move(double, double, ScrollView* , Machine* );
00070     void getBoundingRect(double&, double&, double&, double&, GState* );
00071     void updateBoundingRect(DRect&, GState* );
00072 
00074     int countStates() { return ssel_list.count(); };
00076     int countTransitions() { return tsel_list.count(); };
00078     int count() { return ssel_list.count()+tsel_list.count(); };
00080     void clear() { ssel_list.clear(); tsel_list.clear(); };
00081 
00083     void setContextObject(GObject* obj, int type) { context_object = obj; co_type=type; };
00085     GObject* getContextObject(int& type) { type = co_type; return context_object; };
00086 
00087   private:
00088     void setMinMax(double, double, double&, double&, double&, double&);
00089 
00091     QList<GState> ssel_list;
00093     QList<GTransition> tsel_list;
00095     bool itrans;
00096 
00098     GObject* context_object;
00100     int co_type;
00101 
00102   signals:
00104     void updateAll();
00105 };
00106 
00107 
00108 #endif

Generated at Fri Apr 11 22:37:14 2003 for Qfsm by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001