Debian Codegraph @

pencil/include/layout/layout_diagram.inl

raw
1 /* File: layout_diagram.inl; Copyright and License: see below */
2
3 #include <assert.h>
4
5 static inline void layout_diagram_init ( layout_diagram_t *this_, const data_diagram_t *diagram_data )
6 {
7 assert ( NULL != diagram_data );
8
9 geometry_rectangle_init_empty( &((*this_).bounds) );
10 geometry_rectangle_init_empty( &((*this_).draw_area) );
11 geometry_rectangle_init_empty( &((*this_).label_box) );
12 (*this_).data = diagram_data;
13 }
14
15 static inline void layout_diagram_destroy ( layout_diagram_t *this_ )
16 {
17 geometry_rectangle_destroy( &((*this_).bounds) );
18 geometry_rectangle_destroy( &((*this_).draw_area) );
19 geometry_rectangle_destroy( &((*this_).label_box) );
20 (*this_).data = NULL;
21 }
22
23 static inline bool layout_diagram_is_valid ( const layout_diagram_t *this_ )
24 {
25 bool result;
26 if ( (*this_).data == NULL )
27 {
28 result = false; /* cannot happen on initialized objects */
29 }
30 else
31 {
32 result = data_diagram_is_valid( (*this_).data );
33 }
34 return result;
35 }
36
37 static inline const geometry_rectangle_t *layout_diagram_get_bounds_const ( const layout_diagram_t *this_ )
38 {
39 return &((*this_).bounds);
40 }
41
42 static inline void layout_diagram_set_bounds ( layout_diagram_t *this_, const geometry_rectangle_t *diagram_bounds )
43 {
44 geometry_rectangle_replace( &((*this_).bounds), diagram_bounds );
45 }
46
47 static inline const geometry_rectangle_t *layout_diagram_get_draw_area_const ( const layout_diagram_t *this_ )
48 {
49 return &((*this_).draw_area);
50 }
51
52 static inline void layout_diagram_set_draw_area ( layout_diagram_t *this_, const geometry_rectangle_t *diagram_draw_area )
53 {
54 geometry_rectangle_replace( &((*this_).draw_area), diagram_draw_area );
55 }
56
57 static inline const geometry_rectangle_t *layout_diagram_get_label_box_const ( const layout_diagram_t *this_ )
58 {
59 return &((*this_).label_box);
60 }
61
62 static inline void layout_diagram_set_label_box ( layout_diagram_t *this_, const geometry_rectangle_t *label_box )
63 {
64 geometry_rectangle_replace( &((*this_).label_box), label_box );
65 }
66
67 static inline const data_diagram_t *layout_diagram_get_data_const ( const layout_diagram_t *this_ )
68 {
69 assert ( NULL != (*this_).data );
70 return (*this_).data;
71 }
72
73 static inline data_row_t layout_diagram_get_diagram_id ( const layout_diagram_t *this_ )
74 {
75 return data_diagram_get_row_id( (*this_).data );
76 }
77
78
79 /*
80 Copyright 2018-2026 Andreas Warnke
81
82 Licensed under the Apache License, Version 2.0 (the "License");
83 you may not use this file except in compliance with the License.
84 You may obtain a copy of the License at
85
86 http://www.apache.org/licenses/LICENSE-2.0
87
88 Unless required by applicable law or agreed to in writing, software
89 distributed under the License is distributed on an "AS IS" BASIS,
90 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
91 See the License for the specific language governing permissions and
92 limitations under the License.
93 */