COPASI API  4.16.103
CUpDownSubwidget.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CUpDownSubwidget.cpp,v $
3 // $Revision: 1.13 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/03/15 17:07:51 $
7 // End CVS Header
8 
9 // Copyright (C) 2012 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 #include "CUpDownSubwidget.h"
16 
17 /*
18  * Constructs a CUpDownSubwidget as a child of 'parent', with the
19  * name 'name' and widget flags set to 'f'.
20  */
21 CUpDownSubwidget::CUpDownSubwidget(QWidget* parent, const char* name, Qt::WindowFlags fl)
22  : QWidget(parent, fl)
23 {
24  setObjectName(QString::fromUtf8(name));
25  setupUi(this);
26 
27  init();
28 }
29 
30 /*
31  * Destroys the object and frees any allocated resources
32  */
34 {
35  // no need to delete child widgets, Qt does it all for us
36 }
37 
39 {
40  setIndex(0, true, true);
41  enableCopy(false);
42 
43  toolButtonDel->setIcon(CQIconResource::icon(CQIconResource::editDelete));
44  toolButtonUp->setIcon(CQIconResource::icon(CQIconResource::moveUp));
45  toolButtonCopy->setIcon(CQIconResource::icon(CQIconResource::editCopy));
46  toolButtonDown->setIcon(CQIconResource::icon(CQIconResource::moveDown));
47 
48 }
49 
51 {
52  emit copy(mIndex);
53 }
54 
56 {
57  emit up(mIndex);
58 }
59 
61 {
62  emit down(mIndex);
63 }
64 
66 {
67  emit del(mIndex);
68 }
69 
70 void CUpDownSubwidget::enableCopy(const bool & enable)
71 {
72  if (enable) toolButtonCopy->show();
73  else toolButtonCopy->hide();
74 }
75 
76 void CUpDownSubwidget::setIndex(int index, bool isFirst, bool isLast)
77 {
78  mIndex = index;
79 
80  if ((mIndex == 0) || (isFirst))
81  toolButtonUp->setEnabled(false);
82  else
83  toolButtonUp->setEnabled(true);
84 
85  if (isLast)
86  toolButtonDown->setEnabled(false);
87  else
88  toolButtonDown->setEnabled(true);
89 }
90 
92 {
93  return mIndex;
94 }
virtual void setIndex(int, bool, bool)
virtual int getIndex() const
static const QIcon & icon(const IconID &id)
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
CUpDownSubwidget(QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
void enableCopy(const bool &)