Line data Source code
1 : /* File: pos_nav_tree_node.inl; Copyright and License: see below */ 2 : 3 : #include <assert.h> 4 : 5 15 : static inline void pos_nav_tree_node_init ( pos_nav_tree_node_t *this_, 6 : pos_nav_tree_node_type_t node_type, 7 : const data_diagram_t *diagram_data ) 8 : { 9 15 : shape_int_rectangle_init_empty( &((*this_).icon_box) ); 10 15 : shape_int_rectangle_init_empty( &((*this_).label_box) ); 11 15 : (*this_).node_type = node_type; 12 15 : (*this_).data = diagram_data; 13 15 : } 14 : 15 15 : static inline void pos_nav_tree_node_destroy ( pos_nav_tree_node_t *this_ ) 16 : { 17 15 : shape_int_rectangle_destroy( &((*this_).icon_box) ); 18 15 : shape_int_rectangle_destroy( &((*this_).label_box) ); 19 15 : (*this_).data = NULL; 20 15 : } 21 : 22 : static inline bool pos_nav_tree_node_is_valid ( const pos_nav_tree_node_t *this_ ) 23 : { 24 : bool result; 25 : if ( (*this_).data == NULL ) 26 : { 27 : assert(false); 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 160 : static inline const shape_int_rectangle_t *pos_nav_tree_node_get_icon_box_const ( const pos_nav_tree_node_t *this_ ) 38 : { 39 160 : return &((*this_).icon_box); 40 : } 41 : 42 15 : static inline void pos_nav_tree_node_set_icon_box ( pos_nav_tree_node_t *this_, const shape_int_rectangle_t *icon_box ) 43 : { 44 15 : shape_int_rectangle_replace( &((*this_).icon_box), icon_box ); 45 15 : } 46 : 47 130 : static inline const shape_int_rectangle_t *pos_nav_tree_node_get_label_box_const ( const pos_nav_tree_node_t *this_ ) 48 : { 49 130 : return &((*this_).label_box); 50 : } 51 : 52 15 : static inline void pos_nav_tree_node_set_label_box ( pos_nav_tree_node_t *this_, const shape_int_rectangle_t *label_box ) 53 : { 54 15 : shape_int_rectangle_replace( &((*this_).label_box), label_box ); 55 15 : } 56 : 57 30 : static inline pos_nav_tree_node_type_t pos_nav_tree_node_get_type ( const pos_nav_tree_node_t *this_ ) 58 : { 59 30 : return (*this_).node_type; 60 : } 61 : 62 30 : static inline const data_diagram_t *pos_nav_tree_node_get_data_const ( const pos_nav_tree_node_t *this_ ) 63 : { 64 30 : return (*this_).data; 65 : } 66 : 67 : static inline data_row_id_t pos_nav_tree_node_get_diagram_id ( const pos_nav_tree_node_t *this_ ) 68 : { 69 : return data_diagram_get_row_id( (*this_).data ); 70 : } 71 : 72 : 73 : /* 74 : Copyright 2021-2024 Andreas Warnke 75 : 76 : Licensed under the Apache License, Version 2.0 (the "License"); 77 : you may not use this file except in compliance with the License. 78 : You may obtain a copy of the License at 79 : 80 : http://www.apache.org/licenses/LICENSE-2.0 81 : 82 : Unless required by applicable law or agreed to in writing, software 83 : distributed under the License is distributed on an "AS IS" BASIS, 84 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 85 : See the License for the specific language governing permissions and 86 : limitations under the License. 87 : */