00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <qstring.h>
00017
00018 #include "TObject.h"
00019 #include "QFitItem.h"
00020 #include "TGo4FitPanelSlots.h"
00021
00022 QFitItem::QFitItem(TGo4FitPanelSlots* iSlots, QFitItem* parent, TObject* iObj, int iObjectType, int iWidgetType, int iPopupMenuType, int iGraphType, int iTag ) :
00023 QListViewItem (parent, QString::null, QString::null) {
00024 fxSlots = iSlots;
00025 fxObj = iObj;
00026 fiObjectType = iObjectType;
00027 fiWidgetType = iWidgetType;
00028 fiPopupMenuType = iPopupMenuType;
00029 fiGraphType = iGraphType;
00030 fiTag = iTag;
00031 if (fxSlots) fxSlots->UpdateItem(this, FALSE);
00032 }
00033
00034 QFitItem::QFitItem(TGo4FitPanelSlots* iSlots, QListView * parent, TObject* iObj, int iObjectType, int iWidgetType, int iPopupMenuType, int iGraphType, int iTag) :
00035 QListViewItem (parent, QString::null, QString::null) {
00036 fxSlots = iSlots;
00037 fxObj = iObj;
00038 fiObjectType = iObjectType;
00039 fiWidgetType = iWidgetType;
00040 fiPopupMenuType = iPopupMenuType;
00041 fiGraphType = iGraphType;
00042 fiTag = iTag;
00043 if (fxSlots) fxSlots->UpdateItem(this, FALSE);
00044 }
00045
00046 QFitItem::~QFitItem() {
00047 if (fxSlots) fxSlots->FitItemDeleted(this);
00048 }
00049
00050 TObject* QFitItem::Object() {
00051 return fxObj;
00052 }
00053
00054 void QFitItem::SetObject(TObject* obj) {
00055 fxObj = obj;
00056 }
00057
00058 int QFitItem::ObjectType() {
00059 return fiObjectType;
00060 }
00061
00062 int QFitItem::WidgetType() {
00063 return fiWidgetType;
00064 }
00065
00066 int QFitItem::PopupMenuType() {
00067 return fiPopupMenuType;
00068 }
00069
00070 int QFitItem::GraphType() {
00071 return fiGraphType;
00072 }
00073
00074 int QFitItem::Tag() {
00075 return fiTag;
00076 }
00077
00078 QFitItem* QFitItem::Parent() {
00079 return dynamic_cast<QFitItem*> (parent());
00080 }
00081
00082 QFitItem* QFitItem::DefineWidgetItem() {
00083 QFitItem* item = this;
00084
00085 while (item!=0) {
00086 if (item->WidgetType()!=-1) return item;
00087 item = item->Parent();
00088 }
00089 return 0;
00090 }
00091
00092 QFitItem* QFitItem::DefineGraphItem() {
00093 QFitItem* item = this;
00094
00095 while (item!=0) {
00096 if (item->GraphType()!=-1) return item;
00097 item = item->Parent();
00098 }
00099 return 0;
00100 }
00101
00102 bool QFitItem::FindInParents(QFitItem* item) {
00103 QFitItem* i = this;
00104 i = i->Parent();
00105
00106 while (i!=0) {
00107 if (i==item) return TRUE;
00108 i = i->Parent();
00109 }
00110
00111 return FALSE;
00112 }
00113
00114