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