1 //========================================================= 2 // MusE 3 // Linux Music Editor 4 // Copyright (C) 1999-2011 by Werner Schweer and others 5 // 6 // scroll_area.h 7 // (C) Copyright 2015 Tim E. Real (terminator356 on sourceforge) 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; version 2 of 12 // the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with this program; if not, write to the Free Software 21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 // 23 //========================================================= 24 25 #ifndef __SCROLL_AREA_H__ 26 #define __SCROLL_AREA_H__ 27 28 #include <QScrollArea> 29 30 class QSize; 31 32 namespace MusEGui { 33 34 //--------------------------------------------------------- 35 // CompactScrollArea 36 //--------------------------------------------------------- 37 38 class CompactScrollArea : public QScrollArea 39 { 40 Q_OBJECT 41 42 public: 43 CompactScrollArea(QWidget* parent); 44 virtual QSize minimumSizeHint() const; 45 }; 46 47 //--------------------------------------------------------- 48 // CompactControllerRack 49 //--------------------------------------------------------- 50 51 class CompactControllerRack : public QScrollArea 52 { 53 Q_OBJECT 54 55 private: 56 int _minItems; 57 QSize _minItemSize; 58 QSize _minSize; 59 int _xItemMargin; 60 int _yItemMargin; 61 62 public: 63 CompactControllerRack(QWidget* parent, int minItems = 0); 64 virtual QSize minimumSizeHint() const; minItems()65 int minItems() const { return _minItems; } 66 void setMinItems(int n); 67 QSize defaultItemSizeHint(); 68 void updateDefaultItemSizeHint(); 69 void updateMinimumSize(); 70 71 void setItemMargins(int x, int y); 72 }; 73 74 } // namespace MusEGui 75 76 #endif 77