1
//--------------------------------------------------------------------------------------
2
// This file is part of the Lomse library.
3
// Copyright (c) 2010 Lomse project
5
// Lomse is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along
14
// with Lomse; if not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//-------------------------------------------------------------------------------------
21
#include "lomse_gm_basic.h"
25
//using namespace std;
30
//-------------------------------------------------------------------------------------
31
// Graphic model implementation
32
//-------------------------------------------------------------------------------------
34
GraphicModel::GraphicModel()
36
m_root = new GmoBoxDocument();
39
GraphicModel::~GraphicModel()
45
int GraphicModel::get_num_pages()
47
return m_root->get_num_pages();
52
//-------------------------------------------------------------------------------------
53
// Graphic model objects (shapes and boxes) implementation
54
//-------------------------------------------------------------------------------------
56
GmoObj::GmoObj(GmoObj* owner)
66
//-------------------------------------------------------------------------------------
68
//-------------------------------------------------------------------------------------
70
GmoBox* GmoBox::get_child_box(int i) //i = 0..n-1
72
if (i < get_num_children())
73
return m_childBoxes[i];
79
//-------------------------------------------------------------------------------------
81
//-------------------------------------------------------------------------------------
83
GmoBoxDocPage::GmoBoxDocPage(GmoObj* owner)
89
//-------------------------------------------------------------------------------------
91
//-------------------------------------------------------------------------------------
93
GmoBoxDocument::GmoBoxDocument()
99
GmoBoxDocPage* GmoBoxDocument::add_new_page()
101
GmoBoxDocPage* pPage = new GmoBoxDocPage(this);
102
pPage->set_number(get_num_pages()+1);
103
add_child_box(pPage);
107
GmoBoxDocPage* GmoBoxDocument::get_page(int i)
109
return dynamic_cast<GmoBoxDocPage*>(get_child_box(i));
113
//-------------------------------------------------------------------------------------
115
//-------------------------------------------------------------------------------------