+//
// layerwidget.cpp: Layer add/remove/use widget
//
// Part of the Architektonas Project
#include "global.h"
#include "layeritemwidget.h"
-
LayerWidget::LayerWidget(void): QWidget(),
addLayer(new QToolButton), removeLayer(new QToolButton),
editLayer(new QToolButton), layerUp(new QToolButton),
Global::layerName.push_back("Background");
}
-
LayerWidget::~LayerWidget()
{
}
-
void LayerWidget::Reload(void)
{
list->clear();
SetButtonStates();
}
-
void LayerWidget::HandleLayerSelected(int currentRow)
{
// If LayerWidget is empty, bail out
SetButtonStates();
}
-
//
// What happens here is that for every QListWidgetItem we make, we connect it
// to these handlers. But we only have to worry about that when adding and
emit LayerToggled();
}
-
void LayerWidget::HandleLockToggle(QListWidgetItem * qlwi, bool state)
{
int currentRow = list->row(qlwi);
// printf("Item #%i, new lock state is %s\n", list->row(qlwi), (state ? "ON" : "off"));
}
-
void LayerWidget::HandleDblClick(QListWidgetItem * /*qlwi*/)
{
EditLayer();
}
-
void LayerWidget::AddLayer(void)
{
// We always stick the newest layer at the top of the list (visually, the
Global::numLayers++;
}
-
void LayerWidget::DeleteLayer(void)
{
int numItems = list->count();
Global::activeLayer--;
}
-
void LayerWidget::EditLayer(void)
{
// Get the LayerItemWidget so we can edit it (its name, anyway)...
}
}
-
void LayerWidget::MoveLayerUp(void)
{
// Get information out of the LayerItemWidget (& get it from the list!)
emit LayersSwapped(layer, layer + 1);
}
-
void LayerWidget::MoveLayerDown(void)
{
// Get information out of the LayerItemWidget (& get it from the list!)
emit LayersSwapped(layer, layer - 1);
}
-
//
// Set button states in this widget to sane values
//
layerUp->setEnabled(currentRow == 0 ? false : true);
removeLayer->setEnabled(numItems == 1 ? false : true);
}
-