1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** GUIX Component */ 17 /** */ 18 /** Scrollbar Management (Scrollbar) */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 /* Include necessary system files. */ 25 26 #include "gx_api.h" 27 #include "gx_system.h" 28 #include "gx_scrollbar.h" 29 30 /**************************************************************************/ 31 /* */ 32 /* FUNCTION RELEASE */ 33 /* */ 34 /* _gx_scrollbar_value_set PORTABLE C */ 35 /* 6.1 */ 36 /* AUTHOR */ 37 /* */ 38 /* Kenneth Maxwell, Microsoft Corporation */ 39 /* */ 40 /* DESCRIPTION */ 41 /* */ 42 /* This service resets the scrollbar. */ 43 /* */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* scrollbar Scrollbar control block */ 48 /* value New scrollbar value */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* status Completion status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _gx_scrollbar_limit_check Check value limits */ 57 /* _gx_scrollbar_thumb_position_calculate */ 58 /* Calculate the scrollbar thumb */ 59 /* position */ 60 /* _gx_system_dirty_mark Mark system block dirty */ 61 /* */ 62 /* CALLED BY */ 63 /* */ 64 /* Application Code */ 65 /* */ 66 /* RELEASE HISTORY */ 67 /* */ 68 /* DATE NAME DESCRIPTION */ 69 /* */ 70 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 71 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 72 /* resulting in version 6.1 */ 73 /* */ 74 /**************************************************************************/ _gx_scrollbar_value_set(GX_SCROLLBAR * scrollbar,INT value)75UINT _gx_scrollbar_value_set(GX_SCROLLBAR *scrollbar, INT value) 76 { 77 GX_EVENT newevent; 78 INT old_value; 79 80 old_value = scrollbar -> gx_scrollbar_info.gx_scroll_value; 81 82 scrollbar -> gx_scrollbar_info.gx_scroll_value = value; 83 _gx_scrollbar_limit_check(scrollbar); 84 85 if (old_value != scrollbar ->gx_scrollbar_info.gx_scroll_value) 86 { 87 _gx_scrollbar_thumb_position_calculate(scrollbar); 88 89 newevent.gx_event_payload.gx_event_intdata[0] = scrollbar -> gx_scrollbar_info.gx_scroll_value; 90 newevent.gx_event_payload.gx_event_intdata[1] = old_value; 91 newevent.gx_event_sender = scrollbar -> gx_widget_id; 92 93 if (scrollbar -> gx_widget_style & GX_SCROLLBAR_VERTICAL) 94 { 95 newevent.gx_event_type = GX_EVENT_VERTICAL_SCROLL; 96 } 97 else 98 { 99 newevent.gx_event_type = GX_EVENT_HORIZONTAL_SCROLL; 100 } 101 newevent.gx_event_target = scrollbar -> gx_widget_parent; 102 _gx_system_event_send(&newevent); 103 104 if (scrollbar -> gx_widget_status & GX_STATUS_VISIBLE) 105 { 106 _gx_system_dirty_mark((GX_WIDGET *)scrollbar); 107 } 108 } 109 return(GX_SUCCESS); 110 } 111 112