1 // layerwidget.cpp: Layer add/remove/use widget
3 // Part of the Architektonas Project
4 // (C) 2011 Underground Software
5 // See the README and GPLv3 files for licensing and warranty information
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 07/11/2013 Created this file
14 #include "layerwidget.h"
15 #include "layeritemwidget.h"
18 LayerWidget::LayerWidget(void): QWidget(),
21 LayerItemWidget * liw = new LayerItemWidget("Background");
22 QListWidgetItem * qlwi = new QListWidgetItem(list);
23 list->setItemWidget(qlwi, liw);
26 QPushButton * pb1 = new QPushButton("+");
27 QPushButton * pb2 = new QPushButton("-");
28 QPushButton * pb3 = new QPushButton("Edit");
29 QPushButton * pb4 = new QPushButton("^");
30 QPushButton * pb5 = new QPushButton("v");
32 QToolButton * pb1 = new QToolButton;
33 QToolButton * pb2 = new QToolButton;
34 QToolButton * pb3 = new QToolButton;
35 QToolButton * pb4 = new QToolButton;
36 QToolButton * pb5 = new QToolButton;
38 pb1->setIcon(QIcon(":/res/generic-tool.png"));
39 pb2->setIcon(QIcon(":/res/generic-tool.png"));
40 pb3->setIcon(QIcon(":/res/generic-tool.png"));
41 pb4->setIcon(QIcon(":/res/generic-tool.png"));
42 pb5->setIcon(QIcon(":/res/generic-tool.png"));
45 QHBoxLayout * hbox1 = new QHBoxLayout;
46 hbox1->addWidget(pb1);
47 hbox1->addWidget(pb2);
48 hbox1->addWidget(pb3);
49 hbox1->addWidget(pb4);
50 hbox1->addWidget(pb5);
53 QVBoxLayout * mainLayout = new QVBoxLayout;
54 mainLayout->addWidget(list);
55 mainLayout->addLayout(hbox1);
57 setLayout(mainLayout);
59 connect(list, SIGNAL(currentRowChanged(int)), this, SLOT(HandleLayerSelected(int)));
60 list->setCurrentRow(4);
61 connect(pb1, SIGNAL(clicked()), this, SLOT(AddLayer()));
62 connect(pb2, SIGNAL(clicked()), this, SLOT(DeleteLayer()));
63 connect(pb3, SIGNAL(clicked()), this, SLOT(EditLayer()));
64 connect(pb4, SIGNAL(clicked()), this, SLOT(MoveLayerUp()));
65 connect(pb5, SIGNAL(clicked()), this, SLOT(MoveLayerDown()));
69 LayerWidget::~LayerWidget()
74 void LayerWidget::HandleLayerSelected(int currentRow)
76 //printf("LayerWidget::HandleLayerSelected(): currentRow = %i\n", currentRow);
77 emit(LayerSelected(currentRow));
81 void LayerWidget::AddLayer(void)
83 int count = list->count();
84 QString text = QString("Layer #%1").arg(count);
85 LayerItemWidget * liw = new LayerItemWidget(text);
86 QListWidgetItem * qlwi = new QListWidgetItem();
87 list->insertItem(0, qlwi);
88 list->setItemWidget(qlwi, liw);
92 void LayerWidget::DeleteLayer(void)
97 void LayerWidget::EditLayer(void)
102 void LayerWidget::MoveLayerUp(void)
107 void LayerWidget::MoveLayerDown(void)