2
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; version 2 of the
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
#include "../lf_mforms.h"
21
#include "../lf_splitter.h"
23
mforms::gtk::SplitterImpl::SplitterImpl(::mforms::Splitter *self, bool horiz)
27
_paned= new Gtk::HPaned();
29
_paned= new Gtk::VPaned();
33
bool mforms::gtk::SplitterImpl::create(::mforms::Splitter *self, bool horiz)
35
return new SplitterImpl(self, horiz);
38
void mforms::gtk::SplitterImpl::add(Splitter *self, View *child, int minwidth)
40
SplitterImpl *splitview= self->get_data<SplitterImpl>();
42
if (!splitview->_paned->get_child1())
43
splitview->_paned->pack1(*child->get_data<ViewImpl>()->get_outer(), true, true);
45
splitview->_paned->pack2(*child->get_data<ViewImpl>()->get_outer(), true, true);
48
void mforms::gtk::SplitterImpl::remove(Splitter *self, View *child)
50
SplitterImpl *splitview= self->get_data<SplitterImpl>();
52
splitview->_paned->remove(*child->get_data<ViewImpl>()->get_outer());
55
void mforms::gtk::SplitterImpl::set_position(Splitter *self, int pos)
57
SplitterImpl *splitview= self->get_data<SplitterImpl>();
59
splitview->_paned->set_position(pos);
62
int mforms::gtk::SplitterImpl::get_position(Splitter *self)
64
SplitterImpl *splitview= self->get_data<SplitterImpl>();
66
return splitview->_paned->get_position();
69
void mforms::gtk::SplitterImpl::set_expanded(Splitter *self, bool first, bool expand)
71
SplitterImpl *sv = self->get_data<SplitterImpl>();
75
Gtk::Widget* child = first ? sv->_paned->get_child1() : sv->_paned->get_child2();
86
void mforms::gtk::SplitterImpl::init()
88
::mforms::ControlFactory *f = ::mforms::ControlFactory::get_instance();
90
f->_splitter_impl.create= &SplitterImpl::create;
91
f->_splitter_impl.add= &SplitterImpl::add;
92
f->_splitter_impl.remove= &SplitterImpl::remove;
93
f->_splitter_impl.set_position= &SplitterImpl::set_position;
94
f->_splitter_impl.get_position= &SplitterImpl::get_position;
95
f->_splitter_impl.set_expanded= &SplitterImpl::set_expanded;
98
mforms::gtk::SplitterImpl::~SplitterImpl()