diff -r 4d620d819f4f -r a027f6fc6141 src/radiobox.h
--- a/src/radiobox.h Tue May 14 04:17:43 2013 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * LDForge: LDraw parts authoring CAD
- * Copyright (C) 2013 Santeri Piippo
- *
- * 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 .
- */
-
-#ifndef RADIOBOX_H
-#define RADIOBOX_H
-
-#include "common.h"
-#include
-#include
-#include
-#include
-#include
-
-// =============================================================================
-// RadioBox
-//
-// Convenience widget - is a groupbox of radio buttons.
-// =============================================================================
-class RadioBox : public QGroupBox {
- Q_OBJECT
-
-public:
- void init (Qt::Orientation orient);
-
- explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) {
- init (Qt::Vertical);
- }
-
- explicit RadioBox (const QString& title, QWidget* parent = null) : QGroupBox (title, parent) {
- init (Qt::Vertical);
- }
-
- explicit RadioBox () {
- init (Qt::Vertical);
- }
-
- explicit RadioBox (const QString& title, initlist entries, int const defaultId,
- const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null);
-
- void rowBreak ();
- void setCurrentRow (uint row);
- void addButton (const char* entry);
- void addButton (QRadioButton* button);
- RadioBox& operator<< (QRadioButton* button);
- RadioBox& operator<< (const char* entry);
-
- int value () const {
- return m_buttonGroup->checkedId ();
- }
-
- void setValue (int val) {
- m_buttonGroup->button (val)->setChecked (true);
- }
-
- std::vector::iterator begin () {
- return m_objects.begin ();
- }
-
- std::vector::iterator end () {
- return m_objects.end ();
- }
-
- QRadioButton* operator[] (uint n) const {
- return m_objects[n];
- }
-
- bool exclusive () const {
- return m_buttonGroup->exclusive ();
- }
-
- void setExclusive (bool val) {
- m_buttonGroup->setExclusive (val);
- }
-
- bool isChecked (int n) const {
- return m_buttonGroup->checkedId () == n;
- }
-
-signals:
- void sig_buttonPressed (int btn);
- void buttonReleased (int btn);
- void valueChanged (int val);
-
-private:
- std::vector m_objects;
- std::vector m_layouts;
- QBoxLayout* m_coreLayout;
- QBoxLayout* m_currentLayout;
- QBoxLayout::Direction m_dir;
- int m_curId, m_defId, m_oldId;
- QButtonGroup* m_buttonGroup;
-
- Q_DISABLE_COPY (RadioBox)
-
-private slots:
- void slot_buttonPressed (int btn);
- void slot_buttonReleased (int btn);
-};
-
-#endif // RADIOBOX_H
\ No newline at end of file