LCOV - code coverage report
Current view: top level - gui/include/sketch - gui_sketch_result_list.inl (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.61.0_covts Lines: 0 39 0.0 %
Date: 2024-10-26 21:44:38 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* File: gui_sketch_result_list.inl; Copyright and License: see below */
       2             : 
       3             : #include "u8/u8_log.h"
       4             : 
       5           0 : static inline void gui_sketch_result_list_load_data( gui_sketch_result_list_t *this_,
       6             :                                                      const data_search_result_list_t *result_list,
       7             :                                                      data_database_reader_t *db_reader )
       8             : {
       9           0 :     assert( result_list != NULL );
      10           0 :     assert( db_reader != NULL );
      11           0 :     gui_sketch_result_list_invalidate_data( this_ );
      12           0 :     data_search_result_list_add_all( &((*this_).result_list), result_list );
      13           0 : }
      14             : 
      15           0 : static inline void gui_sketch_result_list_invalidate_data( gui_sketch_result_list_t *this_ )
      16             : {
      17           0 :     data_search_result_list_clear( &((*this_).result_list) );
      18             : 
      19             :     /* clear layout infos */
      20           0 :     assert( (*this_).element_count <= GUI_SKETCH_RESULT_LIST_MAX_ELEMENTS );
      21           0 :     for ( int ele_index = 0; ele_index < (*this_).element_count; ele_index ++ )
      22             :     {
      23           0 :         pos_search_result_destroy( &((*this_).element_pos[ele_index]) );
      24             :     }
      25           0 :     (*this_).element_count = 0;
      26           0 : }
      27             : 
      28             : static inline shape_int_rectangle_t gui_sketch_result_list_get_bounds( gui_sketch_result_list_t *this_ )
      29             : {
      30             :     return (*this_).bounds;
      31             : }
      32             : 
      33           0 : static inline void gui_sketch_result_list_set_bounds( gui_sketch_result_list_t *this_, shape_int_rectangle_t bounds )
      34             : {
      35           0 :     (*this_).bounds = bounds;
      36           0 : }
      37             : 
      38           0 : static inline bool gui_sketch_result_list_is_visible( gui_sketch_result_list_t *this_ )
      39             : {
      40           0 :     return (*this_).visible;
      41             : }
      42             : 
      43           0 : static inline void gui_sketch_result_list_set_visible( gui_sketch_result_list_t *this_, bool visible )
      44             : {
      45           0 :     (*this_).visible = visible;
      46           0 : }
      47             : 
      48           0 : static inline void gui_sketch_result_list_get_object_id_at_pos ( const gui_sketch_result_list_t *this_,
      49             :                                                                  int32_t x,
      50             :                                                                  int32_t y,
      51             :                                                                  data_id_t* out_selected_id,
      52             :                                                                  data_id_t* out_diagram_id )
      53             : {
      54           0 :     assert( out_selected_id != NULL );
      55           0 :     assert( out_diagram_id != NULL );
      56             : 
      57             :     /* default in case no object found */
      58             :     {
      59           0 :         data_id_init_void( out_selected_id );
      60           0 :         data_id_init_void( out_diagram_id );
      61             :     }
      62             : 
      63             :     /* search object */
      64           0 :     if ( shape_int_rectangle_contains( &((*this_).bounds), x, y ) )
      65             :     {
      66           0 :         const unsigned int count = (*this_).element_count;
      67           0 :         assert( count <= GUI_SKETCH_RESULT_LIST_MAX_ELEMENTS );
      68           0 :         for ( unsigned int idx = 0; idx < count; idx ++ )
      69             :         {
      70           0 :             const pos_search_result_t *const element = &((*this_).element_pos[idx]);
      71           0 :             const shape_int_rectangle_t *icon_box = pos_search_result_get_icon_box_const( element );
      72           0 :             const shape_int_rectangle_t *label_box = pos_search_result_get_label_box_const( element );
      73             : 
      74           0 :             if ( shape_int_rectangle_contains( icon_box, x, y ) || shape_int_rectangle_contains( label_box, x, y ) )
      75             :             {
      76           0 :                 const data_search_result_t *const at_pos = pos_search_result_get_data_const( element );
      77           0 :                 data_id_copy( out_selected_id, data_search_result_get_match_id_const( at_pos ) );
      78           0 :                 data_id_copy( out_diagram_id, data_search_result_get_diagram_id_const( at_pos ) );
      79           0 :                 break;
      80             :             }
      81             :         }
      82             :     }
      83           0 : }
      84             : 
      85             : static inline const pos_search_result_t *gui_sketch_result_list_get_element_pos_const ( const gui_sketch_result_list_t *this_,
      86             :                                                                                         uint32_t index )
      87             : {
      88             :     assert( index < (*this_).element_count );
      89             :     return &((*this_).element_pos[index]);
      90             : }
      91             : 
      92             : static inline uint32_t gui_sketch_result_list_get_element_count ( const gui_sketch_result_list_t *this_ )
      93             : {
      94             :     assert( (*this_).element_count <= GUI_SKETCH_RESULT_LIST_MAX_ELEMENTS );
      95             :     return (*this_).element_count;
      96             : }
      97             : 
      98             : 
      99             : /*
     100             : Copyright 2018-2024 Andreas Warnke
     101             : 
     102             : Licensed under the Apache License, Version 2.0 (the "License");
     103             : you may not use this file except in compliance with the License.
     104             : You may obtain a copy of the License at
     105             : 
     106             :     http://www.apache.org/licenses/LICENSE-2.0
     107             : 
     108             : Unless required by applicable law or agreed to in writing, software
     109             : distributed under the License is distributed on an "AS IS" BASIS,
     110             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     111             : See the License for the specific language governing permissions and
     112             : limitations under the License.
     113             : */

Generated by: LCOV version 1.16