Isis 3 Programmer Reference
ToolList.cpp
1#include "ToolList.h"
2
3#include <QStackedWidget>
4#include <QToolBar>
5
6#include "RubberBandTool.h"
7#include "Tool.h"
8
9namespace Isis {
10 ToolList::ToolList() {
11 m_activeToolBarStack = NULL;
12 m_rubberBandTool = NULL;
13 }
14
15
16 ToolList::~ToolList() {
17 delete m_activeToolBarStack;
18 }
19
20
21 void ToolList::append(Tool *tool) {
22 m_tools.append(tool);
23
24 if (tool) {
25 tool->setList(this);
26
27 RubberBandTool *rubberBandTool = dynamic_cast<RubberBandTool *>(tool);
28
29 if (rubberBandTool) {
30 m_rubberBandTool = rubberBandTool;
31 }
32 }
33 }
34
35
36 int ToolList::count() const {
37 return m_tools.count();
38 }
39
40
41 RubberBandTool *ToolList::rubberBandTool() {
42 return m_rubberBandTool;
43 }
44
45
46 QStackedWidget *ToolList::toolBarStack() {
47 return m_activeToolBarStack;
48 }
49
50
51 QStackedWidget *ToolList::toolBarStack(QToolBar *toolBar) {
52 if(!m_activeToolBarStack) {
53 m_activeToolBarStack = new QStackedWidget;
54 toolBar->addWidget(m_activeToolBarStack);
55 }
56
57 return m_activeToolBarStack;
58 }
59
60
61 Tool *ToolList::operator[](int index) {
62 return m_tools[index];
63 }
64}
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16