Line data Source code
1 : /* File: gui_simple_message_to_user.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include "u8/u8_log.h" 5 : #include <assert.h> 6 : 7 0 : static inline gui_simple_message_type_t gui_simple_message_to_user_get_type_id( gui_simple_message_to_user_t *this_ ) 8 : { 9 0 : return (*this_).type_id; 10 : } 11 : 12 0 : static inline void gui_simple_message_to_user_private_set_icon_image ( gui_simple_message_to_user_t *this_, gui_simple_message_type_t type_id ) 13 : { 14 0 : switch ( type_id ) 15 : { 16 0 : case GUI_SIMPLE_MESSAGE_TYPE_NO_MESSAGE: 17 : { 18 0 : assert(false); /* should not happen */ 19 : } 20 : break; 21 : 22 0 : case GUI_SIMPLE_MESSAGE_TYPE_INFO: 23 : { 24 0 : GdkPaintable *info = GDK_PAINTABLE( gui_resources_get_message_info( (*this_).res) ); 25 0 : gtk_image_set_from_paintable( GTK_IMAGE( (*this_).icon_image ), info ); 26 : } 27 0 : break; 28 : 29 0 : case GUI_SIMPLE_MESSAGE_TYPE_WARNING: 30 : { 31 0 : GdkPaintable *warning = GDK_PAINTABLE( gui_resources_get_message_warn( (*this_).res) ); 32 0 : gtk_image_set_from_paintable( GTK_IMAGE( (*this_).icon_image ), warning ); 33 : } 34 0 : break; 35 : 36 0 : case GUI_SIMPLE_MESSAGE_TYPE_ERROR: 37 : { 38 0 : GdkPaintable *error = GDK_PAINTABLE( gui_resources_get_message_error( (*this_).res) ); 39 0 : gtk_image_set_from_paintable( GTK_IMAGE( (*this_).icon_image ), error ); 40 : } 41 0 : break; 42 : 43 0 : case GUI_SIMPLE_MESSAGE_TYPE_ABOUT: 44 : { 45 0 : GdkPaintable *about = GDK_PAINTABLE( gui_resources_get_crystal_facet_uml( (*this_).res) ); 46 0 : gtk_image_set_from_paintable( GTK_IMAGE( (*this_).icon_image ), about ); 47 : } 48 0 : break; 49 : 50 0 : default: 51 : { 52 0 : U8_LOG_ERROR("unexptected gui_simple_message_type_t"); 53 0 : assert(false); /* should not happen */ 54 : } 55 : } 56 0 : } 57 : 58 : 59 : /* 60 : Copyright 2016-2024 Andreas Warnke 61 : 62 : Licensed under the Apache License, Version 2.0 (the "License"); 63 : you may not use this file except in compliance with the License. 64 : You may obtain a copy of the License at 65 : 66 : http://www.apache.org/licenses/LICENSE-2.0 67 : 68 : Unless required by applicable law or agreed to in writing, software 69 : distributed under the License is distributed on an "AS IS" BASIS, 70 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 71 : See the License for the specific language governing permissions and 72 : limitations under the License. 73 : */