Isis 3 Programmer Reference
Tab.cpp
1 #include "IsisDebug.h"
2 
3 #include "Tab.h"
4 
5 //#include <iostream>
6 
7 #include <QWidget>
8 #include <QStylePainter>
9 
10 #include "IException.h"
11 #include "IString.h"
12 
13 
14 namespace Isis
15 {
16 
18  Tab::Tab(QWidget * associatedWidget, QWidget * parent) : QAction(parent)
19  {
20  this->associatedWidget = associatedWidget;
21 
22  position = 0;
23  radioGroup = 0;
24  selectedStatus = false;
25 
26  setCheckable(true);
27 
28  connect(this, SIGNAL(triggered()), this, SLOT(handleTriggered()));
29 
30  ASSERT_PTR(associatedWidget);
31  }
32 
33 
36  {
37  associatedWidget = NULL;
38  }
39 
40 
42  void Tab::setPosition(const int & newPosition)
43  {
44  position = newPosition;
45  }
46 
47 
49  const int & Tab::getPosition() const
50  {
51  return position;
52  }
53 
54 
61  void Tab::setRadioGroup(const int & newRadioGroup)
62  {
63  radioGroup = newRadioGroup;
64  }
65 
66 
73  const int & Tab::getRadioGroup() const
74  {
75  return radioGroup;
76  }
77 
78 
86  void Tab::setSelected(bool newStatus)
87  {
88  if (associatedWidget == NULL)
89  {
90  QString msg = "Tab::setSelected called but can't show or hide the "
91  "associatedWidget because it is NULL!";
93  _FILEINFO_);
94  }
95  setChecked(newStatus);
96  newStatus ? associatedWidget->show() : associatedWidget->hide();
97  selectedStatus = newStatus;
98  }
99 
100 
109  {
110  return selectedStatus;
111  }
112 
113 
121  {
122  emit clicked(position);
123  }
124 
125 }
const int & getPosition() const
get the position of the Tab within a TabBar
Definition: Tab.cpp:49
void handleTriggered()
This SLOT is executed when the Tab is clicked, and emits its own clicked SIGNAL (which contains its i...
Definition: Tab.cpp:120
bool isSelected()
A selected Tab will look visually pressed and have its associatedWidget visible.
Definition: Tab.cpp:108
const int & getRadioGroup() const
Tabs which share a radio group have the property that only only one Tab in the group can be selected ...
Definition: Tab.cpp:73
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
void setSelected(bool newStatus)
A selected Tab will look visually pressed and have its associatedWidget visible.
Definition: Tab.cpp:86
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
void setRadioGroup(const int &newRadioGroup)
Tabs which share a radio group have the property that only only one Tab in the group can be selected ...
Definition: Tab.cpp:61
void setPosition(const int &newPosition)
set the position of the Tab within a TabBar
Definition: Tab.cpp:42
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual ~Tab()
destructs a Tab
Definition: Tab.cpp:35
Tab(QWidget *associatedWidget, QWidget *parent=0)
constructs a Tab
Definition: Tab.cpp:18