2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Pekka Nissinen - pekka.nissinen@ixonos.com
6 Sami Rämö - sami.ramo@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #include <QListWidget>
25 #include <QResizeEvent>
26 #include <QVBoxLayout>
28 #include "panelbase.h"
30 PanelBase::PanelBase(QWidget *parent)
33 qDebug() << __PRETTY_FUNCTION__;
36 // --- GENERIC BUTTONS ---
37 m_genericButtons = new QWidget;
38 m_genericButtonsLayout = new QVBoxLayout;
40 const int CONTEXT_BUTTON_MARGIN_LEFT = 2;
41 const int CONTEXT_BUTTON_MARGIN_TOP = 10;
42 const int CONTEXT_BUTTON_MARGIN_RIGHT = 0;
43 const int CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
44 const int CONTEXT_BUTTON_SPACING = 0;
45 m_genericButtonsLayout->setContentsMargins(CONTEXT_BUTTON_MARGIN_LEFT,
46 CONTEXT_BUTTON_MARGIN_TOP,
47 CONTEXT_BUTTON_MARGIN_RIGHT,
48 CONTEXT_BUTTON_MARGIN_BOTTOM);
49 m_genericButtonsLayout->setSpacing(CONTEXT_BUTTON_SPACING);
51 m_genericButtons->setLayout(m_genericButtonsLayout);
53 // --- ITEM RELATED BUTTONS ---
54 m_itemButtons = new QWidget(this);
55 m_itemButtonsLayout = new QHBoxLayout;
57 const int ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
58 const int ITEM_CONTEXT_BUTTON_MARGIN_LEFT = 2;
59 const int ITEM_CONTEXT_BUTTON_MARGIN_RIGHT = 2;
60 const int ITEM_CONTEXT_BUTTON_MARGIN_TOP = 2;
61 const int ITEM_CONTEXT_BUTTON_SPACING = 0;
62 m_itemButtonsLayout->setContentsMargins(ITEM_CONTEXT_BUTTON_MARGIN_LEFT,
63 ITEM_CONTEXT_BUTTON_MARGIN_TOP,
64 ITEM_CONTEXT_BUTTON_MARGIN_RIGHT,
65 ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM);
66 m_itemButtonsLayout->setSpacing(ITEM_CONTEXT_BUTTON_SPACING);
68 m_itemButtons->setLayout(m_itemButtonsLayout);
71 QWidget* PanelBase::genericPanelButtons() const
73 qDebug() << __PRETTY_FUNCTION__;
75 return m_genericButtons;
78 QWidget* PanelBase::itemButtons() const
80 qDebug() << __PRETTY_FUNCTION__;
85 void PanelBase::onListItemSelectionChanged()
87 qDebug() << __PRETTY_FUNCTION__;
89 QListWidget *listWidget = dynamic_cast<QListWidget *>(sender());
90 if (listWidget && (listWidget->selectedItems().count() > 0))
91 emit listItemSelectionChanged(true);
93 emit listItemSelectionChanged(false);