- Softwrap mode:
- Toggle
Blob of src/sif/private/buttonarea.cpp
(raw blob data)
| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2008 by David Cuadrado * |
| 3 | * krawek@gmail.com * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #include "buttonarea.h" |
| 22 | |
| 23 | #include <QHBoxLayout> |
| 24 | |
| 25 | #include "aerobutton.h" |
| 26 | |
| 27 | namespace SIFPrivate { |
| 28 | |
| 29 | ButtonArea::ButtonArea(QWidget *parent) |
| 30 | : QWidget(parent), m_buttons(this) |
| 31 | { |
| 32 | m_layout = new QHBoxLayout(this); |
| 33 | setExclusive(true); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | ButtonArea::~ButtonArea() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | void ButtonArea::setExclusive(bool e) |
| 42 | { |
| 43 | m_buttons.setExclusive(e); |
| 44 | } |
| 45 | |
| 46 | bool ButtonArea::exclusive() const |
| 47 | { |
| 48 | return m_buttons.exclusive(); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | SIF::AeroButton *ButtonArea::addButton(const QString &title, const QIcon &icon) |
| 53 | { |
| 54 | SIF::AeroButton *button = new SIF::AeroButton(icon, title); |
| 55 | button->setCheckable(true); |
| 56 | button->setIconSize(QSize(48, 48)); |
| 57 | |
| 58 | m_layout->addWidget(button); |
| 59 | |
| 60 | m_buttons.addButton(button); |
| 61 | |
| 62 | return button; |
| 63 | } |
| 64 | |
| 65 | } |
