]> Shamusworld >> Repos - architektonas/blobdiff - src/layeritemwidget.cpp
More work on LayerWidget. Not functional yet.
[architektonas] / src / layeritemwidget.cpp
diff --git a/src/layeritemwidget.cpp b/src/layeritemwidget.cpp
new file mode 100644 (file)
index 0000000..273ebf1
--- /dev/null
@@ -0,0 +1,54 @@
+// 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()
+{
+}
+