Add iconed groupbox class
authorunc0rr
Tue, 12 Aug 2008 08:48:44 +0000
changeset 1192 63b7961f68de
parent 1191 5539aa59f703
child 1193 2911384169b4
Add iconed groupbox class
QTfrontend/CMakeLists.txt
QTfrontend/igbox.cpp
QTfrontend/igbox.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/CMakeLists.txt	Sun Aug 10 20:18:40 2008 +0000
+++ b/QTfrontend/CMakeLists.txt	Tue Aug 12 08:48:44 2008 +0000
@@ -75,6 +75,7 @@
 	selectWeapon.cpp
 	itemNum.cpp
 	input_ip.cpp
+	igbox.cpp
 	weaponItem.cpp)
 
 if(MINGW)
@@ -121,6 +122,7 @@
 	selectWeapon.h
 	itemNum.h
 	input_ip.h
+	igbox.h
 	weaponItem.h)
 
 set(hwfr_hdrs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/igbox.cpp	Tue Aug 12 08:48:44 2008 +0000
@@ -0,0 +1,38 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * 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; version 2 of the License
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <QPainter>
+#include <QPoint>
+#include "igbox.h"
+
+IconedGroupBox::IconedGroupBox(QWidget * parent)
+{
+
+}
+
+void IconedGroupBox::setIcon(const QIcon & icon)
+{
+	this->icon = icon;
+}
+
+void IconedGroupBox::paintEvent(QPaintEvent * event)
+{
+	QPainter painter(this);
+
+	icon.paint(&painter, QRect(QPoint(0, 0), size()));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/igbox.h	Tue Aug 12 08:48:44 2008 +0000
@@ -0,0 +1,40 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * 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; version 2 of the License
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef _IGBOX_H
+#define _IGBOX_H
+
+#include <QGroupBox>
+#include <QIcon>
+
+class IconedGroupBox : public QGroupBox
+{
+	Q_OBJECT
+
+public:
+	IconedGroupBox(QWidget * parent = 0);
+
+	void setIcon(const QIcon & icon);
+protected:
+	virtual void paintEvent(QPaintEvent * event);
+
+private:
+	QIcon icon;
+};
+
+#endif // _IGBOX_H
--- a/QTfrontend/pages.cpp	Sun Aug 10 20:18:40 2008 +0000
+++ b/QTfrontend/pages.cpp	Tue Aug 12 08:48:44 2008 +0000
@@ -50,6 +50,7 @@
 #include "SDLs.h"
 #include "playrecordpage.h"
 #include "selectWeapon.h"
+#include "igbox.h"
 
 PageMain::PageMain(QWidget* parent) : 
   AbstractPage(parent)
@@ -284,7 +285,7 @@
 	BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 0, 2);
 
 	AGGroupBox = new QGroupBox(this);
-	AGGroupBox->setCheckable(true);
+	//AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
 	AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 	AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
 	pageLayout->addWidget(AGGroupBox, 2, 1);
--- a/QTfrontend/pages.h	Sun Aug 10 20:18:40 2008 +0000
+++ b/QTfrontend/pages.h	Tue Aug 12 08:48:44 2008 +0000
@@ -48,6 +48,7 @@
 class FPSEdit;
 class HWChatWidget;
 class SelWeaponWidget;
+class IconedGroupBox;
 
 class AbstractPage : public QWidget
 {