/* * Copyright 2008 Ben Boeckel * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ // Header include #include "MapEditor.h" // Sigmodr includes #include "MapScene.h" // KDE includes #include #include // Qt includes #include #include Sigmodr::MapEditor::MapEditor(QWidget* parent) : QWidget(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); QGridLayout* layout = new QGridLayout; m_view = new QGraphicsView; m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layout->addWidget(m_view, 0, 0, 6, 1); m_addTile = new KPushButton(KIcon("list-add"), "Add Tile"); layout->addWidget(m_addTile, 0, 1, 1, 1); m_removeTiles = new KPushButton(KIcon("list-remove"), "Remove Tiles"); layout->addWidget(m_removeTiles, 1, 1, 1, 1); m_moveToTop = new KPushButton(KIcon("arrow-up-double"), "Move to Top"); layout->addWidget(m_moveToTop, 2, 1, 1, 1); m_moveUp = new KPushButton(KIcon("arrow-up"), "Move Up"); layout->addWidget(m_moveUp, 3, 1, 1, 1); m_moveDown = new KPushButton(KIcon("arrow-down"), "Move Down"); layout->addWidget(m_moveDown, 4, 1, 1, 1); m_moveToBottom = new KPushButton(KIcon("arrow-down-double"), "Move to Bottom"); layout->addWidget(m_moveToBottom, 5, 1, 1, 1); setLayout(layout); } void Sigmodr::MapEditor::setMap(Sigmod::Map* map) { m_map = map; m_scene = new MapScene(map, this); connect(m_scene, SIGNAL(changed()), this, SIGNAL(changed())); connect(m_addTile, SIGNAL(pressed()), m_scene, SLOT(addTile())); connect(m_removeTiles, SIGNAL(pressed()), m_scene, SLOT(removeTiles())); m_view->setScene(m_scene); } void Sigmodr::MapEditor::reset() { }