Warning, file /office/calligra/braindump/src/StatusBarItem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 1998, 1999 Torben Weis <weis@kde.org> 0003 * Copyright (c) 2007 Thomas Zander <zander@kde.org> 0004 * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; 0009 * either version 2, or (at your option) any later version of the License. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public License 0017 * along with this library; see the file COPYING. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef _STATUSBARITEM_H_ 0023 #define _STATUSBARITEM_H_ 0024 0025 #include "MainWindow.h" 0026 0027 #include <QStatusBar> 0028 0029 struct MainWindow::StatusBarItem { 0030 StatusBarItem(QWidget* _widget, int _strech, bool _permanent) : m_widget(_widget), m_stretch(_strech), m_permanent(_permanent), m_visible(false) { 0031 } 0032 void ensureItemShown(QStatusBar * sb) { 0033 Q_ASSERT(m_widget); 0034 Q_ASSERT(sb); 0035 if(!m_visible) { 0036 if(m_permanent) { 0037 sb->addPermanentWidget(m_widget, m_stretch); 0038 } else { 0039 sb->addWidget(m_widget, m_stretch); 0040 } 0041 m_visible = true; 0042 m_widget->show(); 0043 } 0044 } 0045 void ensureItemHidden(QStatusBar * sb) { 0046 Q_ASSERT(sb); 0047 if(m_visible) { 0048 sb->removeWidget(m_widget); 0049 m_visible = false; 0050 m_widget->hide(); 0051 } 0052 } 0053 QWidget* m_widget; 0054 int m_stretch; 0055 bool m_permanent; 0056 bool m_visible; 0057 }; 0058 0059 #endif