00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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