File indexing completed on 2024-12-22 04:17:32

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2011 C. Barth Netterfield
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 
0014 #ifndef FORMATGRIDHELPER_H
0015 #define FORMATGRIDHELPER_H
0016 
0017 #include <QList>
0018 #include <QVector>
0019 
0020 namespace Kst {
0021 
0022 class ViewItem;
0023 
0024 struct AutoFormatEdges {
0025   int edge_number;
0026   qreal edge;
0027   bool left_or_top;
0028   ViewItem *item;
0029 };
0030 
0031 struct AutoFormatRC {
0032   int row;
0033   int row_span;
0034   int col;
0035   int col_span;
0036 };
0037 
0038 
0039 class FormatGridHelper
0040 {
0041 public:
0042   explicit FormatGridHelper(const QList<ViewItem*> &viewItems, bool protectLayout=true);
0043 
0044   QList<AutoFormatRC> rcList;
0045   QVector< QVector <int> > a;
0046   int n_rows;
0047   int n_cols;
0048   int numHoles();
0049   void getHole(int &row, int &col);
0050   void condense();
0051 };
0052 
0053 }
0054 #endif // FORMATGRIDHELPER_H