1 //
2 // This file is part of libyacurs.
3 // Copyright (C) 2013  Rafael Ostertag
4 //
5 // This program is free software: you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program.  If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19 //
20 // $Id$
21 
22 #include <cassert>
23 #include <cstdlib>
24 
25 #include "hrule.h"
26 #include "yacursex.h"
27 
28 using namespace YACURS;
29 
30 //
31 // Private
32 //
33 
34 //
35 // Protected
36 //
37 
38 //
39 // Public
40 //
HRule()41 HRule::HRule() : Rule() {}
42 
~HRule()43 HRule::~HRule() {}
44 
size_available(const Size & s)45 void HRule::size_available(const Size& s) {
46     assert(s.rows() > 0);
47     WidgetBase::size_available(s);
48     _size = Size(1, s.cols());
49 }
50 
size_hint() const51 Size HRule::size_hint() const { return Size(1, 0); }
52 
refresh(bool immediate)53 void HRule::refresh(bool immediate) {
54     if (realization() != REALIZED && realization() != REALIZING) return;
55 
56     assert(widget_subwin() != 0);
57 
58     widget_subwin()->set_color(_color);
59     widget_subwin()->set_bg(_color);
60     widget_subwin()->hrule();
61 
62     Widget::refresh(immediate);
63 }
64