COPASI API  4.16.103
copasiWidget.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 // copasiWidget.cpp: implementation of the CopasiWidget class.
16 //
17 //////////////////////////////////////////////////////////////////////
18 #include <QtGui/QApplication>
19 
20 #include "copasi/UI/copasiWidget.h"
21 #include "copasi/UI/listviews.h"
22 #include "copasi/UI/DataModelGUI.h"
26 
27 CopasiWidget::CopasiWidget(QWidget * parent, const char * name, Qt::WFlags f)
28  : QWidget(parent, f),
29  mpListView(NULL),
30  mKey(),
31  mpObject(NULL),
32  mpDataModel(NULL),
33  mIgnoreUpdates(false),
34  mFramework(0)
35 {
36  setObjectName(name);
37  QObject *pParent = parent;
38 
39  while (pParent != NULL &&
40  (mpListView = dynamic_cast< ListViews * >(pParent)) == NULL)
41  {
42  pParent = pParent->parent();
43  }
44 
45  assert(mpListView != NULL);
46 }
47 
49 {return true;}
50 
52 {return true;}
53 
54 bool CopasiWidget::enter(const std::string & key)
55 {
56  mKey = key;
58 
59  if (mpObject != NULL)
60  {
62  }
63  else
64  {
65  mpDataModel = NULL;
66  }
67 
68  return enterProtected();
69 }
70 
72 {
73  return true;
74 }
75 
76 void CopasiWidget::setFramework(int framework)
77 {mFramework = framework;}
78 
80 {
81  bool notifyRun = false;
82 
83  if (!mIgnoreUpdates)
84  {
85  mIgnoreUpdates = true;
86  mpListView->getDataModel()->notify(objectType, action, key);
87  notifyRun = true;
88  }
89 
90  mIgnoreUpdates = false;
91 
92  return notifyRun;
93 }
94 
96 {
97  return mIgnoreUpdates;
98 }
99 
101 {
102  mIgnoreUpdates = v;
103 }
104 
106 {
107  return mpDataModel;
108 }
CCopasiDataModel * getObjectDataModel()
virtual bool enterProtected()
objectType
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
CCopasiObject * get(const std::string &key)
CCopasiObject * mpObject
Definition: copasiWidget.h:64
#define C_UNUSED(p)
Definition: copasi.h:220
bool mIgnoreUpdates
Definition: copasiWidget.h:67
virtual bool leave()
ListViews * mpListView
Definition: copasiWidget.h:62
virtual bool update(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
void setIgnoreUpdates(bool v)
CCopasiDataModel * mpDataModel
Definition: copasiWidget.h:65
DataModelGUI * getDataModel()
Definition: listviews.h:134
static CKeyFactory * getKeyFactory()
virtual void setFramework(int framework)
std::string mKey
Definition: copasiWidget.h:63
CCopasiDataModel * getDataModel()
bool getIgnoreUpdates()
bool enter(const std::string &key)