00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libetonyek project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 #ifndef KEYTABLE_H_INCLUDED 00011 #define KEYTABLE_H_INCLUDED 00012 00013 #include <deque> 00014 00015 #include "KEYObject.h" 00016 00017 namespace libetonyek 00018 { 00019 00020 class KEYTable 00021 { 00022 struct Cell 00023 { 00024 KEYObjectPtr_t content; 00025 unsigned columnSpan; 00026 unsigned rowSpan; 00027 bool covered; 00028 00029 Cell(); 00030 }; 00031 00032 typedef std::deque<Cell> Row_t; 00033 typedef std::deque<Row_t> Table_t; 00034 00035 public: 00036 typedef std::deque<double> ColumnSizes_t; 00037 typedef std::deque<double> RowSizes_t; 00038 00039 public: 00040 KEYTable(); 00041 00042 void setSizes(const ColumnSizes_t &columnSizes, const RowSizes_t &rowSizes); 00043 void insertCell(unsigned column, unsigned row, const KEYObjectPtr_t &content = KEYObjectPtr_t(), unsigned columnSpan = 1, unsigned rowSpan = 1); 00044 void insertCoveredCell(unsigned column, unsigned row); 00045 00046 void setGeometry(const KEYGeometryPtr_t &geometry); 00047 00048 void draw(const KEYOutput &output) const; 00049 00050 private: 00051 Table_t m_table; 00052 ColumnSizes_t m_columnSizes; 00053 RowSizes_t m_rowSizes; 00054 KEYGeometryPtr_t m_geometry; 00055 }; 00056 00057 KEYObjectPtr_t makeObject(const KEYTable &table); 00058 00059 } 00060 00061 #endif // KEYTABLE_H_INCLUDED 00062 00063 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */