--- /dev/null
+// layeritemwidget.cpp: Layer item widget
+//
+// Part of the Architektonas Project
+// (C) 2011 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 07/13/2013 Created this file
+//
+
+#include "layeritemwidget.h"
+
+
+LayerItemWidget::LayerItemWidget(QString s, bool invisible/*=false*/, bool locked/*=false*/):
+ QWidget(),
+ name(new QLabel(s)),
+ visibility(new QPushButton),
+ editibility(new QPushButton)
+{
+ QIcon visibleIcon(":/res/eye-open.png");
+ visibleIcon.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
+ QIcon lockedIcon(":/res/lock-open.png");
+ lockedIcon.addFile(":/res/lock-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
+ QSize buttonSize(20, 20);
+
+ QHBoxLayout * mainLayout = new QHBoxLayout;
+ mainLayout->setContentsMargins(0, 0, 0, 0); // This is required, otherwise the layout engine puts too much space around this widget. :-/
+
+ visibility->setFlat(true);
+ visibility->setIcon(visibleIcon);
+ visibility->setCheckable(true);
+ visibility->setMaximumSize(buttonSize);
+ visibility->setChecked(invisible);
+
+ editibility->setFlat(true);
+ editibility->setIcon(lockedIcon);
+ editibility->setCheckable(true);
+ editibility->setMaximumSize(buttonSize);
+ editibility->setChecked(locked);
+
+ mainLayout->addWidget(visibility);
+ mainLayout->addWidget(editibility);
+ mainLayout->addWidget(name);
+ setLayout(mainLayout);
+}
+
+
+LayerItemWidget::~LayerItemWidget()
+{
+}
+
//
#include "layerwidget.h"
+#include "layeritemwidget.h"
#if 0
// checkboxes to change their look (eye open/closed for visibility,
// lock open/closed for layer lock).
- QIcon visibleChecked(":/res/eye-open.png");
-// QIcon visibleUnchecked(":/res/eye-closed.png");
- visibleChecked.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
+ QIcon visible(":/res/eye-open.png");
+ visible.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
+ QIcon locked(":/res/lock-open.png");
+ locked.addFile(":/res/lock-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
QVBoxLayout * mainLayout = new QVBoxLayout;
- QCheckBox * box1 = new QCheckBox("bleah");
- box1->setIcon(visibleChecked);
- mainLayout->addWidget(box1);
- QPushButton * button1 = new QPushButton;//(visibleChecked);
+ QHBoxLayout * line1 = new QHBoxLayout;
+ QHBoxLayout * line2 = new QHBoxLayout;
+
+// QCheckBox * box1 = new QCheckBox("bleah");
+// box1->setIcon(visible);
+// mainLayout->addWidget(box1);
+
+ QPushButton * button1 = new QPushButton;
button1->setFlat(true);
- button1->setIcon(visibleChecked);
+ button1->setIcon(visible);
button1->setCheckable(true);
- mainLayout->addWidget(button1);
-//printf("LayerWidget: About to set layout...\n");
+ button1->setMaximumSize(QSize(20, 20));
+ QPushButton * button2 = new QPushButton;
+ button2->setFlat(true);
+ button2->setIcon(locked);
+ button2->setCheckable(true);
+ button2->setMaximumSize(QSize(20, 20));
+ QLabel * label1 = new QLabel("Background");
+
+ QPushButton * button3 = new QPushButton;
+ button3->setFlat(true);
+ button3->setIcon(visible);
+ button3->setCheckable(true);
+ button3->setMaximumSize(QSize(20, 20));
+ QPushButton * button4 = new QPushButton;
+ button4->setFlat(true);
+ button4->setIcon(locked);
+ button4->setCheckable(true);
+ button4->setMaximumSize(QSize(20, 20));
+ QLabel * label2 = new QLabel("Guides");
+
+ line1->addWidget(button1);
+ line1->addWidget(button2);
+ line1->addWidget(label1);
+
+ line2->addWidget(button3);
+ line2->addWidget(button4);
+ line2->addWidget(label2);
+
+ LayerItemWidget * liw1 = new LayerItemWidget("Floor #1");
+ LayerItemWidget * liw2 = new LayerItemWidget("Mechanical");
+
+ mainLayout->addLayout(line1);
+ mainLayout->addLayout(line2);
+ mainLayout->addWidget(liw1);
+ mainLayout->addWidget(liw2);
+ mainLayout->addStretch();
setLayout(mainLayout);
}