guit
0.1
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Typedefs
Enumerations
Friends
props
gmargin.hpp
1
//
2
// Margins
3
// Guit GUI Toolkit
4
// Copyright © 2019/2020 Eric Lecolinet. All rights reserved.
5
// http://www.telecom-paris.fr/~elc
6
//
7
8
#ifndef GuitMargin_hpp
9
#define GuitMargin_hpp
10
#include <gvarprop.hpp>
11
namespace
guit {
12
13
class
GMarginValue {
14
public
:
15
GMarginValue();
16
GMarginValue(
float
left,
float
right,
float
top,
float
bottom);
17
18
bool
operator==(GMarginValue
const
&)
const
;
19
bool
operator!=(GMarginValue
const
&)
const
;
20
21
float
left, right, top, bottom;
22
};
23
24
inline
bool
gconvert(GMarginValue
const
& from, GMarginValue& to) {to = from;
return
true
;}
25
bool
gconvert(GString
const
& from, GMarginValue& to);
26
bool
gconvert(GMarginValue
const
& from, GString& to);
27
28
30
class
GMargin
:
public
GVarProp_
<GMarginValue> {
31
public
:
32
using
Super
=
GVarProp_<GMarginValue>
;
33
34
GMargin
();
35
40
explicit
GMargin
(GString
const
&
value
);
41
43
GMargin
(
float
left_right,
float
top_bottom);
44
46
GMargin
(
float
left,
float
right,
float
top,
float
bottom);
47
48
explicit
GMargin
(GMarginValue
const
&);
49
50
GMargin
*
clone
(
bool
copy_value)
const override
;
51
52
float
left()
const
{
return
value_.left;}
53
float
right()
const
{
return
value_.right;}
54
float
top()
const
{
return
value_.top;}
55
float
bottom()
const
{
return
value_.bottom;}
56
57
using
GType
=
GPropType_<GMargin,GProp>
;
58
static
GType
& Type();
59
GType
& type()
const override
{
return
Type();}
60
61
protected
:
62
friend
class
GRender;
63
void
updateGadget(
Gadget
&)
override
;
64
void
apply(
Gadget
*, GRender&,
Specif
)
override
;
65
};
66
69
inline
GMargin
& Margin() {
return
*
new
GMargin
();}
70
inline
GMargin& Margin(GString
const
& value) {
return
*
new
GMargin(value);}
72
73
}
74
#endif
Generated on Thu Feb 25 2021 16:42:45 for guit by
1.8.4