1
0
mirror of https://github.com/azure-rtos/guix.git synced 2025-01-14 06:43:20 +08:00

Initial commit

This commit is contained in:
PProvost 2020-05-11 08:48:55 -06:00
commit 824be64444
1251 changed files with 218808 additions and 0 deletions

40
.gitattributes vendored Normal file
View File

@ -0,0 +1,40 @@
.git* export-ignore
.hooks* export-ignore
# Custom attribute to mark sources as using our C code style.
[attr]our-c-style whitespace=tab-in-indent eol=lf format.clang-format-6.0
# Custom attribute to mark sources as generated.
# Do not perform whitespace checks. Do not format.
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format-6.0
bootstrap eol=lf
configure eol=lf
*.[1-9] eol=lf
*.bash eol=lf
*.sh eol=lf
*.sh.in eol=lf
*.bat eol=crlf
*.bat.in eol=crlf
*.sln eol=crlf
*.vcproj eol=crlf
*.pfx -text
*.png -text
*.png.in -text
*.c our-c-style
*.cc our-c-style
*.cpp our-c-style
*.cu our-c-style
*.cxx our-c-style
*.h our-c-style
*.hh our-c-style
*.hpp our-c-style
*.hxx our-c-style
*.notcu our-c-style
*.cmake whitespace=tab-in-indent
*.rst whitespace=tab-in-indent conflict-marker-size=79
*.txt whitespace=tab-in-indent

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
.vscode/
_deps/
build/
CMakeFiles/
CMakeScripts/
CMakeLists.txt.user
CMakeCache.txt
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

49
CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
# Set up the project
project(guix
VERSION 6.0.0
LANGUAGES C ASM
)
if(NOT DEFINED THREADX_ARCH)
message(FATAL_ERROR "Error: THREADX_ARCH not defined")
endif()
if(NOT DEFINED THREADX_TOOLCHAIN)
message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
endif()
# Define our target library and an alias for consumers
add_library(${PROJECT_NAME})
add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
# Define any required dependencies between this library and others
target_link_libraries(${PROJECT_NAME} PUBLIC
"azrtos::threadx"
)
# A place for generated/copied include files (no need to change)
set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
# Pick up the port specific stuff first
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
# Then the common files
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
# Include the user's override file if required
if (NOT GX_USER_FILE)
message(STATUS "Using default gx_user.h file")
set(GX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/gx_user_sample.h)
else()
message(STATUS "Using custom gx_user.h file from ${GX_USER_FILE}")
endif()
configure_file(${GX_USER_FILE} ${CUSTOM_INC_DIR}/gx_user.h COPYONLY)
target_include_directories(${PROJECT_NAME}
PUBLIC
${CUSTOM_INC_DIR}
)
target_compile_definitions(${PROJECT_NAME} PUBLIC "GX_INCLUDE_USER_DEFINE_FILE" )

246
LICENSE.txt Normal file
View File

@ -0,0 +1,246 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT AZURE RTOS
Shape
These license terms are an agreement between you and Microsoft Corporation (or
one of its affiliates). They apply to the software named above and any Microsoft
services or software updates (except to the extent such services or updates are
accompanied by new or additional terms, in which case those different terms
apply prospectively and do not alter your or Microsofts rights relating to
pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU
HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS.
INSTALLATION AND USE RIGHTS.
General. You may install and use the software and the included Microsoft
applications solely for internal development, testing and evaluation purposes.
Any distribution or production use requires a separate license as set forth in
Section 2.
Contributions. Microsoft welcomes contributions to this software. In the event
that you make a contribution to this software you will be required to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and
actually do, grant Microsoft the rights to use your contribution. For details,
visit https://cla.microsoft.com.
Included Microsoft Applications. The software includes other Microsoft
applications which are governed by the licenses embedded in or made available
with those applications.
Third Party Components. The software may include third party components with
separate legal notices or governed by other agreements, as may be described
within the software or in the ThirdPartyNotices file(s) accompanying the
software.
Competitive Benchmarking. If you are a direct competitor, and you access or use
the software for purposes of competitive benchmarking, analysis, or intelligence
gathering, you waive as against Microsoft, its subsidiaries, and its affiliated
companies (including prospectively) any competitive use, access, and
benchmarking test restrictions in the terms governing your software to the
extent your terms of use are, or purport to be, more restrictive than
Microsofts terms. If you do not waive any such purported restrictions in the
terms governing your software, you are not allowed to access or use this
software, and will not do so.
DISTRIBUTION AND PRODUCTION USE. If you have obtained and/or are developing on
microprocessor(s) and/or microcontroller(s) (“hardware”) listed in the file
named “LICENSED-HARDWARE.txt” included in the repository and/or distributed with
the software you have the following rights in and to the software solely when
used in combination with the hardware. In the event hardware is not listed in
the LICENSED-HARDWARE.txt file, you do not have the rights in this Section 2.
Distribution and Production Use Rights.
You may use the software in production (e.g. program the modified or unmodified
software to devices you own or control) and distribute (i.e. make available to
third parties) the modified or unmodified binary image produced from this code.
You may permit your device distributors or developers to copy and distribute the
binary image as programmed or to be programmed to your devices.
You may redistribute the unmodified or modified source to your device
distributors or developers. Modifications must be clearly marked. Any
redistribution in source code form must contain this license and any other
licenses that accompany the software.
Requirements. For any code you distribute, you must:
when distributed in binary form, except as embedded in a device, include with
such distribution the terms of this agreement;
when distributed in source code form to distributors or developers of your
devices, include with such distribution the terms of this agreement; and
indemnify, defend and hold harmless Microsoft from any claims, including
attorneys fees, related to the distribution or use of your devices, except to
the extent that any claim is based solely on the unmodified software.
Restrictions. You may not:
use or modify the software to create a competing real time operating system
software;
remove any copyright notices or licenses contained in the software;
use Microsofts trademarks or trade dress in your application in any way that
suggests your device or application comes from or is endorsed by Microsoft;
transfer individual components, specific libraries, classes, functions or code
fragments of the software separately for purposes unrelated to the software; or
use or distribute the software in any way that would subject the software or
Microsofts intellectual property or technology to any other license terms.
SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all
other rights. Unless applicable law gives you more rights despite this
limitation, you will not (and have no right to):
remove, minimize, block, or modify any notices of Microsoft or its suppliers in
the software;
use the software in any way that is against the law or to create or propagate
malware; or
share, publish, distribute, or lease the software (except as permitted in
Section 2 above), or provide the software as a stand-alone offering for others
to use.
DATA. This software may interact with other Microsoft products that collect data
that is transmitted to Microsoft. To learn more about how Microsoft processes
personal data we collect, please see the Microsoft Privacy Statement at
https://go.microsoft.com/fwlink/?LinkId=248681.
EXPORT RESTRICTIONS. You must comply with all domestic and international export
laws and regulations that apply to the software, which include restrictions on
destinations, end users, and end use. For further information on export
restrictions, visit https://aka.ms/exporting.
SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any
support services for the software. Any support provided is “as is”, “with all
faults”, and without warranty of any kind.
UPDATES. Microsoft may periodically update the software. You may obtain updates
only from Microsoft or Microsoft-authorized sources. Updates may not include or
support all existing software features, services, or peripheral devices.
TERMINATION. Without prejudice to any other rights, Microsoft may terminate this
agreement if you fail to comply with any of its terms or conditions. In such
event, you must destroy all copies of the software and all of its component
parts.
ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for
supplements, updates, or third-party applications, is the entire agreement for
the software. To the extent you have entered into a separate agreement with
Microsoft relating specifically to the software, the terms in such agreement
shall control.
APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in
the United States or Canada, the laws of the state or province where you live
(or, if a business, where your principal place of business is located) govern
the interpretation of this agreement, claims for its breach, and all other
claims (including consumer protection, unfair competition, and tort claims),
regardless of conflict of laws principles. If you acquired the software in any
other country, its laws apply. If U.S. federal jurisdiction exists, you and
Microsoft consent to exclusive jurisdiction and venue in the federal court in
King County, Washington for all disputes heard in court. If not, you and
Microsoft consent to exclusive jurisdiction and venue in the Superior Court of
King County, Washington for all disputes heard in court.
CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal
rights. You may have other rights, including consumer rights, under the laws of
your state or country. Separate and apart from your relationship with Microsoft,
you may also have rights with respect to the party from which you acquired the
software. This agreement does not change those other rights if the laws of your
state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the
following provisions apply to you:
Australia. You have statutory guarantees under the Australian Consumer Law and
nothing in this agreement is intended to affect those rights.
Germany and Austria.
i.Warranty. The properly licensed software will perform substantially as
described in any Microsoft materials that accompany the software. However,
Microsoft gives no contractual guarantee in relation to the licensed software.
ii.Limitation of Liability. In case of intentional conduct, gross negligence,
claims based on the Product Liability Act, as well as, in case of death or
personal or physical injury, Microsoft is liable according to the statutory law.
Subject to the foregoing clause ii., Microsoft will only be liable for slight
negligence if Microsoft is in breach of such material contractual obligations,
the fulfillment of which facilitate the due performance of this agreement, the
breach of which would endanger the purpose of this agreement and the compliance
with which a party may constantly trust in (so-called "cardinal obligations").
In other cases of slight negligence, Microsoft will not be liable for slight
negligence.
DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO
THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED
WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT.
LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING
DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM
MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT
RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL,
INDIRECT, OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services,
content (including code) on third party Internet sites, or third party
applications; and (b) claims for breach of contract, warranty, guarantee, or
condition; strict liability, negligence, or other tort; or any other claim; in
each case to the extent permitted by applicable law.
It also applies even if Microsoft knew or should have known about the
possibility of the damages. The above limitation or exclusion may not apply to
you because your state, province, or country may not allow the exclusion or
limitation of incidental, consequential, or other damages.
Please note: As this software is distributed in Canada, some of the clauses in
this agreement are provided below in French.
Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce
contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel
». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft
naccorde aucune autre garantie expresse. Vous pouvez bénéficier de droits
additionnels en vertu du droit local sur la protection des consommateurs, que ce
contrat ne peut modifier. La ou elles sont permises par le droit locale, les
garanties implicites de qualité marchande, dadéquation à un usage particulier
et dabsence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES
DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une
indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous
ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris
les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne:
•tout ce qui est relié au logiciel, aux services ou au contenu (y compris le
code) figurant sur des sites Internet tiers ou dans des programmes tiers; et
•les réclamations au titre de violation de contrat ou de garantie, ou au titre
de responsabilité stricte, de négligence ou dune autre faute dans la limite
autorisée par la loi en vigueur.
Elle sapplique également, même si Microsoft connaissait ou devrait connaître
léventualité dun tel dommage. Si votre pays nautorise pas lexclusion ou la
limitation de responsabilité pour les dommages indirects, accessoires ou de
quelque nature que ce soit, il se peut que la limitation ou lexclusion
ci-dessus ne sappliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous
pourriez avoir dautres droits prévus par les lois de votre pays. Le présent
contrat ne modifie pas les droits que vous confèrent les lois de votre pays si
celles-ci ne le permettent pas.

16
LICENSED-HARDWARE.txt Normal file
View File

@ -0,0 +1,16 @@
LICENSED HARDWARE LIST
Last Updated: 2020-05-08
Microsoft has entered into OEM Agreements with manufacturers of the following
microprocessors and microcontrollers (the “hardware”) to enable those
manufacturers to include and distribute Azure RTOS in certain hardware. If you
have obtained and/or are developing on microprocessor(s) and/or
microcontroller(s) (“hardware”) listed below you inherit the “Distribution and
Production Use” rights in Section 2 of the Microsoft Software License Terms for
Microsoft Azure RTOS. If hardware is not listed below, you do not have those
rights.
--------------------------------------------------------------------------------
More coming soon. Please check back frequently for updates.

1
README.md Normal file
View File

@ -0,0 +1 @@
# GuiX

1
TODO Normal file
View File

@ -0,0 +1 @@
TODO:

1212
common/CMakeLists.txt Executable file

File diff suppressed because it is too large Load Diff

89
common/inc/gx_animation.h Normal file
View File

@ -0,0 +1,89 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_animation.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX animation component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_ANIMATION_H
#define GX_ANIMATION_H
#define GX_ANIMATION_SLIDE_LEFT 0x0001
#define GX_ANIMATION_SLIDE_RIGHT 0x0002
#define GX_ANIMATION_SLIDE_UP 0x0040
#define GX_ANIMATION_SLIDE_DOWN 0x0080
#define GX_ANIMATION_SLIDE_TIMER 1000
#define GX_ANIMATION_MIN_SLIDING_DIST 5
/* Define animation management function prototypes. */
UINT _gx_animation_create(GX_ANIMATION *animation);
UINT _gx_animation_canvas_define(GX_ANIMATION *animation, GX_CANVAS *canvas);
VOID _gx_animation_complete_event_send(GX_ANIMATION *animation);
UINT _gx_animation_start(GX_ANIMATION *animation, GX_ANIMATION_INFO *info);
UINT _gx_animation_stop(GX_ANIMATION *animation);
VOID _gx_animation_update(VOID);
VOID _gx_animation_complete(GX_ANIMATION *animation);
UINT _gx_animation_drag_disable(GX_ANIMATION *animation, GX_WIDGET *widget);
UINT _gx_animation_drag_enable(GX_ANIMATION *animation, GX_WIDGET *widget, GX_ANIMATION_INFO *info);
UINT _gx_animation_drag_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr);
UINT _gx_animation_drag_tracking(GX_ANIMATION *animation, GX_POINT penpos);
UINT _gx_animation_drag_tracking_start(GX_ANIMATION *animation, GX_POINT penpos);
UINT _gx_animation_slide_landing(GX_ANIMATION *animation);
UINT _gx_animation_landing_speed_set(GX_ANIMATION *animation, USHORT shift_per_step);
UINT _gx_animation_slide_landing_start(GX_ANIMATION *animation);
/* error checking versions of the animation API functions */
UINT _gxe_animation_create(GX_ANIMATION *animation);
UINT _gxe_animation_canvas_define(GX_ANIMATION *animation, GX_CANVAS *canvas);
UINT _gxe_animation_drag_disable(GX_ANIMATION *animation, GX_WIDGET *widget);
UINT _gxe_animation_drag_enable(GX_ANIMATION *animation, GX_WIDGET *widget, GX_ANIMATION_INFO *info);
UINT _gxe_animation_start(GX_ANIMATION *animation, GX_ANIMATION_INFO *info);
UINT _gxe_animation_stop(GX_ANIMATION *animation);
UINT _gxe_animation_landing_speed_set(GX_ANIMATION *animation, USHORT shift_per_step);
#endif

5604
common/inc/gx_api.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Binres Loader Management (Binres Loader) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_binres_loader.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX binres loader component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_BINRES_LOADER_H
#define GX_BINRES_LOADER_H
#define GX_BINRES_VERSION_ADD_STRING_LENGTH 50600
#ifdef GX_BINARY_RESOURCE_SUPPORT
typedef struct GX_BINRES_DATA_INFO_STRUCT
{
GX_UBYTE *gx_binres_root_address;
UINT gx_binres_read_offset;
GX_UBYTE *gx_binres_buffer;
UINT gx_binres_buffer_size;
UINT gx_binres_buffer_index;
} GX_BINRES_DATA_INFO;
/* Define utility component function prototypes. */
UINT _gx_binres_language_count_get(GX_UBYTE *root_address, GX_VALUE *put_count);
UINT _gx_binres_language_info_load(GX_UBYTE *root_address, GX_LANGUAGE_HEADER *put_info);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_binres_language_table_load(GX_UBYTE *root_address, GX_UBYTE ****returned_language_table);
#endif
UINT _gx_binres_language_table_load_ext(GX_UBYTE *root_address, GX_STRING ***returned_language_table);
UINT _gx_binres_theme_load(GX_UBYTE *root_address, INT theme_id, GX_THEME **returned_theme);
UINT _gx_binres_resource_header_load(GX_BINRES_DATA_INFO *info, GX_RESOURCE_HEADER *header);
UINT _gx_binres_string_header_load(GX_BINRES_DATA_INFO *info, GX_STRING_HEADER *header);
UINT _gx_binres_language_header_load(GX_BINRES_DATA_INFO *info, GX_LANGUAGE_HEADER *header);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_binres_language_count_get(GX_UBYTE *root_address, GX_VALUE *put_count);
UINT _gxe_binres_language_info_load(GX_UBYTE *root_address, GX_LANGUAGE_HEADER *put_info);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_binres_language_table_load(GX_UBYTE *root_address, GX_UBYTE ****returned_language_table);
#endif
UINT _gxe_binres_language_table_load_ext(GX_UBYTE *root_address, GX_STRING ***returned_language_table);
UINT _gxe_binres_theme_load(GX_UBYTE *root_address, INT theme_id, GX_THEME **returned_theme);
#endif
#endif

197
common/inc/gx_button.h Normal file
View File

@ -0,0 +1,197 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_button.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX button management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_BUTTON_H
#define GX_BUTTON_H
/* Define button management function prototypes. */
UINT _gx_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
VOID _gx_button_background_draw(GX_BUTTON *button);
UINT _gx_button_deselect(GX_BUTTON *button, GX_BOOL generate_event);
VOID _gx_button_draw(GX_BUTTON *button);
UINT _gx_button_event_process(GX_BUTTON *button, GX_EVENT *event_ptr);
VOID _gx_button_siblings_deselect(GX_BUTTON *button);
UINT _gx_button_select(GX_BUTTON *button);
UINT _gx_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT checkbox_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_checkbox_draw(GX_CHECKBOX *checkbox);
UINT _gx_checkbox_event_process(GX_CHECKBOX *checkbox, GX_EVENT *event_ptr);
UINT _gx_checkbox_pixelmap_set(GX_CHECKBOX *button, GX_RESOURCE_ID unchecked_id, GX_RESOURCE_ID checked_id,
GX_RESOURCE_ID unchecked_disabled_id, GX_RESOURCE_ID checked_disabled_id);
UINT _gx_checkbox_select(GX_CHECKBOX *checkbox);
UINT _gx_icon_button_create(GX_ICON_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID icon_id,
ULONG style, USHORT icon_button_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_icon_button_draw(GX_ICON_BUTTON *button);
UINT _gx_icon_button_pixelmap_set(GX_ICON_BUTTON *button, GX_RESOURCE_ID icon_id);
UINT _gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_multi_line_text_button_draw(GX_MULTI_LINE_TEXT_BUTTON *button);
UINT _gx_multi_line_text_button_event_process(GX_MULTI_LINE_TEXT_BUTTON *button, GX_EVENT *event_ptr);
VOID _gx_multi_line_text_button_line_pointers_set(GX_MULTI_LINE_TEXT_BUTTON *button);
VOID _gx_multi_line_text_button_text_draw(GX_MULTI_LINE_TEXT_BUTTON *button);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_multi_line_text_button_text_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
#endif
UINT _gx_multi_line_text_button_text_set_ext(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
UINT _gx_multi_line_text_button_text_id_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
UINT _gx_pixelmap_button_create(GX_PIXELMAP_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id, GX_RESOURCE_ID disabled_id,
ULONG style, USHORT pixelmap_button_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_pixelmap_button_draw(GX_PIXELMAP_BUTTON *button);
UINT _gx_pixelmap_button_event_process(GX_PIXELMAP_BUTTON *button, GX_EVENT *event_ptr);
UINT _gx_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON *button, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id,
GX_RESOURCE_ID disabled_id);
VOID _gx_pixelmap_button_transparent_detect(GX_PIXELMAP_BUTTON *button);
UINT _gx_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT radio_button_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_radio_button_draw(GX_RADIO_BUTTON *button);
UINT _gx_radio_button_pixelmap_set(GX_RADIO_BUTTON *button, GX_RESOURCE_ID off_id, GX_RESOURCE_ID on_id,
GX_RESOURCE_ID off_disabled_id, GX_RESOURCE_ID on_disabled_id);
UINT _gx_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_text_button_draw(GX_TEXT_BUTTON *button);
VOID _gx_text_button_text_draw(GX_TEXT_BUTTON *button);
UINT _gx_text_button_text_color_set(GX_TEXT_BUTTON *text_button,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
UINT _gx_text_button_font_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID font_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_text_button_text_get(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR **return_text);
UINT _gx_text_button_text_set(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
#endif
UINT _gx_text_button_text_get_ext(GX_TEXT_BUTTON *button, GX_STRING *return_text);
UINT _gx_text_button_text_set_ext(GX_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
UINT _gx_text_button_text_id_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
VOID _gx_monochrome_driver_disabled_button_line_draw(GX_BUTTON *button);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, ULONG style,
USHORT Id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
UINT _gxe_button_deselect(GX_BUTTON *button, GX_BOOL gen_event);
UINT _gxe_button_event_process(GX_BUTTON *button, GX_EVENT *event_ptr);
UINT _gxe_button_select(GX_BUTTON *button);
UINT _gxe_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style,
USHORT checkbox_id, GX_CONST GX_RECTANGLE *size, UINT checkbox_control_block_size);
UINT _gxe_checkbox_event_process(GX_CHECKBOX *checkbox, GX_EVENT *event_ptr);
UINT _gxe_checkbox_pixelmap_set(GX_CHECKBOX *checkbox,
GX_RESOURCE_ID unchecked_id,
GX_RESOURCE_ID checked_id,
GX_RESOURCE_ID unchecked_disabled_id,
GX_RESOURCE_ID checked_disabled_id);
UINT _gxe_checkbox_select(GX_CHECKBOX *checkbox);
UINT _gxe_icon_button_create(GX_ICON_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID icon_id,
ULONG style, USHORT icon_button_id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
UINT _gxe_icon_button_pixelmap_set(GX_ICON_BUTTON *button, GX_RESOURCE_ID pixelmap_id);
UINT _gxe_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size, UINT text_button_control_block);
UINT _gxe_multi_line_text_button_event_process(GX_MULTI_LINE_TEXT_BUTTON *button, GX_EVENT *event_ptr);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_multi_line_text_button_text_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_multi_line_text_button_text_set_ext(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
UINT _gxe_multi_line_text_button_text_id_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
UINT _gxe_pixelmap_button_event_process(GX_PIXELMAP_BUTTON *button, GX_EVENT *event_ptr);
UINT _gxe_pixelmap_button_create(GX_PIXELMAP_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID normal_id,
GX_RESOURCE_ID selected_id, GX_RESOURCE_ID disabled_id, ULONG style, USHORT pixelmap_button_id,
GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
UINT _gxe_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON *button, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id,
GX_RESOURCE_ID disabled_id);
UINT _gxe_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style,
USHORT radio_button_id, GX_CONST GX_RECTANGLE *size, UINT radio_button_control_block_size);
UINT _gxe_radio_button_pixelmap_set(GX_RADIO_BUTTON *button, GX_RESOURCE_ID off_id, GX_RESOURCE_ID on_id, GX_RESOURCE_ID off_disabled_id,
GX_RESOURCE_ID on_disabled_id);
UINT _gxe_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size, UINT text_button_control_block);
UINT _gxe_text_button_font_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID font_id);
UINT _gxe_text_button_text_color_set(GX_TEXT_BUTTON *text_button,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_text_button_text_get(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR **return_text);
UINT _gxe_text_button_text_set(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_text_button_text_get_ext(GX_TEXT_BUTTON *button, GX_STRING *return_text);
UINT _gxe_text_button_text_set_ext(GX_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
UINT _gxe_text_button_text_id_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
#endif

164
common/inc/gx_canvas.h Normal file
View File

@ -0,0 +1,164 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_canvas.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX canvas component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_CANVAS_H
#define GX_CANVAS_H
/* Define canvas management constants. */
#define GX_CANVAS_ID ((ULONG)0x43414E56)
/* Define canvas management function prototypes. */
UINT _gx_canvas_alpha_set(GX_CANVAS *canvas, GX_UBYTE alpha);
UINT _gx_canvas_arc_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_canvas_anti_alias_line_draw(GX_DRAW_CONTEXT *context, INT xs, INT ys, INT xe, INT ye, INT flag);
UINT _gx_canvas_block_move(GX_RECTANGLE *block, GX_VALUE x_shift, GX_VALUE y_shift, GX_RECTANGLE *dirty);
UINT _gx_canvas_circle_draw(INT xcenter, INT ycenter, UINT r);
GX_BOOL _gx_canvas_composite_create(GX_CANVAS **return_composite);
UINT _gx_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *dispaly,
UINT type, UINT width, UINT height, GX_COLOR *memory_area, ULONG memory_size);
UINT _gx_canvas_delete(GX_CANVAS *canvas);
VOID _gx_canvas_dirty_mark(GX_CANVAS *canvas, GX_RECTANGLE *area);
UINT _gx_canvas_drawing_complete(GX_CANVAS *canvas, GX_BOOL Flush);
UINT _gx_canvas_drawing_initiate(GX_CANVAS *canvas, GX_WIDGET *who, GX_RECTANGLE *clip_area);
UINT _gx_canvas_ellipse_draw(INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_canvas_glyphs_draw(GX_DRAW_CONTEXT *context, GX_POINT *draw_position, GX_CONST GX_STRING *string,
GX_RECTANGLE *view,
VOID (*draw_glyph)(GX_DRAW_CONTEXT *, GX_RECTANGLE *, GX_POINT *, GX_CONST GX_GLYPH *));
UINT _gx_canvas_hardware_layer_bind(GX_CANVAS *canvas, INT layer);
UINT _gx_canvas_hide(GX_CANVAS *canvas);
UINT _gx_canvas_line_draw(GX_VALUE x_start, GX_VALUE y_start, GX_VALUE x_end, GX_VALUE y_end);
UINT _gx_canvas_memory_define(GX_CANVAS *canvas, GX_COLOR *memory, ULONG memsize);
#if defined(GX_MOUSE_SUPPORT)
UINT _gx_canvas_mouse_define(GX_CANVAS *canvas, GX_MOUSE_CURSOR_INFO *info);
UINT _gx_canvas_mouse_show(GX_CANVAS *canvas);
UINT _gx_canvas_mouse_hide(GX_CANVAS *canvas);
#endif
UINT _gx_canvas_offset_set(GX_CANVAS *canvas, GX_VALUE x, GX_VALUE y);
UINT _gx_canvas_pixel_draw(GX_POINT position);
UINT _gx_canvas_pixelmap_blend(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap, GX_UBYTE alpha);
UINT _gx_canvas_pixelmap_draw(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap);
UINT _gx_canvas_pixelmap_get(GX_PIXELMAP *pixelmap);
UINT _gx_canvas_pixelmap_tile(GX_RECTANGLE *fill, GX_PIXELMAP *pixelmap);
UINT _gx_canvas_pixelmap_rotate(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
UINT _gx_canvas_polygon_draw(GX_POINT *point_array, INT number_of_points);
UINT _gx_canvas_pie_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
UINT _gx_canvas_rectangle_draw(GX_RECTANGLE *rectangle);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_canvas_rotated_text_draw(GX_CONST GX_CHAR *text, GX_VALUE xcenter, GX_VALUE ycenter, INT angle);
#endif
UINT _gx_canvas_rotated_text_draw_ext(GX_CONST GX_STRING *text, GX_VALUE xcenter, GX_VALUE ycenter, INT angle);
UINT _gx_canvas_shift(GX_CANVAS *canvas, GX_VALUE x, GX_VALUE y);
UINT _gx_canvas_show(GX_CANVAS *canvas);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_canvas_text_draw(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_CHAR *string, INT length);
#endif
UINT _gx_canvas_text_draw_ext(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_STRING *string);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_canvas_alpha_set(GX_CANVAS *canvas, GX_UBYTE alpha);
UINT _gxe_canvas_arc_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
UINT _gxe_canvas_block_move(GX_RECTANGLE *block, GX_VALUE x_shift, GX_VALUE y_shift, GX_RECTANGLE *dirty);
UINT _gxe_canvas_circle_draw(INT xcenter, INT ycenter, UINT r);
UINT _gxe_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *display, UINT type, UINT width,
UINT height, GX_COLOR *memory_area, ULONG memory_size,
UINT canvas_control_block_size);
UINT _gxe_canvas_delete(GX_CANVAS *canvas);
UINT _gxe_canvas_drawing_complete(GX_CANVAS *canvas, GX_BOOL Flush);
UINT _gxe_canvas_drawing_initiate(GX_CANVAS *canvas, GX_WIDGET *who, GX_RECTANGLE *dirty_area);
UINT _gxe_canvas_ellipse_draw(INT xcenter, INT ycenter, INT a, INT b);
UINT _gxe_canvas_hardware_layer_bind(GX_CANVAS *canvas, INT layer);
UINT _gxe_canvas_hide(GX_CANVAS *canvas);
UINT _gxe_canvas_line_draw(GX_VALUE x_start, GX_VALUE y_start, GX_VALUE x_end, GX_VALUE y_end);
UINT _gxe_canvas_memory_define(GX_CANVAS *canvas, GX_COLOR *memory, ULONG memsize);
#if defined(GX_MOUSE_SUPPORT)
UINT _gxe_canvas_mouse_define(GX_CANVAS *canvas, GX_MOUSE_CURSOR_INFO *info);
UINT _gxe_canvas_mouse_show(GX_CANVAS *canvas);
UINT _gxe_canvas_mouse_hide(GX_CANVAS *canvas);
#endif
UINT _gxe_canvas_offset_set(GX_CANVAS *canvas, GX_VALUE x, GX_VALUE y);
UINT _gxe_canvas_pie_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
UINT _gxe_canvas_pixel_draw(GX_POINT position);
UINT _gxe_canvas_pixelmap_blend(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap, GX_UBYTE alpha);
UINT _gxe_canvas_pixelmap_draw(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap);
UINT _gxe_canvas_pixelmap_get(GX_PIXELMAP *pixelmap);
UINT _gxe_canvas_pixelmap_tile(GX_RECTANGLE *fill, GX_PIXELMAP *pixelmap);
UINT _gxe_canvas_pixelmap_rotate(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap, INT angle, INT rot_cx, INT rot_cy);
UINT _gxe_canvas_polygon_draw(GX_POINT *point_array, INT number_of_points);
UINT _gxe_canvas_rectangle_draw(GX_RECTANGLE *rectangle);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_canvas_rotated_text_draw(GX_CONST GX_CHAR *text, GX_VALUE xcenter, GX_VALUE ycenter, INT angle);
#endif
UINT _gxe_canvas_rotated_text_draw_ext(GX_CONST GX_STRING *text, GX_VALUE xcenter, GX_VALUE ycenter, INT angle);
UINT _gxe_canvas_shift(GX_CANVAS *canvas, GX_VALUE x, GX_VALUE y);
UINT _gxe_canvas_show(GX_CANVAS *canvas);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_canvas_text_draw(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_CHAR *string, INT length);
#endif
UINT _gxe_canvas_text_draw_ext(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_STRING *string);
#ifdef GX_TARGET_WIN32
VOID _win32_compatible_canvas_memory_allocate(GX_CANVAS *canvas);
#endif
#endif

View File

@ -0,0 +1,91 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Circular Gauge Management (Circular Gauge) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_circular_gauge.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX circular gauge widget, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_CIRCULAR_GAUGE_H
#define GX_CIRCULAR_GAUGE_H
/* Define prompt management function prototypes. */
UINT _gx_circular_gauge_angle_get(GX_CIRCULAR_GAUGE *circular_gauge, INT *angle);
UINT _gx_circular_gauge_angle_set(GX_CIRCULAR_GAUGE *circular_gauge, INT angle);
UINT _gx_circular_gauge_animation_set(GX_CIRCULAR_GAUGE *circular_gauge, INT steps, INT delay);
VOID _gx_circular_gauge_background_draw(GX_CIRCULAR_GAUGE *gauge);
UINT _gx_circular_gauge_create(GX_CIRCULAR_GAUGE *circular_gauge,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_CIRCULAR_GAUGE_INFO *circular_gauge_info,
GX_RESOURCE_ID background,
ULONG style,
USHORT circular_gauge_id,
GX_VALUE xpos, GX_VALUE ypos);
VOID _gx_circular_gauge_draw(GX_CIRCULAR_GAUGE *circular_gauge);
UINT _gx_circular_gauge_event_process(GX_CIRCULAR_GAUGE *circular_gauge, GX_EVENT *event_ptr);
UINT _gx_circular_gauge_needle_rectangle_calculate(GX_CIRCULAR_GAUGE *gauge, INT angle, GX_RECTANGLE *rect);
UINT _gx_circular_gauge_needle_rotate(GX_CIRCULAR_GAUGE *circular_gauge);
UINT _gx_circular_gauge_needle_rotate_callback(VOID *gauge);
UINT _gx_circular_gauge_angle_increment_calculate(GX_CIRCULAR_GAUGE *circular_gauge);
UINT _gx_circular_gauge_needle_dirty_mark(GX_CIRCULAR_GAUGE *circular_gauge);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_circular_gauge_angle_get(GX_CIRCULAR_GAUGE *circular_gauge, INT *angle);
UINT _gxe_circular_gauge_angle_set(GX_CIRCULAR_GAUGE *circular_gauge, INT angle);
UINT _gxe_circular_gauge_animation_set(GX_CIRCULAR_GAUGE *circular_gauge, INT steps, INT delay);
UINT _gxe_circular_gauge_create(GX_CIRCULAR_GAUGE *circular_gauge,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_CIRCULAR_GAUGE_INFO *circular_gauge_info,
GX_RESOURCE_ID background,
ULONG style,
USHORT circular_gauge_id,
GX_VALUE xpos, GX_VALUE ypos, UINT checkbox_control_block_size);
UINT _gxe_circular_gauge_event_process(GX_CIRCULAR_GAUGE *circular_gauge, GX_EVENT *event_ptr);
#endif

112
common/inc/gx_context.h Normal file
View File

@ -0,0 +1,112 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Context Management (Context) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_context.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX draw context component, including all */
/* data types and external references. It is assumed that gx_api.h */
/* and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_DRAW_CONTEXT_H
#define GX_DRAW_CONTEXT_H
/* Define context management function prototypes. */
UINT _gx_brush_default(GX_BRUSH *brush);
UINT _gx_brush_define(GX_BRUSH *brush, GX_COLOR line_color, GX_COLOR fill_color, UINT style);
UINT _gx_context_brush_get(GX_BRUSH **return_brush);
UINT _gx_context_brush_set(GX_BRUSH *brush);
UINT _gx_context_brush_default(GX_DRAW_CONTEXT *context);
UINT _gx_context_brush_define(GX_RESOURCE_ID line_color_id, GX_RESOURCE_ID fill_color_id, UINT style);
UINT _gx_context_brush_pattern_set(ULONG pattern);
UINT _gx_context_brush_style_set(UINT style);
UINT _gx_context_brush_width_set(UINT width);
UINT _gx_context_color_get(GX_RESOURCE_ID id, GX_COLOR *color);
UINT _gx_context_fill_color_set(GX_RESOURCE_ID fill_color_id);
UINT _gx_context_font_get(GX_RESOURCE_ID resource_id, GX_FONT **return_font);
UINT _gx_context_font_set(GX_RESOURCE_ID font_id);
UINT _gx_context_line_color_set(GX_RESOURCE_ID line_color_id);
UINT _gx_context_pixelmap_get(GX_RESOURCE_ID resource_id, GX_PIXELMAP **return_pixelmap);
UINT _gx_context_pixelmap_set(GX_RESOURCE_ID pixelmap_id);
/* functins for defining brush using r:g:b color description */
UINT _gx_context_raw_brush_define(GX_COLOR line_color, GX_COLOR fill_color, UINT style);
UINT _gx_context_raw_fill_color_set(GX_COLOR line_color);
UINT _gx_context_raw_line_color_set(GX_COLOR line_color);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_context_string_get(GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
#endif
UINT _gx_context_string_get_ext(GX_RESOURCE_ID resource_id, GX_STRING *return_string);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_brush_define(GX_BRUSH *brush, GX_COLOR line_color, GX_COLOR fill_color, UINT style);
UINT _gxe_brush_default(GX_BRUSH *brush);
UINT _gxe_context_brush_default(GX_DRAW_CONTEXT *context);
UINT _gxe_context_brush_define(GX_RESOURCE_ID line_color_id, GX_RESOURCE_ID fill_color_id, UINT style);
UINT _gxe_context_brush_get(GX_BRUSH **return_brush);
UINT _gxe_context_brush_set(GX_BRUSH *brush);
UINT _gxe_context_brush_pattern_set(ULONG pattern);
UINT _gxe_context_brush_style_set(UINT style);
UINT _gxe_context_brush_width_set(UINT width);
UINT _gxe_context_color_get(GX_RESOURCE_ID color_id, GX_COLOR *return_color);
UINT _gxe_context_fill_color_set(GX_RESOURCE_ID fill_color_id);
UINT _gxe_context_font_set(GX_RESOURCE_ID font_id);
UINT _gxe_context_font_get(GX_RESOURCE_ID resource_id, GX_FONT **return_font);
UINT _gxe_context_line_color_set(GX_RESOURCE_ID line_color_id);
UINT _gxe_context_pixelmap_get(GX_RESOURCE_ID resource_id, GX_PIXELMAP **return_pixelmap);
UINT _gxe_context_pixelmap_set(GX_RESOURCE_ID pixelmap_id);
UINT _gxe_context_raw_brush_define(GX_COLOR line_color, GX_COLOR fill_color, UINT style);
UINT _gxe_context_raw_fill_color_set(GX_COLOR line_color);
UINT _gxe_context_raw_line_color_set(GX_COLOR line_color);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_context_string_get(GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
#endif
UINT _gxe_context_string_get_ext(GX_RESOURCE_ID string_id, GX_STRING *return_string);
#endif

395
common/inc/gx_display.h Normal file
View File

@ -0,0 +1,395 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Display Management (Display) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_display.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX Display component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_DISPLAY_H
#define GX_DISPLAY_H
/* Define Display management constants. */
#define GX_DISPLAY_ID ((ULONG)0x53435245)
#define GX_MAX_DISPLAY_RESOLUTION 8192
/* Define display management function prototypes. */
UINT _gx_display_active_language_set(GX_DISPLAY *display, GX_UBYTE language);
UINT _gx_display_create(GX_DISPLAY *display, GX_CONST GX_CHAR *name, UINT (*display_driver_setup)(GX_DISPLAY *), GX_VALUE width, GX_VALUE height);
UINT _gx_display_delete(GX_DISPLAY *display, VOID (*display_driver_cleanup)(GX_DISPLAY *));
VOID _gx_display_canvas_dirty(GX_DISPLAY *display);
UINT _gx_display_color_set(GX_DISPLAY *display, GX_RESOURCE_ID id, GX_COLOR color);
UINT _gx_display_color_table_set(GX_DISPLAY *display, GX_COLOR *color_table, INT number_of_colors);
UINT _gx_display_font_table_set(GX_DISPLAY *display, GX_FONT **font_table, UINT number_of_fonts);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_display_language_table_get(GX_DISPLAY *display, GX_CHAR ****table, GX_UBYTE *language_count, UINT *string_count);
UINT _gx_display_language_table_set(GX_DISPLAY *display, GX_CHAR ***table, GX_UBYTE num_languages, UINT number_of_strings);
#endif
UINT _gx_display_language_table_get_ext(GX_DISPLAY *display, GX_STRING ***table, GX_UBYTE *language_count, UINT *string_count);
UINT _gx_display_language_table_set_ext(GX_DISPLAY *display, GX_CONST GX_STRING **table, GX_UBYTE num_languages, UINT number_of_strings);
UINT _gx_display_pixelmap_table_set(GX_DISPLAY *display, GX_PIXELMAP **pixelmap_table, UINT number_of_pixelmaps);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_display_string_get(GX_DISPLAY *display, GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
UINT _gx_display_string_table_get(GX_DISPLAY *display, GX_UBYTE language, GX_CHAR ***table, UINT *size);
#endif
UINT _gx_display_string_get_ext(GX_DISPLAY *display, GX_RESOURCE_ID string_id, GX_STRING *return_string);
UINT _gx_display_string_table_get_ext(GX_DISPLAY *display, GX_UBYTE language, GX_STRING **table, UINT *size);
UINT _gx_display_theme_install(GX_DISPLAY *display, GX_CONST GX_THEME *theme_ptr);
UINT _gxe_display_active_language_set(GX_DISPLAY *display, GX_UBYTE language);
UINT _gxe_display_create(GX_DISPLAY *display, GX_CONST GX_CHAR *name, UINT (*display_driver_setup)(GX_DISPLAY *), GX_VALUE width, GX_VALUE height, UINT display_control_block_size);
UINT _gxe_display_color_set(GX_DISPLAY *display, GX_RESOURCE_ID resource_id, GX_COLOR new_color);
UINT _gxe_display_color_table_set(GX_DISPLAY *display, GX_COLOR *color_table, INT number_of_colors);
UINT _gxe_display_delete(GX_DISPLAY *display, VOID (*display_driver_cleanup)(GX_DISPLAY *));
UINT _gxe_display_font_table_set(GX_DISPLAY *display, GX_FONT **font_table, UINT number_of_fonts);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_display_language_table_get(GX_DISPLAY *display, GX_CHAR ****table, GX_UBYTE *language_count, UINT *string_count);
UINT _gxe_display_language_table_set(GX_DISPLAY *display, GX_CHAR ***table, GX_UBYTE num_languages, UINT number_of_strings);
#endif
UINT _gxe_display_language_table_get_ext(GX_DISPLAY *display, GX_STRING ***table, GX_UBYTE *language_count, UINT *string_count);
UINT _gxe_display_language_table_set_ext(GX_DISPLAY *display, GX_CONST GX_STRING **table, GX_UBYTE num_languages, UINT number_of_strings);
UINT _gxe_display_pixelmap_table_set(GX_DISPLAY *display, GX_PIXELMAP **pixelmap_table, UINT number_of_pixelmaps);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_display_string_get(GX_DISPLAY *display, GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
UINT _gxe_display_string_table_get(GX_DISPLAY *display, GX_UBYTE language, GX_CHAR ***table, UINT *size);
#endif
UINT _gxe_display_string_get_ext(GX_DISPLAY *display, GX_RESOURCE_ID string_id, GX_STRING *return_string);
UINT _gxe_display_string_table_get_ext(GX_DISPLAY *display, GX_UBYTE language, GX_STRING **table, UINT *size);
UINT _gxe_display_theme_install(GX_DISPLAY *display, GX_CONST GX_THEME *theme_ptr);
#if defined(GX_MOUSE_SUPPORT)
VOID _gx_display_driver_generic_mouse_define(GX_DISPLAY *display, GX_CANVAS *canvas, GX_MOUSE_CURSOR_INFO *info);
#if !defined(GX_HARDWARE_MOUSE_SUPPORT)
VOID _gx_display_driver_generic_mouse_position_set(GX_DISPLAY *display, GX_POINT *point);
VOID _gx_display_driver_generic_mouse_enable(GX_DISPLAY *display, GX_BOOL enable);
VOID _gx_display_driver_generic_drawing_complete(GX_DISPLAY *display, GX_CANVAS *canvas);
VOID _gx_display_driver_generic_drawing_initiate(GX_DISPLAY *display, GX_CANVAS *canvas);
VOID _gx_display_driver_generic_mouse_draw(GX_DISPLAY *display);
VOID _gx_display_driver_24xrgb_mouse_capture(GX_DISPLAY *display);
VOID _gx_display_driver_24xrgb_mouse_restore(GX_DISPLAY *display);
VOID _gx_display_driver_16bpp_mouse_capture(GX_DISPLAY *display);
VOID _gx_display_driver_16bpp_mouse_restore(GX_DISPLAY *display);
VOID _gx_display_driver_8bpp_mouse_capture(GX_DISPLAY *display);
VOID _gx_display_driver_8bpp_mouse_restore(GX_DISPLAY *display);
VOID _gx_display_driver_4bpp_mouse_capture(GX_DISPLAY *display);
VOID _gx_display_driver_4bpp_mouse_restore(GX_DISPLAY *display);
VOID _gx_display_driver_1bpp_mouse_capture(GX_DISPLAY *display);
VOID _gx_display_driver_1bpp_mouse_restore(GX_DISPLAY *display);
#endif
#endif
/* Generic driver level functions (not specific to color depth) */
VOID _gx_display_driver_generic_simple_wide_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_generic_aliased_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_generic_aliased_fixed_point_line_draw(GX_DRAW_CONTEXT *context,
GX_FIXED_VAL xstart, GX_FIXED_VAL ystart,
GX_FIXED_VAL xend, GX_FIXED_VAL yend);
VOID _gx_display_driver_generic_aliased_wide_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_generic_filled_circle_draw(GX_DRAW_CONTEXT *context, GX_FIXED_VAL xcenter, GX_FIXED_VAL ycenter, GX_FIXED_VAL r);
VOID _gx_display_driver_generic_aliased_filled_circle_draw(GX_DRAW_CONTEXT *context, GX_FIXED_VAL xcenter, GX_FIXED_VAL ycenter, GX_FIXED_VAL r);
VOID _gx_display_driver_generic_glyph_8bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_generic_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_32bpp_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_16bpp_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
/* Define screen driver function prototypes. */
VOID _gx_display_driver_1bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_1bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
VOID _gx_display_driver_1bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
VOID _gx_display_driver_1bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
GX_COLOR _gx_display_driver_1bpp_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
VOID _gx_display_driver_1bpp_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
VOID _gx_display_driver_1bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
VOID _gx_display_driver_1bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
VOID _gx_display_driver_1bpp_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
VOID _gx_display_driver_1bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
VOID _gx_display_driver_1bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
USHORT _gx_display_driver_1bpp_row_pitch_get(USHORT width);
VOID _gx_display_driver_1bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_1bpp_glyph_1bpp_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_332rgb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
VOID _gx_display_driver_332rgb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_332rgb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
VOID _gx_display_driver_332rgb_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
GX_COLOR _gx_display_driver_332rgb_native_color_get(GX_DISPLAY *display, GX_COLOR rawcolor);
VOID _gx_display_driver_4bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
VOID _gx_display_driver_4bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_4bpp_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, const GX_GLYPH *glyph);
VOID _gx_display_driver_4bpp_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, const GX_GLYPH *glyph);
VOID _gx_display_driver_4bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
VOID _gx_display_driver_4bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
VOID _gx_display_driver_4bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
GX_COLOR _gx_display_driver_4bpp_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
VOID _gx_display_driver_4bpp_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
VOID _gx_display_driver_4bpp_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
VOID _gx_display_driver_4bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT rot_cx, INT rot_cy);
USHORT _gx_display_driver_4bpp_row_pitch_get(USHORT width);
VOID _gx_display_driver_4bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_4bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
VOID _gx_display_driver_4bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
VOID _gx_display_driver_8bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_8bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
VOID _gx_display_driver_8bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
VOID _gx_display_driver_8bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
GX_COLOR _gx_display_driver_8bit_palette_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
VOID _gx_display_driver_8bpp_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
VOID _gx_display_driver_8bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
VOID _gx_display_driver_8bpp_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
VOID _gx_display_driver_8bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
VOID _gx_display_driver_8bpp_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
VOID _gx_display_driver_8bpp_pixelmap_simple_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT cx, INT cy);
VOID _gx_display_driver_8bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT rot_cx, INT rot_cy);
VOID _gx_display_driver_8bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
USHORT _gx_display_driver_8bpp_row_pitch_get(USHORT width);
VOID _gx_display_driver_8bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_8bpp_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_8bpp_glyph_3bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_8bpp_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
VOID _gx_display_driver_565rgb_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_16bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_16bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
VOID _gx_display_driver_16bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
VOID _gx_display_driver_565rgb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
VOID _gx_display_driver_565rgb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_16bpp_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
VOID _gx_display_driver_16bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
VOID _gx_display_driver_16bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
VOID _gx_display_driver_565rgb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
VOID _gx_display_driver_565rgb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
VOID _gx_display_driver_565rgb_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
VOID _gx_display_driver_565rgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
#endif
VOID _gx_display_driver_16bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
GX_COLOR _gx_display_driver_565rgb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
USHORT _gx_display_driver_16bpp_row_pitch_get(USHORT width);
VOID _gx_display_driver_16bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_16bpp_pixelmap_simple_alpha_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT cx, INT cy);
VOID _gx_display_driver_16bpp_pixelmap_simple_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT cx, INT cy);
VOID _gx_display_driver_16bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
VOID _gx_display_driver_24xrgb_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_24xrgb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
VOID _gx_display_driver_24xrgb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
VOID _gx_display_driver_24xrgb_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
VOID _gx_display_driver_24xrgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
#endif
GX_COLOR _gx_display_driver_24xrgb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
VOID _gx_display_driver_32bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
VOID _gx_display_driver_32bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
VOID _gx_display_driver_32bpp_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
VOID _gx_display_driver_32bpp_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
VOID _gx_display_driver_32bpp_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
VOID _gx_display_driver_32bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
VOID _gx_display_driver_32bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
VOID _gx_display_driver_32bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
USHORT _gx_display_driver_32bpp_row_pitch_get(USHORT width);
VOID _gx_display_driver_32bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
VOID _gx_display_driver_32argb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_32argb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
VOID _gx_display_driver_32argb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
GX_COLOR _gx_display_driver_32argb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
VOID _gx_display_driver_32bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
VOID _gx_display_driver_4444argb_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite);
VOID _gx_display_driver_4444argb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_4444argb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
VOID _gx_display_driver_4444argb_pixelmap_draw(GX_DRAW_CONTEXT *context,
INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
VOID _gx_display_driver_4444argb_pixelmap_blend(GX_DRAW_CONTEXT *context,
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha);
VOID _gx_display_driver_4444argb_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
GX_COLOR _gx_display_driver_4444argb_native_color_get(GX_DISPLAY *display, GX_COLOR rawcolor);
VOID _gx_display_driver_1555xrgb_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
GX_COLOR _gx_display_driver_1555xrgb_native_color_get(GX_DISPLAY *display, GX_COLOR rawcolor);
VOID _gx_display_driver_1555xrgb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
VOID _gx_display_driver_1555xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context,
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha);
VOID _gx_display_driver_1555xrgb_pixelmap_draw(GX_DRAW_CONTEXT *context,
INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
VOID _gx_display_driver_1555xrgb_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
INT angle, INT rot_cx, INT rot_cy);
VOID _gx_display_driver_1555xrgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
#if defined(GX_BRUSH_ALPHA_SUPPORT)
VOID _gx_display_driver_horizontal_line_alpha_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color, GX_UBYTE alpha);
VOID _gx_display_driver_vertical_line_alpha_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color, GX_UBYTE alpha);
VOID _gx_display_driver_simple_line_alpha_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend, GX_UBYTE alpha);
#endif
VOID _gx_display_driver_generic_alphamap_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp);
GX_FIXED_POINT *_gx_display_driver_generic_wide_line_points_calculate(GX_DRAW_CONTEXT *context, INT xStart, INT yStart,
INT xEnd, INT yEnd, INT brush_width, GX_BOOL outline);
VOID _gx_display_driver_generic_wide_line_fill(GX_DRAW_CONTEXT *context, GX_FIXED_POINT *pPoints);
VOID _gx_display_driver_generic_polygon_draw(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num);
VOID _gx_display_driver_generic_polygon_fill(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num);
#if defined(GX_ARC_DRAWING_SUPPORT)
VOID _gx_display_driver_generic_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
VOID _gx_display_driver_generic_wide_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
VOID _gx_display_driver_generic_aliased_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
VOID _gx_display_driver_generic_aliased_wide_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
VOID _gx_display_driver_generic_circle_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
VOID _gx_display_driver_generic_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_generic_simple_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle, GX_BOOL skip_end);
VOID _gx_display_driver_generic_arc_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_generic_wide_arc_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_generic_aliased_arc_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_generic_aliased_wide_arc_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_generic_arc_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
VOID _gx_display_driver_arc_clipping_get(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle,
GX_RECTANGLE *clip_1, GX_RECTANGLE *clip_2, GX_RECTANGLE *clip_3, GX_RECTANGLE *clip_4);
#endif
VOID _gx_display_driver_generic_aliased_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_display_driver_generic_aliased_wide_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_display_driver_generic_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_display_driver_generic_wide_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_display_driver_generic_ellipse_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
VOID _gx_display_driver_32argb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_24xrgb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_4444argb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_4bpp_grayscale_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_565rgb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_8bit_palette_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_332rgb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_monochrome_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_1555xrgb_setup(GX_DISPLAY *display, VOID *aux_data,
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
GX_RECTANGLE *dirty_area));
VOID _gx_display_driver_1555xrgb_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite);
#ifdef GX_TARGET_WIN32
VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
#endif
#define REDVAL_16BPP(_c) (GX_UBYTE)(((_c) >> 11) & 0x1f)
#define GREENVAL_16BPP(_c) (GX_UBYTE)(((_c) >> 5) & 0x3f)
#define BLUEVAL_16BPP(_c) (GX_UBYTE)(((_c)) & 0x1f)
/* Define macros for assembling a 16-bit r:g:b value from 3 components. */
#define ASSEMBLECOLOR_16BPP(_r, _g, _b) \
((((_r) & 0x1f) << 11) | \
(((_g) & 0x3f) << 5) | \
(((_b) & 0x1f)))
#define REDVAL_24BPP(_c) (GX_UBYTE)((_c) >> 16)
#define GREENVAL_24BPP(_c) (GX_UBYTE)((_c) >> 8)
#define BLUEVAL_24BPP(_c) (GX_UBYTE)(_c)
/* Define macros for assembling a 24-bit r:g:b value from 3 components. */
#define ASSEMBLECOLOR_24BPP(_r, _g, _b) \
(((_r) << 16) | \
((_g) << 8) | \
(_b))
#define REDVAL_32BPP(_c) (GX_UBYTE)((_c) >> 16)
#define GREENVAL_32BPP(_c) (GX_UBYTE)((_c) >> 8)
#define BLUEVAL_32BPP(_c) (GX_UBYTE)(_c)
/* Define macros for assembling a 32-bit r:g:b value from 3 components. */
#define ASSEMBLECOLOR_32BPP(_r, _g, _b) \
(((_r) << 16) | \
((_g) << 8) | \
(_b))
#endif

76
common/inc/gx_drop_list.h Normal file
View File

@ -0,0 +1,76 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Window Management (Window) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_drop_list.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX window management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_DROP_LIST_H
#define GX_DROP_LIST_H
/* Define drop list management function prototypes. */
UINT _gx_drop_list_close(GX_DROP_LIST *drop_list);
UINT _gx_drop_list_create(GX_DROP_LIST *drop_list, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_rows, INT open_height,
VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT drop_list_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_drop_list_draw(GX_DROP_LIST *box);
VOID _gx_drop_list_background_draw(GX_DROP_LIST *drop_list);
UINT _gx_drop_list_event_process(GX_DROP_LIST *widget, GX_EVENT *event_ptr);
UINT _gx_drop_list_open(GX_DROP_LIST *list);
UINT _gx_drop_list_pixelmap_set(GX_DROP_LIST *drop_list, GX_RESOURCE_ID pixelmap_id);
UINT _gx_drop_list_popup_get(GX_DROP_LIST *box, GX_VERTICAL_LIST **return_list);
UINT _gxe_drop_list_close(GX_DROP_LIST *drop_list);
UINT _gxe_drop_list_create(GX_DROP_LIST *drop_list, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_rows, INT open_height,
VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT drop_list_id, GX_CONST GX_RECTANGLE *size, UINT drop_list_control_block_size);
UINT _gxe_drop_list_event_process(GX_DROP_LIST *widget, GX_EVENT *event_ptr);
UINT _gxe_drop_list_open(GX_DROP_LIST *list);
UINT _gxe_drop_list_pixelmap_set(GX_DROP_LIST *drop_list, GX_RESOURCE_ID pixelmap_id);
UINT _gxe_drop_list_popup_get(GX_DROP_LIST *box, GX_VERTICAL_LIST **return_list);
#endif

74
common/inc/gx_icon.h Normal file
View File

@ -0,0 +1,74 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Icon Management (Icon) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_icon.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX icon management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_ICON_H
#define GX_ICON_H
/* Define button management function prototypes. */
VOID _gx_icon_background_draw(GX_ICON *icon);
UINT _gx_icon_create(GX_ICON *icon, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID pixelmap_id,
ULONG style, USHORT icon_id, GX_VALUE x, GX_VALUE y);
VOID _gx_icon_draw(GX_ICON *icon);
UINT _gx_icon_event_process(GX_ICON *icon, GX_EVENT *event_ptr);
UINT _gx_icon_pixelmap_set(GX_ICON *icon, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id);
VOID _gx_icon_pixelmap_update(GX_ICON *icon);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_icon_create(GX_ICON *icon, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID pixelmap_id,
ULONG style, USHORT icon_id, GX_VALUE x, GX_VALUE y, UINT icon_control_block_size);
UINT _gxe_icon_event_process(GX_ICON *button, GX_EVENT *event_ptr);
UINT _gxe_icon_pixelmap_set(GX_ICON *icon, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id);
#endif

View File

@ -0,0 +1,174 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Image Reader Management (Image Reader) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_image_reader.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX image reader management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
#ifndef GX_IMAGE_READER_H
#define GX_IMAGE_READER_H
#define GX_IMAGE_FORMAT_1BPP 0xf0
#define GX_IMAGE_FORMAT_2BPP 0xf1
#define GX_IMAGE_FORMAT_4BPP 0xf2
#define GX_IMAGE_FORMAT_8BPP 0xf3
#define GX_IMAGE_FORMAT_16BPP_GRAY 0xf4 /* Internal format: 16bits for each gray value. */
#define GX_IMAGE_FORMAT_16BPP_GRAY_ALPHA 0xf5 /* Internal format: gray: alpha stream, 8 bits. */
#define GX_IMAGE_FORMAT_32BPP_GRAY_ALPHA 0xf6 /* Internal format: gray: alpha steam, 16bits. */
#define GX_IMAGE_FORMAT_24BPP 0xf7 /* Internal format: r:g:b stream, 8bits for each channel. */
#define GX_IMAGE_FORMAT_32BPP 0xf8 /* Internal format: r:g:b:a strem, 8bits for each channel. */
#define GX_IMAGE_FORMAT_48BPP 0xf9 /* Internal format: r:g:b stream, 16bits for each channel. */
#define GX_IMAGE_FORMAT_64BPP 0xfa /* Internal format: r:g:b:a stream, 16bits for each channel */
#define GX_TRANSPARENT_COLOR 0xff
/* Control block used internally for jpeg reader. */
typedef struct GX_JPEG_INFO_STRUCT
{
USHORT gx_jpeg_width;
USHORT gx_jpeg_height;
INT gx_jpeg_num_of_components;
GX_UBYTE gx_jpeg_sample_factor[3];
GX_UBYTE gx_jpeg_component_id[3];
GX_UBYTE gx_jpeg_qantization_table_index[3];
GX_UBYTE gx_jpeg_dc_table_index[3];
GX_UBYTE gx_jpeg_ac_table_index[3];
INT gx_jpeg_quantization_table[4][64];
INT *gx_jpeg_huffman_table[2][2];
GX_VALUE gx_jpeg_huffman_bits_count[2][2][16];
INT gx_jpeg_restart_interval;
GX_UBYTE gx_jpeg_Y_block[256];
GX_UBYTE gx_jpeg_Cr_block[64];
GX_UBYTE gx_jpeg_Cb_block[64];
INT gx_jpeg_pre_dc[3];
INT gx_jpeg_vecter[64];
GX_UBYTE *gx_jpeg_data;
INT gx_jpeg_data_size;
INT gx_jpeg_data_index;
GX_UBYTE *gx_jpeg_decoded_data;
UINT gx_jpeg_decoded_data_size;
GX_DRAW_CONTEXT *gx_jpeg_draw_context;
UINT (*gx_jpeg_mcu_draw)(struct GX_JPEG_INFO_STRUCT *, INT, INT);
INT gx_jpeg_draw_xpos;
INT gx_jpeg_draw_ypos;
} GX_JPEG_INFO;
/* control block used internally for png reader */
typedef struct GX_PNG_STRUCT
{
GX_UBYTE *gx_png_data;
INT gx_png_data_size;
INT gx_png_data_index;
GX_UBYTE *gx_png_decoded_data;
INT gx_png_decoded_data_len;
INT gx_png_width;
INT gx_png_height;
GX_UBYTE gx_png_bit_depth;
INT gx_png_color_type;
GX_UBYTE gx_png_bpp; /* bits per pixel */
INT gx_png_compression_method;
INT gx_png_filter_method;
INT gx_png_interlace_method;
UINT gx_png_crc_table[256];
INT gx_png_gamma;
INT gx_png_huffman_clen_table[20];
INT gx_png_huffman_clen_bits_count[17];
INT gx_png_huffman_lit_table[286];
INT gx_png_huffman_lit_code_len[286];
INT gx_png_huffman_lit_bits_count[17];
INT gx_png_huffman_dist_table[30];
INT gx_png_huffman_dist_code_len[30];
INT gx_png_huffman_dist_bits_count[17];
GX_COLOR gx_png_palette_table[256];
INT gx_png_palette_table_size;
GX_COLOR *gx_png_trans;
INT gx_png_trans_num;
INT gx_png_trunk_end_index;
UINT gx_png_trunk_crc;
} GX_PNG;
/* Define API functions for image reader. */
UINT _gx_image_reader_start(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
UINT _gx_image_reader_colorspace_convert(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
UINT _gx_image_reader_create(GX_IMAGE_READER *image_reader,
GX_CONST GX_UBYTE *read_data,
INT read_data_size,
GX_UBYTE color_format,
GX_UBYTE mode);
/* Define internal function prototypes. */
UINT _gx_image_reader_png_decode(GX_CONST GX_UBYTE *read_data, ULONG read_data_size, GX_PIXELMAP *outmap);
UINT _gx_image_reader_jpeg_decode(GX_CONST GX_UBYTE *read_data, ULONG data_size, GX_PIXELMAP *outmap);
UINT _gx_image_reader_jpeg_mcu_decode(GX_CONST GX_UBYTE * read_data, ULONG data_size,
GX_DRAW_CONTEXT * context, INT xpos, INT ypos,
UINT(draw_function)(GX_JPEG_INFO *, INT, INT));
UINT _gx_image_reader_pixel_read_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
UINT _gx_image_reader_pixel_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
UINT _gx_image_reader_image_decode(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
UINT _gx_image_reader_palette_set(GX_IMAGE_READER *image_reader, GX_COLOR *pal, UINT palsize);
UINT _gx_image_reader_nearest_palette_color_get(GX_IMAGE_READER *image_reader, GX_PIXEL *want_color, INT *index);
VOID _gx_image_reader_rgb2gray(GX_PIXEL *pixel, GX_UBYTE *gray);
UINT _gx_image_reader_rle_encode(GX_IMAGE_READER *image_reader, GX_PIXELMAP *pRLEmap);
UINT _gx_image_reader_rle_encode_size_get(GX_IMAGE_READER *image_reader, UINT *data_size, UINT *aux_size);
VOID _gx_image_reader_rgb2gray(GX_PIXEL *pixel, GX_UBYTE *gray);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_image_reader_create(GX_IMAGE_READER *image_reader,
GX_CONST GX_UBYTE *read_data,
INT read_data_size,
GX_UBYTE color_format,
GX_UBYTE mode);
UINT _gxe_image_reader_palette_set(GX_IMAGE_READER *image_reader, GX_COLOR *pal, UINT palsize);
UINT _gxe_image_reader_start(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap);
#endif
#endif

View File

@ -0,0 +1,82 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Line Chart (Charting) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_line_chart.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX line chart component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_LINE_CHART_H
#define GX_LINE_CHART_H
/* APIs defined for line chart widget */
VOID _gx_line_chart_axis_draw(GX_LINE_CHART *chart);
UINT _gx_line_chart_create(GX_LINE_CHART *chart,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_CONST GX_LINE_CHART_INFO *info,
ULONG style,
USHORT chart_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_line_chart_data_draw(GX_LINE_CHART *chart);
VOID _gx_line_chart_draw(GX_LINE_CHART *chart);
UINT _gx_line_chart_update(GX_LINE_CHART *chart, INT *data, INT data_count);
UINT _gx_line_chart_y_scale_calculate(GX_LINE_CHART *chart_info, INT *return_val);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_line_chart_create(GX_LINE_CHART *chart,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_CONST GX_LINE_CHART_INFO *info,
ULONG style,
USHORT chart_id,
GX_CONST GX_RECTANGLE *size,
UINT control_block_size);
UINT _gxe_line_chart_update(GX_LINE_CHART *chart, INT *data, INT data_count);
UINT _gxe_line_chart_y_scale_calculate(GX_LINE_CHART *chart_info, INT *return_val);
#endif

90
common/inc/gx_menu.h Normal file
View File

@ -0,0 +1,90 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Menu Management (Menu) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_menu.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX menu component, including all data types */
/* and external references. It is assumed that gx_api.h and gx_port.h */
/* have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_MENU_H
#define GX_MENU_H
/* Define menu management function prototypes. */
#define GX_MENU_ANIMATION_OPEN 0x01
#define GX_MENU_ANIMATION_CLOSE 0x02
#define GX_MENU_OPEN_TIMER 0xf0
#define GX_MENU_CLOSE_TIMER 0xf1
UINT _gx_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_accordion_menu_draw(GX_ACCORDION_MENU *menu);
UINT _gx_accordion_menu_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr);
UINT _gx_accordion_menu_position(GX_ACCORDION_MENU *accordion);
UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_menu_draw(GX_MENU *menu);
UINT _gx_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
UINT _gx_menu_one_level_position(GX_MENU *menu, GX_VALUE indentation);
UINT _gx_menu_position(GX_MENU *menu, GX_VALUE indentation);
UINT _gx_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
VOID _gx_menu_text_draw(GX_MENU *menu);
UINT _gx_menu_text_offset_set(GX_MENU *menu, GX_VALUE x_offset, GX_VALUE y_offset);
/* error checking versions of menu API functions. */
UINT _gxe_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_accordion_menu_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr);
UINT _gxe_accordion_menu_position(GX_ACCORDION_MENU *accordion);
UINT _gxe_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
UINT _gxe_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
UINT _gxe_menu_text_offset_set(GX_MENU *menu, GX_VALUE x_offset, GX_VALUE y_offset);
#endif

View File

@ -0,0 +1,154 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Multi Line Text Input Management (Multi Line Text Input) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_multi_line_text_input.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX multi line text input management */
/* component, including all data types and external references. It is */
/* assumed that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#define ID_TEXT_INPUT_TIMER 2
#define GX_MARK_TIMER 3
#define NUM_BEF_CURSOR 1
#define NUM_AFT_CURSOR 3
#define GX_MARK_INTERVAL 5
/* Define multi-line text input management function prototypes. */
UINT _gx_multi_line_text_input_backspace(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_buffer_clear(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_buffer_get(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address,
UINT *content_size, UINT *buffer_size);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size);
#endif
UINT _gx_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str);
UINT _gx_multi_line_text_input_char_remove(GX_MULTI_LINE_TEXT_INPUT *text_input, UINT index, UINT del_bytes);
UINT _gx_multi_line_text_input_copy(GX_MULTI_LINE_TEXT_INPUT *input);
UINT _gx_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr,
GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent,
GX_CHAR *input_buffer, UINT buffer_size, ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size);
UINT _gx_multi_line_text_input_cursor_pos_calculate(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_POINT click_pos);
UINT _gx_multi_line_text_input_cursor_pos_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT *cursor_pos);
UINT _gx_multi_line_text_input_cursor_pos_update(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_BOOL make_cursor_visible);
UINT _gx_multi_line_text_input_cursor_visible(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_cut(GX_MULTI_LINE_TEXT_INPUT *input);
UINT _gx_multi_line_text_input_delete(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_down_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
VOID _gx_multi_line_text_input_draw(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_end(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr);
UINT _gx_multi_line_text_input_fill_color_set(GX_MULTI_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_fill_color_id,
GX_RESOURCE_ID selected_fill_color_id,
GX_RESOURCE_ID disabled_fill_color_id,
GX_RESOURCE_ID readonly_fill_color_id);
UINT _gx_multi_line_text_input_home(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_highlight_rectangle_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_RECTANGLE *rect);
UINT _gx_multi_line_text_input_keydown_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr);
UINT _gx_multi_line_text_input_left_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_end(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_home(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_next(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_previous(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_up(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_mark_down(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_paste(GX_MULTI_LINE_TEXT_INPUT *input);
UINT _gx_multi_line_text_input_right_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gx_multi_line_text_input_style_add(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gx_multi_line_text_input_style_remove(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gx_multi_line_text_input_style_set(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gx_multi_line_text_input_text_color_set(GX_MULTI_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id,
GX_RESOURCE_ID readonly_text_color_id);
UINT _gx_multi_line_text_input_text_rectangle_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT start_cursor_pos, GX_POINT end_cursor_pos, GX_RECTANGLE *rect);
UINT _gx_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_CHAR *text);
#endif
UINT _gx_multi_line_text_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *text);
UINT _gx_multi_line_text_input_up_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_multi_line_text_input_backspace(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_buffer_clear(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_buffer_get(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address,
UINT *content_size, UINT *buffer_size);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size);
#endif
UINT _gxe_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str);
UINT _gxe_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent,
GX_CHAR *input_buffer, UINT buffer_size, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size,
UINT text_input_control_block_size);
UINT _gxe_multi_line_text_input_cursor_pos_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT *cursor_pos);
UINT _gxe_multi_line_text_input_delete(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_down_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_end(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *input, GX_EVENT *event_ptr);
UINT _gxe_multi_line_text_input_fill_color_set(GX_MULTI_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_fill_color_id,
GX_RESOURCE_ID selected_fill_color_id,
GX_RESOURCE_ID disabled_fill_color_id,
GX_RESOURCE_ID readonly_fill_color_id);
UINT _gxe_multi_line_text_input_home(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_left_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_right_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);
UINT _gxe_multi_line_text_input_style_add(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gxe_multi_line_text_input_style_remove(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gxe_multi_line_text_input_style_set(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type);
UINT _gxe_multi_line_text_input_text_color_set(GX_MULTI_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id,
GX_RESOURCE_ID readonly_text_color_id);
UINT _gxe_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_multi_line_text_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text);
UINT _gxe_multi_line_text_input_up_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input);

View File

@ -0,0 +1,100 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Multi Line Text View Management (Multi Line Text View) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_multi_line_text_view.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX text view management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
/* Define multi-line text view management function prototypes. */
UINT _gx_multi_line_text_view_create(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
GX_CONST GX_CHAR *name_ptr,
GX_WIDGET *parent, GX_RESOURCE_ID text_id,
ULONG style, USHORT Id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_multi_line_text_view_display_info_get(GX_MULTI_LINE_TEXT_VIEW *text_view, UINT start_index,
UINT end_index, GX_MULTI_LINE_TEXT_INFO *text_info, GX_VALUE available_width);
VOID _gx_multi_line_text_view_draw(GX_MULTI_LINE_TEXT_VIEW *view);
VOID _gx_multi_line_text_view_text_draw(GX_MULTI_LINE_TEXT_VIEW *text_view, GX_RESOURCE_ID text_color);
UINT _gx_multi_line_text_view_event_process(GX_MULTI_LINE_TEXT_VIEW *view, GX_EVENT *event_ptr);
UINT _gx_multi_line_text_view_font_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_RESOURCE_ID font_id);
UINT _gx_multi_line_text_view_line_space_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_BYTE line_space);
UINT _gx_multi_line_text_view_line_cache_update(GX_MULTI_LINE_TEXT_VIEW *view);
UINT _gx_multi_line_text_view_scroll(GX_MULTI_LINE_TEXT_VIEW *view, GX_VALUE amount_to_scroll);
UINT _gx_multi_line_text_view_scroll_info_get(GX_MULTI_LINE_TEXT_VIEW *view, ULONG style, GX_SCROLL_INFO *info);
UINT _gx_multi_line_text_view_string_total_rows_compute(GX_MULTI_LINE_TEXT_VIEW *text_view);
UINT _gx_multi_line_text_view_text_color_set(GX_MULTI_LINE_TEXT_VIEW *text_view,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
UINT _gx_multi_line_text_view_text_id_set(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
GX_RESOURCE_ID text_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_CHAR *text);
#endif
UINT _gx_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_STRING *text);
UINT _gx_multi_line_text_view_visible_rows_compute(GX_MULTI_LINE_TEXT_VIEW *view);
UINT _gx_multi_line_text_view_whitespace_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_UBYTE whitespace);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_multi_line_text_view_create(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr, GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size,
UINT text_view_control_block_size);
UINT _gxe_multi_line_text_view_event_process(GX_MULTI_LINE_TEXT_VIEW *view, GX_EVENT *event_ptr);
UINT _gxe_multi_line_text_view_font_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_RESOURCE_ID font_id);
UINT _gxe_multi_line_text_view_line_space_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_BYTE line_space);
UINT _gxe_multi_line_text_view_scroll_info_get(GX_MULTI_LINE_TEXT_VIEW *view, ULONG style, GX_SCROLL_INFO *info);
UINT _gxe_multi_line_text_view_text_color_set(GX_MULTI_LINE_TEXT_VIEW *view,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
UINT _gxe_multi_line_text_view_text_id_set(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
GX_RESOURCE_ID text_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_STRING *text);
UINT _gxe_multi_line_text_view_whitespace_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_UBYTE whitespace);

View File

@ -0,0 +1,75 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Numeric Pixelmap Prompt Management (Prompt) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_numeric_pixelmap_prompt.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX numeric pixelmap prompt management */
/* component, including all data types and external references. It is */
/* assumed that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_NUMERIC_PIXELMAP_PROMPT_H
#define GX_NUMERIC_PIXELMAP_PROMPT_H
/* Define numeric pixelmap prompt management function prototypes. */
UINT _gx_numeric_pixelmap_prompt_create(GX_NUMERIC_PIXELMAP_PROMPT *prompt,
GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT pixelmap_prompt_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_numeric_pixelmap_prompt_format(GX_NUMERIC_PIXELMAP_PROMPT *prompt, INT value);
UINT _gx_numeric_pixelmap_prompt_format_function_set(GX_NUMERIC_PIXELMAP_PROMPT *prompt, VOID (*format_func)(GX_NUMERIC_PIXELMAP_PROMPT *, INT));
UINT _gx_numeric_pixelmap_prompt_value_set(GX_NUMERIC_PIXELMAP_PROMPT *prompt, INT value);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_numeric_pixelmap_prompt_create(GX_NUMERIC_PIXELMAP_PROMPT *prompt,
GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT pixelmap_prompt_id,
GX_CONST GX_RECTANGLE *size,
UINT control_block_size);
UINT _gxe_numeric_pixelmap_prompt_format_function_set(GX_NUMERIC_PIXELMAP_PROMPT *prompt, VOID (*format_func)(GX_NUMERIC_PIXELMAP_PROMPT *, INT));
UINT _gxe_numeric_pixelmap_prompt_value_set(GX_NUMERIC_PIXELMAP_PROMPT *prompt, INT value);
#endif

View File

@ -0,0 +1,69 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Numeric Prompt Management (Prompt) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_numeric_prompt.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX numeric prompt management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_NUMERIC_PROMPT_H
#define GX_NUMERIC_PROMPT_H
/* Define prompt management function prototypes. */
UINT _gx_numeric_prompt_create(GX_NUMERIC_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_numeric_prompt_format(GX_NUMERIC_PROMPT *prompt, INT value);
UINT _gx_numeric_prompt_format_function_set(GX_NUMERIC_PROMPT *prompt, VOID (*format_func)(GX_NUMERIC_PROMPT *, INT));
UINT _gx_numeric_prompt_value_set(GX_NUMERIC_PROMPT *prompt, INT value);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_numeric_prompt_create(GX_NUMERIC_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id, GX_CONST GX_RECTANGLE *size,
UINT control_block_size);
UINT _gxe_numeric_prompt_format_function_set(GX_NUMERIC_PROMPT *prompt, VOID (*format_func)(GX_NUMERIC_PROMPT *, INT));
UINT _gxe_numeric_prompt_value_set(GX_NUMERIC_PROMPT *prompt, INT value);
#endif

View File

@ -0,0 +1,80 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Prompt Management (pixelmap prompt) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_pixelmap_prompt.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX bitmap prompt management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_PIXELMAP_PROMPT_H
#define GX_PIXELMAP_PROMPT_H
/* Define prompt management function prototypes. */
VOID _gx_pixelmap_prompt_background_draw(GX_PIXELMAP_PROMPT *prompt);
UINT _gx_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT pixelmap_prompt_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_pixelmap_prompt_draw(GX_PIXELMAP_PROMPT *prompt);
UINT _gx_pixelmap_prompt_pixelmap_set(GX_PIXELMAP_PROMPT *prompt,
GX_RESOURCE_ID normal_left_id,
GX_RESOURCE_ID normal_fill_id,
GX_RESOURCE_ID normal_right_id,
GX_RESOURCE_ID selected_left_id,
GX_RESOURCE_ID selected_fill_id,
GX_RESOURCE_ID selected_right_id);
UINT _gxe_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
ULONG style, USHORT pixelmap_prompt_id,
GX_CONST GX_RECTANGLE *size, UINT pixelmap_prompt_control_block_size);
UINT _gxe_pixelmap_prompt_pixelmap_set(GX_PIXELMAP_PROMPT *prompt,
GX_RESOURCE_ID normal_left_id,
GX_RESOURCE_ID normal_fill_id,
GX_RESOURCE_ID normal_right_id,
GX_RESOURCE_ID selected_left_id,
GX_RESOURCE_ID selected_fill_id,
GX_RESOURCE_ID selected_right_id);
#endif

View File

@ -0,0 +1,90 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Progress Bar Management (Progress Bar) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_progress_bar.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX progress bar widget, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_PROGRESS_BAR_H
#define GX_PROGRESS_BAR_H
/* Define progress bar management function prototypes. */
#define GX_SEGMENT_BORDER_INTERVAL 1
#define GX_SEGMENT_INTERVAL 1
VOID _gx_progress_bar_background_draw(GX_PROGRESS_BAR *progress_bar);
UINT _gx_progress_bar_create(GX_PROGRESS_BAR *progress_bar, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
USHORT progress_bar_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_progress_bar_draw(GX_PROGRESS_BAR *progress_bar);
UINT _gx_progress_bar_event_process(GX_PROGRESS_BAR *progress_bar, GX_EVENT *event_ptr);
UINT _gx_progress_bar_font_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID font_id);
UINT _gx_progress_bar_info_set(GX_PROGRESS_BAR *progress_bar, GX_PROGRESS_BAR_INFO *info);
UINT _gx_progress_bar_pixelmap_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID pixelmap);
UINT _gx_progress_bar_range_set(GX_PROGRESS_BAR *progress_bar, INT min_value, INT max_value);
UINT _gx_progress_bar_text_color_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id, GX_RESOURCE_ID disabled_text_color_id);
VOID _gx_progress_bar_text_draw(GX_PROGRESS_BAR *progress_bar);
UINT _gx_progress_bar_value_set(GX_PROGRESS_BAR *progress_bar, INT new_value);
UINT _gxe_progress_bar_create(GX_PROGRESS_BAR *progress_bar, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
USHORT progress_bar_id, GX_CONST GX_RECTANGLE *size,
UINT progress_bar_control_block_size);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_progress_bar_event_process(GX_PROGRESS_BAR *progress_bar, GX_EVENT *event_ptr);
UINT _gxe_progress_bar_font_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID font_id);
UINT _gxe_progress_bar_info_set(GX_PROGRESS_BAR *progress_bar, GX_PROGRESS_BAR_INFO *info);
UINT _gxe_progress_bar_pixelmap_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID pixelmap);
UINT _gxe_progress_bar_range_set(GX_PROGRESS_BAR *progress_bar, INT min_value, INT max_value);
UINT _gxe_progress_bar_text_color_set(GX_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id, GX_RESOURCE_ID disabled_text_color_id);
UINT _gxe_progress_bar_value_set(GX_PROGRESS_BAR *progress_bar, INT new_value);
#endif

94
common/inc/gx_prompt.h Normal file
View File

@ -0,0 +1,94 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Prompt Management (Prompt) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_prompt.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX prompt management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_PROMPT_H
#define GX_PROMPT_H
/* Define prompt management function prototypes. */
UINT _gx_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RESOURCE_ID text_id,
ULONG style, USHORT prompt_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_prompt_draw(GX_PROMPT *prompt);
UINT _gx_prompt_font_set(GX_PROMPT *prompt, GX_RESOURCE_ID fontid);
VOID _gx_prompt_text_draw(GX_PROMPT *prompt);
UINT _gx_prompt_text_color_set(GX_PROMPT *prompt,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_prompt_text_get(GX_PROMPT *prompt, GX_CONST GX_CHAR **return_text);
UINT _gx_prompt_text_set(GX_PROMPT *prompt, GX_CONST GX_CHAR *text);
#endif
UINT _gx_prompt_text_get_ext(GX_PROMPT *prompt, GX_STRING *return_text);
UINT _gx_prompt_text_set_ext(GX_PROMPT *prompt, GX_CONST GX_STRING *text);
UINT _gx_prompt_text_id_set(GX_PROMPT *prompt, GX_RESOURCE_ID string_id);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID text_id,
ULONG style, USHORT prompt_id, GX_CONST GX_RECTANGLE *size, UINT prompt_control_block_size);
UINT _gxe_prompt_font_set(GX_PROMPT *prompt, GX_RESOURCE_ID fontid);
UINT _gxe_prompt_text_color_set(GX_PROMPT *prompt,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_prompt_text_get(GX_PROMPT *prompt, GX_CONST GX_CHAR **return_text);
UINT _gxe_prompt_text_set(GX_PROMPT *prompt, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_prompt_text_get_ext(GX_PROMPT *prompt, GX_STRING *return_text);
UINT _gxe_prompt_text_set_ext(GX_PROMPT *prompt, GX_CONST GX_STRING *text);
UINT _gxe_prompt_text_id_set(GX_PROMPT *prompt, GX_RESOURCE_ID string_id);
#endif

View File

@ -0,0 +1,99 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Progress Bar Management (Radial Progress Bar) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_radial_progress_bar.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX progress bar widget, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_RADIAL_PROGRESS_BAR_H
#define GX_RADIAL_PROGRESS_BAR_H
/* Define radial progress bar management function prototypes. */
UINT _gx_radial_progress_bar_anchor_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_VALUE angle);
VOID _gx_radial_progress_bar_background_draw(GX_RADIAL_PROGRESS_BAR *progress_bar);
UINT _gx_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR *progress_bar,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_RADIAL_PROGRESS_BAR_INFO *progress_bar_info,
ULONG style,
USHORT progress_bar_id);
VOID _gx_radial_progress_bar_draw(GX_RADIAL_PROGRESS_BAR *progress_bar);
UINT _gx_radial_progress_bar_event_process(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_EVENT *event_ptr);
UINT _gx_radial_progress_bar_font_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID font_id);
UINT _gx_radial_progress_bar_info_set(GX_RADIAL_PROGRESS_BAR *bar, GX_RADIAL_PROGRESS_BAR_INFO *info);
UINT _gx_radial_progress_bar_resize(GX_RADIAL_PROGRESS_BAR *radial_progress);
UINT _gx_radial_progress_bar_size_update(GX_RADIAL_PROGRESS_BAR *bar);
UINT _gx_radial_progress_bar_text_color_set(GX_RADIAL_PROGRESS_BAR *progress_bar,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
VOID _gx_radial_progress_bar_text_draw(GX_RADIAL_PROGRESS_BAR *bar);
UINT _gx_radial_progress_bar_value_calculate(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_POINT new_position);
UINT _gx_radial_progress_bar_value_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_VALUE new_value);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_radial_progress_bar_anchor_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_VALUE angle);
UINT _gxe_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR *progress_bar,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent,
GX_RADIAL_PROGRESS_BAR_INFO *progress_bar_info,
ULONG style,
USHORT progress_bar_id,
UINT progress_bar_control_block_size);
UINT _gxe_radial_progress_bar_event_process(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_EVENT *event_ptr);
UINT _gxe_radial_progress_bar_font_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_RESOURCE_ID font_id);
UINT _gxe_radial_progress_bar_text_color_set(GX_RADIAL_PROGRESS_BAR *progress_bar,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id);
UINT _gxe_radial_progress_bar_info_set(GX_RADIAL_PROGRESS_BAR *bar, GX_RADIAL_PROGRESS_BAR_INFO *info);
UINT _gxe_radial_progress_bar_value_set(GX_RADIAL_PROGRESS_BAR *progress_bar, GX_VALUE new_value);
#endif

View File

@ -0,0 +1,85 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Radial Slider Management (Slider) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_radial_slider.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX progress bar widget, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_RADIAL_SLIDER_H
#define GX_RADIAL_SLIDER_H
/* Define radial slider management function prototypes. */
UINT _gx_radial_slider_anchor_angle_calculate(GX_RADIAL_SLIDER *slider, GX_VALUE *target_value);
UINT _gx_radial_slider_anchor_angles_set(GX_RADIAL_SLIDER *slider, GX_VALUE *anchor_values, USHORT anchor_count);
UINT _gx_radial_slider_animation_set(GX_RADIAL_SLIDER *slider, USHORT steps, USHORT delay, USHORT animation_style,
VOID (*animation_update_callback)(GX_RADIAL_SLIDER *slider));
UINT _gx_radial_slider_animation_start(GX_RADIAL_SLIDER *slider, GX_VALUE new_value);
UINT _gx_radial_slider_animation_update(GX_RADIAL_SLIDER *slider);
UINT _gx_radial_slider_create(GX_RADIAL_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RADIAL_SLIDER_INFO *info, ULONG style, USHORT slider_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_radial_slider_draw(GX_RADIAL_SLIDER *slider);
UINT _gx_radial_slider_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gx_radial_slider_info_get(GX_RADIAL_SLIDER *slider, GX_RADIAL_SLIDER_INFO **info);
UINT _gx_radial_slider_info_set(GX_RADIAL_SLIDER *slider, GX_RADIAL_SLIDER_INFO *info);
UINT _gx_radial_slider_needle_rectangle_calculate(GX_RADIAL_SLIDER *slider, GX_RECTANGLE *rectangle);
UINT _gx_radial_slider_pixelmap_set(GX_RADIAL_SLIDER *slider, GX_RESOURCE_ID background_pixelmap, GX_RESOURCE_ID needle_pixelmap);
UINT _gx_radial_slider_angle_calculate(GX_RADIAL_SLIDER *slider, GX_POINT point, GX_VALUE *return_value);
UINT _gx_radial_slider_angle_set(GX_RADIAL_SLIDER *slider, GX_VALUE new_value);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_radial_slider_anchor_angles_set(GX_RADIAL_SLIDER *slider, GX_VALUE *anchor_values, USHORT anchor_count);
UINT _gxe_radial_slider_animation_set(GX_RADIAL_SLIDER *slider, USHORT steps, USHORT delay, USHORT animation_style,
VOID (*animation_update_callback)(GX_RADIAL_SLIDER *slider));
UINT _gxe_radial_slider_animation_start(GX_RADIAL_SLIDER *slider, GX_VALUE new_value);
UINT _gxe_radial_slider_create(GX_RADIAL_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_RADIAL_SLIDER_INFO *info, ULONG style, USHORT slider_id,
GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_radial_slider_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gxe_radial_slider_info_get(GX_RADIAL_SLIDER *slider, GX_RADIAL_SLIDER_INFO **info);
UINT _gxe_radial_slider_info_set(GX_RADIAL_SLIDER *slider, GX_RADIAL_SLIDER_INFO *info);
UINT _gxe_radial_slider_pixelmap_set(GX_RADIAL_SLIDER *slider, GX_RESOURCE_ID background_pixelmap, GX_RESOURCE_ID needle_pixelmap);
UINT _gxe_radial_slider_angle_set(GX_RADIAL_SLIDER *slider, GX_VALUE new_value);
#endif

View File

@ -0,0 +1,64 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Screen Stack Management (Screen Stack) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_screen_stack.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX screen stack component, including all */
/* data types and external references. It is assumed that gx_api.h */
/* and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SCREEN_STACK_H
#define GX_SCREEN_STACK_H
/* Define screen stack management function prototypes. */
UINT _gx_screen_stack_create(GX_SCREEN_STACK_CONTROL *control, GX_WIDGET **memory, INT size);
UINT _gx_screen_stack_push(GX_SCREEN_STACK_CONTROL *control, GX_WIDGET *screen, GX_WIDGET *new_screen);
UINT _gx_screen_stack_pop(GX_SCREEN_STACK_CONTROL *control);
UINT _gx_screen_stack_reset(GX_SCREEN_STACK_CONTROL *control);
/* error checking versions of the screen stack API functions */
UINT _gxe_screen_stack_create(GX_SCREEN_STACK_CONTROL *control, GX_WIDGET **memory, INT size);
UINT _gxe_screen_stack_push(GX_SCREEN_STACK_CONTROL *control, GX_WIDGET *screen, GX_WIDGET *new_screen);
UINT _gxe_screen_stack_pop(GX_SCREEN_STACK_CONTROL *control);
UINT _gxe_screen_stack_reset(GX_SCREEN_STACK_CONTROL *control);
#endif

View File

@ -0,0 +1,171 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Scroll Wheel Management (Scroll Wheel) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_scroll_wheel.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX scroll wheel management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SCROLL_WHEEL_H
#define GX_SCROLL_WHEEL_H
#define GX_ANIMATION_TIMER 0x1100
/* Define scroll wheel management function prototypes. */
UINT _gx_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
INT start_val, INT end_val,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
UINT _gx_numeric_scroll_wheel_range_set(GX_NUMERIC_SCROLL_WHEEL *wheel, INT start_val, INT end_val);
UINT _gx_numeric_scroll_wheel_text_get(GX_NUMERIC_SCROLL_WHEEL *wheel, INT row, GX_STRING *);
UINT _gx_scroll_wheel_create(GX_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
UINT _gx_scroll_wheel_event_process(GX_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr);
VOID _gx_scroll_wheel_gradient_create(GX_SCROLL_WHEEL *wheel);
UINT _gx_scroll_wheel_gradient_alpha_set(GX_SCROLL_WHEEL *wheel, GX_UBYTE start_alpha, GX_UBYTE end_alpha);
UINT _gx_scroll_wheel_row_height_set(GX_SCROLL_WHEEL *wheel, GX_VALUE row_height);
UINT _gx_scroll_wheel_selected_row_calculate(GX_SCROLL_WHEEL *wheel);
UINT _gx_scroll_wheel_scroll(GX_SCROLL_WHEEL *wheel, GX_VALUE shift);
UINT _gx_scroll_wheel_selected_background_set(GX_SCROLL_WHEEL *wheel, GX_RESOURCE_ID selected_bg);
UINT _gx_scroll_wheel_selected_get(GX_SCROLL_WHEEL *wheel, INT *row);
UINT _gx_scroll_wheel_selected_set(GX_SCROLL_WHEEL *wheel, INT row);
UINT _gx_scroll_wheel_speed_set(GX_SCROLL_WHEEL *wheel, GX_FIXED_VAL start_speed_rate, GX_FIXED_VAL end_speed_rate,
GX_VALUE max_steps, GX_VALUE delay);
UINT _gx_scroll_wheel_total_rows_set(GX_SCROLL_WHEEL *wheel, INT total_rows);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_string_scroll_wheel_create(GX_STRING_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
GX_CONST GX_CHAR **string_list,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
#endif
UINT _gx_string_scroll_wheel_create_ext(GX_STRING_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
GX_CONST GX_STRING *string_list,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
UINT _gx_string_scroll_wheel_string_id_list_set(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_RESOURCE_ID *string_id_list,
INT id_count);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_CHAR **string_list,
INT string_count);
#endif
UINT _gx_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_STRING *string_list,
INT string_count);
UINT _gx_string_scroll_wheel_text_get(GX_STRING_SCROLL_WHEEL *wheel, INT row, GX_STRING *string);
/* Define text scroll wheel management function prototypes. */
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_text_scroll_wheel_callback_set(GX_TEXT_SCROLL_WHEEL * wheel, GX_CONST GX_CHAR * (*callback)(GX_TEXT_SCROLL_WHEEL *, INT));
#endif
UINT _gx_text_scroll_wheel_callback_set_ext(GX_TEXT_SCROLL_WHEEL* wheel, UINT (*callback)(GX_TEXT_SCROLL_WHEEL*, INT, GX_STRING *));
UINT _gx_text_scroll_wheel_create(GX_TEXT_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
VOID _gx_text_scroll_wheel_draw(GX_TEXT_SCROLL_WHEEL *wheel);
UINT _gx_text_scroll_wheel_font_set(GX_TEXT_SCROLL_WHEEL *wheel, GX_RESOURCE_ID normal_font, GX_RESOURCE_ID selected_font);
UINT _gx_text_scroll_wheel_text_color_set(GX_TEXT_SCROLL_WHEEL *wheel,
GX_RESOURCE_ID normal_text_color,
GX_RESOURCE_ID selected_text_color,
GX_RESOURCE_ID disabled_text_color);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
INT start_val, INT end_val,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_numeric_scroll_wheel_range_set(GX_NUMERIC_SCROLL_WHEEL *wheel, INT start_val, INT end_val);
UINT _gxe_scroll_wheel_create(GX_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_scroll_wheel_event_process(GX_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr);
UINT _gxe_scroll_wheel_gradient_alpha_set(GX_SCROLL_WHEEL *wheel, GX_UBYTE start_alpha, GX_UBYTE end_alpha);
UINT _gxe_scroll_wheel_row_height_set(GX_SCROLL_WHEEL *wheel, GX_VALUE row_height);
UINT _gxe_scroll_wheel_selected_background_set(GX_SCROLL_WHEEL *wheel, GX_RESOURCE_ID selected_bg);
UINT _gxe_scroll_wheel_selected_get(GX_SCROLL_WHEEL *wheel, INT *row);
UINT _gxe_scroll_wheel_selected_set(GX_SCROLL_WHEEL *wheel, INT row);
UINT _gxe_scroll_wheel_speed_set(GX_SCROLL_WHEEL *wheel, GX_FIXED_VAL start_speed_rate, GX_FIXED_VAL end_speed_rate,
GX_VALUE max_steps, GX_VALUE delay);
UINT _gxe_scroll_wheel_total_rows_set(GX_SCROLL_WHEEL *wheel, INT total_rows);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_string_scroll_wheel_create(GX_STRING_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
GX_CONST GX_CHAR **string_list,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
#endif
UINT _gxe_string_scroll_wheel_create_ext(GX_STRING_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
GX_CONST GX_STRING *string_list,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_string_scroll_wheel_string_id_list_set(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_RESOURCE_ID *string_id_list,
INT id_count);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_CHAR **string_list,
INT string_count);
#endif
UINT _gxe_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL *wheel,
GX_CONST GX_STRING *string_list,
INT string_count);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_text_scroll_wheel_callback_set(GX_TEXT_SCROLL_WHEEL * wheel, GX_CONST GX_CHAR * (*callback)(GX_TEXT_SCROLL_WHEEL *, INT));
#endif
UINT _gxe_text_scroll_wheel_callback_set_ext(GX_TEXT_SCROLL_WHEEL* wheel, UINT (*callback)(GX_TEXT_SCROLL_WHEEL*, INT, GX_STRING *));
UINT _gxe_text_scroll_wheel_create(GX_TEXT_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT total_rows,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_text_scroll_wheel_font_set(GX_TEXT_SCROLL_WHEEL *wheel, GX_RESOURCE_ID normal_font, GX_RESOURCE_ID selected_font);
UINT _gxe_text_scroll_wheel_text_color_set(GX_TEXT_SCROLL_WHEEL *wheel,
GX_RESOURCE_ID normal_text_color,
GX_RESOURCE_ID selected_text_color,
GX_RESOURCE_ID disabled_text_color);
#endif

96
common/inc/gx_scrollbar.h Normal file
View File

@ -0,0 +1,96 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Scroll Management (Scrollbar) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_scrollbar.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX icon management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SCROLLBAR_H
#define GX_SCROLLBAR_H
/* Define scrollbar management function prototypes. */
UINT _gx_horizontal_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name, GX_WINDOW *parent,
GX_SCROLLBAR_APPEARANCE *appearance, ULONG style);
UINT _gx_vertical_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name, GX_WINDOW *parent,
GX_SCROLLBAR_APPEARANCE *appearance, ULONG style);
VOID _gx_scrollbar_draw(GX_SCROLLBAR *scrollbar);
UINT _gx_scrollbar_event_process(GX_SCROLLBAR *scrollbar, GX_EVENT *event_ptr);
UINT _gx_scrollbar_limit_check(GX_SCROLLBAR *scrollbar);
VOID _gx_scrollbar_thumb_position_calculate(GX_SCROLLBAR *scroll);
UINT _gx_scrollbar_reset(GX_SCROLLBAR *scrollbar, GX_SCROLL_INFO *info);
VOID _gx_scrollbar_size_update(GX_SCROLLBAR *scroll);
VOID _gx_scrollbar_value_calculate(GX_SCROLLBAR *scroll, INT offset, INT size);
UINT _gx_scrollbar_value_set(GX_SCROLLBAR *scroll, INT value);
/* Define scroll thumb management function prototypes. */
UINT _gx_scroll_thumb_create(GX_SCROLL_THUMB *scroll_thumb, GX_SCROLLBAR *parent, ULONG style);
VOID _gx_scroll_thumb_draw(GX_SCROLL_THUMB *scroll_thumb);
UINT _gx_scroll_thumb_event_process(GX_SCROLL_THUMB *scroll_thumb, GX_EVENT *event_ptr);
INT _gx_scroll_thumb_shift_limit(GX_SCROLL_THUMB *thumb, INT shift);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_horizontal_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name, GX_WINDOW *parent,
GX_SCROLLBAR_APPEARANCE *appearance, ULONG style,
UINT scrollbar_control_block_size);
UINT _gxe_vertical_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name, GX_WINDOW *parent,
GX_SCROLLBAR_APPEARANCE *appearance,
ULONG style, UINT scrollbar_control_block_size);
UINT _gxe_scroll_thumb_event_process(GX_SCROLL_THUMB *scroll_thumb, GX_EVENT *event_ptr);
UINT _gxe_scroll_thumb_create(GX_SCROLL_THUMB *scroll_thumb, GX_SCROLLBAR *parent, ULONG style, UINT scroll_thumb_control_block_size);
UINT _gxe_scrollbar_event_process(GX_SCROLLBAR *scrollbar, GX_EVENT *event_ptr);
UINT _gxe_scrollbar_limit_check(GX_SCROLLBAR *scrollbar);
UINT _gxe_scrollbar_reset(GX_SCROLLBAR *scrollbar, GX_SCROLL_INFO *info);
UINT _gxe_scrollbar_value_set(GX_SCROLLBAR *scrollbar, INT value);
#endif

View File

@ -0,0 +1,142 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Text Input Management (Single Line Text Input) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_single_line_text_input.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX text input management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SINGLE_LINE_TEXT_INPUT_H
#define GX_SINGLE_LINE_TEXT_INPUT_H
#define ID_TEXT_INPUT_TIMER 2
#define TIME_OUT_PERIOD 20
#define GX_MARK_TIMER 3
#define GX_MARK_INTERVAL 5
/* Define text input management function prototypes. */
UINT _gx_single_line_text_input_backspace(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_buffer_clear(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_buffer_get(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address,
UINT *content_size, UINT *buffer_size);
UINT _gx_single_line_text_input_character_delete(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_character_insert(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size);
UINT _gx_single_line_text_input_copy(GX_SINGLE_LINE_TEXT_INPUT *input);
UINT _gx_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_CHAR *input_buffer, UINT buffer_size, UINT style, USHORT Id,
GX_CONST GX_RECTANGLE *size);
UINT _gx_single_line_text_input_cut(GX_SINGLE_LINE_TEXT_INPUT *input);
VOID _gx_single_line_text_input_draw(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_draw_position_get(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_VALUE *xpos, GX_VALUE *ypos);
UINT _gx_single_line_text_input_end(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_event_process(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr);
UINT _gx_single_line_text_input_fill_color_set(GX_SINGLE_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_fill_color_id,
GX_RESOURCE_ID selected_fill_color_id,
GX_RESOURCE_ID disabled_fill_color_id,
GX_RESOURCE_ID readonly_fill_color_id);
UINT _gx_single_line_text_input_home(GX_SINGLE_LINE_TEXT_INPUT *text_input);
VOID _gx_single_line_text_input_keydown_process(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr);
UINT _gx_single_line_text_input_left_arrow(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_mark_end(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_mark_home(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_mark_next(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_mark_previous(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_paste(GX_SINGLE_LINE_TEXT_INPUT *input);
UINT _gx_single_line_text_input_position_get(GX_SINGLE_LINE_TEXT_INPUT *text_input, INT pixel_position);
UINT _gx_single_line_text_input_position_update(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_right_arrow(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gx_single_line_text_input_style_add(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gx_single_line_text_input_style_remove(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gx_single_line_text_input_style_set(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gx_single_line_text_input_text_color_set(GX_SINGLE_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id,
GX_RESOURCE_ID readonly_text_color_id);
UINT _gx_single_line_text_input_text_rectangle_get(GX_SINGLE_LINE_TEXT_INPUT *input, INT shift, GX_RECTANGLE *rect);
UINT _gx_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_single_line_text_input_text_set(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_CONST GX_CHAR *text);
#endif
UINT _gx_single_line_text_input_text_set_ext(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *text);
/* error checking versions of the animation API functions */
UINT _gxe_single_line_text_input_backspace(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_buffer_clear(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr);
UINT _gxe_single_line_text_input_buffer_get(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address,
UINT *content_size, UINT *buffer_size);
UINT _gxe_single_line_text_input_character_delete(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_character_insert(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size);
UINT _gxe_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_CHAR *input_buffer, UINT buffer_size, UINT style, USHORT Id,
GX_CONST GX_RECTANGLE *size, UINT text_input_control_block_size);
UINT _gxe_single_line_text_input_draw_position_get(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_VALUE *xpos, GX_VALUE *ypos);
UINT _gxe_single_line_text_input_end(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_event_process(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, GX_EVENT *event_ptr);
UINT _gxe_single_line_text_input_home(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_left_arrow(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_position_get(GX_SINGLE_LINE_TEXT_INPUT *text_input, INT pixel_position);
UINT _gxe_single_line_text_input_right_arrow(GX_SINGLE_LINE_TEXT_INPUT *text_input);
UINT _gxe_single_line_text_input_style_add(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gxe_single_line_text_input_style_remove(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gxe_single_line_text_input_style_set(GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr, ULONG style);
UINT _gxe_single_line_text_input_fill_color_set(GX_SINGLE_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_fill_color_id,
GX_RESOURCE_ID selected_fill_color_id,
GX_RESOURCE_ID disabled_fill_color_id,
GX_RESOURCE_ID readonly_fill_color_id);
UINT _gxe_single_line_text_input_text_color_set(GX_SINGLE_LINE_TEXT_INPUT *input,
GX_RESOURCE_ID normal_text_color_id,
GX_RESOURCE_ID selected_text_color_id,
GX_RESOURCE_ID disabled_text_color_id,
GX_RESOURCE_ID readonly_text_color_id);
UINT _gxe_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_single_line_text_input_text_set(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text);
#endif
UINT _gxe_single_line_text_input_text_set_ext(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text);
#endif

98
common/inc/gx_slider.h Normal file
View File

@ -0,0 +1,98 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Prompt Management (Slider) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_slider.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX slide widget, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SLIDER_H
#define GX_SLIDER_H
/* Define prompt management function prototypes. */
#define GX_SLIDER_NEEDLE_WIDTH 5
UINT _gx_slider_create(GX_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
INT tick_count, GX_SLIDER_INFO *slider_info,
ULONG style, USHORT slider_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_slider_draw(GX_SLIDER *slider);
UINT _gx_slider_event_process(GX_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gx_slider_info_set(GX_SLIDER *slider, GX_SLIDER_INFO *info);
VOID _gx_slider_needle_draw(GX_SLIDER *slider);
UINT _gx_slider_needle_position_get(GX_SLIDER *slider, GX_SLIDER_INFO *slider_info, GX_RECTANGLE *return_position);
VOID _gx_slider_tickmarks_draw(GX_SLIDER *slider);
UINT _gx_slider_travel_get(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT *return_min_travel, INT *return_max_travel);
UINT _gx_slider_value_calculate(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT newpos);
UINT _gx_slider_value_set(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT new_value);
UINT _gx_pixelmap_slider_create(GX_PIXELMAP_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_SLIDER_INFO *info,
GX_PIXELMAP_SLIDER_INFO *pixelmap_info, ULONG style, USHORT pixelmap_slider_id,
GX_CONST GX_RECTANGLE *size);
VOID _gx_pixelmap_slider_draw(GX_PIXELMAP_SLIDER *slider);
UINT _gx_pixelmap_slider_event_process(GX_PIXELMAP_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gx_pixelmap_slider_pixelmap_set(GX_PIXELMAP_SLIDER *slider, GX_PIXELMAP_SLIDER_INFO *info);
UINT _gxe_slider_create(GX_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent, INT tick_count,
GX_SLIDER_INFO *slider_info, ULONG style, USHORT slider_id, GX_CONST GX_RECTANGLE *size,
UINT slider_control_block_size);
UINT _gxe_slider_event_process(GX_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gxe_slider_travel_get(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT *return_min_travel, INT *return_max_travel);
UINT _gxe_slider_needle_position_get(GX_SLIDER *slider, GX_SLIDER_INFO *slider_info, GX_RECTANGLE *return_position);
UINT _gxe_slider_value_calculate(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT new_position);
UINT _gxe_slider_value_set(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT new_value);
UINT _gxe_pixelmap_slider_create(GX_PIXELMAP_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_SLIDER_INFO *info, GX_PIXELMAP_SLIDER_INFO *pixelmap_info,
ULONG style, USHORT pixelmap_slider_id,
GX_CONST GX_RECTANGLE *size, UINT pixelmap_slider_controlb_block_size);
UINT _gxe_pixelmap_slider_event_process(GX_PIXELMAP_SLIDER *slider, GX_EVENT *event_ptr);
UINT _gxe_slider_info_set(GX_SLIDER *slider, GX_SLIDER_INFO *info);
UINT _gxe_pixelmap_slider_pixelmap_set(GX_PIXELMAP_SLIDER *slider, GX_PIXELMAP_SLIDER_INFO *info);
VOID _gx_pixelmap_slider_pixelmap_update(GX_PIXELMAP_SLIDER *slider);
#endif

80
common/inc/gx_sprite.h Normal file
View File

@ -0,0 +1,80 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Sprite Management (Sprite) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_sprite.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX sprite component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SPRITE_H
#define GX_SPRITE_H
#define GX_SPRITE_IDLE 0x0001
#define GX_SPRITE_RUNNING 0x0002
#define GX_SPRITE_TIMER 0x1000
/* Define animation management function prototypes. */
UINT _gx_sprite_create(GX_SPRITE *sprite, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_SPRITE_FRAME *frame_list, USHORT frame_count,
ULONG style, USHORT sprite_id, GX_CONST GX_RECTANGLE *size);
UINT _gx_sprite_start(GX_SPRITE *sprite, USHORT start_frame);
UINT _gx_sprite_stop(GX_SPRITE *sprite);
VOID _gx_sprite_update(GX_SPRITE *sprite);
VOID _gx_sprite_complete(GX_SPRITE *sprite);
UINT _gx_sprite_current_frame_set(GX_SPRITE *sprite, USHORT frame);
VOID _gx_sprite_draw(GX_SPRITE *sprite);
UINT _gx_sprite_event_process(GX_SPRITE *sprite, GX_EVENT *event_ptr);
UINT _gx_sprite_frame_list_set(GX_SPRITE *sprite, GX_SPRITE_FRAME *frame_list, USHORT frame_count);
/* error checking versions of the animation API functions */
UINT _gxe_sprite_create(GX_SPRITE *sprite, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
GX_SPRITE_FRAME *frame_list, USHORT frame_count,
ULONG style, USHORT sprite_id, GX_CONST GX_RECTANGLE *size, UINT sprite_control_block_size);
UINT _gxe_sprite_current_frame_set(GX_SPRITE *sprite, USHORT frame);
UINT _gxe_sprite_frame_list_set(GX_SPRITE *sprite, GX_SPRITE_FRAME *frame_list, USHORT frame_count);
UINT _gxe_sprite_start(GX_SPRITE *sprite, USHORT frame);
UINT _gxe_sprite_stop(GX_SPRITE *sprite);
#endif

416
common/inc/gx_system.h Normal file
View File

@ -0,0 +1,416 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** System Management (System) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_system.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX system management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_SYSTEM_H
#define GX_SYSTEM_H
/* Define system management function prototypes. */
UINT _gx_system_active_language_set(GX_UBYTE language);
VOID _gx_system_all_canvas_dirty(VOID);
VOID _gx_system_all_views_free(GX_WINDOW_ROOT *root);
#if (GX_ANIMATION_POOL_SIZE > 0)
UINT _gx_system_animation_get(GX_ANIMATION **animation);
UINT _gx_system_animation_free(GX_ANIMATION *animation);
#endif
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
UINT _gx_system_bidi_text_enable(VOID);
UINT _gx_system_bidi_text_disable(VOID);
#endif
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
UINT _gx_system_text_render_style_set(GX_UBYTE style);
#endif
UINT _gx_system_canvas_refresh(VOID);
UINT _gx_system_clipboard_put(VOID *data, UINT data_size);
UINT _gx_system_clipboard_get(VOID **data, UINT *data_size);
UINT _gx_system_dirty_mark(GX_WIDGET *widget);
UINT _gx_system_dirty_list_trim(GX_RECTANGLE *dirty_area, GX_WINDOW_ROOT *root);
VOID _gx_system_dirty_list_remove(GX_WIDGET *remove);
UINT _gx_system_dirty_partial_add(GX_WIDGET *widget, GX_RECTANGLE *dirty_area);
VOID _gx_system_dirty_entry_shift(GX_WIDGET *widget, INT xShift, INT yShift);
UINT _gx_system_draw_context_get(GX_DRAW_CONTEXT **current_context);
VOID _gx_system_error_process(UINT error_code);
UINT _gx_system_event_dispatch(GX_EVENT *new_event);
UINT _gx_system_event_fold(GX_EVENT *in_event);
VOID _gx_system_event_remove(GX_WIDGET *widget);
UINT _gx_system_event_send(GX_EVENT *in_event);
UINT _gx_system_focus_claim(GX_WIDGET *widget);
GX_VIEW *_gx_system_free_view_get(VOID);
UINT _gx_system_initialize(VOID);
UINT _gx_system_input_capture(GX_WIDGET *owner);
UINT _gx_system_input_release(GX_WIDGET *owner);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_system_language_table_get(GX_CHAR ****language_table, GX_UBYTE *language_count, UINT *string_count);
UINT _gx_system_language_table_set(GX_CHAR ***language_table, GX_UBYTE number_of_langauges, UINT number_of_strings);
#endif
VOID _gx_system_lock(VOID);
UINT _gx_system_memory_allocator_set(VOID *(*allocate)(ULONG size), VOID (*release)(VOID *));
VOID _gx_system_unlock(VOID);
VOID _gx_system_input_lock(VOID);
VOID _gx_system_input_unlock(VOID);
VOID _gx_system_pen_speed_init(GX_POINT *current);
VOID _gx_system_pen_speed_update(GX_POINT *current);
VOID _gx_system_pen_flick_test(VOID);
UINT _gx_system_pen_configure(GX_PEN_CONFIGURATION *pen_configuration);
UINT _gx_system_private_string_copy(GX_STRING *ptr_address, GX_CONST GX_STRING *text);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_system_private_string_list_copy(GX_CONST GX_CHAR ***ptr_address, GX_CONST GX_CHAR **string_list, INT string_count);
VOID _gx_system_private_string_list_get(GX_CONST GX_CHAR **input, GX_CONST GX_CHAR ***output, ULONG style);
#endif
UINT _gx_system_private_string_list_copy_ext(GX_STRING **ptr_address, USHORT *buffer_size, GX_CONST GX_STRING *string_list, INT string_count);
UINT _gx_system_private_string_delete(GX_WIDGET *widget);
VOID _gx_system_private_string_get(GX_CONST GX_STRING *input, GX_STRING *output, ULONG style);
VOID _gx_system_root_view_add(GX_WINDOW_ROOT *root, GX_RECTANGLE *inrect);
UINT _gx_system_screen_stack_create(GX_WIDGET **memory, INT size);
UINT _gx_system_screen_stack_pop(VOID);
UINT _gx_system_screen_stack_push(GX_WIDGET *screen);
UINT _gx_system_screen_stack_get(GX_WIDGET **popped_parent, GX_WIDGET **popped_screen);
UINT _gx_system_screen_stack_reset(VOID);
UINT _gx_system_scroll_appearance_get(ULONG type, GX_SCROLLBAR_APPEARANCE *save);
UINT _gx_system_scroll_appearance_set(ULONG style, GX_SCROLLBAR_APPEARANCE *appearance);
UINT _gx_system_start(VOID);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_system_string_get(GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
UINT _gx_system_string_table_get(GX_UBYTE langauge, GX_CHAR ***put_table, UINT *put_size);
UINT _gx_system_string_width_get(GX_CONST GX_FONT *font, GX_CONST GX_CHAR *string, INT string_length, GX_VALUE *return_width);
#endif
UINT _gx_system_string_width_get_ext(GX_CONST GX_FONT *font, GX_CONST GX_STRING *string, GX_VALUE *return_width);
VOID _gx_system_thread_entry(ULONG id);
VOID _gx_system_timer_expiration(ULONG val);
UINT _gx_system_timer_start(GX_WIDGET *owner, UINT timer_id, UINT initial_ticks, UINT reschedule_ticks);
UINT _gx_system_timer_stop(GX_WIDGET *owner, UINT timer_id);
VOID _gx_system_timer_update(ULONG ticks);
GX_WINDOW_ROOT *_gx_system_top_root_find(GX_EVENT *in_event);
GX_WIDGET *_gx_system_top_widget_find(GX_WIDGET *root, GX_POINT test_point, ULONG status);
#ifdef GX_ENABLE_DEPRECATED_STRING_API
UINT _gx_system_version_string_get(GX_CHAR **return_string);
#endif
UINT _gx_system_version_string_get_ext(GX_STRING *return_string);
VOID _gx_system_view_add(GX_WINDOW *win, GX_RECTANGLE *view);
GX_BOOL _gx_system_view_fold(GX_WINDOW *win, GX_RECTANGLE *view);
VOID _gx_system_views_free(GX_VIEW *head);
VOID _gx_system_view_split(GX_WINDOW *over, GX_WINDOW_ROOT *root, GX_RECTANGLE *original);
VOID _gx_system_views_update(GX_WINDOW_ROOT *root);
UINT _gx_system_widget_find(USHORT widget_id, INT search_level, GX_WIDGET **return_search_result);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_system_active_language_set(GX_UBYTE language);
#if (GX_ANIMATION_POOL_SIZE > 0)
UINT _gxe_system_animation_get(GX_ANIMATION **animation);
UINT _gxe_system_animation_free(GX_ANIMATION *animation);
#endif
UINT _gxe_system_canvas_refresh(VOID);
UINT _gxe_system_dirty_mark(GX_WIDGET *widget);
UINT _gxe_system_dirty_partial_add(GX_WIDGET *widget, GX_RECTANGLE *dirty_area);
UINT _gxe_system_draw_context_get(GX_DRAW_CONTEXT **current_context);
UINT _gxe_system_event_fold(GX_EVENT *event_ptr);
UINT _gxe_system_event_send(GX_EVENT *event_ptr);
UINT _gxe_system_focus_claim(GX_WIDGET *widget);
UINT _gxe_system_initialize(VOID);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_system_language_table_get(GX_CHAR ****language_table, GX_UBYTE *language_count, UINT *string_count);
UINT _gxe_system_language_table_set(GX_CHAR ***string_table, GX_UBYTE language_count, UINT number_of_strings);
#endif
UINT _gxe_system_memory_allocator_set(VOID *(*allocate)(ULONG size), VOID (*release)(VOID *));
UINT _gxe_system_pen_configure(GX_PEN_CONFIGURATION *pen_configuration);
UINT _gxe_system_screen_stack_create(GX_WIDGET **memory, INT size, UINT control_block_size);
UINT _gxe_system_screen_stack_get(GX_WIDGET **popped_parent, GX_WIDGET **popped_screen);
UINT _gxe_system_screen_stack_pop(VOID);
UINT _gxe_system_screen_stack_push(GX_WIDGET *screen);
UINT _gxe_system_scroll_appearance_get(ULONG style, GX_SCROLLBAR_APPEARANCE *return_appearance);
UINT _gxe_system_scroll_appearance_set(ULONG style, GX_SCROLLBAR_APPEARANCE *appearance);
UINT _gxe_system_start(VOID);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_system_string_get(GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
UINT _gxe_system_string_table_get(GX_UBYTE language, GX_CHAR ***get_table, UINT *get_size);
UINT _gxe_system_string_width_get(GX_CONST GX_FONT *font, GX_CONST GX_CHAR *string, INT string_length, GX_VALUE *return_width);
#endif
UINT _gxe_system_string_width_get_ext(GX_CONST GX_FONT *font, GX_CONST GX_STRING *string, GX_VALUE *return_width);
UINT _gxe_system_timer_start(GX_WIDGET *owner, UINT timer_id, UINT initial_ticks, UINT reschedule_ticks);
UINT _gxe_system_timer_stop(GX_WIDGET *owner, UINT timer_id);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_system_version_string_get(GX_CHAR **return_string);
#endif
UINT _gxe_system_version_string_get_ext(GX_STRING *return_string);
UINT _gxe_system_widget_find(USHORT widget_id, INT search_level, GX_WIDGET **return_search_result);
/* System management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef GX_SYSTEM_INIT
#define SYSTEM_DECLARE
#else
#define SYSTEM_DECLARE extern
#endif
#define GX_VERSION_STRING_LENGTH 16
/* Define string for holding system version information */
SYSTEM_DECLARE GX_CHAR _gx_system_version_string[GX_VERSION_STRING_LENGTH];
/* internal structure for implementing gx_system_timer API. */
typedef struct GX_TIMER_STRUCT
{
UINT gx_timer_initial_ticks;
UINT gx_timer_reschedule_ticks;
UINT gx_timer_id;
GX_WIDGET *gx_timer_owner;
struct GX_TIMER_STRUCT *gx_timer_next;
} GX_TIMER;
/* Define touch configuration information. */
SYSTEM_DECLARE GX_PEN_CONFIGURATION _gx_system_pen_configuration;
/* Define the created display list head pointer. */
SYSTEM_DECLARE GX_DISPLAY *_gx_system_display_created_list;
/* Define the number of created displays. */
SYSTEM_DECLARE ULONG _gx_system_display_created_count;
/* Define the created canvas list head pointer. */
SYSTEM_DECLARE GX_CANVAS *_gx_system_canvas_created_list;
/* Define the number of created canvases. */
SYSTEM_DECLARE ULONG _gx_system_canvas_created_count;
/* Define the root window list head pointer. */
SYSTEM_DECLARE GX_WINDOW_ROOT *_gx_system_root_window_created_list;
/* define memory for holding nested drawing context */
SYSTEM_DECLARE GX_DRAW_CONTEXT _gx_system_draw_context_stack[GX_MAX_CONTEXT_NESTING];
/* define pointer to the current active drawing context */
SYSTEM_DECLARE GX_DRAW_CONTEXT *_gx_system_current_draw_context;
/* define pointer to the end of the draw context stack */
SYSTEM_DECLARE GX_DRAW_CONTEXT *_gx_system_draw_context_stack_end;
/* define storage for GX_TIMERs */
SYSTEM_DECLARE GX_TIMER _gx_system_timer_memory[GX_MAX_ACTIVE_TIMERS];
/* linked list of running timers */
SYSTEM_DECLARE GX_TIMER *_gx_system_active_timer_list;
/* linked list of free timers */
SYSTEM_DECLARE GX_TIMER *_gx_system_free_timer_list;
/* define scratchpad area for storing line end points
used by wide line, circle, and arc functions */
/* Scratch area. */
SYSTEM_DECLARE INT _gx_system_scratchpad[GX_MAX_DISPLAY_HEIGHT * 2];
/* Define memory for holding GX_ANIMATION structure pool */
#if (GX_ANIMATION_POOL_SIZE > 0)
SYSTEM_DECLARE GX_ANIMATION _gx_system_animation_pool[GX_ANIMATION_POOL_SIZE];
SYSTEM_DECLARE GX_ANIMATION *_gx_system_animation_free_list;
#endif
/* linked list of active animations */
SYSTEM_DECLARE GX_ANIMATION *_gx_system_animation_list;
/* linked list of created gradients */
SYSTEM_DECLARE GX_GRADIENT *_gx_system_gradient_list;
/* application defined memory allocation function */
SYSTEM_DECLARE VOID * (*_gx_system_memory_allocator)(ULONG);
/* application defined memory free function */
SYSTEM_DECLARE VOID (*_gx_system_memory_free)(VOID *);
/* storage for the system views */
SYSTEM_DECLARE GX_VIEW _gx_system_view_memory[GX_MAX_VIEWS];
/* linked list of free GX_VIEWS */
SYSTEM_DECLARE GX_VIEW *_gx_system_free_views;
/* Define pointer to widget that owns input focus */
SYSTEM_DECLARE GX_WIDGET *_gx_system_focus_owner;
/* storage for default vertical scrollbar appearance */
SYSTEM_DECLARE ULONG _gx_system_vertical_scrollbar_style;
SYSTEM_DECLARE GX_SCROLLBAR_APPEARANCE _gx_system_vertical_scrollbar_appearance;
/* storage for default horizontal scrollbar appearance */
SYSTEM_DECLARE ULONG _gx_system_horizontal_scrollbar_style;
SYSTEM_DECLARE GX_SCROLLBAR_APPEARANCE _gx_system_horizontal_scrollbar_appearance;
/* stack of input owners */
SYSTEM_DECLARE GX_WIDGET *_gx_system_input_capture_stack[GX_MAX_INPUT_CAPTURE_NESTING];
SYSTEM_DECLARE GX_WIDGET *_gx_system_input_owner;
SYSTEM_DECLARE INT _gx_system_capture_count;
#ifdef GX_THREADX_BINDING
/* guix system thread control block */
SYSTEM_DECLARE TX_THREAD _gx_system_thread;
/* guix system thread stack */
SYSTEM_DECLARE GX_UBYTE _gx_system_thread_stack[GX_THREAD_STACK_SIZE];
/* Keep track of which thread has GUIX locked */
SYSTEM_DECLARE TX_THREAD *_gx_system_lock_thread;
/* Keep track of which thread has block input */
SYSTEM_DECLARE TX_THREAD *_gx_system_input_lock_thread;
/* Define the system event queue. */
SYSTEM_DECLARE TX_QUEUE _gx_system_event_queue;
/* Define the system protection mutex. */
SYSTEM_DECLARE TX_MUTEX _gx_system_protect;
/* Define the system input lock mutex. */
SYSTEM_DECLARE TX_MUTEX _gx_system_input_protect;
/* Define the system timer. */
SYSTEM_DECLARE TX_TIMER _gx_system_timer;
/* Define the memory area for the system event queue. */
SYSTEM_DECLARE GX_UBYTE _gx_system_event_queue_memory[GX_MAX_QUEUE_EVENTS * GX_EVENT_SIZE];
#define GX_CURRENT_THREAD _tx_thread_identify()
#else
SYSTEM_DECLARE VOID *_gx_system_lock_thread;
#endif /* GX_THREADX_BINDING */
/* Define the system mutex lock count. */
SYSTEM_DECLARE UINT _gx_system_lock_nesting;
/* Define the system input lock count. */
SYSTEM_DECLARE UINT _gx_system_input_lock_nesting;
/* Define variables for tracking pen speed */
SYSTEM_DECLARE ULONG _gx_system_last_clock;
SYSTEM_DECLARE LONG _gx_system_clock_delta;
SYSTEM_DECLARE GX_POINT _gx_system_last_pen_point;
SYSTEM_DECLARE INT _gx_system_pen_speed_x;
SYSTEM_DECLARE INT _gx_system_pen_speed_y;
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
/* Define text style. */
SYSTEM_DECLARE GX_BOOL _gx_system_bidi_text_enabled;
#endif
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
SYSTEM_DECLARE GX_UBYTE _gx_system_text_render_style;
#endif
/* Define the theme table */
SYSTEM_DECLARE GX_CONST GX_THEME **_gx_system_theme_table;
/* Define the theme table size. */
SYSTEM_DECLARE GX_RESOURCE_ID _gx_system_theme_table_size;
/* Define the active theme. */
SYSTEM_DECLARE GX_RESOURCE_ID _gx_system_active_theme;
/* Define the storage for the last system error code. */
SYSTEM_DECLARE UINT _gx_system_last_error;
/* Define the number of system errors. */
SYSTEM_DECLARE ULONG _gx_system_error_count;
SYSTEM_DECLARE VOID *_gx_system_clipboard;
SYSTEM_DECLARE UINT _gx_system_clipboard_size;
SYSTEM_DECLARE GX_SCREEN_STACK_CONTROL _gx_system_screen_stack;
#endif

View File

@ -0,0 +1,110 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** System Management (System) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_system_rtos_bind PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains a small set of functions that bind GUIX to the */
/* underlying RTOS. This is by default the ThreadX RTOS, but can be */
/* modified to support other operating systems. Refer to the GUIX */
/* User Guide for more information. */
/* */
/* INPUT */
/* */
/* Refer to GUIX User Guide */
/* */
/* OUTPUT */
/* */
/* Refer to GUIX User Guide */
/* */
/* CALLS */
/* */
/* Refer to GUIX User Guide */
/* */
/* CALLED BY */
/* */
/* GUIX system serives */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_DISABLE_THREADX_BINDING
/* If you are porting GUIX to another RTOS, the function shells below serve as prototypes to
demonstrate what each RTOS specific service should look like. The user will need to complete
each of these functions using syntax and services available within the chosen RTOS
*/
/* types used by GUIX, normally provided by ThreadX API, but replaced here */
VOID gx_generic_rtos_initialize(VOID);
UINT gx_generic_thread_start(VOID (*thread_entry)(ULONG));
UINT gx_generic_event_post(GX_EVENT *event_ptr);
UINT gx_generic_event_fold(GX_EVENT *event_ptr);
VOID gx_generic_event_purge(GX_WIDGET *widget);
UINT gx_generic_event_pop(GX_EVENT *put_event, GX_BOOL wait);
VOID gx_generic_timer_start(VOID);
VOID gx_generic_timer_stop(VOID);
VOID gx_generic_system_mutex_lock(VOID);
VOID gx_generic_system_mutex_unlock(VOID);
ULONG gx_generic_system_time_get(VOID);
VOID *gx_generic_thread_identify(VOID);
VOID gx_generic_time_delay(INT ticks);
#define GX_RTOS_BINDING_INITIALIZE gx_generic_rtos_initialize()
#define GX_SYSTEM_THREAD_START gx_generic_thread_start
#define GX_EVENT_PUSH gx_generic_event_post
#define GX_EVENT_POP gx_generic_event_pop
#define GX_EVENT_FOLD gx_generic_event_fold
#define GX_EVENT_PURGE gx_generic_event_purge
#define GX_TIMER_START gx_generic_timer_start()
#define GX_TIMER_STOP gx_generic_timer_stop()
#define GX_SYSTEM_MUTEX_LOCK gx_generic_system_mutex_lock()
#define GX_SYSTEM_MUTEX_UNLOCK gx_generic_system_mutex_unlock()
#define GX_SYSTEM_TIME_GET gx_generic_system_time_get()
#define GX_CURRENT_THREAD gx_generic_thread_identify()
#define GX_GENERIC_TIME_DELAY(a) gx_generic_time_delay(a)
#endif

View File

@ -0,0 +1,69 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Cursor Management (Cursor) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_text_input_cursor.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX cursor management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_CURSOR_H
#define GX_CURSOR_H
/* Define cursor management function prototypes. */
VOID _gx_text_input_cursor_draw(GX_TEXT_INPUT_CURSOR *cursor_input);
UINT _gx_text_input_cursor_dirty_rectangle_get(GX_TEXT_INPUT_CURSOR *cursor_ptr, GX_RECTANGLE *dirty_rect);
UINT _gx_text_input_cursor_width_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE width);
UINT _gx_text_input_cursor_height_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE height);
UINT _gx_text_input_cursor_blink_interval_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE blink_interval);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_text_input_cursor_width_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE width);
UINT _gxe_text_input_cursor_height_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE height);
UINT _gxe_text_input_cursor_blink_interval_set(GX_TEXT_INPUT_CURSOR *cursor_input, GX_UBYTE blink_interval);
#endif

80
common/inc/gx_tree_view.h Normal file
View File

@ -0,0 +1,80 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Tree View Management (Tree View) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_tree_view.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX tree view component, including all data */
/* types and external references. It is assumed that gx_api.h and */
/* gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_TREE_VIEW_H
#define GX_TREE_VIEW_H
#define GX_TREE_VIEW_ROOT_LINE_PATTERN 0x55555555
/* Define tree view management function prototypes. */
UINT _gx_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT tree_menu_id, GX_CONST GX_RECTANGLE *size);
VOID _gx_tree_view_draw(GX_TREE_VIEW *tree);
UINT _gx_tree_view_event_process(GX_TREE_VIEW *tree, GX_EVENT *event_ptr);
UINT _gx_tree_view_indentation_set(GX_TREE_VIEW *tree, GX_VALUE indentation);
UINT _gx_tree_view_position(GX_TREE_VIEW *tree);
UINT _gx_tree_view_root_line_color_set(GX_TREE_VIEW *tree, GX_RESOURCE_ID color);
UINT _gx_tree_view_root_pixelmap_set(GX_TREE_VIEW *tree, GX_RESOURCE_ID expand_map_id, GX_RESOURCE_ID collapse_map_id);
UINT _gx_tree_view_scroll(GX_TREE_VIEW *tree, GX_VALUE x_scroll, GX_VALUE y_scroll);
UINT _gx_tree_view_scroll_info_get(GX_TREE_VIEW *tree, ULONG type, GX_SCROLL_INFO *return_scroll_info);
UINT _gx_tree_view_selected_get(GX_TREE_VIEW *tree, GX_WIDGET **selected);
UINT _gx_tree_view_selected_set(GX_TREE_VIEW *tree, GX_WIDGET *selected);
/* error checking versions of the tree view API functions */
UINT _gxe_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT tree_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
UINT _gxe_tree_view_event_process(GX_TREE_VIEW *tree, GX_EVENT *event_ptr);
UINT _gxe_tree_view_indentation_set(GX_TREE_VIEW *tree, GX_VALUE indentation);
UINT _gxe_tree_view_position(GX_TREE_VIEW *tree);
UINT _gxe_tree_view_root_line_color_set(GX_TREE_VIEW *tree, GX_RESOURCE_ID color);
UINT _gxe_tree_view_root_pixelmap_set(GX_TREE_VIEW *tree, GX_RESOURCE_ID expand_map_id, GX_RESOURCE_ID collapse_map_id);
UINT _gxe_tree_view_selected_get(GX_TREE_VIEW *tree, GX_WIDGET **selected);
UINT _gxe_tree_view_selected_set(GX_TREE_VIEW *tree, GX_WIDGET *selected);
#endif

View File

@ -0,0 +1,67 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** User optional settings */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* gx_user.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains optional settings. You can enable and disable */
/* GUIX features by commenting out or including the definitions below */
/* to the implementation of high-performance GUIX UI framework. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_USER_H
#define GX_USER_H
/* Should GUIX support multiple threads using the GUIX API simultaneously
If your application is organized such that only one thread utilizes the
GUI API services, comment out the definition below to reduce system
overhead.
*/
/* #define GUIX_DISABLE_MULTITHREAD_SUPPORT */
/* Defined, GUIX disables UTF8 support. */
/* #define GX_DISABLE_UTF8_SUPPORT */
/* By default GUIX System Timer runs at 20ms. Modify the value below to
change GUIX System Timer value. */
/* #define GX_SYSTEM_TIMER_MS 20 */
/* This can be defined to insert an application specific data
field into the GX_WIDGET control block */
/* #define GX_WIDGET_USER_DATA */
#endif

285
common/inc/gx_utility.h Normal file
View File

@ -0,0 +1,285 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Utility (Utility) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_utility.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX utility component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_UTILITY_H
#define GX_UTILITY_H
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
#define GX_BIDI_CHARACTER_TYPE_L 0x01 /* Left to Right */
#define GX_BIDI_CHARACTER_TYPE_R 0x02 /* Right to Left */
#define GX_BIDI_CHARACTER_TYPE_AL 0x03 /* Right to Left Arabic */
#define GX_BIDI_CHARACTER_TYPE_EN 0x04 /* European Number */
#define GX_BIDI_CHARACTER_TYPE_ES 0x05 /* European Number Separator */
#define GX_BIDI_CHARACTER_TYPE_ET 0x06 /* European Number Terminator */
#define GX_BIDI_CHARACTER_TYPE_AN 0x07 /* Arabic Number */
#define GX_BIDI_CHARACTER_TYPE_CS 0x08 /* Common Number Separator */
#define GX_BIDI_CHARACTER_TYPE_NSM 0x09 /* Nonspacing Mark */
#define GX_BIDI_CHARACTER_TYPE_BN 0x0A /* Boundary Neutral */
#define GX_BIDI_CHARACTER_TYPE_B 0x0B /* Paragraph Separator */
#define GX_BIDI_CHARACTER_TYPE_S 0x0C /* Segment Separator */
#define GX_BIDI_CHARACTER_TYPE_WS 0x0D /* Whitespace */
#define GX_BIDI_CHARACTER_TYPE_ON 0x0E /* Other Neutrals */
#define GX_BIDI_CHARACTER_TYPE_LRE 0x0F
#define GX_BIDI_CHARACTER_TYPE_LRO 0x10
#define GX_BIDI_CHARACTER_TYPE_RLE 0x11
#define GX_BIDI_CHARACTER_TYPE_RLO 0x12
#define GX_BIDI_CHARACTER_TYPE_PDF 0x13
#define GX_BIDI_CHARACTER_TYPE_LRI 0x14
#define GX_BIDI_CHARACTER_TYPE_RLI 0x15
#define GX_BIDI_CHARACTER_TYPE_FSI 0x16
#define GX_BIDI_CHARACTER_TYPE_PDI 0x17
#define GX_BIDI_CATEGORY_STRONG 0x01
#define GX_BIDI_CATEGORY_WEAK 0x02
#define GX_BIDI_CATEGORY_NEUTRAL 0x03
#define GX_BIDI_DIRECTION_FORMAT_LRE 0x202A /* Left to Right Embedding */
#define GX_BIDI_DIRECTION_FORMAT_LRO 0x202D /* Left to Right Override */
#define GX_BIDI_DIRECTION_FORMAT_RLE 0x202B /* Right to Left Embedding */
#define GX_BIDI_DIRECTION_FORMAT_RLO 0x202E /* Right to Left Override */
#define GX_BIDI_DIRECTION_FORMAT_PDF 0x202C /* Pop Directional Format */
#define GX_BIDI_DIRECTION_FORMAT_LRI 0x2066 /* Left to Right Isolate */
#define GX_BIDI_DIRECTION_FORMAT_RLI 0x2067 /* Right to Left Isolate */
#define GX_BIDI_DIRECTION_FORMAT_FSI 0x2068 /* First Strong Isolate */
#define GX_BIDI_DIRECTION_FORMAT_PDI 0x2069 /* Pop Directional Isolate */
typedef struct GX_BIDI_TEXT_INFO_STRUCT
{
GX_STRING gx_bidi_text_info_text;
GX_FONT *gx_bidi_text_info_font;
GX_VALUE gx_bidi_text_info_display_width;
} GX_BIDI_TEXT_INFO;
typedef struct GX_BIDI_RESOLVED_TEXT_INFO_STRUCT
{
GX_STRING *gx_bidi_resolved_text_info_text;
UINT gx_bidi_resolved_text_total_lines;
UINT gx_bidi_resolved_text_processed_count;
} GX_BIDI_RESOLVED_TEXT_INFO;
/* Define bidirectional character infomation structure. */
typedef struct GX_BIDI_CHARACTER_INFO_STRUCT
{
ULONG gx_bidi_character_info_range_start;
ULONG gx_bidi_character_info_range_end;
GX_UBYTE gx_bidi_character_info_type;
} GX_BIDI_CHARACTER_INFO;
typedef struct GX_BIDI_BRACKET_PAIR_STRUCT
{
ULONG gx_bidi_bracket_pair_open;
ULONG gx_bidi_bracket_pair_close;
} GX_BIDI_BRACKET_PAIR;
#endif
#define GX_UTILITY_MATH_UINT_ADD(augend, addend, result) \
if ((UINT)-1 - (augend) < (addend)) \
{ \
return GX_MATH_OVERFLOW; \
} \
else \
{ \
(result) = (augend) + (addend); \
}
#define GX_UTILITY_MATH_UINT_MULT(multiplicand, multiplier, result) \
if ((UINT)-1 / (multiplier) < (multiplicand)) \
{ \
return GX_MATH_OVERFLOW; \
} \
else \
{ \
(result) = (multiplicand) * (multiplier); \
}
#define GX_UTILITY_MATH_USHORT_ADD(augend, addend, result) \
if ((USHORT)-1 - (augend) < (addend)) \
{ \
return GX_MATH_OVERFLOW; \
} \
else \
{ \
(result) = (USHORT)((augend) + (addend)); \
}
#define GX_UTILITY_MATH_USHORT_MULT(multiplicand, multiplier, result) \
if ((USHORT)-1 / (multiplier) < (multiplicand)) \
{ \
return GX_MATH_OVERFLOW; \
} \
else \
{ \
result = (USHORT)((multiplicand) * (multiplier)); \
}
#define GX_UTILITY_USHORT_CHECK(a)\
if((a) > (USHORT)-1) \
{ \
return GX_MATH_OVERFLOW; \
}
/* Define utility component function prototypes. */
UINT _gx_utility_1bpp_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_1bpp_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_1bpp_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_4bpp_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_4bpp_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_4bpp_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_8bpp_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_8bit_alphamap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_8bpp_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_8bpp_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_8bit_alphamap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_16bpp_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_32argb_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_32argb_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_32argb_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_332rgb_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_332rgb_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_565rgb_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_565rgb_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_1555xrgb_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_1555xrgb_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_4444argb_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_4444argb_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_4444argb_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_alphamap_create(INT width, INT height, GX_PIXELMAP *map);
UINT _gx_utility_circle_point_get(INT xcenter, INT ycenter, UINT r, INT angle, GX_POINT *point);
UINT _gx_utility_easing_function_calculate(USHORT easing_function_style, INT start_val, INT end_val, INT t, INT d, INT *return_value);
VOID _gx_utility_glyph_1bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph);
VOID _gx_utility_glyph_4bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph);
VOID _gx_utility_glyph_8bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph);
#if defined(GX_SYNERGY_FONT_FORMAT_SUPPORT)
VOID _gx_utility_glyph_reversed_4bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph);
VOID _gx_utility_glyph_reversed_1bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph);
#endif
UINT _gx_utility_gradient_create(GX_GRADIENT *gradient, GX_VALUE width, GX_VALUE height, UCHAR type, GX_UBYTE start_alpha, GX_UBYTE end_alpha);
UINT _gx_utility_gradient_delete(GX_GRADIENT *gradient);
UINT _gx_utility_canvas_to_bmp(GX_CANVAS *canvas, GX_RECTANGLE *rect, UINT (*write_data)(GX_UBYTE *byte_data, UINT data_count));
UINT _gx_utility_ltoa(LONG value, GX_CHAR *return_buffer, UINT return_buffer_size);
#if defined(GUIX_5_4_0_COMPATIBILITY)
INT _gx_utility_math_acos_5_4_0(INT x);
INT _gx_utility_math_asin_5_4_0(INT x);
INT _gx_utility_math_cos_5_4_0(INT angle);
INT _gx_utility_math_sin_5_4_0(INT angle);
#endif
INT _gx_utility_math_acos(GX_FIXED_VAL x);
INT _gx_utility_math_asin(GX_FIXED_VAL x);
GX_FIXED_VAL _gx_utility_math_cos(GX_FIXED_VAL angle);
GX_FIXED_VAL _gx_utility_math_sin(GX_FIXED_VAL angle);
UINT _gx_utility_math_sqrt(UINT n);
UINT _gx_utility_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gx_utility_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gx_utility_rectangle_center(GX_RECTANGLE *rectangle, GX_RECTANGLE *within);
UINT _gx_utility_rectangle_center_find(GX_RECTANGLE *rectangle, GX_POINT *return_center);
UINT _gx_utility_rectangle_combine(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle);
GX_BOOL _gx_utility_rectangle_compare(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle);
UINT _gx_utility_rectangle_define(GX_RECTANGLE *rectangle, GX_VALUE left, GX_VALUE top, GX_VALUE right, GX_VALUE bottom);
GX_BOOL _gx_utility_rectangle_inside_detect(GX_RECTANGLE *outer, GX_RECTANGLE *inner);
GX_BOOL _gx_utility_rectangle_overlap_detect(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle, GX_RECTANGLE *return_overlap_area);
GX_BOOL _gx_utility_rectangle_point_detect(GX_RECTANGLE *rectangle, GX_POINT point);
UINT _gx_utility_rectangle_resize(GX_RECTANGLE *rectangle, GX_VALUE adjust);
UINT _gx_utility_rectangle_shift(GX_RECTANGLE *rectangle, GX_VALUE x_shift, GX_VALUE y_shift);
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
UINT _gx_utility_bidi_bracket_pair_get(ULONG code, GX_BIDI_BRACKET_PAIR *bracket_pair);
UINT _gx_utility_bidi_character_type_get(ULONG code, GX_UBYTE *type);
UINT _gx_utility_bidi_mirroring_get(USHORT code, USHORT *mirror);
UINT _gx_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO *resolved_info);
#endif
#ifdef GX_THAI_GLYPH_SHAPING_SUPPORT
UINT _gx_utility_thai_glyph_shaping(GX_CONST GX_STRING *string, GX_CHAR_CODE **returned_code_list, UINT *returned_code_count);
#endif
UINT _gx_utility_string_length_check(GX_CONST GX_CHAR *string, UINT *length, UINT max_string_length);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_utility_string_to_alphamap(GX_CONST GX_CHAR *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
#endif
UINT _gx_utility_string_to_alphamap_ext(GX_CONST GX_STRING *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
VOID _gx_utility_string_to_alphamap_draw(GX_CONST GX_STRING *text, GX_CONST GX_FONT *font, GX_PIXELMAP *map);
#ifdef GX_UTF8_SUPPORT
UINT _gx_utility_unicode_to_utf8(ULONG unicode, GX_UBYTE *return_utf8_str, UINT *return_utf8_size);
UINT _gx_utility_utf8_string_character_get(GX_STRING *utf8_str, GX_CHAR_CODE *glyph_value, UINT *glyph_len);
UINT _gx_utility_utf8_string_backward_character_length_get(GX_STRING *utf8_str, INT start_index, UINT *glyph_len);
#endif /* GX_UTF8_SUPPORT */
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_utility_canvas_to_bmp(GX_CANVAS *canvas, GX_RECTANGLE *rect, UINT (*write_data)(GX_UBYTE *byte_data, UINT data_count));
UINT _gxe_utility_circle_point_get(INT xcenter, INT ycenter, UINT r, INT angle, GX_POINT *point);
UINT _gxe_utility_gradient_create(GX_GRADIENT *gradient, GX_VALUE width, GX_VALUE height, UCHAR type, GX_UBYTE start_alpha, GX_UBYTE end_alpha);
UINT _gxe_utility_gradient_delete(GX_GRADIENT *gradient);
UINT _gxe_utility_ltoa(LONG value, GX_CHAR *return_buffer, UINT return_buffer_size);
UINT _gxe_utility_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height);
UINT _gxe_utility_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gxe_utility_pixelmap_simple_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy);
UINT _gxe_utility_rectangle_center(GX_RECTANGLE *rectangle, GX_RECTANGLE *within);
UINT _gxe_utility_rectangle_center_find(GX_RECTANGLE *rectangle, GX_POINT *return_center);
UINT _gxe_utility_rectangle_combine(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle);
GX_BOOL _gxe_utility_rectangle_compare(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle);
UINT _gxe_utility_rectangle_define(GX_RECTANGLE *rectangle, GX_VALUE left, GX_VALUE top, GX_VALUE right, GX_VALUE bottom);
UINT _gxe_utility_rectangle_resize(GX_RECTANGLE *rectangle, GX_VALUE adjust);
GX_BOOL _gxe_utility_rectangle_overlap_detect(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle, GX_RECTANGLE *return_overlap_area);
GX_BOOL _gxe_utility_rectangle_point_detect(GX_RECTANGLE *rectangle, GX_POINT point);
UINT _gxe_utility_rectangle_shift(GX_RECTANGLE *rectangle, GX_VALUE x_shift, GX_VALUE y_shift);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_utility_string_to_alphamap(GX_CONST GX_CHAR *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
#endif
UINT _gxe_utility_string_to_alphamap_ext(GX_CONST GX_STRING *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
#endif

212
common/inc/gx_widget.h Normal file
View File

@ -0,0 +1,212 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Widget Management (Widget) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_widget.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX widget management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_WIDGET_H
#define GX_WIDGET_H
/* Define widget management function prototypes. */
UINT _gx_widget_allocate(GX_WIDGET **widget, ULONG memsize);
UINT _gx_widget_attach(GX_WIDGET *parent, GX_WIDGET *child);
UINT _gx_widget_back_attach(GX_WIDGET *parent, GX_WIDGET *child);
VOID _gx_widget_background_draw(GX_WIDGET *widget);
UINT _gx_widget_back_move(GX_WIDGET *widget, GX_BOOL *widget_moved);
UINT _gx_widget_block_move(GX_WIDGET *widget, GX_RECTANGLE *block, INT x_shift, INT y_shift);
VOID _gx_widget_border_draw(GX_WIDGET *widget, GX_RESOURCE_ID border_color, GX_RESOURCE_ID upper_color, GX_RESOURCE_ID lower_color, GX_BOOL fill);
UINT _gx_widget_border_style_set(GX_WIDGET *widget, ULONG Style);
UINT _gx_widget_border_width_get(GX_WIDGET *widget, GX_VALUE *return_width);
UINT _gx_widget_canvas_get(GX_WIDGET *widget, GX_CANVAS **return_canvas);
UINT _gx_widget_child_detect(GX_WIDGET *parent, GX_WIDGET *child, GX_BOOL *return_detect);
VOID _gx_widget_children_draw(GX_WIDGET *widget);
VOID _gx_widget_children_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr);
UINT _gx_widget_client_get(GX_WIDGET *widget, GX_VALUE border_width, GX_RECTANGLE *return_size);
VOID _gx_widget_clipping_update(GX_WIDGET *widget);
UINT _gx_widget_color_get(GX_WIDGET *widget, GX_RESOURCE_ID color_id, GX_COLOR *color);
VOID _gx_widget_child_clipping_update(GX_WIDGET *parent);
VOID _gx_widget_child_focus_assign(GX_WIDGET *parent);
VOID _gx_widget_context_fill_set(GX_WIDGET *widget);
UINT _gx_widget_create(GX_WIDGET *widget, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
UINT _gx_widget_created_test(GX_WIDGET *widget, GX_BOOL *return_test);
UINT _gx_widget_detach(GX_WIDGET *child);
UINT _gx_widget_delete(GX_WIDGET *widget);
VOID _gx_widget_draw(GX_WIDGET *widget);
UINT _gx_widget_draw_set(GX_WIDGET *widget, VOID (*draw_func)(GX_WIDGET *));
UINT _gx_widget_event_generate(GX_WIDGET *widget, USHORT event_type, LONG value);
UINT _gx_widget_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr);
UINT _gx_widget_event_process_set(GX_WIDGET *widget, UINT (*event_processing_function)(GX_WIDGET *, GX_EVENT *));
UINT _gx_widget_event_to_parent(GX_WIDGET *widget, GX_EVENT *event_ptr);
UINT _gx_widget_fill_color_set(GX_WIDGET *widget, GX_RESOURCE_ID normal_color, GX_RESOURCE_ID selected_color, GX_RESOURCE_ID disabled_color);
UINT _gx_widget_find(GX_WIDGET *parent, USHORT widget_id, INT search_depth, GX_WIDGET **return_widget);
UINT _gx_widget_first_child_get(GX_WIDGET *parent, GX_WIDGET **child_return);
UINT _gx_widget_font_get(GX_WIDGET *widget, GX_RESOURCE_ID font_id, GX_FONT **return_font);
UINT _gx_widget_free(GX_WIDGET *widget);
UINT _gx_widget_front_move(GX_WIDGET *widget, GX_BOOL *return_moved);
UINT _gx_widget_focus_next(GX_WIDGET *widget);
UINT _gx_widget_focus_previous(GX_WIDGET *widget);
UINT _gx_widget_height_get(GX_WIDGET *widget, GX_VALUE *return_height);
UINT _gx_widget_hide(GX_WIDGET *widget);
UINT _gx_widget_last_child_get(GX_WIDGET *parent, GX_WIDGET **child_return);
VOID _gx_widget_link(GX_WIDGET *parent, GX_WIDGET *child);
VOID _gx_widget_nav_order_initialize(GX_WIDGET *widget);
UINT _gx_widget_next_sibling_get(GX_WIDGET *current, GX_WIDGET **sibling_return);
UINT _gx_widget_parent_get(GX_WIDGET *current, GX_WIDGET **parent_return);
UINT _gx_widget_previous_sibling_get(GX_WIDGET *current, GX_WIDGET **sibling_return);
UINT _gx_widget_pixelmap_get(GX_WIDGET *widget, GX_RESOURCE_ID pixelmap_id, GX_PIXELMAP **return_map);
VOID _gx_widget_back_link(GX_WIDGET *parent, GX_WIDGET *child);
UINT _gx_widget_resize(GX_WIDGET *widget, GX_RECTANGLE *new_size);
UINT _gx_widget_scroll_shift(GX_WIDGET *widget, INT xShift, INT yShift, GX_BOOL clip);
UINT _gx_widget_shift(GX_WIDGET *widget, GX_VALUE x_shift, GX_VALUE y_shift, GX_BOOL mark_dirty);
UINT _gx_widget_show(GX_WIDGET *widget);
UINT _gx_widget_status_add(GX_WIDGET *widget, ULONG status);
UINT _gx_widget_status_get(GX_WIDGET *widget, ULONG *return_status);
UINT _gx_widget_status_remove(GX_WIDGET *widget, ULONG status);
UINT _gx_widget_status_test(GX_WIDGET *widget, ULONG status, GX_BOOL *return_test);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_widget_string_get(GX_WIDGET *widget, GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
#endif
UINT _gx_widget_string_get_ext(GX_WIDGET *widget, GX_RESOURCE_ID string_id, GX_STRING *return_string);
UINT _gx_widget_style_add(GX_WIDGET *widget, ULONG style);
UINT _gx_widget_style_get(GX_WIDGET *widget, ULONG *return_style);
UINT _gx_widget_style_remove(GX_WIDGET *widget, ULONG style);
UINT _gx_widget_style_set(GX_WIDGET *widget, ULONG style);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gx_widget_text_blend(GX_WIDGET *widget, UINT tColor, UINT font_id, GX_CONST GX_CHAR *string,
INT x_offset, INT y_offset, UCHAR alpha);
VOID _gx_widget_text_draw(GX_WIDGET *widget, UINT tColor, UINT font_id, GX_CONST GX_CHAR *string,
INT x_offset, INT y_offset);
#endif
UINT _gx_widget_text_blend_ext(GX_WIDGET *widget, UINT tColor, UINT font_id, GX_CONST GX_STRING *string,
INT x_offset, INT y_offset, UCHAR alpha);
VOID _gx_widget_text_draw_ext(GX_WIDGET *widget, UINT tColor, UINT font_id, GX_CONST GX_STRING *string,
INT x_offset, INT y_offset);
VOID _gx_widget_text_id_draw(GX_WIDGET *widget, UINT tColor, UINT font_id, UINT text_id,
INT x_offset, INT y_offset);
UINT _gx_widget_top_visible_child_find(GX_WIDGET *parent, GX_WIDGET **child_return);
GX_BOOL _gx_widget_transparent_pixelmap_detect(GX_WIDGET *widget, GX_RESOURCE_ID pixelmap_id);
UINT _gx_widget_type_find(GX_WIDGET *parent, USHORT widget_id, GX_WIDGET **return_widget);
GX_WIDGET *_gx_widget_unlink(GX_WIDGET *widget);
GX_WIDGET *_gx_widget_first_client_child_get(GX_WIDGET *parent);
GX_WIDGET *_gx_widget_last_client_child_get(GX_WIDGET *parent);
GX_WIDGET *_gx_widget_next_client_child_get(GX_WIDGET *current);
INT _gx_widget_client_index_get(GX_WIDGET *parent, GX_WIDGET *child);
UINT _gx_widget_width_get(GX_WIDGET *widget, GX_VALUE *return_width);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_widget_allocate(GX_WIDGET **widget, ULONG memsize);
UINT _gxe_widget_attach(GX_WIDGET *parent, GX_WIDGET *child);
UINT _gxe_widget_back_attach(GX_WIDGET *parent, GX_WIDGET *child);
UINT _gxe_widget_back_move(GX_WIDGET *widget, GX_BOOL *widget_moved);
UINT _gxe_widget_block_move(GX_WIDGET *widget, GX_RECTANGLE *block, INT x_shift, INT y_shift);
UINT _gxe_widget_border_style_set(GX_WIDGET *widget, ULONG Style);
UINT _gxe_widget_border_width_get(GX_WIDGET *widget, GX_VALUE *return_width);
UINT _gxe_widget_canvas_get(GX_WIDGET *widget, GX_CANVAS **return_canvas);
UINT _gxe_widget_child_detect(GX_WIDGET *parent, GX_WIDGET *child, GX_BOOL *return_detect);
UINT _gxe_widget_client_get(GX_WIDGET *widget, GX_VALUE border_width, GX_RECTANGLE *return_size);
UINT _gxe_widget_color_get(GX_WIDGET *widget, GX_RESOURCE_ID color_id, GX_COLOR *return_color);
UINT _gxe_widget_create(GX_WIDGET *widget, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT widget_block_size);
UINT _gxe_widget_created_test(GX_WIDGET *widget, GX_BOOL *return_test);
UINT _gxe_widget_delete(GX_WIDGET *widget);
UINT _gxe_widget_detach(GX_WIDGET *widget);
UINT _gxe_widget_draw_set(GX_WIDGET *widget, VOID (*draw_func)(GX_WIDGET *));
UINT _gxe_widget_event_generate(GX_WIDGET *widget, USHORT event_type, LONG value);
UINT _gxe_widget_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr);
UINT _gxe_widget_event_process_set(GX_WIDGET *widget, UINT (*event_processing_function)(GX_WIDGET *, GX_EVENT *));
UINT _gxe_widget_fill_color_set(GX_WIDGET *widget, GX_RESOURCE_ID normal_color, GX_RESOURCE_ID selected_color, GX_RESOURCE_ID disabled_color);
UINT _gxe_widget_find(GX_WIDGET *parent, USHORT widget_id, INT search_depth, GX_WIDGET **return_widget);
UINT _gxe_widget_first_child_get(GX_WIDGET *parent, GX_WIDGET **child_return);
UINT _gxe_widget_focus_next(GX_WIDGET *widget);
UINT _gxe_widget_focus_previous(GX_WIDGET *widget);
UINT _gxe_widget_font_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_FONT **return_font);
UINT _gxe_widget_free(GX_WIDGET *widget);
UINT _gxe_widget_front_move(GX_WIDGET *widget, GX_BOOL *return_moved);
UINT _gxe_widget_height_get(GX_WIDGET *widget, GX_VALUE *return_height);
UINT _gxe_widget_hide(GX_WIDGET *widget);
UINT _gxe_widget_last_child_get(GX_WIDGET *parent, GX_WIDGET ** child_return);
UINT _gxe_widget_next_sibling_get(GX_WIDGET *current, GX_WIDGET **sibling_return);
UINT _gxe_widget_parent_get(GX_WIDGET *current, GX_WIDGET **parent_return);
UINT _gxe_widget_previous_sibling_get(GX_WIDGET* current, GX_WIDGET** sibling_return);
UINT _gxe_widget_pixelmap_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_PIXELMAP **return_pixelmap);
UINT _gxe_widget_resize(GX_WIDGET *widget, GX_RECTANGLE *new_size);
UINT _gxe_widget_shift(GX_WIDGET *widget, GX_VALUE x_shift, GX_VALUE y_shift, GX_BOOL mark_dirty);
UINT _gxe_widget_show(GX_WIDGET *widget);
UINT _gxe_widget_status_add(GX_WIDGET *widget, ULONG status);
UINT _gxe_widget_status_get(GX_WIDGET *widget, ULONG *return_status);
UINT _gxe_widget_status_remove(GX_WIDGET *widget, ULONG status);
UINT _gxe_widget_status_test(GX_WIDGET *widget, ULONG status, GX_BOOL *return_test);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_widget_string_get(GX_WIDGET *widget, GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string);
#endif
UINT _gxe_widget_string_get_ext(GX_WIDGET *widget, GX_RESOURCE_ID string_id, GX_STRING *return_string);
UINT _gxe_widget_style_add(GX_WIDGET *widget, ULONG style);
UINT _gxe_widget_style_get(GX_WIDGET *widget, ULONG *return_style);
UINT _gxe_widget_style_set(GX_WIDGET *widget, ULONG style);
UINT _gxe_widget_style_remove(GX_WIDGET *widget, ULONG style);
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
UINT _gxe_widget_text_blend(GX_WIDGET *widget,
UINT tColor, UINT font_id,
GX_CONST GX_CHAR *string, INT x_offset, INT y_offset, UCHAR alpha);
#endif
UINT _gxe_widget_text_blend_ext(GX_WIDGET *widget,
UINT tColor, UINT font_id,
GX_CONST GX_STRING *string, INT x_offset, INT y_offset, UCHAR alpha);
UINT _gxe_widget_top_visible_child_find(GX_WIDGET *parent, GX_WIDGET **child_return);
UINT _gxe_widget_type_find(GX_WIDGET *parent, USHORT widget_id, GX_WIDGET **return_widget);
UINT _gxe_widget_width_get(GX_WIDGET *widget, GX_VALUE *return_width);
UINT _gxe_widget_event_to_parent(GX_WIDGET *widget, GX_EVENT *event_ptr);
#endif

177
common/inc/gx_window.h Normal file
View File

@ -0,0 +1,177 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Window Management (Window) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* gx_window.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the GUIX window management component, */
/* including all data types and external references. It is assumed */
/* that gx_api.h and gx_port.h have already been included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef GX_WINDOW_H
#define GX_WINDOW_H
#define LIST_CHILD_ID_START 4096
#define GX_SNAP_TIMER 1000
#define GX_FLICK_TIMER 1001
/* Define vertical list management function prototypes. */
UINT _gx_horizontal_list_children_position(GX_HORIZONTAL_LIST *list);
UINT _gx_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_columns,
VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT horizontal_list_id, GX_CONST GX_RECTANGLE *size);
UINT _gx_horizontal_list_event_process(GX_HORIZONTAL_LIST *list, GX_EVENT *event_ptr);
VOID _gx_horizontal_list_left_wrap(GX_HORIZONTAL_LIST *list);
UINT _gx_horizontal_list_page_index_set(GX_HORIZONTAL_LIST *list, INT index);
VOID _gx_horizontal_list_right_wrap(GX_HORIZONTAL_LIST *list);
UINT _gx_horizontal_list_selected_index_get(GX_HORIZONTAL_LIST *horizontal_list, INT *return_index);
UINT _gx_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST *horizontal_list, GX_WIDGET **return_list_entry);
UINT _gx_horizontal_list_selected_set(GX_HORIZONTAL_LIST *horizontal_list, INT entry);
VOID _gx_horizontal_list_selected_visible(GX_HORIZONTAL_LIST *list, GX_WIDGET *child);
VOID _gx_horizontal_list_scroll(GX_HORIZONTAL_LIST *list, INT amount);
VOID _gx_horizontal_list_scroll_info_get(GX_WINDOW *win, ULONG style, GX_SCROLL_INFO *info);
VOID _gx_horizontal_list_slide_back_check(GX_HORIZONTAL_LIST *list);
UINT _gx_horizontal_list_total_columns_set(GX_HORIZONTAL_LIST *list, INT count);
UINT _gx_popup_list_event_process(GX_POPUP_LIST *popup_list, GX_EVENT *event_ptr);
UINT _gx_vertical_list_children_position(GX_VERTICAL_LIST *list);
UINT _gx_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_rows,
VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size);
UINT _gx_vertical_list_event_process(GX_VERTICAL_LIST *list, GX_EVENT *event_ptr);
VOID _gx_vertical_list_down_wrap(GX_VERTICAL_LIST *list);
UINT _gx_vertical_list_page_index_set(GX_VERTICAL_LIST *list, INT index);
UINT _gx_vertical_list_selected_index_get(GX_VERTICAL_LIST *vertical_list, INT *return_index);
UINT _gx_vertical_list_selected_widget_get(GX_VERTICAL_LIST *vertical_list, GX_WIDGET **return_list_entry);
UINT _gx_vertical_list_selected_set(GX_VERTICAL_LIST *vertical_list, INT index);
VOID _gx_vertical_list_selected_visible(GX_VERTICAL_LIST *list, GX_WIDGET *child);
VOID _gx_vertical_list_scroll(GX_VERTICAL_LIST *list, INT amount);
VOID _gx_vertical_list_scroll_info_get(GX_VERTICAL_LIST *list, ULONG style, GX_SCROLL_INFO *info);
VOID _gx_vertical_list_slide_back_check(GX_VERTICAL_LIST *list);
UINT _gx_vertical_list_total_rows_set(GX_VERTICAL_LIST *list, INT count);
VOID _gx_vertical_list_up_wrap(GX_VERTICAL_LIST *list);
/* Define window management function prototypes. */
VOID _gx_window_background_draw(GX_WINDOW *win);
VOID _gx_window_border_draw(GX_WINDOW *win, GX_COLOR fill_color);
UINT _gx_window_client_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll);
UINT _gx_window_client_height_get(GX_WINDOW *window, GX_VALUE *return_height);
UINT _gx_window_client_width_get(GX_WINDOW *window, GX_VALUE *return_width);
UINT _gx_window_close(GX_WINDOW *window);
UINT _gx_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
VOID _gx_window_draw(GX_WINDOW *window);
UINT _gx_window_event_process(GX_WINDOW *window, GX_EVENT *event_ptr);
UINT _gx_window_execute(GX_WINDOW *window, ULONG *return_ptr);
UINT _gx_window_root_create(GX_WINDOW_ROOT *root_window, GX_CONST GX_CHAR *name, GX_CANVAS *canvas,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
UINT _gx_window_root_delete(GX_WINDOW_ROOT *root_window);
UINT _gx_window_root_find(GX_WIDGET *widget, GX_WINDOW_ROOT **return_root_window);
UINT _gx_window_root_event_process(GX_WINDOW_ROOT *root, GX_EVENT *event_ptr);
UINT _gx_window_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll);
UINT _gx_window_scroll_info_get(GX_WINDOW *window, ULONG type, GX_SCROLL_INFO *return_scroll_info);
UINT _gx_window_scrollbar_find(GX_WINDOW *window, USHORT type, GX_SCROLLBAR **return_scrollbar);
VOID _gx_window_view_update_detect(GX_WINDOW *win);
UINT _gx_window_wallpaper_get(GX_WINDOW *window, GX_RESOURCE_ID *return_wallpaper_id);
UINT _gx_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX_BOOL tile);
/* Define error checking shells for API services. These are only referenced by the
application. */
UINT _gxe_window_client_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll);
UINT _gxe_window_client_height_get(GX_WINDOW *window, GX_VALUE *return_height);
UINT _gxe_window_client_width_get(GX_WINDOW *window, GX_VALUE *return_width);
UINT _gxe_window_close(GX_WINDOW *window);
UINT _gxe_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT window_control_block_size);
UINT _gxe_window_event_process(GX_WINDOW *window, GX_EVENT *event_ptr);
UINT _gxe_window_execute(GX_WINDOW *window, ULONG *return_ptr);
UINT _gxe_window_root_find(GX_WIDGET *widget, GX_WINDOW_ROOT **return_root_window);
UINT _gxe_window_scroll_info_get(GX_WINDOW *window, ULONG type, GX_SCROLL_INFO *return_scroll_info);
UINT _gxe_window_scrollbar_find(GX_WINDOW *window, USHORT type, GX_SCROLLBAR **return_scrollbar);
UINT _gxe_window_wallpaper_get(GX_WINDOW *window, GX_RESOURCE_ID *return_wallpaper_id);
UINT _gxe_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX_BOOL tile);
UINT _gxe_horizontal_list_children_position(GX_HORIZONTAL_LIST *list);
UINT _gxe_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list,
GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_rows,
VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT horizontal_list_id,
GX_CONST GX_RECTANGLE *size,
UINT horizontal_list_control_block_size);
UINT _gxe_horizontal_list_event_process(GX_HORIZONTAL_LIST *list, GX_EVENT *event_ptr);
UINT _gxe_horizontal_list_selected_index_get(GX_HORIZONTAL_LIST *horizontal_list, INT *return_index);
UINT _gxe_horizontal_list_selected_set(GX_HORIZONTAL_LIST *horizontal_list, INT index);
UINT _gxe_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST *horizontal_list, GX_WIDGET **return_list_entry);
UINT _gxe_horizontal_list_total_columns_set(GX_HORIZONTAL_LIST *list, INT count);
UINT _gxe_horizontal_list_page_index_set(GX_HORIZONTAL_LIST *vertical_list, INT index);
UINT _gxe_vertical_list_children_position(GX_VERTICAL_LIST *list);
UINT _gxe_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name,
GX_WIDGET *parent, INT total_rows,
VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size,
UINT vertical_list_control_block_size);
UINT _gxe_vertical_list_event_process(GX_VERTICAL_LIST *list, GX_EVENT *event_ptr);
UINT _gxe_vertical_list_selected_set(GX_VERTICAL_LIST *vertical_list, INT index);
UINT _gxe_vertical_list_selected_index_get(GX_VERTICAL_LIST *vertical_list, INT *return_index);
UINT _gxe_vertical_list_selected_widget_get(GX_VERTICAL_LIST *vertical_list, GX_WIDGET **return_list_entry);
UINT _gxe_vertical_list_total_rows_set(GX_VERTICAL_LIST *list, INT count);
UINT _gxe_vertical_list_page_index_set(GX_VERTICAL_LIST *horizontal_list, INT list_entry);
UINT _gxe_window_root_create(GX_WINDOW_ROOT *root_window, GX_CONST GX_CHAR *name,
GX_CANVAS *canvas, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT root_window_control_block_size);
UINT _gxe_window_root_delete(GX_WINDOW_ROOT *root_window);
UINT _gxe_window_root_event_process(GX_WINDOW_ROOT *root, GX_EVENT *event_ptr);
#endif

View File

@ -0,0 +1,100 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Accordion Menu Management (Menu) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_menu.h"
#include "gx_widget.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates an accordion menu. */
/* */
/* INPUT */
/* */
/* menu Pointer to the accordion menu */
/* control block */
/* name Name of the menu */
/* parent Parent widget control block */
/* style Style of the widget */
/* accordion_menu_id Application-defined ID of */
/* the accordion menu */
/* size Accordion menu size */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_create Create a widget */
/* _gx_widget_link Link a widget to its parent */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size)
{
/* Call the widget create function. */
_gx_widget_create((GX_WIDGET *)accordion, name, GX_NULL, style, accordion_menu_id, size);
/* Populate the rest of the accordion menu control block - overriding as necessary. */
accordion -> gx_widget_type = GX_TYPE_ACCORDION_MENU;
accordion -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_accordion_menu_event_process;
accordion -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_accordion_menu_draw;
accordion -> gx_accordion_menu_expand_item = GX_NULL;
accordion -> gx_accordion_menu_collapse_item = GX_NULL;
accordion -> gx_accordion_menu_animation_status = 0;
/* Determine if a parent widget was provided. */
if (parent)
{
_gx_widget_link(parent, (GX_WIDGET *)accordion);
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,80 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Accordion Menu Management (Menu) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_menu.h"
#include "gx_widget.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function draws the specified menu, which is a special type of */
/* widget. */
/* */
/* INPUT */
/* */
/* accordion Pointer the to accordion */
/* menu control block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_widget_background_draw Draw widget backgrond */
/* _gx_widget_children_draw Draw widget children */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_accordion_menu_draw(GX_ACCORDION_MENU *accordion)
{
/* Draw accordion menu background. */
_gx_widget_background_draw((GX_WIDGET *)accordion);
_gx_widget_children_draw((GX_WIDGET *)accordion);
}

View File

@ -0,0 +1,689 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Accordion Menu Management (Menu) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_menu.h"
#include "gx_widget.h"
#include "gx_window.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_shift_helper PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to shift one accordion menu. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordion menu */
/* control block */
/* animation_target Animation target */
/* shift Shift value */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_scroll_shift Change the widget position */
/* _gx_widget_resize Resize the widget */
/* _gx_menu_list_shift Change the menu list position */
/* */
/* CALLED BY */
/* */
/* _gx_accordion_menu_shift_helper */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static VOID _gx_accordion_menu_shift_helper(GX_ACCORDION_MENU *accordion, GX_WIDGET *animation_target, INT shift)
{
GX_WIDGET *child;
GX_MENU *menu;
GX_BOOL shift_start = GX_FALSE;
GX_RECTANGLE size;
child = accordion -> gx_widget_first_child;
while (child)
{
switch (child -> gx_widget_type)
{
case GX_TYPE_MENU:
if (shift_start)
{
/* Shift the menu item. */
_gx_widget_scroll_shift(child, 0, shift, GX_TRUE);
menu = (GX_MENU *)child;
/* Shift the menu list which is a member of menu item. */
_gx_widget_scroll_shift((GX_WIDGET *)&menu -> gx_menu_list, 0, shift, GX_TRUE);
}
break;
case GX_TYPE_MENU_LIST:
/* The shift work has done by the menu list owner. */
break;
default:
if (shift_start)
{
/* Shift other types of menu item. */
_gx_widget_scroll_shift(child, 0, shift, GX_TRUE);
}
break;
}
if (child == animation_target)
{
shift_start = GX_TRUE;
}
child = child -> gx_widget_next;
}
/* Resize accordion menu. */
size = accordion -> gx_widget_size;
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_bottom + shift);
_gx_widget_resize((GX_WIDGET *)accordion, &size);
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_shift PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to shift menu items for an accordion menu. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordion menu */
/* control block */
/* animation_target Animation target */
/* shift Shift value */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_resize Resize the widget */
/* _gx_accordion_menu_shift_heloer Change the accordion menu */
/* position */
/* */
/* CALLED BY */
/* */
/* _gx_accordion_menu_close_animation_update */
/* _gx_accordion_menu_open_animation_update */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_shift(GX_ACCORDION_MENU *accordion, GX_WIDGET *animation_target, INT shift)
{
GX_WIDGET *temp_target;
GX_WIDGET *parent;
GX_RECTANGLE size;
GX_WIDGET *child;
_gx_accordion_menu_shift_helper(accordion, animation_target, shift);
temp_target = (GX_WIDGET *)accordion;
parent = accordion -> gx_widget_parent;
while (parent)
{
if (parent -> gx_widget_type == GX_TYPE_MENU_LIST)
{
/* If the accordion menu is the child of a menu list,
Resize the menu list.*/
size = parent -> gx_widget_size;
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_bottom + shift);
_gx_widget_resize(parent, &size);
/* Get the menu that owns the menu list. */
child = ((GX_MENU_LIST *)parent) -> gx_menu_list_owner;
/* Get the parent of the menu*/
if (child)
{
parent = child -> gx_widget_parent;
/* Check if the menu parent is an accordion menu. */
if (parent && parent -> gx_widget_type == GX_TYPE_ACCORDION_MENU)
{
_gx_accordion_menu_shift_helper((GX_ACCORDION_MENU *)parent, child, shift);
}
else
{
break; /* Break out of the "while(parent)" loop and return. */
}
}
else
{
break; /* Break out of the "while(parent)" loop and return. */
}
}
else if (parent -> gx_widget_type == GX_TYPE_ACCORDION_MENU)
{
_gx_accordion_menu_shift_helper((GX_ACCORDION_MENU *)parent, temp_target, shift);
}
else
{
break;
}
temp_target = parent;
parent = parent -> gx_widget_parent;
}
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_close_animation_update PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to execute one step in menu close */
/* animation. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordin menu */
/* control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_height_get Get widget height */
/* _gx_system_timer_stop Stop a timer for widget */
/* _gx_widget_detach Detach widget from its parent */
/* _gx_widget_resize Resize a widget */
/* _gx_accordion_menu_shift Change accordion menu position*/
/* */
/* CALLED BY */
/* */
/* _gx_accordion_menu_event_process */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_close_animation_update(GX_ACCORDION_MENU *accordion)
{
GX_MENU *deselected = (GX_MENU *)accordion -> gx_accordion_menu_collapse_item;
GX_VALUE list_children_height = 0;
GX_VALUE height;
GX_VALUE shift;
GX_RECTANGLE size;
GX_WIDGET *child;
child = deselected -> gx_menu_list.gx_widget_first_child;
/* Calcualte total height of list children. */
while (child)
{
_gx_widget_height_get(child, &height);
list_children_height = (GX_VALUE)(list_children_height + height);
child = child -> gx_widget_next;
}
/* Calcualte shift value for each animation step. */
shift = (GX_VALUE)(list_children_height / 10);
if (shift == 0)
{
shift = list_children_height;
}
/* Get menu list height. */
_gx_widget_height_get((GX_WIDGET *)&deselected -> gx_menu_list, &height);
if (shift > height)
{
shift = height;
_gx_system_timer_stop((GX_WIDGET *)accordion, GX_MENU_CLOSE_TIMER);
deselected -> gx_widget_style &= (ULONG)(~GX_STYLE_MENU_EXPANDED);
accordion -> gx_accordion_menu_animation_status &= (GX_UBYTE)(~GX_MENU_ANIMATION_CLOSE);
accordion -> gx_accordion_menu_collapse_item = GX_NULL;
_gx_widget_detach((GX_WIDGET *)&deselected -> gx_menu_list);
}
/* Resize menu list. */
size = deselected -> gx_menu_list.gx_widget_size;
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_bottom - shift);
_gx_widget_resize((GX_WIDGET *)&deselected -> gx_menu_list, &size);
/* Shift menus that follow the opening menu. */
_gx_accordion_menu_shift(accordion, (GX_WIDGET *)deselected, -shift);
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_open_animation_update PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to execute one step in menu open animation.*/
/* */
/* INPUT */
/* */
/* accordion Pointer to accordin menu */
/* control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_height_get Get widget height */
/* _gx_system_timer_stop Stop a timer for widget */
/* _gx_widget_resize Resize widget */
/* _gx_accordion_menu_shift Change accordin menu position */
/* */
/* CALLED BY */
/* */
/* _gx_accordion_menu_event_process */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_open_animation_update(GX_ACCORDION_MENU *accordion)
{
GX_MENU *selected = (GX_MENU *)accordion -> gx_accordion_menu_expand_item;
GX_VALUE shift;
GX_RECTANGLE size;
GX_VALUE list_children_height = 0;
GX_VALUE height = 0;
GX_WIDGET *child;
child = selected -> gx_menu_list.gx_widget_first_child;
/* Calcualte total height of list children. */
while (child)
{
_gx_widget_height_get(child, &height);
list_children_height = (GX_VALUE)(list_children_height + height);
child = child -> gx_widget_next;
}
/* Calcualte shift value for each animation step. */
shift = (GX_VALUE)(list_children_height / 10);
if (shift == 0)
{
shift = list_children_height;
}
/* Get menu list height. */
_gx_widget_height_get((GX_WIDGET *)&selected -> gx_menu_list, &height);
if (height + shift >= list_children_height)
{
shift = (GX_VALUE)(list_children_height - height);
_gx_system_timer_stop((GX_WIDGET *)accordion, GX_MENU_OPEN_TIMER);
accordion -> gx_accordion_menu_animation_status &= (GX_UBYTE)(~GX_MENU_ANIMATION_OPEN);
selected -> gx_widget_style |= GX_STYLE_MENU_EXPANDED;
}
/* Resize menu list. */
size = selected -> gx_menu_list.gx_widget_size;
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_bottom + shift);
_gx_widget_resize((GX_WIDGET *)&selected -> gx_menu_list, &size);
/* Shift menus that follow the opening menu. */
_gx_accordion_menu_shift(accordion, (GX_WIDGET *)selected, shift);
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_pen_down_event_process PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to process pen down event for an accordion */
/* menu. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordion menu */
/* control block */
/* event_ptr Pointer to event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_system_top_widget_find Find toppest widget that */
/* contain test point */
/* _gx_system_input_capture Temporarily direct all inputs */
/* to specified widget */
/* _gx_widget_event_process Default widget event procses */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_pen_down_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr)
{
GX_WIDGET *widget = (GX_WIDGET *)accordion;
GX_WIDGET *child = GX_NULL;
child = _gx_system_top_widget_find(widget, event_ptr -> gx_event_payload.gx_event_pointdata, GX_STATUS_SELECTABLE);
if (child && (child -> gx_widget_type == GX_TYPE_MENU) &&
((GX_MENU *)child) -> gx_menu_list.gx_widget_first_child)
{
if ((accordion -> gx_accordion_menu_animation_status & GX_MENU_ANIMATION_CLOSE) ||
(accordion -> gx_accordion_menu_animation_status & GX_MENU_ANIMATION_OPEN))
{
/* Animation is going on. */
return GX_SUCCESS;
}
/* Set expand and collapse menu items. */
if (child -> gx_widget_style & GX_STYLE_MENU_EXPANDED)
{
accordion -> gx_accordion_menu_collapse_item = child;
accordion -> gx_accordion_menu_expand_item = GX_NULL;
}
else
{
if (accordion -> gx_accordion_menu_expand_item != child)
{
accordion -> gx_accordion_menu_collapse_item = accordion -> gx_accordion_menu_expand_item;
}
accordion -> gx_accordion_menu_expand_item = child;
}
_gx_system_input_capture(widget);
}
else
{
_gx_widget_event_process(widget, event_ptr);
}
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_pen_up_event_process PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to process pen up event for an accordion */
/* menu. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordion menu */
/* control block */
/* event_ptr Pointer to event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_system_input_release Release event capture */
/* _gx_system_timer_start Start a timer for widget */
/* _gx_widget_link Link a widget to its parent */
/* _gx_widget_shift Change a widget's position */
/* _gx_widget_event_process Default widget event process */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_pen_up_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr)
{
GX_WIDGET *widget = (GX_WIDGET *)accordion;
GX_WIDGET *child = GX_NULL;
GX_MENU_LIST *menu_list;
GX_VALUE x_shift;
GX_VALUE y_shift;
if (accordion -> gx_widget_status & GX_STATUS_OWNS_INPUT)
{
_gx_system_input_release(widget);
if (accordion -> gx_accordion_menu_collapse_item)
{
/* Start a timer to collapse a menu. */
_gx_system_timer_start((GX_WIDGET *)accordion, GX_MENU_CLOSE_TIMER, 1, 1);
accordion -> gx_accordion_menu_animation_status |= GX_MENU_ANIMATION_CLOSE;
}
if (accordion -> gx_accordion_menu_expand_item)
{
/* Start a timer to expand a menu. */
_gx_system_timer_start((GX_WIDGET *)accordion, GX_MENU_OPEN_TIMER, 1, 1);
accordion -> gx_accordion_menu_animation_status |= GX_MENU_ANIMATION_OPEN;
child = accordion -> gx_accordion_menu_expand_item;
menu_list = &((GX_MENU *)child) -> gx_menu_list;
/* Link menu list to menu's parent. */
_gx_widget_link(child -> gx_widget_parent, (GX_WIDGET *)menu_list);
x_shift = (GX_VALUE)(child -> gx_widget_size.gx_rectangle_left - menu_list -> gx_widget_size.gx_rectangle_left);
y_shift = (GX_VALUE)(child -> gx_widget_size.gx_rectangle_bottom + 1 - menu_list -> gx_widget_size.gx_rectangle_top);
/* Shift menu list to the bottom of the menu. */
if (x_shift || y_shift)
{
_gx_widget_shift((GX_WIDGET *)menu_list, x_shift, y_shift, GX_FALSE);
}
}
}
else
{
_gx_widget_event_process(widget, event_ptr);
}
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_event_process PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service processes an event for the accordion menu. */
/* */
/* INPUT */
/* */
/* accordion Pointer to accordion menu */
/* control block */
/* event_ptr Pointer to event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_event_process Default widget event process */
/* _gx_accordion_menu_position Position an accordion menu */
/* _gx_accordion_menu_open_animation_update */
/* Execute one step menu open */
/* animation */
/* _gx_accordion_menu_close_animation_update */
/* Execute one step menu close */
/* animation */
/* _gx_accordion_menu_pen_down_event_process */
/* Handle pen down event */
/* _gx_accordion_menu_pen_up_event_process */
/* Handle pen up event */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_accordion_menu_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr)
{
UINT timer_id;
switch (event_ptr -> gx_event_type)
{
case GX_EVENT_SHOW:
_gx_widget_event_process((GX_WIDGET *)accordion, event_ptr);
/* Check if the accordion parent is a menu list, if so, this is not a top level accordion,
Do not call accordion menu position here. We should only call menu position for a top level accordion menu. */
if (!(accordion -> gx_widget_parent && accordion -> gx_widget_parent -> gx_widget_type == GX_TYPE_MENU_LIST))
{
_gx_accordion_menu_position(accordion);
}
break;
case GX_EVENT_PEN_DOWN:
_gx_accordion_menu_pen_down_event_process(accordion, event_ptr);
break;
case GX_EVENT_PEN_UP:
_gx_accordion_menu_pen_up_event_process(accordion, event_ptr);
break;
case GX_EVENT_TIMER:
timer_id = event_ptr -> gx_event_payload.gx_event_timer_id;
if (timer_id == GX_MENU_CLOSE_TIMER)
{
_gx_accordion_menu_close_animation_update(accordion);
}
else if (timer_id == GX_MENU_OPEN_TIMER)
{
_gx_accordion_menu_open_animation_update(accordion);
}
break;
default:
return _gx_widget_event_process((GX_WIDGET *)accordion, event_ptr);
}
return(GX_SUCCESS);
}

View File

@ -0,0 +1,268 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Accordion Menu Management (Menu) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_menu.h"
#include "gx_widget.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_one_level_position PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function positions first level items for an accordion menu. */
/* */
/* INPUT */
/* */
/* accordion Accordion menu control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_border_width_get Get widget border width */
/* _gx_widget_client_get Get widget client rectangle */
/* _gx_widget_height_get Get widget height */
/* _gx_widget_shift Shift a widget */
/* _gx_widget_resize Resize a widget */
/* */
/* CALLED BY */
/* */
/* _gx_accordion_menu_position */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_accordion_menu_one_level_position(GX_ACCORDION_MENU *accordion)
{
GX_WIDGET *child = accordion -> gx_widget_first_child;
GX_RECTANGLE size;
GX_RECTANGLE client;
GX_VALUE height;
GX_VALUE bottom;
GX_VALUE border_width;
GX_MENU_LIST *list;
_gx_widget_border_width_get((GX_WIDGET *)accordion, &border_width);
_gx_widget_client_get((GX_WIDGET *)accordion, border_width, &client);
size.gx_rectangle_left = client.gx_rectangle_left;
size.gx_rectangle_right = client.gx_rectangle_right;
size.gx_rectangle_top = client.gx_rectangle_top;
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top - 1);
bottom = size.gx_rectangle_bottom;
accordion -> gx_accordion_menu_expand_item = GX_NULL;
/* Reposition accordion menu items. */
while (child)
{
switch (child -> gx_widget_type)
{
case GX_TYPE_MENU:
list = &((GX_MENU *)child) -> gx_menu_list;
if (child -> gx_widget_style & GX_STYLE_MENU_EXPANDED)
{
if (!accordion -> gx_accordion_menu_expand_item && list -> gx_widget_first_child)
{
accordion -> gx_accordion_menu_expand_item = child;
}
else
{
child -> gx_widget_style &= (ULONG)(~GX_STYLE_MENU_EXPANDED);
_gx_widget_detach((GX_WIDGET *)list);
list -> gx_widget_size.gx_rectangle_bottom = (GX_VALUE)(list -> gx_widget_size.gx_rectangle_top - 1);
}
}
_gx_widget_height_get(child, &height);
size.gx_rectangle_top = (GX_VALUE)(bottom + 1);
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top + height - 1);
_gx_widget_resize(child, &size);
if (list -> gx_widget_parent)
{
_gx_widget_shift((GX_WIDGET *)list,
(GX_VALUE)(size.gx_rectangle_left - list -> gx_widget_size.gx_rectangle_left),
(GX_VALUE)(size.gx_rectangle_bottom + 1 - list -> gx_widget_size.gx_rectangle_top), GX_FALSE);
bottom = list -> gx_widget_size.gx_rectangle_bottom;
}
else
{
bottom = size.gx_rectangle_bottom;
}
break;
case GX_TYPE_MENU_LIST:
break;
default:
_gx_widget_height_get(child, &height);
size.gx_rectangle_top = (GX_VALUE)(bottom + 1);
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top + height - 1);
_gx_widget_resize(child, &size);
bottom = size.gx_rectangle_bottom;
break;
}
child -> gx_widget_status &= ~GX_STATUS_ACCEPTS_FOCUS;
child = child -> gx_widget_next;
}
size = accordion -> gx_widget_size;
size.gx_rectangle_bottom = (GX_VALUE)(bottom + border_width);
/* Resize accordion menu. */
_gx_widget_resize((GX_WIDGET *)accordion, &size);
/* Return completion status code. */
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_accordion_menu_position PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function positions an accordion menu and its items. */
/* */
/* INPUT */
/* */
/* accordion Accordion menu control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_menu_one_level_position Position a menu widget */
/* _gx_accordion_one_levelmenu_position Position an accordion menu */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_accordion_menu_position(GX_ACCORDION_MENU *accordion)
{
GX_WIDGET *parent = (GX_WIDGET *)accordion;
GX_WIDGET *child;
GX_MENU_LIST *child_list;
child = accordion -> gx_widget_first_child;
/* Reposition items of menu list. */
while (child)
{
if (child -> gx_widget_type == GX_TYPE_MENU)
{
child_list = &((GX_MENU *)child) -> gx_menu_list;
if (child_list -> gx_widget_first_child)
{
child = child_list -> gx_widget_first_child;
continue;
}
else if (child_list -> gx_widget_parent)
{
_gx_widget_detach((GX_WIDGET *)child_list);
}
}
else if (child -> gx_widget_type == GX_TYPE_ACCORDION_MENU)
{
if (child -> gx_widget_first_child)
{
child = child -> gx_widget_first_child;
continue;
}
}
while ((child -> gx_widget_next == GX_NULL) && (child != parent))
{
child = child -> gx_widget_parent;
if (child -> gx_widget_type == GX_TYPE_MENU_LIST)
{
child_list = (GX_MENU_LIST *)child;
child = child_list -> gx_menu_list_owner;
}
if ((child -> gx_widget_type == GX_TYPE_MENU))
{
_gx_menu_one_level_position((GX_MENU *)child, 0);
}
else
{
_gx_accordion_menu_one_level_position((GX_ACCORDION_MENU *)child);
}
}
if (child == parent)
{
break;
}
child = child -> gx_widget_next;
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,87 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_utility.h"
#include "gx_window.h"
#include "gx_canvas.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_canvas_define PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function defines canvas for animation manager to use. */
/* */
/* INPUT */
/* */
/* animation Animation control block */
/* canvas Memory canvas used to */
/* implement the translation */
/* animation */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_canvas_define(GX_ANIMATION *animation, GX_CANVAS *canvas)
{
if (animation -> gx_animation_status != GX_ANIMATION_IDLE)
{
return(GX_INVALID_STATUS);
}
animation -> gx_animation_canvas = canvas;
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,251 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_canvas.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_complete_event_send PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function to send an animation complete event. */
/* */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_system_event_send Send GUIX event */
/* */
/* CALLED BY */
/* */
/* _gx_animation_complete */
/* _gx_animation_slide_landing */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_animation_complete_event_send(GX_ANIMATION *animation)
{
GX_EVENT complete_event;
if (animation -> gx_animation_info.gx_animation_id)
{
if (animation -> gx_animation_info.gx_animation_target)
{
complete_event.gx_event_target = animation -> gx_animation_info.gx_animation_target;
}
else
{
complete_event.gx_event_target = animation -> gx_animation_info.gx_animation_parent;
}
/* send event to notify the animation has been completed */
complete_event.gx_event_type = GX_EVENT_ANIMATION_COMPLETE;
complete_event.gx_event_sender = animation -> gx_animation_info.gx_animation_id;
_gx_system_event_send(&complete_event);
}
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_complete PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Called internally when an animation sequence is finished. */
/* */
/* */
/* INPUT */
/* */
/* animation Pointer to window control */
/* block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_animation_stop Stop an animation */
/* _gx_widget_detach Detach a widget from its */
/* parent */
/* _gx_widget_hide Hide a widget */
/* _gx_widget_shift Shift a widget */
/* _gx_widget_attach Attach a widget to its parent */
/* _gx_system_event_send Send GUIX event */
/* */
/* CALLED BY */
/* */
/* _gx_animation_update */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_animation_complete(GX_ANIMATION *animation)
{
GX_WIDGET *target;
GX_VALUE xshift;
GX_VALUE yshift;
/* Remove animation from active list and assign idle status */
_gx_animation_stop(animation);
/* do final cleanup */
target = animation -> gx_animation_info.gx_animation_target;
if (animation -> gx_animation_canvas)
{
/* hide the animation root */
if (target -> gx_widget_parent)
{
_gx_widget_hide(target -> gx_widget_parent);
}
/* Hide animation target. */
_gx_widget_detach(target);
if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_PUSH_STACK)
{
/* Push animation target to system screen stack. */
_gx_system_screen_stack_push(target);
}
else if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_DETACH)
{
if (target -> gx_widget_status & GX_STATUS_STUDIO_CREATED)
{
_gx_widget_delete(target);
animation -> gx_animation_info.gx_animation_target = GX_NULL;
}
}
else
{
/* shift the target into final position */
_gx_widget_shift(animation -> gx_animation_info.gx_animation_target,
animation -> gx_animation_info.gx_animation_end_position.gx_point_x,
animation -> gx_animation_info.gx_animation_end_position.gx_point_y, GX_FALSE);
/* attach the widget to it's parent */
_gx_widget_attach(animation -> gx_animation_info.gx_animation_parent, target);
}
_gx_system_canvas_refresh();
_gx_canvas_hide(animation -> gx_animation_canvas);
}
else
{
#if defined(GX_BRUSH_ALPHA_SUPPORT)
if (animation -> gx_animation_info.gx_animation_start_alpha !=
animation -> gx_animation_info.gx_animation_end_alpha)
{
animation -> gx_animation_info.gx_animation_target -> gx_widget_style &= ~GX_STYLE_USE_LOCAL_ALPHA;
}
#endif
if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_PUSH_STACK)
{
/* Push animation target to system screen stack. */
_gx_system_screen_stack_push(target);
}
else if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_DETACH)
{
_gx_widget_hide(target);
/* if this target was created by the Studio generated code, then delete the widget here */
if (target -> gx_widget_status & GX_STATUS_STUDIO_CREATED)
{
_gx_widget_delete(target);
animation -> gx_animation_info.gx_animation_target = GX_NULL;
}
}
else
{
/* test for shift translation */
xshift = (GX_VALUE)(animation -> gx_animation_info.gx_animation_end_position.gx_point_x -
animation -> gx_animation_info.gx_animation_start_position.gx_point_x);
yshift = (GX_VALUE)(animation -> gx_animation_info.gx_animation_end_position.gx_point_y -
animation -> gx_animation_info.gx_animation_start_position.gx_point_y);
if (xshift || yshift)
{
xshift = (GX_VALUE)(animation -> gx_animation_info.gx_animation_end_position.gx_point_x -
target -> gx_widget_size.gx_rectangle_left);
yshift = (GX_VALUE)(animation -> gx_animation_info.gx_animation_end_position.gx_point_y -
target -> gx_widget_size.gx_rectangle_top);
/* shift the target into final position */
_gx_widget_shift(target, xshift, yshift, GX_TRUE);
}
}
}
_gx_animation_complete_event_send(animation);
/* If this animation came from the system pool, return it */
if (animation -> gx_animation_system_allocated)
{
_gx_system_animation_free(animation);
}
}

View File

@ -0,0 +1,81 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_window.h"
#include "gx_canvas.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the animation widget. */
/* */
/* INPUT */
/* */
/* animation Pointer to window control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* memset Cleanup the memory */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_create(GX_ANIMATION *animation)
{
memset(animation, 0, sizeof(GX_ANIMATION));
animation -> gx_animation_status = GX_ANIMATION_IDLE;
animation -> gx_animation_landing_speed = 10;
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,84 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_disable PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function removes the screen slide aimation hook from the */
/* widget's default event process. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* widget Pointer to widget control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_animation_stop Stop an animation sequence */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_drag_disable(GX_ANIMATION *animation, GX_WIDGET *widget)
{
UINT status;
/* Replace the widget's event process function with its original event process function. */
widget -> gx_widget_event_process_function = animation -> gx_animation_original_event_process_function;
animation -> gx_animation_original_event_process_function = GX_NULL;
/* Remove a animation from animation list. */
status = _gx_animation_stop(animation);
return status;
}

View File

@ -0,0 +1,95 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_animation.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_enable PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function sets screen slide animation event process as a hook */
/* procedure of the widget's default event process. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* widget Pointer to widget control */
/* block */
/* info Animation information */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_drag_enable(GX_ANIMATION *animation, GX_WIDGET *widget, GX_ANIMATION_INFO *info)
{
/* Test invalid animation status. */
if (animation -> gx_animation_status != GX_ANIMATION_IDLE)
{
return(GX_INVALID_STATUS);
}
/* Save the widget's event process function, and replace it with the slide animation event process. */
animation -> gx_animation_original_event_process_function = widget -> gx_widget_event_process_function;
widget -> gx_widget_event_process_function = _gx_animation_drag_event_process;
/* Save the animation parameters */
animation -> gx_animation_info = *info;
animation -> gx_animation_timer = animation -> gx_animation_info.gx_animation_frame_interval;
animation -> gx_animation_next = _gx_system_animation_list;
animation -> gx_animation_total_steps = info -> gx_animation_steps;
_gx_system_animation_list = animation;
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,339 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_widget.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_event_check PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* Internal helper function that handles incoming events for screen */
/* drag animation. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* event_ptr Event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_animation_slide_landing Move animation screens one */
/* step toward target position */
/* _gx_animation_slide_landing_start Prepare for screen landing */
/* _gx_animation_drag_tracking_start Prepare for screen slide */
/* animation */
/* _gx_animation_drag_tracking Shift animation screens */
/* accordion to pen pos */
/* _gx_system_event_send Send an event for processing */
/* _gx_system_input_capture Temporarily direct all input */
/* events to specified widget */
/* _gx_system_input_release Release captured input events */
/* _gx_system_timer_stop Stop a timer for a widget */
/* */
/* CALLED BY */
/* */
/* _gx_animation_drag_event_process */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static UINT _gx_animation_drag_event_check(GX_ANIMATION *animation, GX_EVENT *event_ptr)
{
GX_ANIMATION_INFO *info = &animation -> gx_animation_info;
GX_RECTANGLE *size;
INT delta;
INT temp;
GX_WIDGET **stackptr;
GX_EVENT input_release_event;
INT shift;
switch (event_ptr -> gx_event_type)
{
case GX_EVENT_PEN_DOWN:
if (animation -> gx_animation_status == GX_ANIMATION_IDLE)
{
_gx_system_input_capture(info -> gx_animation_parent);
/* Initiate animation information. */
animation -> gx_animation_status = GX_ANIMATION_SLIDE_TRACKING;
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
animation -> gx_animation_slide_tracking_start_pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y;
animation -> gx_animation_slide_tracking_current_pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y;
}
else
{
animation -> gx_animation_slide_tracking_start_pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x;
animation -> gx_animation_slide_tracking_current_pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x;
}
animation -> gx_animation_slide_target_index_1 = -1;
animation -> gx_animation_slide_target_index_2 = -1;
}
break;
case GX_EVENT_PEN_DRAG:
if (animation -> gx_animation_status == GX_ANIMATION_SLIDE_TRACKING)
{
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
delta = GX_ABS(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y - animation -> gx_animation_slide_tracking_start_pos);
}
else
{
delta = GX_ABS(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x - animation -> gx_animation_slide_tracking_start_pos);
}
if ((animation -> gx_animation_slide_target_index_1 == -1) &&
(delta > GX_ANIMATION_MIN_SLIDING_DIST))
{
/* Start swiping, remove other widgets from input capture stack. */
stackptr = _gx_system_input_capture_stack;
memset(&input_release_event, 0, sizeof(GX_EVENT));
input_release_event.gx_event_type = GX_EVENT_INPUT_RELEASE;
while (*stackptr)
{
if (*stackptr != info -> gx_animation_parent)
{
input_release_event.gx_event_target = *stackptr;
_gx_system_event_send(&input_release_event);
}
stackptr++;
}
_gx_animation_drag_tracking_start(animation, event_ptr -> gx_event_payload.gx_event_pointdata);
}
_gx_animation_drag_tracking(animation, event_ptr -> gx_event_payload.gx_event_pointdata);
}
break;
case GX_EVENT_PEN_UP:
if (animation -> gx_animation_status == GX_ANIMATION_SLIDE_TRACKING)
{
_gx_system_input_release(info -> gx_animation_parent);
animation -> gx_animation_status = GX_ANIMATION_IDLE;
size = &info -> gx_animation_parent -> gx_widget_size;
delta = animation -> gx_animation_slide_tracking_current_pos - animation -> gx_animation_slide_tracking_start_pos;
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
shift = (size -> gx_rectangle_bottom - size -> gx_rectangle_top + 1) >> 1;
}
else
{
shift = (size -> gx_rectangle_right - size -> gx_rectangle_left + 1) >> 1;
}
if ((abs(delta) < shift) || (animation -> gx_animation_slide_target_index_2 == -1))
{
/* slide back to original when slide distance is less than half screen width/height. */
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
temp = animation -> gx_animation_slide_target_index_1;
animation -> gx_animation_slide_target_index_1 = animation -> gx_animation_slide_target_index_2;
animation -> gx_animation_slide_target_index_2 = (GX_VALUE)temp;
}
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_LEFT:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_RIGHT;
break;
case GX_ANIMATION_SLIDE_RIGHT:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_LEFT;
break;
case GX_ANIMATION_SLIDE_UP:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_DOWN;
break;
case GX_ANIMATION_SLIDE_DOWN:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_UP;
break;
}
}
if (delta)
{
_gx_animation_slide_landing_start(animation);
}
}
break;
case GX_EVENT_HORIZONTAL_FLICK:
case GX_EVENT_VERTICAL_FLICK:
if (animation -> gx_animation_status == GX_ANIMATION_SLIDE_LANDING)
{
delta = event_ptr -> gx_event_payload.gx_event_intdata[0];
if (((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_LEFT) && (delta > 0)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_RIGHT) && (delta < 0)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_UP) && (delta > 0)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_DOWN) && (delta < 0)))
{
/* landing direction is different to flick direction
exchange targets */
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
temp = animation -> gx_animation_slide_target_index_1;
animation -> gx_animation_slide_target_index_1 = animation -> gx_animation_slide_target_index_2;
animation -> gx_animation_slide_target_index_2 = (GX_VALUE)temp;
}
animation -> gx_animation_status = GX_ANIMATION_IDLE;
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_LEFT:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_RIGHT;
break;
case GX_ANIMATION_SLIDE_RIGHT:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_LEFT;
break;
case GX_ANIMATION_SLIDE_UP:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_DOWN;
break;
default:
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_UP;
break;
}
}
if (delta)
{
_gx_animation_slide_landing_start(animation);
}
}
break;
case GX_EVENT_TIMER:
if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_ANIMATION_SLIDE_TIMER)
{
if (animation -> gx_animation_status != GX_ANIMATION_SLIDE_LANDING)
{
_gx_system_timer_stop(info -> gx_animation_parent, GX_ANIMATION_SLIDE_TIMER);
break;
}
_gx_animation_slide_landing(animation);
}
break;
}
return GX_SUCCESS;
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_event_process PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function handles incoming events for screen drag animation. */
/* */
/* INPUT */
/* */
/* widget Pointer to widget control */
/* block */
/* event_ptr Event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_animation_slide_event_check Handle incoming events for */
/* screen drag animation */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_drag_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr)
{
GX_ANIMATION *animation;
animation = _gx_system_animation_list;
while (animation)
{
if ((animation -> gx_animation_info.gx_animation_parent == widget) &&
(animation -> gx_animation_original_event_process_function))
{
_gx_animation_drag_event_check(animation, event_ptr);
/* Call original event process function. */
animation -> gx_animation_original_event_process_function(widget, event_ptr);
}
animation = animation -> gx_animation_next;
}
return GX_SUCCESS;
}

View File

@ -0,0 +1,181 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_tracking PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function moves the animation screens according to current pen */
/* position. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* penpos Current pen position */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_detach Detach a widget from its */
/* parent */
/* _gx_widget_shift Change widget's position */
/* _gx_animation_drag_tracking_start Prepare for screen draw */
/* animation */
/* */
/* CALLED BY */
/* */
/* _gx_animation_drag_event_check */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_drag_tracking(GX_ANIMATION *animation, GX_POINT penpos)
{
GX_VALUE delta_x = 0;
GX_VALUE delta_y = 0;
GX_VALUE shift_x = 0;
GX_VALUE shift_y = 0;
GX_VALUE last_pos;
GX_VALUE start_pos;
GX_VALUE pen_pos;
GX_WIDGET *target_1 = GX_NULL;
GX_WIDGET *target_2 = GX_NULL;
if (animation -> gx_animation_slide_target_index_1 >= 0)
{
target_1 = animation -> gx_animation_info.gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
}
if (target_1 == GX_NULL)
{
return GX_SUCCESS;
}
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
target_2 = animation -> gx_animation_info.gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
}
last_pos = animation -> gx_animation_slide_tracking_current_pos;
if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_VERTICAL)
{
pen_pos = penpos.gx_point_y;
delta_y = (GX_VALUE)(pen_pos - last_pos);
}
else
{
pen_pos = penpos.gx_point_x;
delta_x = (GX_VALUE)(pen_pos - last_pos);
}
if (delta_x || delta_y)
{
/* Calculate sliding distance. */
start_pos = animation -> gx_animation_slide_tracking_start_pos;
if (((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_LEFT) && (pen_pos > start_pos)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_RIGHT) && (pen_pos < start_pos)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_UP) && (pen_pos > start_pos)) ||
((animation -> gx_animation_slide_direction == GX_ANIMATION_SLIDE_DOWN) && (pen_pos < start_pos)))
{
/* Sliding direction changed, detach the second animation target and
call tracking start again. */
if (target_2)
{
_gx_widget_detach(target_2);
}
_gx_animation_drag_tracking_start(animation, penpos);
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
target_2 = animation -> gx_animation_info.gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
}
else
{
target_2 = GX_NULL;
}
if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_VERTICAL)
{
shift_y = (GX_VALUE)(start_pos - last_pos);
delta_y = (GX_VALUE)(pen_pos - start_pos);
}
else
{
shift_x = (GX_VALUE)(start_pos - last_pos);
delta_x = (GX_VALUE)(pen_pos - start_pos);
}
}
if (target_2)
{
_gx_widget_shift(target_2, (GX_VALUE)(shift_x + delta_x), (GX_VALUE)(shift_y + delta_y), GX_TRUE);
}
else
{
if (animation -> gx_animation_info.gx_animation_style & GX_ANIMATION_VERTICAL)
{
animation -> gx_animation_slide_tracking_start_pos = (GX_VALUE)(animation -> gx_animation_slide_tracking_start_pos + ((delta_y + 1) >> 1));
delta_y >>= 1;
}
else
{
animation -> gx_animation_slide_tracking_start_pos = (GX_VALUE)(animation -> gx_animation_slide_tracking_start_pos + ((delta_x + 1) >> 1));
delta_x >>= 1;
}
}
_gx_widget_shift(target_1, (GX_VALUE)(shift_x + delta_x), (GX_VALUE)(shift_y + delta_y), GX_TRUE);
animation -> gx_animation_slide_tracking_current_pos = pen_pos;
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,226 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_drag_tracking_start PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares for screen slide animation. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_resize Resize widget */
/* _gx_widget_attach Attach a widget to its parent */
/* */
/* CALLED BY */
/* */
/* _gx_animation_drag_event_check */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_drag_tracking_start(GX_ANIMATION *animation, GX_POINT penpos)
{
GX_ANIMATION_INFO *info;
GX_RECTANGLE size;
INT width;
GX_WIDGET *target_1;
GX_WIDGET *target_2;
INT index;
INT current_pos;
info = &animation -> gx_animation_info;
target_1 = info -> gx_animation_slide_screen_list[0];
index = 0;
/* Search for visible screen, which is the first animation target. */
while (target_1)
{
if (target_1 -> gx_widget_status & GX_STATUS_VISIBLE)
{
animation -> gx_animation_slide_target_index_1 = (GX_VALUE)index;
}
index++;
target_1 = info -> gx_animation_slide_screen_list[index];
}
animation -> gx_animation_slide_screen_list_size = (USHORT)index;
if (animation -> gx_animation_slide_target_index_1 == -1)
{
return(GX_FAILURE);
}
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
current_pos = penpos.gx_point_y;
}
else
{
current_pos = penpos.gx_point_x;
}
/* Find second animation target according to sliding direction. */
if (current_pos < animation -> gx_animation_slide_tracking_start_pos)
{
/* Sliding left/up. */
index = animation -> gx_animation_slide_target_index_1 + 1;
if ((index >= animation -> gx_animation_slide_screen_list_size) &&
(info -> gx_animation_style & GX_ANIMATION_WRAP))
{
index = 0;
}
}
else
{
/* Sliding right/down. */
index = animation -> gx_animation_slide_target_index_1 - 1;
if ((index < 0) && (info -> gx_animation_style & GX_ANIMATION_WRAP))
{
index = animation -> gx_animation_slide_screen_list_size - 1;
}
}
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
if (current_pos < animation -> gx_animation_slide_tracking_start_pos)
{
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_UP;
}
else
{
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_DOWN;
}
}
else
{
if (current_pos < animation -> gx_animation_slide_tracking_start_pos)
{
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_LEFT;
}
else
{
animation -> gx_animation_slide_direction = GX_ANIMATION_SLIDE_RIGHT;
}
}
if ((index >= 0) && (index < animation -> gx_animation_slide_screen_list_size))
{
animation -> gx_animation_slide_target_index_2 = (GX_VALUE)(index);
target_1 = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
target_2 = info -> gx_animation_slide_screen_list[index];
size = target_2 -> gx_widget_size;
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
width = size.gx_rectangle_bottom - size.gx_rectangle_top + 1;
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_UP:
/* Slide up. */
size.gx_rectangle_top = (GX_VALUE)(target_1 -> gx_widget_size.gx_rectangle_bottom + 1);
size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top + width - 1);
break;
default:
/* Slide down. */
size.gx_rectangle_bottom = (GX_VALUE)(target_1 -> gx_widget_size.gx_rectangle_top - 1);
size.gx_rectangle_top = (GX_VALUE)(size.gx_rectangle_bottom - width + 1);
break;
}
size.gx_rectangle_left = (GX_VALUE)target_1 -> gx_widget_size.gx_rectangle_left;
size.gx_rectangle_right = (GX_VALUE)target_1 -> gx_widget_size.gx_rectangle_right;
}
else
{
width = size.gx_rectangle_right - size.gx_rectangle_left + 1;
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_LEFT:
/* Slide left. */
size.gx_rectangle_left = (GX_VALUE)(target_1 -> gx_widget_size.gx_rectangle_right + 1);
size.gx_rectangle_right = (GX_VALUE)(size.gx_rectangle_left + width - 1);
break;
default:
/* Slide right. */
size.gx_rectangle_right = (GX_VALUE)(target_1 -> gx_widget_size.gx_rectangle_left - 1);
size.gx_rectangle_left = (GX_VALUE)(size.gx_rectangle_right - width + 1);
break;
}
size.gx_rectangle_top = (GX_VALUE)target_1 -> gx_widget_size.gx_rectangle_top;
size.gx_rectangle_bottom = (GX_VALUE)target_1 -> gx_widget_size.gx_rectangle_bottom;
}
/* Resize the second animation target. */
_gx_widget_resize(target_2, &size);
/* Attach the second target to animation parent. */
_gx_widget_attach(info -> gx_animation_parent, target_2);
}
else
{
animation -> gx_animation_slide_target_index_2 = -1;
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,79 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_animation.h"
#include "gx_utility.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_landing_speed_set PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function sets landing speed for screen drag animation. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* shift_per_step Shift distance for each step */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_landing_speed_set(GX_ANIMATION *animation, USHORT shift_per_step)
{
animation -> gx_animation_landing_speed = shift_per_step;
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,225 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_animation.h"
#include "gx_utility.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_slide_landing PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function shifts the sliding screens one step to target */
/* position. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_detach Detach widget from its parent */
/* _gx_widget_shift Change widget's position */
/* _gx_system_timer_stop Stop a timer for a widget */
/* _gx_animation_complete_event_send Send a complete event to */
/* widget's parent */
/* */
/* CALLED BY */
/* */
/* _gx_animation_drag_event_check */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_slide_landing(GX_ANIMATION *animation)
{
GX_ANIMATION_INFO *info = &animation -> gx_animation_info;
GX_WIDGET *parent;
GX_WIDGET *target_1 = GX_NULL;
GX_WIDGET *target_2 = GX_NULL;
INT x_shift = 0;
INT y_shift = 0;
GX_RECTANGLE target_size;
parent = animation -> gx_animation_info.gx_animation_parent;
/* Get current animation targets. */
if (animation -> gx_animation_slide_target_index_1 >= 0)
{
target_1 = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
}
else
{
/* Sliding animation should have 1 target at least, this should not happen. */
/* Stop landing timer. */
_gx_system_timer_stop(parent, GX_ANIMATION_SLIDE_TIMER);
return GX_FAILURE;
}
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
target_2 = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
}
if (target_2)
{
target_size = target_2 -> gx_widget_size;
}
else
{
target_size = target_1 -> gx_widget_size;
}
if (info -> gx_animation_style & GX_ANIMATION_EASING_FUNC_MASK)
{
info -> gx_animation_steps = (GX_UBYTE)(info -> gx_animation_steps - 1);
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_LEFT:
case GX_ANIMATION_SLIDE_RIGHT:
_gx_utility_easing_function_calculate(info -> gx_animation_style,
info -> gx_animation_start_position.gx_point_x,
parent -> gx_widget_size.gx_rectangle_left,
animation -> gx_animation_total_steps - info -> gx_animation_steps,
animation -> gx_animation_total_steps, &x_shift);
x_shift -= target_size.gx_rectangle_left;
break;
default:
_gx_utility_easing_function_calculate(info -> gx_animation_style,
info -> gx_animation_start_position.gx_point_y,
parent -> gx_widget_size.gx_rectangle_top,
animation -> gx_animation_total_steps - info -> gx_animation_steps,
animation -> gx_animation_total_steps, &y_shift);
y_shift -= target_size.gx_rectangle_top;
break;
}
}
else
{
/* Get landing shift value according to slide direction. */
switch (animation -> gx_animation_slide_direction)
{
case GX_ANIMATION_SLIDE_LEFT:
x_shift = -animation -> gx_animation_landing_speed;
break;
case GX_ANIMATION_SLIDE_RIGHT:
x_shift = animation -> gx_animation_landing_speed;
break;
case GX_ANIMATION_SLIDE_UP:
y_shift = -animation -> gx_animation_landing_speed;
break;
default:
y_shift = animation -> gx_animation_landing_speed;
break;
}
}
if (((info -> gx_animation_style & GX_ANIMATION_EASING_FUNC_MASK) && (info -> gx_animation_steps != 0)) ||
((x_shift < 0) && ((GX_VALUE)(target_size.gx_rectangle_left + x_shift) > parent -> gx_widget_size.gx_rectangle_left)) ||
((x_shift > 0) && ((GX_VALUE)(target_size.gx_rectangle_left + x_shift) < parent -> gx_widget_size.gx_rectangle_left)) ||
((y_shift < 0) && ((GX_VALUE)(target_size.gx_rectangle_top + y_shift) > parent -> gx_widget_size.gx_rectangle_top)) ||
((y_shift > 0) && ((GX_VALUE)(target_size.gx_rectangle_top + y_shift) < parent -> gx_widget_size.gx_rectangle_top)))
{
/* Shift animation targets one step toward target position. */
_gx_widget_shift(target_1, (GX_VALUE)x_shift, (GX_VALUE)y_shift, GX_TRUE);
if (target_2)
{
_gx_widget_shift(target_2, (GX_VALUE)x_shift, (GX_VALUE)y_shift, GX_TRUE);
}
}
else
{
/* Shift animation targets to the target position. */
/* Stop landing timer. */
_gx_system_timer_stop(parent, GX_ANIMATION_SLIDE_TIMER);
/* Calculate the distance from current postion to final position. */
if (info -> gx_animation_style & GX_ANIMATION_VERTICAL)
{
y_shift = parent -> gx_widget_size.gx_rectangle_top - target_size.gx_rectangle_top;
}
else
{
x_shift = parent -> gx_widget_size.gx_rectangle_left - target_size.gx_rectangle_left;
}
if (target_2)
{
/* Detach the first target. */
_gx_widget_detach(target_1);
/* Move the second target to its final position. */
_gx_widget_shift(target_2, (GX_VALUE)x_shift, (GX_VALUE)y_shift, GX_TRUE);
}
else
{
/* No second target, just move the first target to its final position. */
_gx_widget_shift(target_1, (GX_VALUE)x_shift, (GX_VALUE)y_shift, GX_TRUE);
}
/* Reset animation information. */
animation -> gx_animation_slide_target_index_1 = -1;
animation -> gx_animation_slide_target_index_2 = -1;
animation -> gx_animation_status = GX_ANIMATION_IDLE;
/* Send animation complete event. */
_gx_animation_complete_event_send(animation);
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,110 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_slide_landing_start PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function starts a timer to move the sliding screens to the */
/* target position step by step. */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_system_timer_start Start a timer for a widget */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_slide_landing_start(GX_ANIMATION *animation)
{
GX_ANIMATION_INFO *info;
GX_WIDGET *target;
GX_RECTANGLE *target_size;
if ((animation -> gx_animation_slide_target_index_1 >= 0) &&
(animation -> gx_animation_status == GX_ANIMATION_IDLE))
{
info = &animation -> gx_animation_info;
if (animation -> gx_animation_slide_target_index_2 >= 0)
{
target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
}
else
{
target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
}
target_size = &target -> gx_widget_size;
info -> gx_animation_start_position.gx_point_x = target_size -> gx_rectangle_left;
info -> gx_animation_start_position.gx_point_y = target_size -> gx_rectangle_top;
/* Start a landing timer. */
_gx_system_timer_start(info -> gx_animation_parent, GX_ANIMATION_SLIDE_TIMER,
info -> gx_animation_frame_interval,
info -> gx_animation_frame_interval);
/* Set animation status. */
animation -> gx_animation_status = GX_ANIMATION_SLIDE_LANDING;
info -> gx_animation_steps = animation -> gx_animation_total_steps;
}
/* Return completion status code. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,202 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_canvas.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_start PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function starts an animation sequence. */
/* */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* info Animation information */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_detach Detach a widget from its */
/* parent */
/* _gx_widget_shift Shift a widget */
/* _gx_canvas_offset_set Set the offset of canvas */
/* _gx_canvas_alpha_set Set the alpha of canvas */
/* _gx_widget_attach Attach a widget to its parent */
/* _gx_widget_show Show a widget */
/* tx_timer_info_get Get the information of */
/* ThreadX timer */
/* tx_timer_activate Start the ThreadX timer */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_start(GX_ANIMATION *animation, GX_ANIMATION_INFO *info)
{
UINT status = GX_SUCCESS;
GX_WINDOW_ROOT *root;
#ifdef GX_THREADX_BINDING
UINT tx_timer_active;
#endif
GX_VALUE left;
GX_VALUE top;
animation -> gx_animation_total_steps = info -> gx_animation_steps;
if (animation -> gx_animation_canvas)
{
/* Make sure the widget is not attached to any parent */
_gx_widget_detach(info -> gx_animation_target);
/* position the target widget at 0,0 within the animation canvas */
left = info -> gx_animation_target -> gx_widget_size.gx_rectangle_left;
top = info -> gx_animation_target -> gx_widget_size.gx_rectangle_top;
if (left || top)
{
_gx_widget_shift(info -> gx_animation_target, (GX_VALUE)-left, (GX_VALUE)-top, GX_FALSE);
}
/* position the canvas at the animation starting position */
_gx_canvas_offset_set(animation -> gx_animation_canvas,
info -> gx_animation_start_position.gx_point_x,
info -> gx_animation_start_position.gx_point_y);
/* link the target to the animation root window */
root = _gx_system_root_window_created_list;
while (root && root -> gx_window_root_canvas != animation -> gx_animation_canvas)
{
root = (GX_WINDOW_ROOT *)root -> gx_widget_next;
}
if (root)
{
_gx_widget_attach((GX_WIDGET *)root, info -> gx_animation_target);
/* and show the animation root window to make everything visible */
_gx_widget_show((GX_WIDGET *)root);
_gx_canvas_drawing_initiate(animation -> gx_animation_canvas, (GX_WIDGET *) root, &root -> gx_widget_size);
_gx_widget_children_draw((GX_WIDGET *)root);
_gx_canvas_drawing_complete(animation -> gx_animation_canvas, GX_FALSE);
/* set the initial alpha and make our canvas visible */
_gx_canvas_alpha_set(animation -> gx_animation_canvas, info -> gx_animation_start_alpha);
_gx_canvas_show(animation -> gx_animation_canvas);
}
else
{
status = GX_FAILURE;
}
}
else
{
if (info -> gx_animation_start_alpha != info -> gx_animation_end_alpha)
{
#ifdef GX_BRUSH_ALPHA_SUPPORT
info -> gx_animation_target -> gx_widget_style |= GX_STYLE_USE_LOCAL_ALPHA;
info -> gx_animation_target -> gx_widget_alpha = info -> gx_animation_start_alpha;
#else
status = GX_INVALID_VALUE;
#endif
}
/* position the target at the starting position */
left = (GX_VALUE)(info -> gx_animation_start_position.gx_point_x -
info -> gx_animation_target -> gx_widget_size.gx_rectangle_left);
top = (GX_VALUE)(info -> gx_animation_start_position.gx_point_y -
info -> gx_animation_target -> gx_widget_size.gx_rectangle_top);
if (left || top)
{
_gx_widget_shift(info -> gx_animation_target,
left, top, GX_TRUE);
}
/* link the target to the animation root window */
_gx_widget_attach(info -> gx_animation_parent, info -> gx_animation_target);
}
/* If we were able to start this animation, link it into the active list */
if (status == GX_SUCCESS)
{
/* save the animation parameters */
animation -> gx_animation_info = *info;
if (info -> gx_animation_start_delay)
{
animation -> gx_animation_timer = info -> gx_animation_start_delay;
}
else
{
animation -> gx_animation_timer = animation -> gx_animation_info.gx_animation_frame_interval;
}
animation -> gx_animation_status = GX_ANIMATION_ACTIVE;
animation -> gx_animation_next = _gx_system_animation_list;
_gx_system_animation_list = animation;
#ifdef GX_THREADX_BINDING
/* if the low-level timer is not active, start it */
tx_timer_info_get(&_gx_system_timer, (CHAR **)TX_NULL, &tx_timer_active,
(ULONG *)TX_NULL, (ULONG *)TX_NULL, (TX_TIMER **)TX_NULL);
if (!tx_timer_active)
{
tx_timer_activate(&_gx_system_timer);
}
#else
GX_TIMER_START;
#endif
}
return(status);
}

View File

@ -0,0 +1,119 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_canvas.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_stop PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function stops an animation sequence. */
/* */
/* */
/* INPUT */
/* */
/* animation Pointer to animation control */
/* block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* tx_timer_deactivate Deactivate a timer */
/* */
/* CALLED BY */
/* */
/* _gx_animation_complete */
/* _gx_animation_update */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_animation_stop(GX_ANIMATION *animation)
{
UINT status = GX_SUCCESS;
GX_ANIMATION *previous;
/* assign IDLE status to this animation structure */
animation -> gx_animation_status = GX_ANIMATION_IDLE;
/* Remove the animation from the active list */
GX_ENTER_CRITICAL
if (_gx_system_animation_list == animation)
{
/* animation is first in active list */
_gx_system_animation_list = _gx_system_animation_list -> gx_animation_next;
/* if there are no other active animations or timers, stop the system timer */
if ((_gx_system_active_timer_list == NULL) && (_gx_system_animation_list == NULL))
{
#ifdef GX_THREADX_BINDING
tx_timer_deactivate(&_gx_system_timer);
#else
GX_TIMER_STOP;
#endif
}
}
else
{
/* the animation is not the first, find the previous and
adjust linked list
*/
previous = _gx_system_animation_list;
while (previous)
{
if (previous -> gx_animation_next == animation)
{
previous -> gx_animation_next = animation -> gx_animation_next;
break;
}
previous = previous -> gx_animation_next;
}
}
GX_EXIT_CRITICAL
return(status);
}

View File

@ -0,0 +1,237 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Animation Management (Animation) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_system.h"
#include "gx_canvas.h"
#include "gx_utility.h"
#include "gx_animation.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_animation_update PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function executes one step on an animation sequence. */
/* */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_canvas_alpha_set Set the alpha of canvas */
/* _gx_animation_complete Called when an animation */
/* sequence is finished */
/* _gx_canvas_offset_set Set the offset of canvas */
/* _gx_widget_shift Shift a widget */
/* _gx_animation_stop Stop an animation */
/* */
/* CALLED BY */
/* */
/* _gx_system_timer_update Update active system timers */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_animation_update(VOID)
{
GX_ANIMATION *animation;
GX_ANIMATION *next;
GX_WIDGET *target;
INT test_step;
INT test_alpha;
INT x_current;
INT y_current;
INT x_trans = 0;
INT y_trans = 0;
GX_ANIMATION_INFO *info;
animation = _gx_system_animation_list;
while (animation)
{
info = &animation -> gx_animation_info;
next = animation -> gx_animation_next;
/* has this animation timer expired ? */
if (animation -> gx_animation_timer > 1)
{
/* no, just decrement timer count and continue */
animation -> gx_animation_timer--;
animation = next;
continue;
}
if (info -> gx_animation_style & GX_ANIMATION_SCREEN_DRAG)
{
animation = next;
continue;
}
/* the animation timer has expired. First reload the
timer counter in case we are not on last step
*/
info -> gx_animation_steps = (GX_UBYTE)(info -> gx_animation_steps - 1);
if (info -> gx_animation_steps <= 0)
{
_gx_animation_complete(animation);
animation = next;
continue;
}
else
{
animation -> gx_animation_timer = info -> gx_animation_frame_interval;
}
target = info -> gx_animation_target;
/* check for a fade style animation */
if (info -> gx_animation_end_alpha !=
info -> gx_animation_start_alpha)
{
if (animation -> gx_animation_canvas)
{
test_alpha = animation -> gx_animation_canvas -> gx_canvas_alpha;
test_step = info -> gx_animation_end_alpha - test_alpha;
test_step /= info -> gx_animation_steps;
test_alpha += test_step;
_gx_canvas_alpha_set(animation -> gx_animation_canvas, (GX_UBYTE)test_alpha);
}
#if defined(GX_BRUSH_ALPHA_SUPPORT)
else
{
test_alpha = target -> gx_widget_alpha;
test_step = info -> gx_animation_end_alpha - test_alpha;
test_step /= info -> gx_animation_steps;
test_alpha += test_step;
target -> gx_widget_alpha = (GX_UBYTE)test_alpha;
if (test_alpha == 0xff)
{
_gx_system_dirty_mark(target);
}
else
{
_gx_system_dirty_partial_add(target -> gx_widget_parent, &target -> gx_widget_size);
}
}
#endif
}
/* check for a slide style animation */
if ((info -> gx_animation_end_position.gx_point_x !=
info -> gx_animation_start_position.gx_point_x) ||
(info -> gx_animation_end_position.gx_point_y !=
info -> gx_animation_start_position.gx_point_y))
{
if (animation -> gx_animation_canvas)
{
x_current = animation -> gx_animation_canvas -> gx_canvas_display_offset_x;
y_current = animation -> gx_animation_canvas -> gx_canvas_display_offset_y;
}
else
{
x_current = target -> gx_widget_size.gx_rectangle_left;
y_current = target -> gx_widget_size.gx_rectangle_top;
}
if (info -> gx_animation_style & GX_ANIMATION_EASING_FUNC_MASK)
{
if (info -> gx_animation_start_position.gx_point_x != info -> gx_animation_end_position.gx_point_x)
{
_gx_utility_easing_function_calculate(info -> gx_animation_style,
info -> gx_animation_start_position.gx_point_x,
info -> gx_animation_end_position.gx_point_x,
animation -> gx_animation_total_steps - info -> gx_animation_steps,
animation -> gx_animation_total_steps, &x_trans);
x_trans -= x_current;
}
else
{
x_trans = 0;
}
if (info -> gx_animation_start_position.gx_point_y != info -> gx_animation_end_position.gx_point_y)
{
_gx_utility_easing_function_calculate(info -> gx_animation_style,
info -> gx_animation_start_position.gx_point_y,
info -> gx_animation_end_position.gx_point_y,
animation -> gx_animation_total_steps - info -> gx_animation_steps,
animation -> gx_animation_total_steps, &y_trans);
y_trans -= y_current;
}
else
{
y_trans = 0;
}
}
else
{
x_trans = info -> gx_animation_end_position.gx_point_x - x_current;
x_trans /= info -> gx_animation_steps;
y_trans = info -> gx_animation_end_position.gx_point_y - y_current;
y_trans /= info -> gx_animation_steps;
}
/* still moving */
if (animation -> gx_animation_canvas)
{
/* adjust canvas offset */
_gx_canvas_offset_set(animation -> gx_animation_canvas,
(GX_VALUE)(x_current + x_trans), (GX_VALUE)(y_current + y_trans));
}
else
{
/* adjust target position */
_gx_widget_shift(target, (GX_VALUE)x_trans, (GX_VALUE)y_trans, GX_TRUE);
}
}
animation = next;
}
}

View File

@ -0,0 +1,110 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Binres Loader Management (Binres Loader) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_binres_loader.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_language_count_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrives language count of specified binary resource. */
/* */
/* INPUT */
/* */
/* root_address Root address of binary */
/* resource data */
/* header Returned Language count */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_language_count_get(GX_UBYTE *root_address, GX_VALUE *put_count)
{
UINT status = GX_SUCCESS;
GX_BINRES_DATA_INFO info;
GX_RESOURCE_HEADER header;
GX_STRING_HEADER string_header;
memset(&info, 0, sizeof(GX_BINRES_DATA_INFO));
info.gx_binres_root_address = root_address;
/* Read Resource header. */
info.gx_binres_read_offset = 0;
_gx_binres_resource_header_load(&info, &header);
/* Skip theme info. */
info.gx_binres_read_offset += header.gx_resource_header_theme_data_size;
if (header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
/* Read string header. */
_gx_binres_string_header_load(&info, &string_header);
if (string_header.gx_string_header_magic_number != GX_MAGIC_NUMBER)
{
status = GX_INVALID_FORMAT;
}
else
{
*put_count = (GX_VALUE)(string_header.gx_string_header_language_count);
}
return status;
}
#endif

View File

@ -0,0 +1,122 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Binres Loader Management (Binres Loader) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_binres_loader.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* gx_binres_language_info_load PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrives language header information. */
/* */
/* INPUT */
/* */
/* root_address Root address of binary */
/* resource data */
/* header Returned Language header */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_language_info_load(GX_UBYTE *root_address, GX_LANGUAGE_HEADER *put_info)
{
UINT status = GX_SUCCESS;
GX_BINRES_DATA_INFO info;
GX_RESOURCE_HEADER header;
GX_STRING_HEADER string_header;
UINT lang_index;
memset(&info, 0, sizeof(GX_BINRES_DATA_INFO));
info.gx_binres_root_address = root_address;
/* Read Resource header. */
info.gx_binres_read_offset = 0;
_gx_binres_resource_header_load(&info, &header);
/* Skip theme info. */
info.gx_binres_read_offset += header.gx_resource_header_theme_data_size;
if (header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
/* Read string header. */
_gx_binres_string_header_load(&info, &string_header);
if (string_header.gx_string_header_magic_number != GX_MAGIC_NUMBER)
{
status = GX_INVALID_FORMAT;
}
else
{
for (lang_index = 0; lang_index < string_header.gx_string_header_language_count; lang_index++)
{
/* Read language header. */
_gx_binres_language_header_load(&info, put_info);
if (put_info -> gx_language_header_magic_number != GX_MAGIC_NUMBER)
{
status = GX_INVALID_FORMAT;
break;
}
info.gx_binres_read_offset += put_info -> gx_language_header_data_size;
put_info++;
}
}
return status;
}
#endif

View File

@ -0,0 +1,638 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Binres Loader Management (Binres Loader) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_binres_loader.h"
#include "gx_system.h"
#include "gx_utility.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_resource_header_load PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function reads resource header from a binary data buffer. */
/* */
/* INPUT */
/* */
/* info Binary read control block */
/* header Returned resource header */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_resource_header_load(GX_BINRES_DATA_INFO *info, GX_RESOURCE_HEADER *header)
{
memcpy((GX_BYTE *)&header -> gx_resource_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_resource_header_version, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_resource_header_theme_count, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_resource_header_language_count, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_resource_header_theme_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(ULONG));
info -> gx_binres_read_offset += sizeof(ULONG);
memcpy((GX_BYTE *)&header -> gx_resource_header_string_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(ULONG));
info -> gx_binres_read_offset += sizeof(ULONG);
memcpy((GX_BYTE *)&header -> gx_resource_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(ULONG));
info -> gx_binres_read_offset += sizeof(ULONG);
return GX_SUCCESS;
}
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_string_header_load PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function reads string header from a binary data buffer. */
/* */
/* INPUT */
/* */
/* info Binary read control block */
/* header Returned string header */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_string_header_load(GX_BINRES_DATA_INFO *info, GX_STRING_HEADER *header)
{
memcpy((GX_BYTE *)&header -> gx_string_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_string_header_language_count, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_string_header_string_count, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_string_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(ULONG));
info -> gx_binres_read_offset += sizeof(ULONG);
return GX_SUCCESS;
}
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_language_header_load PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function reads language header from a binary data buffer. */
/* */
/* INPUT */
/* */
/* info Binary read control block */
/* header Returned language header */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_language_header_load(GX_BINRES_DATA_INFO *info, GX_LANGUAGE_HEADER *header)
{
memcpy((GX_BYTE *)&header -> gx_language_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)&header -> gx_language_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(USHORT));
info -> gx_binres_read_offset += sizeof(USHORT);
memcpy((GX_BYTE *)header -> gx_language_header_name, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(header -> gx_language_header_name));
info -> gx_binres_read_offset += sizeof(header -> gx_language_header_name);
memcpy((GX_BYTE *)&header -> gx_language_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset, sizeof(ULONG));
info -> gx_binres_read_offset += sizeof(ULONG);
return GX_SUCCESS;
}
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_language_table_buffer_allocate PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function allocates needed memory buffer for loading language */
/* table. */
/* */
/* INPUT */
/* */
/* info Binary resource control block */
/* language_table_type_size Size of language table type */
/* string_table_type_size Size of string table type */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* _gx_system_memory_allocator Application defined memory */
/* allocation function */
/* _gx_binres_resource_header_load Read binary resource header */
/* _gx_binres_string_header_load Read string data header */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
static UINT _gx_binres_language_table_buffer_allocate(GX_BINRES_DATA_INFO *info, GX_UBYTE language_table_type_size, GX_UBYTE string_table_type_size)
{
GX_RESOURCE_HEADER res_header;
GX_STRING_HEADER string_header;
USHORT language_count;
USHORT string_count;
UINT language_table_size;
UINT string_table_size;
info -> gx_binres_read_offset = 0;
/* Read resource header. */
_gx_binres_resource_header_load(info, &res_header);
info -> gx_binres_read_offset += res_header.gx_resource_header_theme_data_size;
if (res_header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
_gx_binres_string_header_load(info, &string_header);
if (string_header.gx_string_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
language_count = string_header.gx_string_header_language_count;
string_count = string_header.gx_string_header_string_count;
/* Calcualte memory size needed for string tables. */
string_table_size = (UINT)(string_count * string_table_type_size);
GX_UTILITY_MATH_UINT_MULT(string_table_size, language_count, string_table_size)
/* Calculate memory size needed for language table. */
language_table_size = (UINT)(language_table_type_size * language_count);
/* Calculate memory size needed. */
GX_UTILITY_MATH_UINT_ADD(string_table_size, language_table_size, info -> gx_binres_buffer_size)
info -> gx_binres_buffer = (GX_UBYTE *)_gx_system_memory_allocator(info -> gx_binres_buffer_size);
if (!info -> gx_binres_buffer)
{
return GX_SYSTEM_MEMORY_ERROR;
}
memset(info -> gx_binres_buffer, 0, info -> gx_binres_buffer_size);
info -> gx_binres_buffer_index = 0;
return GX_SUCCESS;
}
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_language_table_load PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION (deprecated) */
/* */
/* This service loads a language table from a binary data buffer. */
/* */
/* INPUT */
/* */
/* root_address Root address of binary */
/* resource data */
/* returned_language_table Pointer to loaded language */
/* table */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* _gx_binres_language_table_buffer_allocate */
/* Allocate needed buffer for */
/* loading language table */
/* _gx_binres_resource_header_load */
/* Read resource header */
/* _gx_binres_string_header_load Read string data header */
/* _gx_binres_language_header_load Read language data header */
/* _gx_system_memory_free Application defined memory */
/* free function */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
#ifdef GX_ENABLE_DEPRECATED_STRING_API
UINT _gx_binres_language_table_load(GX_UBYTE *root_address, GX_UBYTE ****returned_language_table)
{
UINT status;
GX_BINRES_DATA_INFO info;
GX_RESOURCE_HEADER header;
GX_STRING_HEADER string_header;
GX_LANGUAGE_HEADER language_header;
GX_UBYTE ***language_table;
UINT lang_index;
UINT string_index;
USHORT string_length;
GX_CHAR get_char;
memset(&info, 0, sizeof(GX_BINRES_DATA_INFO));
info.gx_binres_root_address = root_address;
/* Allocate memory that needed for language table. */
status = _gx_binres_language_table_buffer_allocate(&info, sizeof(GX_UBYTE * *), sizeof(GX_UBYTE *));
/* Read Resource header. */
info.gx_binres_read_offset = 0;
_gx_binres_resource_header_load(&info, &header);
/* Skip theme info. */
info.gx_binres_read_offset += header.gx_resource_header_theme_data_size;
if (header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
language_table = GX_NULL;
/* Read language table. */
if (status == GX_SUCCESS)
{
/* Read string header. */
_gx_binres_string_header_load(&info, &string_header);
language_table = (GX_UBYTE ***)(info.gx_binres_buffer + info.gx_binres_buffer_index);
info.gx_binres_buffer_index += sizeof(GX_UBYTE * *) * string_header.gx_string_header_language_count;
for (lang_index = 0; lang_index < string_header.gx_string_header_language_count; lang_index++)
{
/* Read language header. */
_gx_binres_language_header_load(&info, &language_header);
if (language_header.gx_language_header_magic_number != GX_MAGIC_NUMBER)
{
status = GX_INVALID_FORMAT;
break;
}
/* Read string table. */
language_table[lang_index] = (GX_UBYTE **)(info.gx_binres_buffer + info.gx_binres_buffer_index);
info.gx_binres_buffer_index += sizeof(GX_UBYTE *) * string_header.gx_string_header_string_count;
if (header.gx_resource_header_version >= GX_BINRES_VERSION_ADD_STRING_LENGTH)
{
for (string_index = 1; string_index < string_header.gx_string_header_string_count; string_index++)
{
/* Read string length. */
memcpy((USHORT *)&string_length, info.gx_binres_root_address + info.gx_binres_read_offset, sizeof(USHORT));
info.gx_binres_read_offset += sizeof(USHORT);
if (string_length == 0)
{
language_table[lang_index][string_index] = GX_NULL;
}
else
{
language_table[lang_index][string_index] = (GX_UBYTE *)(info.gx_binres_root_address + info.gx_binres_read_offset);
info.gx_binres_read_offset += (UINT)(string_length + 1);
}
}
}
else
{
string_index = 1;
string_length = 0;
while (string_index < string_header.gx_string_header_string_count)
{
string_length++;
memcpy((GX_BYTE *)&get_char, info.gx_binres_root_address + info.gx_binres_read_offset, 1);
info.gx_binres_read_offset++;
if (get_char == '\0')
{
if (string_length == 1)
{
language_table[lang_index][string_index] = GX_NULL;
}
else
{
language_table[lang_index][string_index] = (GX_UBYTE *)(info.gx_binres_root_address + info.gx_binres_read_offset - string_length);
}
string_length = 0;
string_index++;
}
}
}
}
}
if (status == GX_SUCCESS)
{
*returned_language_table = language_table;
}
else
{
/* Free allocated memory when language loading failed. */
if (info.gx_binres_buffer)
{
_gx_system_memory_free(info.gx_binres_buffer);
}
*returned_language_table = GX_NULL;
}
return status;
}
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_binres_language_table_load_ext PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service loads a language table from a binary data buffer. */
/* */
/* INPUT */
/* */
/* root_address Root address of binary */
/* resource data */
/* returned_language_table Pointer to loaded language */
/* table */
/* */
/* OUTPUT */
/* */
/* Status Completion status */
/* */
/* CALLS */
/* */
/* _gx_binres_language_table_buffer_allocate */
/* Allocate needed buffer for */
/* loading language table */
/* _gx_binres_resource_header_load */
/* Read resource header */
/* _gx_binres_string_header_load Read string data header */
/* _gx_binres_language_header_load Read language data header */
/* _gx_system_memory_free Application defined memory */
/* free function */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#ifdef GX_BINARY_RESOURCE_SUPPORT
UINT _gx_binres_language_table_load_ext(GX_UBYTE *root_address, GX_STRING ***returned_language_table)
{
UINT status;
GX_BINRES_DATA_INFO info;
GX_RESOURCE_HEADER header;
GX_STRING_HEADER string_header;
GX_LANGUAGE_HEADER language_header;
GX_STRING **language_table;
UINT lang_index;
UINT string_index;
USHORT string_length;
GX_UBYTE *get_data;
memset(&info, 0, sizeof(GX_BINRES_DATA_INFO));
info.gx_binres_root_address = root_address;
/* Allocate memory that needed for language table. */
status = _gx_binres_language_table_buffer_allocate(&info, sizeof(GX_STRING *), sizeof(GX_STRING));
/* Read Resource header. */
info.gx_binres_read_offset = 0;
_gx_binres_resource_header_load(&info, &header);
/* Skip theme info. */
info.gx_binres_read_offset += header.gx_resource_header_theme_data_size;
if (header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
{
return GX_INVALID_FORMAT;
}
language_table = GX_NULL;
/* Read language table. */
if (status == GX_SUCCESS)
{
/* Read string header. */
_gx_binres_string_header_load(&info, &string_header);
language_table = (GX_STRING **)(info.gx_binres_buffer + info.gx_binres_buffer_index);
info.gx_binres_buffer_index += sizeof(GX_STRING *) * string_header.gx_string_header_language_count;
for (lang_index = 0; lang_index < string_header.gx_string_header_language_count; lang_index++)
{
/* Read language header. */
_gx_binres_language_header_load(&info, &language_header);
if (language_header.gx_language_header_magic_number != GX_MAGIC_NUMBER)
{
status = GX_INVALID_FORMAT;
break;
}
/* Read string table. */
language_table[lang_index] = (GX_STRING *)(info.gx_binres_buffer + info.gx_binres_buffer_index);
info.gx_binres_buffer_index += sizeof(GX_STRING) * string_header.gx_string_header_string_count;
for (string_index = 1; string_index < string_header.gx_string_header_string_count; string_index++)
{
/* Read string length. */
get_data = info.gx_binres_root_address + info.gx_binres_read_offset;
string_length = *(get_data + 1);
string_length = (USHORT)(string_length << 8);
string_length = (USHORT)(string_length | (*get_data));
info.gx_binres_read_offset += sizeof(USHORT);
if (string_length)
{
language_table[lang_index][string_index].gx_string_ptr = (GX_CHAR *)(info.gx_binres_root_address + info.gx_binres_read_offset);
}
else
{
language_table[lang_index][string_index].gx_string_ptr = GX_NULL;
}
language_table[lang_index][string_index].gx_string_length = string_length;
info.gx_binres_read_offset += (UINT)(string_length + 1);
}
}
}
if (status == GX_SUCCESS)
{
*returned_language_table = language_table;
}
else
{
/* Free allocated memory when language loading failed. */
if (info.gx_binres_buffer)
{
_gx_system_memory_free(info.gx_binres_buffer);
}
*returned_language_table = GX_NULL;
}
return status;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Utility (Utility) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_context.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_brush_default PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function defines the brush type. */
/* */
/* INPUT */
/* */
/* brush Pointer to brush */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _gx_context_brush_default */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_brush_default(GX_BRUSH *brush)
{
/* Define brush. */
brush -> gx_brush_pixelmap = GX_NULL;
brush -> gx_brush_fill_color = 0;
brush -> gx_brush_font = GX_NULL;
brush -> gx_brush_line_color = 0;
brush -> gx_brush_line_pattern = 0;
brush -> gx_brush_pattern_mask = 0;
brush -> gx_brush_style = 0;
brush -> gx_brush_width = 1;
brush -> gx_brush_alpha = 0xff;
return(GX_SUCCESS);
}

View File

@ -0,0 +1,84 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Utility (Utility) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_context.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_brush_define PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service defines a brush with the specified line color, fill */
/* color and style. */
/* */
/* INPUT */
/* */
/* brush Pointer to brush */
/* line_color Color of brush line */
/* fill_color Color of brush fill */
/* style Brush style */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_context_brush_define Define the brush for context */
/* _gx_context_raw_brush_define Define the brush for context */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_brush_define(GX_BRUSH *brush, GX_COLOR line_color, GX_COLOR fill_color, UINT style)
{
/* Define brush. */
brush -> gx_brush_fill_color = fill_color;
brush -> gx_brush_line_color = line_color;
brush -> gx_brush_style = style;
brush -> gx_brush_line_pattern = 0;
return(GX_SUCCESS);
}

View File

@ -0,0 +1,111 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_button.h"
#include "gx_system.h"
#include "gx_widget.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_background_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function draws the specified button, which is a special type */
/* of widget. */
/* */
/* INPUT */
/* */
/* button Button control block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_widget_border_style_set Set the border style */
/* _gx_widget_border_draw Draw the border */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_button_draw */
/* _gx_icon_button_draw */
/* _gx_text_button_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_button_background_draw(GX_BUTTON *button)
{
GX_RESOURCE_ID fill1;
GX_RESOURCE_ID fill2;
GX_WIDGET *widget = (GX_WIDGET *)button;
/* Draw button background. */
if (button -> gx_widget_style & GX_STYLE_ENABLED)
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_PUSHED)
{
if ((button -> gx_widget_style & GX_STYLE_BORDER_MASK) == GX_STYLE_BORDER_RAISED)
{
_gx_widget_border_style_set(widget, GX_STYLE_BORDER_RECESSED);
}
fill1 = widget -> gx_widget_normal_fill_color;
fill2 = widget -> gx_widget_selected_fill_color;
}
else
{
if ((button -> gx_widget_style & GX_STYLE_BORDER_MASK) == GX_STYLE_BORDER_RECESSED)
{
_gx_widget_border_style_set(widget, GX_STYLE_BORDER_RAISED);
}
fill1 = widget -> gx_widget_selected_fill_color;
fill2 = widget -> gx_widget_normal_fill_color;
}
}
else
{
fill1 = widget -> gx_widget_disabled_fill_color;
fill2 = widget -> gx_widget_disabled_fill_color;
}
_gx_widget_border_draw(widget, GX_COLOR_ID_BUTTON_BORDER, fill1, fill2, GX_TRUE);
}

View File

@ -0,0 +1,118 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_button.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a vector button, which is a special type of */
/* prompt (widget). */
/* */
/* INPUT */
/* */
/* button Pointer to button control */
/* block */
/* name Logical name of button */
/* parent Pointer to parent widget */
/* of button */
/* style Button stuyle */
/* button_id Application-defined ID of */
/* the button */
/* size Size of the button */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_create Create the underlying prompt */
/* _gx_widget_status_add Set the widget status */
/* _gx_widget_link Link the widget to its parent */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_horizontal_scrollbar_create */
/* _gx_icon_button_create */
/* _gx_pixelmap_button_create */
/* _gx_scroll_thumb_create */
/* _gx_text_button_create */
/* _gx_vertical_scrollbar_create */
/* _gx_scroll_thumb_create */
/* _gx_text_button_create */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
ULONG style, USHORT button_id, GX_CONST GX_RECTANGLE *size)
{
/* Call the widget create function. */
_gx_widget_create((GX_WIDGET *)button, name, GX_NULL, style, button_id, size);
/* Check for completion status on the prompt create. */
/* Yes, the prompt widget was created successfully. Populate the rest of
button control block - overriding as necessary. */
button -> gx_widget_type = GX_TYPE_BUTTON;
_gx_widget_status_add((GX_WIDGET *)button, GX_STATUS_BUTTON_DERIVED);
button -> gx_button_select_handler = (VOID (*)(GX_WIDGET *))_gx_button_select;
button -> gx_button_deselect_handler = (VOID (*)(GX_WIDGET *, GX_BOOL))_gx_button_deselect;
button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_button_draw;
button -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_button_event_process;
button -> gx_widget_normal_fill_color = GX_COLOR_ID_BUTTON_LOWER;
button -> gx_widget_selected_fill_color = GX_COLOR_ID_BUTTON_UPPER;
/* Determine if a parent widget was provided. */
if (parent)
{
_gx_widget_link(parent, (GX_WIDGET *)button);
}
/* Return the completion status code */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,134 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_button.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_deselect PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service deselects the specified button. */
/* */
/* INPUT */
/* */
/* button Pointer to button control */
/* block */
/* generate_event If GX_TRUE, the button will */
/* generate an event depending */
/* on the button style. */
/* If GX_FALSE, the button will */
/* not generate any higher */
/* level event. */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_system_timer_stop Stop an active GUIX timer */
/* _gx_widget_event_generate Generate event to notify */
/* parent widget */
/* _gx_system_dirty_mark Sets the dirty flag */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_button_deselect(GX_BUTTON *button, GX_BOOL generate_event)
{
GX_WIDGET *widget = (GX_WIDGET *)button;
if (button -> gx_widget_style & GX_STYLE_BUTTON_PUSHED)
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_TOGGLE)
{
if (!(button -> gx_widget_status & GX_STATUS_TOGGLE_UNLOCK))
{
return GX_SUCCESS;
}
button -> gx_widget_status &= ~GX_STATUS_TOGGLE_UNLOCK;
}
if (button -> gx_widget_style & GX_STYLE_BUTTON_REPEAT)
{
_gx_system_timer_stop(widget, GX_BUTTON_TIMER);
}
/* Remove style for pen down. */
button -> gx_widget_style &= ~GX_STYLE_BUTTON_PUSHED;
if (generate_event)
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_RADIO)
{
_gx_widget_event_generate(widget, GX_EVENT_RADIO_DESELECT, 0);
}
else
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_TOGGLE)
{
_gx_widget_event_generate(widget, GX_EVENT_TOGGLE_OFF, 0);
}
else
{
if (!(button -> gx_widget_style & GX_STYLE_BUTTON_EVENT_ON_PUSH))
{
_gx_widget_event_generate(widget, GX_EVENT_CLICKED, 0);
}
}
}
}
}
if (button -> gx_widget_status & GX_STATUS_VISIBLE)
{
/* Mark as dirty. */
_gx_system_dirty_mark(widget);
}
return(GX_SUCCESS);
}

View File

@ -0,0 +1,87 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_display.h"
#include "gx_context.h"
#include "gx_widget.h"
#include "gx_button.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function draws the specified button, which is a special type */
/* of widget. */
/* */
/* INPUT */
/* */
/* button Pointer to the button */
/* control block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_button_background_draw Draw button background */
/* _gx_widget_children_draw Draw children widgets */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_button_draw(GX_BUTTON *button)
{
GX_WIDGET *widget;
widget = (GX_WIDGET *)button;
_gx_button_background_draw(button);
/* Draw button's children. */
_gx_widget_children_draw(widget);
}

View File

@ -0,0 +1,173 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_widget.h"
#include "gx_button.h"
#include "gx_utility.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_event_process PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function processes events for the specified button. */
/* */
/* INPUT */
/* */
/* button Pointer to button control */
/* block */
/* event_ptr Incoming event to process */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* [_gx_button_select_handler] Button select callback */
/* _gx_system_input_capture Assign system input widget */
/* _gx_system_input_release Release system input widget */
/* [_gx_button_deselect_handler] Widget-provided deselect */
/* handler routine */
/* _gx_widget_event_generate Generate event to notify */
/* parent widget */
/* _gx_system_timer_stop Stop an active GUIX timer */
/* _gx_widget_event_process Default widget event process */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_button_event_process(GX_BUTTON *button, GX_EVENT *event_ptr)
{
UINT status;
GX_WIDGET *widget = (GX_WIDGET *)button;
GX_BOOL generate_event = GX_FALSE;
/* Default status to success. */
status = GX_SUCCESS;
/* Process relative to the type of event. */
switch (event_ptr -> gx_event_type)
{
case GX_EVENT_PEN_DOWN:
case GX_EVENT_SELECT:
if (widget -> gx_widget_style & GX_STYLE_ENABLED)
{
button -> gx_button_select_handler(widget);
_gx_system_input_capture(widget);
}
if (event_ptr -> gx_event_type == GX_EVENT_PEN_DOWN)
{
/* Delivery event to parent here, _gx_widget_event_process handle GX_EVENT_PEN_DOWN to
produce a GX_EVENT_CLICK event, if call _gx_widget_event_process here, 2 GX_EVENT_CLICK events will
be sent.*/
status = _gx_widget_event_to_parent(widget, event_ptr);
}
break;
case GX_EVENT_PEN_UP:
if (widget -> gx_widget_status & GX_STATUS_OWNS_INPUT)
{
_gx_system_input_release(widget);
if (widget -> gx_widget_style & GX_STYLE_BUTTON_PUSHED)
{
if (_gx_utility_rectangle_point_detect(&widget -> gx_widget_size, event_ptr -> gx_event_payload.gx_event_pointdata))
{
generate_event = GX_TRUE;
}
if (!(widget -> gx_widget_style & GX_STYLE_BUTTON_RADIO))
{
button -> gx_button_deselect_handler(widget, generate_event);
}
}
}
status = _gx_widget_event_to_parent(widget, event_ptr);
break;
case GX_EVENT_DESELECT:
case GX_EVENT_INPUT_RELEASE:
if (widget -> gx_widget_status & GX_STATUS_OWNS_INPUT)
{
_gx_system_input_release(widget);
if (widget -> gx_widget_style & GX_STYLE_BUTTON_PUSHED)
{
if (event_ptr -> gx_event_type == GX_EVENT_DESELECT)
{
generate_event = GX_TRUE;
}
if (!(widget -> gx_widget_style & GX_STYLE_BUTTON_RADIO))
{
button -> gx_button_deselect_handler(widget, generate_event);
}
}
}
break;
case GX_EVENT_TIMER:
if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_BUTTON_TIMER)
{
if (widget -> gx_widget_style & GX_STYLE_BUTTON_REPEAT)
{
_gx_widget_event_generate(widget, GX_EVENT_CLICKED, widget -> gx_widget_id);
}
else
{
_gx_system_timer_stop(widget, GX_BUTTON_TIMER);
}
}
break;
default:
/* Call the widget default processing. */
status = _gx_widget_event_process(widget, event_ptr);
}
/* Return completion status. */
return(status);
}

View File

@ -0,0 +1,128 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_button.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_select PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function selects one button, invalidating and eventing as */
/* necessary. */
/* */
/* INPUT */
/* */
/* button Button control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_widget_front_move Move widget to the front */
/* _gx_button_siblings_deselect Deselect all the siblings */
/* _gx_widget_event_generate Generate events for widget */
/* _gx_system_timer_start Allocate a free timer and */
/* activates it */
/* _gx_system_dirty_mark Mark the widget dirty */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_button_select(GX_BUTTON *button)
{
GX_WIDGET *widget = (GX_WIDGET *)button;
if (button -> gx_widget_style & GX_STYLE_ENABLED)
{
if (!(button -> gx_widget_style & GX_STYLE_BUTTON_PUSHED))
{
/* Set style for pen down. */
button -> gx_widget_style |= GX_STYLE_BUTTON_PUSHED;
if (widget -> gx_widget_status & GX_STATUS_ACCEPTS_FOCUS)
{
_gx_widget_front_move(widget, NULL);
}
if (button -> gx_widget_style & GX_STYLE_BUTTON_RADIO)
{
_gx_button_siblings_deselect(button);
_gx_widget_event_generate(widget, GX_EVENT_RADIO_SELECT, 0);
}
if (button -> gx_widget_style & GX_STYLE_BUTTON_EVENT_ON_PUSH)
{
_gx_widget_event_generate(widget, GX_EVENT_CLICKED, 0);
}
else
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_TOGGLE)
{
_gx_widget_event_generate(widget, GX_EVENT_TOGGLE_ON, 0);
}
}
if (button -> gx_widget_style & GX_STYLE_BUTTON_REPEAT)
{
_gx_system_timer_start(widget, GX_BUTTON_TIMER, GX_REPEAT_BUTTON_INITIAL_TICS, GX_REPEAT_BUTTON_REPEAT_TICS);
}
/* Mark as dirty. */
_gx_system_dirty_mark(widget);
}
else
{
if (button -> gx_widget_style & GX_STYLE_BUTTON_TOGGLE)
{
button -> gx_widget_status |= GX_STATUS_TOGGLE_UNLOCK;
}
}
}
return(GX_SUCCESS);
}

View File

@ -0,0 +1,103 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Button Management (Button) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_widget.h"
#include "gx_button.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_button_siblings_deselect PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function deselects all sibling buttons of the caller that */
/* have GX_STYLE_BUTTON_RADIO style. */
/* */
/* INPUT */
/* */
/* button Button control block */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* [gx_button_deselect_handler] Widget-provided deselect */
/* handler routine */
/* */
/* CALLED BY */
/* */
/* _gx_button_select */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_button_siblings_deselect(GX_BUTTON *button)
{
GX_WIDGET *parent;
GX_WIDGET *test;
GX_WIDGET *widget;
GX_BUTTON *sibling;
widget = (GX_WIDGET *)button;
parent = widget -> gx_widget_parent;
test = parent -> gx_widget_first_child;
while (test)
{
/* not the incoming widget? */
if (test != widget)
{
/* is this widget a button? */
if (test -> gx_widget_status & GX_STATUS_BUTTON_DERIVED)
{
sibling = (GX_BUTTON *)test;
/* is this a pushed radio button? */
if ((test -> gx_widget_style & (GX_STYLE_BUTTON_RADIO | GX_STYLE_BUTTON_PUSHED)) ==
(GX_STYLE_BUTTON_RADIO | GX_STYLE_BUTTON_PUSHED))
{
sibling -> gx_button_deselect_handler(test, GX_TRUE);
}
}
}
test = test -> gx_widget_next;
}
}

View File

@ -0,0 +1,96 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_alpha_set PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function assigns the alpha-blend value of a canvas */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* alpha alpha value */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_canvas_dirty_mark Set the canvas dirty flag */
/* */
/* CALLED BY */
/* */
/* _gx_animation_start */
/* _gx_animation_update */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_alpha_set(GX_CANVAS *canvas, GX_UBYTE alpha)
{
VOID (*alpha_set)(INT layer, GX_UBYTE alpha);
/* change the alpha value */
canvas -> gx_canvas_alpha = alpha;
if (canvas -> gx_canvas_hardware_layer >= 0)
{
alpha_set = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_alpha_set;
if (alpha_set)
{
alpha_set(canvas -> gx_canvas_hardware_layer, alpha);
return(GX_SUCCESS);
}
}
/* mark the canvas dirty so that it get refreshed */
_gx_canvas_dirty_mark(canvas, GX_NULL);
/* Return successful status. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,209 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Display Management (Display) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_arc_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This draws a circle arc into the currrent context. */
/* */
/* INPUT */
/* */
/* xcenter x-coord of center of circle */
/* arc */
/* ycenter y-coord of center of circle */
/* arc */
/* r Radius of circle arc */
/* start_angle The start angle of circle arc */
/* end_angle The end angle of circle arc */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define */
/* _gx_utility_rectangle_overlap_detect */
/* _gx_display_driver_arc_draw */
/* _gx_display_driver_anti_aliased_arc_draw */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_ARC_DRAWING_SUPPORT)
UINT _gx_canvas_arc_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE bound;
GX_RECTANGLE clip_rect;
GX_VIEW *view;
GX_BRUSH *brush;
UINT brush_width;
VOID (*outline_function)(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
while (start_angle < 0)
{
start_angle += 360;
}
while (end_angle < 0)
{
end_angle += 360;
}
if (start_angle >= 360)
{
start_angle %= 360;
}
if (end_angle >= 360)
{
end_angle %= 360;
}
if (end_angle <= start_angle)
{
end_angle += 360;
}
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
brush = &context -> gx_draw_context_brush;
brush_width = (UINT)((brush -> gx_brush_width + 1) >> 1);
_gx_utility_rectangle_define(&bound, (GX_VALUE)((UINT)xcenter - r - brush_width), (GX_VALUE)((UINT)ycenter - r - brush_width),
(GX_VALUE)((UINT)xcenter + r + brush_width), (GX_VALUE)((UINT)ycenter + r + brush_width));
brush_width = (UINT)brush -> gx_brush_width;
/* clip the arc bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* Default to no outline */
outline_function = GX_NULL;
/* Determine which outline function to use.*/
if (brush_width == 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_arc_draw != GX_NULL)
{
outline_function = display -> gx_display_driver_anti_aliased_arc_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_arc_draw;
}
}
else
{
if (brush_width > 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_wide_arc_draw)
{
outline_function = display -> gx_display_driver_anti_aliased_wide_arc_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_wide_arc_draw;
}
}
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the arc, do it */
context -> gx_draw_context_clip = &clip_rect;
if (brush -> gx_brush_style & (GX_BRUSH_SOLID_FILL | GX_BRUSH_PIXELMAP_FILL))
{
display -> gx_display_driver_arc_fill(context, xcenter, ycenter, r, start_angle, end_angle);
}
if (outline_function)
{
outline_function(context, xcenter, ycenter, r, start_angle, end_angle);
}
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}
#endif

View File

@ -0,0 +1,162 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
#include "gx_display.h"
#include "gx_window.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_block_move.c PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function copies a block of pixel from one reference position */
/* to another. */
/* */
/* INPUT */
/* */
/* block Rectangle to move */
/* x_shift Distance to move in x */
/* direction */
/* y_shift Distance to move in y */
/* direction */
/* dirty Flag of dirty block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_inside_detect Detect if a second rectangle */
/* is completely within the */
/* first one */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_window_client_scroll */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_block_move(GX_RECTANGLE *block, GX_VALUE x_shift, GX_VALUE y_shift, GX_RECTANGLE *dirty)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_VIEW *view;
UINT status = GX_FAILURE;
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
/* If the caller hasn't opened the canvas, we can't do anything */
if (!context)
{
return status;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* check to see if this driver supports block move */
if (!display -> gx_display_driver_block_move)
{
/* this driver doesn't support block move. If we are
partial drawing just mark the caller as dirty so that
a normal redraw operation occurs.
*/
return status;
}
/* test to determine if any viewport of the caller contains the block to move.
If yes, we can do the block move. If no, we have to
do a normal invalidation and redraw.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (_gx_utility_rectangle_inside_detect(&view -> gx_view_rectangle, block))
{
context -> gx_draw_context_clip = block;
display -> gx_display_driver_block_move(context, block, x_shift, y_shift);
status = GX_SUCCESS;
break;
}
view = view -> gx_view_next;
}
if (status == GX_SUCCESS && dirty)
{
/* we were able to aid drawing by doing a block move. Mark
the remainder that was not updated as dirty so that the
caller can redraw that portion
*/
*dirty = *block;
if (x_shift)
{
if (x_shift > 0)
{
dirty -> gx_rectangle_right = (GX_VALUE)(dirty -> gx_rectangle_left + x_shift - 1);
}
else
{
dirty -> gx_rectangle_left = (GX_VALUE)(dirty -> gx_rectangle_right + x_shift + 1);
}
}
else
{
if (y_shift > 0)
{
dirty -> gx_rectangle_bottom = (GX_VALUE)(dirty -> gx_rectangle_top + y_shift - 1);
}
else
{
dirty -> gx_rectangle_top = (GX_VALUE)(dirty -> gx_rectangle_bottom + y_shift + 1);
}
}
}
return(status);
}

View File

@ -0,0 +1,179 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Display Management (Display) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_circle_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This draws a circle into the currrent context. */
/* */
/* INPUT */
/* */
/* xcenter x-coord of center of circle */
/* ycenter y-coord of center of circle */
/* r Radius of circle */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define Define a rectangle */
/* _gx_utility_rectangle_overlap_detect Detects two rectangles being */
/* overlap */
/* [gx_display_driver_arc_draw] Display driver basic */
/* arc drawing routine */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_ARC_DRAWING_SUPPORT)
UINT _gx_canvas_circle_draw(INT xcenter, INT ycenter, UINT r)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE bound;
GX_RECTANGLE clip_rect;
GX_VIEW *view;
GX_BRUSH *brush;
INT brush_width;
VOID (*outline_function)(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
brush = &context -> gx_draw_context_brush;
brush_width = (brush -> gx_brush_width + 1) >> 1;
_gx_utility_rectangle_define(&bound, (GX_VALUE)(xcenter - (INT)r - brush_width), (GX_VALUE)(ycenter - (INT)r - brush_width),
(GX_VALUE)(xcenter + (INT)r + brush_width), (GX_VALUE)(ycenter + (INT)r + brush_width));
brush_width = brush -> gx_brush_width;
/* clip the circle bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* configure outline function to utilize */
outline_function = GX_NULL;
/*Set normal outline draw function.*/
if (brush_width == 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_circle_draw != GX_NULL)
{
outline_function = display -> gx_display_driver_anti_aliased_circle_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_circle_draw;
}
}
else
{
if (brush_width > 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_wide_circle_draw != GX_NULL )
{
outline_function = display -> gx_display_driver_anti_aliased_wide_circle_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_wide_circle_draw;
}
}
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the line, do it */
context -> gx_draw_context_clip = &clip_rect;
if (brush -> gx_brush_style & (GX_BRUSH_SOLID_FILL | GX_BRUSH_PIXELMAP_FILL))
{
display -> gx_display_driver_circle_fill(context, xcenter, ycenter, r);
}
if (outline_function)
{
outline_function(context, xcenter, ycenter, r);
}
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}
#endif

View File

@ -0,0 +1,215 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_composite_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function checks to see if we have a composite canvas created, */
/* and if we have an overlay canvas visible. If both are true, the */
/* function invokes display driver functions to build the composite */
/* canvas and returns a pointer to the resulting composite. */
/* */
/* INPUT */
/* */
/* return_composite Return pointer */
/* */
/* OUTPUT */
/* */
/* TRUE/FALSE composite created */
/* */
/* CALLS */
/* */
/* [gx_display_driver_canvas_copy] copy canvas */
/* [gx_display_driver_canvas_blend] blend canvas */
/* gx_utility_rectangle_shift move a rectangle */
/* gx_utility_rectangle_combine combine (add) two rectangles */
/* */
/* CALLED BY */
/* */
/* _gx_system_canvas_refresh */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
GX_BOOL _gx_canvas_composite_create(GX_CANVAS **return_composite)
{
GX_CANVAS *composite = GX_NULL;
GX_CANVAS *canvas;
GX_CANVAS *last = GX_NULL;
INT canvas_count = 0;
INT dirty_canvas_count = 0;
GX_RECTANGLE invalid_sum;
GX_RECTANGLE dirty;
/* pick up start of canvas list */
canvas = _gx_system_canvas_created_list;
/* initialize the invalid_sum to a NULL rectangle */
invalid_sum.gx_rectangle_left = GX_VALUE_MAX;
invalid_sum.gx_rectangle_right = -1;
invalid_sum.gx_rectangle_top = GX_VALUE_MAX;
invalid_sum.gx_rectangle_bottom = -1;
/* look for a composite canvas and multiple visible managed cavases.
Sum the the invalid areas along the way */
while (canvas)
{
/* is this canvas the composite? */
if (canvas -> gx_canvas_status & GX_CANVAS_COMPOSITE)
{
/* yes, we found the canvas on which to build composite */
composite = canvas;
}
else
{
/* is this a visible managed canvas? */
if ((canvas -> gx_canvas_status & GX_CANVAS_MANAGED_VISIBLE) == GX_CANVAS_MANAGED_VISIBLE)
{
/* yes, add this canvas invalid area to our sum */
if (canvas -> gx_canvas_draw_count > 0)
{
dirty = canvas -> gx_canvas_dirty_area;
_gx_utility_rectangle_shift(&dirty, canvas -> gx_canvas_display_offset_x,
canvas -> gx_canvas_display_offset_y);
_gx_utility_rectangle_combine(&invalid_sum, &dirty);
dirty_canvas_count++;
}
/* increment number of visible canvases */
canvas_count++;
}
}
/* keep pointer to last canvas */
last = canvas;
/* move to the next */
canvas = canvas -> gx_canvas_created_next;
}
/* if we have found both a comosite canvas a multiple visible managed canvases,
then build the composite */
if (composite && canvas_count > 1)
{
if (dirty_canvas_count == 0)
{
/* nothing has changed, just return */
*return_composite = composite;
composite -> gx_canvas_draw_count = 0;
return GX_TRUE;
}
/* make sure the invalid left is not off the screen */
if (invalid_sum.gx_rectangle_left < 0)
{
invalid_sum.gx_rectangle_left = 0;
}
/* make sure the invalid top is not off the screen */
if (invalid_sum.gx_rectangle_top < 0)
{
invalid_sum.gx_rectangle_top = 0;
}
/* make sure the invalid right is not off the screen */
if (invalid_sum.gx_rectangle_right >= composite -> gx_canvas_x_resolution)
{
invalid_sum.gx_rectangle_right = (GX_VALUE)(composite -> gx_canvas_x_resolution - 1);
}
/* make sure the invalid bottom is not off the screen */
if (invalid_sum.gx_rectangle_bottom >= composite -> gx_canvas_y_resolution)
{
invalid_sum.gx_rectangle_bottom = (GX_VALUE)(composite -> gx_canvas_y_resolution - 1);
}
/* save the invalid_sum into composite dirty rectangle */
composite -> gx_canvas_dirty_area = invalid_sum;
/* start at the last (lowest) canvas */
canvas = last;
canvas_count = 0;
/* copy canvases into composite, moving back to front */
while (canvas)
{
/* is this a visible, managed, overlay canvas? */
if ((canvas -> gx_canvas_status & GX_CANVAS_MANAGED_VISIBLE) == GX_CANVAS_MANAGED_VISIBLE &&
((canvas -> gx_canvas_status & GX_CANVAS_COMPOSITE) == 0))
{
/* if this canvas is first to draw into composite, or if this canvas
is not blended, copy it into the composite
*/
if (canvas_count == 0 || canvas -> gx_canvas_alpha == GX_ALPHA_VALUE_OPAQUE)
{
/* copy the canvas data */
canvas -> gx_canvas_display -> gx_display_driver_canvas_copy(canvas, composite);
}
else
{
/* here if the canvas is not first and not opaque. Blend it into
composite unless it is fully transparent
*/
if ((canvas->gx_canvas_alpha != 0) && (canvas->gx_canvas_display -> gx_display_driver_canvas_blend))
{
/* blend the canvas data */
canvas -> gx_canvas_display -> gx_display_driver_canvas_blend(canvas, composite);
}
}
canvas_count++;
}
canvas -> gx_canvas_dirty_count = 0;
canvas -> gx_canvas_draw_count = 0;
canvas = canvas -> gx_canvas_created_previous;
}
/* return pointer to composite */
*return_composite = composite;
composite -> gx_canvas_draw_count = (UINT)dirty_canvas_count;
return GX_TRUE;
}
*return_composite = GX_NULL;
return GX_FALSE;
}

View File

@ -0,0 +1,185 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a canvas associated with the specified */
/* display. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* name Name of canvas */
/* display Display control block */
/* type Type of canvas */
/* width Width of canvas */
/* height Height of canvas */
/* memory_area Memory area of canvas with */
/* each pixel of GX_COLOR */
/* memory_size Size of canvas memory area */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* memset Set control block and canvas */
/* memory to zero */
/* _gx_utility_rectangle_define Define a rectangle */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_animation_canvas_define */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *display,
UINT type, UINT width, UINT height, GX_COLOR *memory_area, ULONG memory_size)
{
/* Clear the canvas control block. */
memset(canvas, 0, sizeof(GX_CANVAS));
/* Setup the canvas. */
canvas -> gx_canvas_display = display;
canvas -> gx_canvas_memory = memory_area;
canvas -> gx_canvas_memory_size = memory_size;
canvas -> gx_canvas_alpha = GX_ALPHA_VALUE_OPAQUE;
canvas -> gx_canvas_display_offset_x = 0;
canvas -> gx_canvas_display_offset_y = 0;
canvas -> gx_canvas_draw_count = 0;
canvas -> gx_canvas_draw_nesting = 0;
canvas -> gx_canvas_dirty_count = 0;
canvas -> gx_canvas_status = type;
canvas -> gx_canvas_x_resolution = (GX_VALUE) width;
canvas -> gx_canvas_y_resolution = (GX_VALUE) height;
canvas -> gx_canvas_hardware_layer = (GX_BYTE) -1;
/* Determine if there is a memory area. */
if (memory_area)
{
/* Yes, clear it! */
memset(memory_area, 0, memory_size);
}
/* Setup the dirty area. */
_gx_utility_rectangle_define(&canvas -> gx_canvas_dirty_area, 0, 0, -1, -1);
/* Now link the canvas control block on the list of created canvases. */
/* Load the canvas ID field in the canvas control block. */
canvas -> gx_canvas_id = GX_CANVAS_ID;
/* Save the canvas name. */
canvas -> gx_canvas_name = name;
/* If running on Win32, create padded memory, only if needed */
#ifdef GX_TARGET_WIN32
_win32_compatible_canvas_memory_allocate(canvas);
#endif
/* initialize previous and next pointers */
canvas -> gx_canvas_created_previous = GX_NULL;
canvas -> gx_canvas_created_next = GX_NULL;
/* lock access to gx_system */
GX_ENTER_CRITICAL
/* Place the canvas on the list of created canvass. First,
check for an empty list. */
_gx_system_canvas_created_count++;
if (_gx_system_canvas_created_count > 1)
{
/* Place the new canvas in the list. */
_gx_system_canvas_created_list -> gx_canvas_created_previous = canvas;
canvas -> gx_canvas_created_next = _gx_system_canvas_created_list;
}
/* point start of list at this new canvas */
_gx_system_canvas_created_list = canvas;
/* unlock gx_system. */
GX_EXIT_CRITICAL
/* Return successful status. */
return(GX_SUCCESS);
}
#ifdef GX_TARGET_WIN32
VOID _win32_compatible_canvas_memory_allocate(GX_CANVAS *canvas)
{
INT padded_width;
USHORT row_byte_width;
INT color_format = GX_COLOR_FORMAT_565RGB;
GX_DISPLAY *display = canvas -> gx_canvas_display;
padded_width = canvas->gx_canvas_x_resolution;
if (display == GX_NULL)
{
return;
}
row_byte_width = display ->gx_display_driver_row_pitch_get(padded_width);
while(row_byte_width % 4)
{
padded_width++;
row_byte_width = display ->gx_display_driver_row_pitch_get(padded_width);
}
if (padded_width != canvas -> gx_canvas_x_resolution)
{
/* We are forced to create a padded buffer to hold Win32 compatible canvas memory */
canvas -> gx_canvas_padded_memory = (GX_COLOR *) malloc(row_byte_width * canvas ->gx_canvas_y_resolution);
}
}
#endif

View File

@ -0,0 +1,116 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_delete PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function deletes a canvas. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* memset Set control block and canvas */
/* memory to zero */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_delete(GX_CANVAS *canvas)
{
/* lock access to gx_system */
GX_ENTER_CRITICAL
if (_gx_system_canvas_created_count > 0)
{
if (canvas -> gx_canvas_created_previous)
{
canvas -> gx_canvas_created_previous -> gx_canvas_created_next = canvas -> gx_canvas_created_next;
if (canvas -> gx_canvas_created_next)
{
canvas -> gx_canvas_created_next -> gx_canvas_created_previous = canvas -> gx_canvas_created_previous;
}
}
else
{
_gx_system_canvas_created_list = canvas -> gx_canvas_created_next;
if (_gx_system_canvas_created_list)
{
_gx_system_canvas_created_list -> gx_canvas_created_previous = GX_NULL;
}
}
_gx_system_canvas_created_count--;
/* Only for Win32, we sometimes have to create module 4 aligned scratch memory buffer */
#ifdef GX_TARGET_WIN32
if (canvas -> gx_canvas_padded_memory != GX_NULL)
{
free(canvas -> gx_canvas_padded_memory);
}
#endif
/* Clear the screen control block. */
memset(canvas, 0, sizeof(GX_CANVAS));
}
/* unlock gx_system. */
GX_EXIT_CRITICAL
/* Return successful status. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,94 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_dirty_mark PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function marks the canvas dirty. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* area Area of canvas to mark as */
/* dirty */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_canvas_dirty_mark(GX_CANVAS *canvas, GX_RECTANGLE *area)
{
canvas -> gx_canvas_draw_count++;
/* did the caller pass a specific rectangle? */
if (area)
{
/* yes, used passed in rectangle */
canvas -> gx_canvas_dirty_area = *area;
}
else
{
/* no, invalidate the entire canvas */
canvas -> gx_canvas_dirty_area.gx_rectangle_top = 0;
canvas -> gx_canvas_dirty_area.gx_rectangle_bottom =
(GX_VALUE)(canvas -> gx_canvas_y_resolution - 1);
canvas -> gx_canvas_dirty_area.gx_rectangle_left = 0;
canvas -> gx_canvas_dirty_area.gx_rectangle_right =
(GX_VALUE)(canvas -> gx_canvas_x_resolution - 1);
}
}

View File

@ -0,0 +1,109 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
#include "gx_display.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_drawing_complete PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function completes drawing on the specified canvas. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* flush If GX_TRUE, the content of */
/* the canvas is flushed to */
/* the display */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* [gx_display_driver_buffer_toggle] Toggle visible frame buffer */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_drawing_complete(GX_CANVAS *canvas, GX_BOOL flush)
{
GX_DISPLAY *display = canvas -> gx_canvas_display;
/* Determing if canvas drawing has been initiated. */
if (canvas -> gx_canvas_draw_nesting > 0)
{
if (display -> gx_display_driver_drawing_complete)
{
display -> gx_display_driver_drawing_complete(display, canvas);
}
/* Decrement the drawing nesting counter. */
canvas -> gx_canvas_draw_nesting = (GX_UBYTE)(canvas->gx_canvas_draw_nesting - 1);
/* Pop the previous draw context. */
_gx_system_current_draw_context++;
if (_gx_system_current_draw_context == _gx_system_draw_context_stack_end)
{
_gx_system_current_draw_context = GX_NULL;
}
if (canvas -> gx_canvas_draw_nesting == 0 && flush)
{
canvas -> gx_canvas_display -> gx_display_driver_buffer_toggle(canvas, &canvas -> gx_canvas_dirty_area);
/* reset the canvas dirty counter */
canvas -> gx_canvas_draw_count = 0;
}
}
return(GX_SUCCESS);
}

View File

@ -0,0 +1,229 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
#include "gx_context.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_drawing_initiate PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initiates drawing on the specified canvas. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* who Widget control block pointer */
/* dirty_area Area to draw on */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define Define rectangle area. */
/* _gx_utility_rectangle_combine Combine adjacent dirty areas. */
/* _gx_context_brush_default Define a brush */
/* _gx_system_error_process Process an error */
/* _gx_utility_rectangle_overlap_detect Detects two rectangles being */
/* overlap */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_multi_line_text_view_draw */
/* _gx_single_line_text_view_draw */
/* _gx_system_canvas_refresh */
/* _gx_widget_block_move */
/* _gx_widget_children_draw */
/* _gx_window_client_scroll */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_drawing_initiate(GX_CANVAS *canvas, GX_WIDGET *who, GX_RECTANGLE *dirty_area)
{
GX_WINDOW *win;
GX_DRAW_CONTEXT *new_context;
GX_DRAW_CONTEXT *current_context = _gx_system_current_draw_context;
GX_DISPLAY *display = canvas -> gx_canvas_display;
if (current_context)
{
new_context = current_context - 1;
/* check for exceeding our maximum stack depth */
if (new_context < _gx_system_draw_context_stack)
{
_gx_system_error_process(GX_DRAW_NESTING_EXCEEDED);
return GX_DRAW_NESTING_EXCEEDED;
}
}
else
{
new_context = _gx_system_draw_context_stack_end - 1;
}
/* test to see if we have draw to this canvas since last refresh */
if (canvas -> gx_canvas_draw_count > 0)
{
_gx_utility_rectangle_combine(&canvas -> gx_canvas_dirty_area, dirty_area);
}
else
{
/* initialize the dirty rectangle */
canvas -> gx_canvas_dirty_area = *dirty_area;
}
/* Are we nested? */
if (canvas -> gx_canvas_draw_nesting > 0 && current_context)
{
/* Yes, clone the previous context. */
*new_context = *current_context;
}
else
{
/* initialize the new context's brush */
_gx_context_brush_default(new_context);
/* save the canvas pointer for any function that needs it */
new_context -> gx_draw_context_canvas = canvas;
/* copy some canvas params to the context to speed access by drawing APIs */
new_context -> gx_draw_context_display = canvas -> gx_canvas_display;
new_context -> gx_draw_context_memory = canvas -> gx_canvas_memory;
new_context -> gx_draw_context_pitch = canvas -> gx_canvas_x_resolution;
}
/* Update canvas draw count and draw nesting. */
canvas -> gx_canvas_draw_nesting++;
canvas -> gx_canvas_draw_count++;
/* let display driver know if it has notification function */
if (display -> gx_display_driver_drawing_initiate)
{
display -> gx_display_driver_drawing_initiate(display, canvas);
}
/* Update the draw context clipping rectangle. */
if (who)
{
_gx_utility_rectangle_overlap_detect(dirty_area,
&who -> gx_widget_clip, &new_context -> gx_draw_context_dirty);
#if defined(GX_BRUSH_ALPHA_SUPPORT)
if (who -> gx_widget_style & GX_STYLE_USE_LOCAL_ALPHA)
{
new_context -> gx_draw_context_brush.gx_brush_alpha = who -> gx_widget_alpha;
}
#endif
}
else
{
new_context -> gx_draw_context_dirty = *dirty_area;
}
/* initialize viewports to NULL */
new_context -> gx_draw_context_view_head = GX_NULL;
/* pick up the viewport list */
if (canvas -> gx_canvas_status & GX_CANVAS_SIMPLE)
{
new_context -> gx_draw_context_simple_view.gx_view_next = NULL;
new_context -> gx_draw_context_simple_view.gx_view_rectangle = new_context -> gx_draw_context_dirty;
new_context -> gx_draw_context_view_head = &new_context -> gx_draw_context_simple_view;
}
else
{
if (who)
{
/* is the root window trying to draw */
if (who -> gx_widget_type == GX_TYPE_ROOT_WINDOW)
{
win = (GX_WINDOW *)who;
new_context -> gx_draw_context_view_head = win -> gx_window_views;
}
else
{
while (who -> gx_widget_parent)
{
if (who -> gx_widget_parent -> gx_widget_type == GX_TYPE_ROOT_WINDOW)
{
if (who -> gx_widget_type >= GX_TYPE_WINDOW &&
!(who -> gx_widget_status & GX_STATUS_TRANSPARENT))
{
/* child windows of the root window get their own view list */
win = (GX_WINDOW *)who;
}
else
{
/* other widget types just inherit the view list of the root */
win = (GX_WINDOW *)who -> gx_widget_parent;
}
new_context -> gx_draw_context_view_head = win -> gx_window_views;
break;
}
who = who -> gx_widget_parent;
}
}
/* the widget being drawn is no longer marked dirty */
who -> gx_widget_status &= ~GX_STATUS_DIRTY;
}
}
/* the new context becomes the current context */
_gx_system_current_draw_context = new_context;
if (new_context -> gx_draw_context_view_head == GX_NULL)
{
/* no viewports for the caller */
return(GX_NO_VIEWS);
}
return(GX_SUCCESS);
}

View File

@ -0,0 +1,181 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Display Management (Display) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_ellipse_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This draws a ellipse into the currrent context. */
/* */
/* INPUT */
/* */
/* xcenter x-coord of center of ellipse */
/* ycenter y-coord of center of ellipse */
/* r Radius of circle */
/* a Length of the Semi-major Axis */
/* b Length of the Semi-minor Axis */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define */
/* _gx_utility_rectangle_overlap_detect */
/* [gx_display_driver_generic_ellipse_draw] */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_ARC_DRAWING_SUPPORT)
UINT _gx_canvas_ellipse_draw(INT xcenter, INT ycenter, INT a, INT b)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE bound;
GX_RECTANGLE clip_rect;
GX_VIEW *view;
GX_BRUSH *brush;
INT brush_width;
VOID (*outline_function)(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
brush = &context -> gx_draw_context_brush;
brush_width = (brush -> gx_brush_width + 1) >> 1;
/* Define ellipse bounding rectangle. */
_gx_utility_rectangle_define(&bound, (GX_VALUE)(xcenter - a - brush_width), (GX_VALUE)(ycenter - b - brush_width),
(GX_VALUE)(xcenter + a + brush_width), (GX_VALUE)(ycenter + b + brush_width));
brush_width = brush -> gx_brush_width;
/* clip the ellipse bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* configure outline function to utilize */
outline_function = GX_NULL;
/* Determine which outline function to use.*/
if(brush_width == 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_ellipse_draw != GX_NULL)
{
outline_function = display -> gx_display_driver_anti_aliased_ellipse_draw;
}
else
{
outline_function = display -> gx_display_driver_ellipse_draw;
}
}
else
{
if (brush_width > 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_wide_ellipse_draw != GX_NULL)
{
outline_function = display -> gx_display_driver_anti_aliased_wide_ellipse_draw;
}
else
{
outline_function = display -> gx_display_driver_wide_ellipse_draw;
}
}
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the line, do it */
context -> gx_draw_context_clip = &clip_rect;
if ((brush -> gx_brush_style & (GX_BRUSH_SOLID_FILL | GX_BRUSH_PIXELMAP_FILL)) &&
display -> gx_display_driver_ellipse_fill)
{
/* Call display driver ellipse filling routine. */
display -> gx_display_driver_ellipse_fill(context, xcenter, ycenter, a, b);
}
if (outline_function)
{
outline_function(context, xcenter, ycenter, a, b);
}
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}
#endif

View File

@ -0,0 +1,663 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
#if defined(GX_FONT_KERNING_SUPPORT)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_kerning_glyphs_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw text. */
/* */
/* INPUT */
/* */
/* context Drawing context */
/* font Font used by the string */
/* draw_position Coord of draw position */
/* string Pointer to string which need */
/* to draw */
/* length Number of string about to draw*/
/* view Pointer to view size */
/* draw_glyph Callback pointer to display */
/* driver text draw function */
/* */
/* OUTPUT */
/* */
/* */
/* CALLS */
/* */
/* _gx_utility_utf8_string_character_get */
/* Get characters of this string */
/* */
/* CALLED BY */
/* */
/* _gx_canvas_glyph_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static VOID _gx_canvas_kerning_glyphs_draw(GX_DRAW_CONTEXT *context, GX_FONT *font, GX_POINT *draw_position, GX_CONST GX_STRING *string, GX_RECTANGLE *view,
VOID (*draw_glyph)(GX_DRAW_CONTEXT *, GX_RECTANGLE *, GX_POINT *, GX_CONST GX_GLYPH *))
{
GX_CONST GX_KERNING_GLYPH *glyph;
GX_CHAR_CODE char_val;
GX_VALUE x_offset;
GX_VALUE y_offset;
GX_VALUE xstart;
GX_VALUE ystart;
GX_POINT map_offset;
GX_RECTANGLE draw_area;
GX_CONST GX_FONT *font_link;
/* Used for kerning glyph. */
GX_CHAR_CODE pre_char_val = 0;
GX_BYTE kerning_offset = 0;
GX_CONST GX_UBYTE *kerning_table;
INT kerning_counts;
INT index;
GX_UBYTE *left_glyph_ptr;
GX_STRING string_copy;
#if defined(GX_UTF8_SUPPORT)
UINT ret;
#endif /* GX_UTF8_SUPPORT */
/* Setup local variables. */
xstart = draw_position -> gx_point_x;
ystart = draw_position -> gx_point_y;
string_copy = *string;
/* for each character in the string */
do
{
#ifdef GX_UTF8_SUPPORT
ret = _gx_utility_utf8_string_character_get(&string_copy, &char_val, GX_NULL);
if ((ret != GX_SUCCESS) || (char_val == 0))
#else
char_val = (GX_CHAR_CODE)(*string_copy.gx_string_ptr++);
string_copy.gx_string_length--;
if (char_val == 0)
#endif /* GX_UTF8_SUPPORT */
{
break;
}
font_link = font;
while (font_link)
{
if (char_val >= font_link -> gx_font_first_glyph &&
char_val <= font_link -> gx_font_last_glyph)
{
break;
}
font_link = font_link -> gx_font_next_page;
}
if (font_link)
{
char_val = (GX_CHAR_CODE)(char_val - font_link -> gx_font_first_glyph);
glyph = &((GX_CONST GX_KERNING_GLYPH *)font_link -> gx_font_glyphs.gx_font_kerning_glyphs)[char_val];
kerning_table = ((GX_KERNING_GLYPH *)glyph) -> gx_kerning_table;
if (kerning_table && (pre_char_val != 0))
{
/* Search the kerning table for the kerning value. */
kerning_counts = *kerning_table;
left_glyph_ptr = (GX_UBYTE *)(kerning_table + 1);
for (index = 0; index < kerning_counts; index++)
{
if ((*left_glyph_ptr) == (pre_char_val + font_link -> gx_font_first_glyph))
{
kerning_offset = (GX_CHAR)(*(left_glyph_ptr + 1));
break;
}
left_glyph_ptr += 2;
}
}
if (glyph -> gx_glyph_map)
{
x_offset = (GX_VALUE)(xstart + glyph -> gx_glyph_leading);
x_offset = (GX_VALUE)(x_offset + kerning_offset);
y_offset = (GX_VALUE)(ystart + font_link -> gx_font_baseline - glyph -> gx_glyph_ascent);
draw_area.gx_rectangle_left = x_offset;
draw_area.gx_rectangle_top = y_offset;
draw_area.gx_rectangle_right = (GX_VALUE)(draw_area.gx_rectangle_left + glyph -> gx_glyph_width - 1);
draw_area.gx_rectangle_bottom = (GX_VALUE)(draw_area.gx_rectangle_top + glyph -> gx_glyph_height - 1);
if (draw_area.gx_rectangle_bottom >= view -> gx_rectangle_top &&
draw_area.gx_rectangle_top <= view -> gx_rectangle_bottom &&
draw_area.gx_rectangle_right >= view -> gx_rectangle_left &&
draw_area.gx_rectangle_left <= view -> gx_rectangle_right)
{
map_offset.gx_point_x = 0;
map_offset.gx_point_y = 0;
/* Calculate the y_start value, which is the offset into the row of
the glyph where we start to the draw. */
if (draw_area.gx_rectangle_top < view -> gx_rectangle_top)
{
map_offset.gx_point_y = (GX_VALUE)(view -> gx_rectangle_top - draw_area.gx_rectangle_top);
draw_area.gx_rectangle_top = view -> gx_rectangle_top;
}
if (draw_area.gx_rectangle_left < view -> gx_rectangle_left)
{
map_offset.gx_point_x = (GX_VALUE)(view -> gx_rectangle_left - x_offset);
draw_area.gx_rectangle_left = view -> gx_rectangle_left;
}
if (draw_area.gx_rectangle_bottom > view -> gx_rectangle_bottom)
{
draw_area.gx_rectangle_bottom = view -> gx_rectangle_bottom;
}
if (draw_area.gx_rectangle_right > view -> gx_rectangle_right)
{
draw_area.gx_rectangle_right = view -> gx_rectangle_right;
}
draw_glyph(context, &draw_area, &map_offset, (const GX_GLYPH *)glyph);
}
}
xstart = (GX_VALUE)(xstart + glyph -> gx_glyph_advance);
xstart = (GX_VALUE)(xstart + kerning_offset);
}
pre_char_val = char_val;
kerning_offset = 0;
} while (string_copy.gx_string_length > 0);
}
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_compressed_glyphs_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw text. */
/* */
/* INPUT */
/* */
/* context Drawing context */
/* font Font used by the string */
/* draw_position Coord of draw position */
/* string Pointer to string which need */
/* to draw */
/* length Number of string about to draw*/
/* view Pointer to view size */
/* draw_glyph Callback pointer to display */
/* driver text draw function */
/* */
/* OUTPUT */
/* */
/* */
/* CALLS */
/* */
/* _gx_utility_utf8_string_character_get */
/* Get characters of this string */
/* */
/* CALLED BY */
/* */
/* _gx_canvas_glyph_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static VOID _gx_canvas_compressed_glyphs_draw(GX_DRAW_CONTEXT *context, GX_FONT *font, GX_POINT *draw_position, GX_CONST GX_STRING *string, GX_RECTANGLE *view,
VOID (*draw_glyph)(GX_DRAW_CONTEXT *, GX_RECTANGLE *, GX_POINT *, GX_CONST GX_GLYPH *))
{
GX_CONST GX_COMPRESSED_GLYPH *glyph;
GX_CHAR_CODE char_val;
GX_VALUE x_offset;
GX_VALUE y_offset;
GX_VALUE xstart;
GX_VALUE ystart;
GX_POINT map_offset;
GX_RECTANGLE draw_area;
GX_CONST GX_FONT *font_link;
GX_STRING string_copy;
#ifdef GX_UTF8_SUPPORT
UINT ret;
#ifdef GX_THAI_GLYPH_SHAPING_SUPPORT
GX_CHAR_CODE *code_list = GX_NULL;
UINT code_count;
UINT index = 0;
if (_gx_system_text_render_style & GX_TEXT_RENDER_THAI_GLYPH_SHAPING)
{
ret = _gx_utility_thai_glyph_shaping(string, &code_list, &code_count);
}
#endif
#endif /* GX_UTF8_SUPPORT */
/* Setup local variables. */
xstart = draw_position -> gx_point_x;
ystart = draw_position -> gx_point_y;
string_copy = *string;
/* for each character in the string */
do
{
#ifdef GX_UTF8_SUPPORT
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
if (code_list)
{
if (index < code_count)
{
char_val = code_list[index++];
}
else
{
char_val = 0;
}
}
else
{
#endif
ret = _gx_utility_utf8_string_character_get(&string_copy, &char_val, GX_NULL);
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
}
#endif
if ((ret != GX_SUCCESS) || (char_val == 0))
#else
char_val = (GX_CHAR_CODE)(*string_copy.gx_string_ptr++);
string_copy.gx_string_length--;
if (char_val == 0)
#endif /* GX_UTF8_SUPPORT */
{
break;
}
font_link = font;
while (font_link)
{
if (char_val >= font_link -> gx_font_first_glyph &&
char_val <= font_link -> gx_font_last_glyph)
{
break;
}
font_link = font_link -> gx_font_next_page;
}
if (font_link)
{
char_val = (GX_CHAR_CODE)(char_val - font_link -> gx_font_first_glyph);
glyph = &((GX_CONST GX_COMPRESSED_GLYPH *)font_link -> gx_font_glyphs.gx_font_compressed_glyphs)[char_val];
/* Skip this glyph if glyph map is availlable. */
if (glyph -> gx_glyph_map)
{
x_offset = (GX_VALUE)(xstart + glyph -> gx_glyph_leading);
y_offset = (GX_VALUE)(ystart + font_link -> gx_font_baseline - glyph -> gx_glyph_ascent);
draw_area.gx_rectangle_left = x_offset;
draw_area.gx_rectangle_top = y_offset;
draw_area.gx_rectangle_right = (GX_VALUE)(draw_area.gx_rectangle_left + glyph -> gx_glyph_width - 1);
draw_area.gx_rectangle_bottom = (GX_VALUE)(draw_area.gx_rectangle_top + glyph -> gx_glyph_height - 1);
if (draw_area.gx_rectangle_bottom >= view -> gx_rectangle_top &&
draw_area.gx_rectangle_top <= view -> gx_rectangle_bottom &&
draw_area.gx_rectangle_right >= view -> gx_rectangle_left &&
draw_area.gx_rectangle_left <= view -> gx_rectangle_right)
{
map_offset.gx_point_x = 0;
map_offset.gx_point_y = 0;
/* Calculate the y_start value, which is the offset into the row of
the glyph where we start to the draw. */
if (draw_area.gx_rectangle_top < view -> gx_rectangle_top)
{
map_offset.gx_point_y = (GX_VALUE)(view -> gx_rectangle_top - draw_area.gx_rectangle_top);
draw_area.gx_rectangle_top = view -> gx_rectangle_top;
}
if (draw_area.gx_rectangle_left < view -> gx_rectangle_left)
{
map_offset.gx_point_x = (GX_VALUE)(view -> gx_rectangle_left - x_offset);
draw_area.gx_rectangle_left = view -> gx_rectangle_left;
}
if (draw_area.gx_rectangle_bottom > view -> gx_rectangle_bottom)
{
draw_area.gx_rectangle_bottom = view -> gx_rectangle_bottom;
}
if (draw_area.gx_rectangle_right > view -> gx_rectangle_right)
{
draw_area.gx_rectangle_right = view -> gx_rectangle_right;
}
draw_glyph(context, &draw_area, &map_offset, (const GX_GLYPH *)glyph);
}
}
xstart = (GX_VALUE)(xstart + glyph -> gx_glyph_advance);
}
} while (string_copy.gx_string_length > 0);
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_generic_glyphs_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw text. */
/* */
/* INPUT */
/* */
/* context Drawing context */
/* font Font used by the string */
/* draw_position Coord of draw position */
/* string Pointer to string which need */
/* to draw */
/* length Number of string about to draw*/
/* view Pointer to view size */
/* draw_glyph Callback pointer to display */
/* driver text draw function */
/* */
/* OUTPUT */
/* */
/* */
/* CALLS */
/* */
/* _gx_utility_utf8_string_character_get */
/* Get characters of this string */
/* */
/* CALLED BY */
/* */
/* _gx_canvas_glyph_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
static VOID _gx_canvas_generic_glyphs_draw(GX_DRAW_CONTEXT *context, GX_FONT *font, GX_POINT *draw_position, GX_CONST GX_STRING *string, GX_RECTANGLE *view,
VOID (*draw_glyph)(GX_DRAW_CONTEXT *, GX_RECTANGLE *, GX_POINT *, GX_CONST GX_GLYPH *))
{
GX_CONST GX_GLYPH *glyph;
GX_CHAR_CODE char_val;
GX_VALUE x_offset;
GX_VALUE y_offset;
GX_VALUE xstart;
GX_VALUE ystart;
GX_POINT map_offset;
GX_RECTANGLE draw_area;
GX_CONST GX_FONT *font_link;
GX_STRING string_copy;
#ifdef GX_UTF8_SUPPORT
UINT ret;
#ifdef GX_THAI_GLYPH_SHAPING_SUPPORT
GX_CHAR_CODE *code_list = GX_NULL;
UINT code_count;
UINT index = 0;
if (_gx_system_text_render_style & GX_TEXT_RENDER_THAI_GLYPH_SHAPING)
{
ret = _gx_utility_thai_glyph_shaping(string, &code_list, &code_count);
}
#endif
#endif /* GX_UTF8_SUPPORT */
/* Setup local variables. */
xstart = draw_position -> gx_point_x;
ystart = draw_position -> gx_point_y;
string_copy = *string;
/* for each character in the string */
do
{
#ifdef GX_UTF8_SUPPORT
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
if (code_list)
{
if (index < code_count)
{
char_val = code_list[index++];
}
else
{
char_val = 0;
}
}
else
{
#endif
ret = _gx_utility_utf8_string_character_get(&string_copy, &char_val, GX_NULL);
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
}
#endif
if ((ret != GX_SUCCESS) || (char_val == 0))
#else
char_val = (GX_CHAR_CODE)(*string_copy.gx_string_ptr++);
string_copy.gx_string_length--;
if (char_val == 0)
#endif /* GX_UTF8_SUPPORT */
{
break;
}
font_link = font;
while (font_link)
{
if (char_val >= font_link -> gx_font_first_glyph &&
char_val <= font_link -> gx_font_last_glyph)
{
break;
}
font_link = font_link -> gx_font_next_page;
}
if (font_link)
{
char_val = (GX_CHAR_CODE)(char_val - font_link -> gx_font_first_glyph);
glyph = &font_link -> gx_font_glyphs.gx_font_normal_glyphs[char_val];
if (glyph -> gx_glyph_map)
{
x_offset = (GX_VALUE)(xstart + glyph -> gx_glyph_leading);
y_offset = (GX_VALUE)(ystart + font_link -> gx_font_baseline - glyph -> gx_glyph_ascent);
draw_area.gx_rectangle_left = x_offset;
draw_area.gx_rectangle_top = y_offset;
draw_area.gx_rectangle_right = (GX_VALUE)(draw_area.gx_rectangle_left + glyph -> gx_glyph_width - 1);
draw_area.gx_rectangle_bottom = (GX_VALUE)(draw_area.gx_rectangle_top + glyph -> gx_glyph_height - 1);
if (draw_area.gx_rectangle_bottom >= view -> gx_rectangle_top &&
draw_area.gx_rectangle_top <= view -> gx_rectangle_bottom &&
draw_area.gx_rectangle_right >= view -> gx_rectangle_left &&
draw_area.gx_rectangle_left <= view -> gx_rectangle_right)
{
map_offset.gx_point_x = 0;
map_offset.gx_point_y = 0;
/* Calculate the y_start value, which is the offset into the row of
the glyph where we start to the draw. */
if (draw_area.gx_rectangle_top < view -> gx_rectangle_top)
{
map_offset.gx_point_y = (GX_VALUE)(view -> gx_rectangle_top - draw_area.gx_rectangle_top);
draw_area.gx_rectangle_top = view -> gx_rectangle_top;
}
if (draw_area.gx_rectangle_left < view -> gx_rectangle_left)
{
map_offset.gx_point_x = (GX_VALUE)(view -> gx_rectangle_left - x_offset);
draw_area.gx_rectangle_left = view -> gx_rectangle_left;
}
if (draw_area.gx_rectangle_bottom > view -> gx_rectangle_bottom)
{
draw_area.gx_rectangle_bottom = view -> gx_rectangle_bottom;
}
if (draw_area.gx_rectangle_right > view -> gx_rectangle_right)
{
draw_area.gx_rectangle_right = view -> gx_rectangle_right;
}
draw_glyph(context, &draw_area, &map_offset, glyph);
}
}
xstart = (GX_VALUE)(xstart + glyph -> gx_glyph_advance);
}
} while (string_copy.gx_string_length > 0);
#ifdef GX_UTF8_SUPPORT
#if defined(GX_THAI_GLYPH_SHAPING_SUPPORT)
if (code_list)
{
_gx_system_memory_free((void *)code_list);
}
#endif
#endif
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_glyphs_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw text. */
/* */
/* INPUT */
/* */
/* context Drawing context */
/* draw_position Coord of draw position */
/* string Pointer to string which need */
/* to draw */
/* length Number of string about to draw*/
/* view Pointer to view size */
/* draw_glyph Callback pointer to display */
/* driver text draw function */
/* */
/* OUTPUT */
/* */
/* */
/* CALLS */
/* */
/* _gx_utility_utf8_string_character_get */
/* Get characters of this string */
/* */
/* CALLED BY */
/* */
/* _gx_canvas_compressed_glyphs_draw */
/* _gx_canvas_kerning_glyphs_draw */
/* _gx_canvas_generic_glyphs_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _gx_canvas_glyphs_draw(GX_DRAW_CONTEXT *context, GX_POINT *draw_position, GX_CONST GX_STRING *string,
GX_RECTANGLE *view,
VOID (*draw_glyph)(GX_DRAW_CONTEXT *, GX_RECTANGLE *, GX_POINT *, GX_CONST GX_GLYPH *))
{
GX_BRUSH *brush;
GX_FONT *font;
/* pickup pointer to current drawing context */
context = _gx_system_current_draw_context;
/* get the current brush */
brush = &context -> gx_draw_context_brush;
/* get the current font and color */
font = brush -> gx_brush_font;
if (!string || !font)
{
/* Return error. */
return;
}
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED)
{
_gx_canvas_compressed_glyphs_draw(context, font, draw_position, string, view, draw_glyph);
}
#if defined(GX_FONT_KERNING_SUPPORT)
else if (font -> gx_font_format & GX_FONT_FORMAT_KERNING)
{
_gx_canvas_kerning_glyphs_draw(context, font, draw_position, string, view, draw_glyph);
}
#endif
else
{
_gx_canvas_generic_glyphs_draw(context, font, draw_position, string, view, draw_glyph);
}
}

View File

@ -0,0 +1,92 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_hardware_layer_bind PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function binds a GUIX canvas to a hardware graphics layer */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* layer Hardware layer */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_canvas_dirty_mark Set the canvas dirty flag */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_hardware_layer_bind(GX_CANVAS *canvas, INT layer)
{
UINT (*initialize_function)(INT, GX_CANVAS *);
UINT status = GX_SUCCESS;
initialize_function = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_initialize;
if (initialize_function == GX_NULL)
{
return (GX_INVALID_DISPLAY);
}
status = initialize_function(layer, canvas);
if (status == GX_SUCCESS)
{
canvas -> gx_canvas_hardware_layer = (GX_BYTE)layer;
}
return(status);
}

View File

@ -0,0 +1,94 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_hide PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function makes a canvas invisible */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_canvas_dirty_mark Set the canvas dirty flag */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_hide(GX_CANVAS *canvas)
{
VOID (*hide_function)(INT layer);
/* change canvas status flag. */
canvas -> gx_canvas_status &= ~(UINT)(GX_CANVAS_VISIBLE);
if (canvas -> gx_canvas_hardware_layer >= 0)
{
hide_function = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_hide;
if (hide_function)
{
hide_function(canvas -> gx_canvas_hardware_layer);
return(GX_SUCCESS);
}
}
/* mark the canvas dirty so that it get refreshed */
_gx_canvas_dirty_mark(canvas, GX_NULL);
/* Return successful status. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,326 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_line_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This draws the specified line on the current context. */
/* */
/* INPUT */
/* */
/* x_start x-coord of endpoint1 */
/* y_start y-coord of endpoint1 */
/* x_end x-coord of endpoint2 */
/* y_end y-coord of endpoint2 */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* gx_utility_rectanlge_define Define a rectangle */
/* gx_utility_rectangle_overlap_detect */
/* Detect rectangle overlap */
/* [gx_display_driver_line_draw] The generic display driver line */
/* drawing routine */
/* [gx_display_driver_horizontal_line_draw] */
/* The display driver horizontal */
/* line drawing function */
/* [gx_display_driver_vertical_line_draw] */
/* The display driver vertical */
/* line drawing function */
/* [gx_display_driver_horizontal_pattern_line_draw] */
/* The display driver horizontal */
/* pattern line drawing function */
/* [gx_display_driver_vertical_pattern_line_draw] */
/* The display driver vertical */
/* pattern line drawing function */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* GUIX Internal Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_line_draw(GX_VALUE x_start, GX_VALUE y_start, GX_VALUE x_end, GX_VALUE y_end)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE clip_rect;
GX_RECTANGLE bound;
GX_VIEW *view;
GX_BRUSH *brush;
GX_BOOL simple_line = GX_FALSE;
GX_VALUE width;
GX_BOOL anti_aliased;
GX_VALUE brush_width;
/* calculate rectangle that bounds the line. This bounding rectangle
is later adjusted based on line width */
/* are line coordinates left to right? */
if (x_start <= x_end)
{
/* are line coordinates bottom to top? */
if (y_start >= y_end)
{
_gx_utility_rectangle_define(&bound, x_start, y_end, x_end, y_start);
}
else
{
/* line is defined left to right, top to bottom */
_gx_utility_rectangle_define(&bound, x_start, y_start, x_end, y_end);
}
}
else
{
if (y_start >= y_end)
{
/* line is defined right to left, bottom to top */
_gx_utility_rectangle_define(&bound, x_end, y_end, x_start, y_start);
}
else
{
/* line is defined right to left, top to bottom */
_gx_utility_rectangle_define(&bound, x_end, y_start, x_start, y_end);
}
}
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
brush = &context -> gx_draw_context_brush;
brush_width = brush -> gx_brush_width;
if (brush_width == 0)
{
/* Check brush width. Just return if width is 0. */
return(GX_SUCCESS);
}
if ((brush_width == 1) ||
((brush -> gx_brush_style & GX_BRUSH_ROUND) == 0))
{
/* If we are drawing a horizontal or vertial line with
square line ends, we can do a much simpler and faster
line drawing function. Check for these special cases.
*/
/* the brush 1 pixel wide or not round, check for horizontal or vertical */
if ((y_start == y_end) || (x_start == x_end))
{
/* yes, simple line case */
simple_line = GX_TRUE;
}
}
/* pick up current display driver */
display = context->gx_draw_context_display;
/* Angled line using current context brush and canvas: */
anti_aliased = GX_FALSE;
if (brush -> gx_brush_style & GX_BRUSH_ALIAS)
{
/* The caller requested an anti-aliased line. Does the driver
support it? */
if (brush_width == 1)
{
if (display -> gx_display_driver_anti_aliased_line_draw)
{
/* Yes, the driver supports anti-aliased lines, so use them: */
anti_aliased = GX_TRUE;
}
}
else
{
if (display -> gx_display_driver_anti_aliased_wide_line_draw)
{
/* Yes, the driver supports anti-aliased lines, so use them: */
anti_aliased = GX_TRUE;
}
}
}
/* We need to expand the bounding rectangle to account for
rounded ends and line width > 1
*/
if (simple_line)
{
if(!brush -> gx_brush_line_pattern)
{
if (x_start == x_end)
{
/* vertical line centered around x coords */
bound.gx_rectangle_left = (GX_VALUE)(x_start - (brush_width / 2));
bound.gx_rectangle_right = (GX_VALUE)(bound.gx_rectangle_left + brush_width - 1);
}
else
{
/* horizontal line centered around y coords */
bound.gx_rectangle_top = (GX_VALUE)(y_start - (brush_width / 2));
bound.gx_rectangle_bottom = (GX_VALUE)(bound.gx_rectangle_top + brush_width - 1);
}
}
}
else
{
width = (GX_VALUE)((brush_width + 1) / 2);
if (anti_aliased)
{
width = (GX_VALUE)(width + 1);
}
/* increase the bound by 1/2 the line width */
bound.gx_rectangle_top = (GX_VALUE)(bound.gx_rectangle_top - width);
bound.gx_rectangle_left = (GX_VALUE)(bound.gx_rectangle_left - width);
bound.gx_rectangle_right = (GX_VALUE)(bound.gx_rectangle_right + width);
bound.gx_rectangle_bottom = (GX_VALUE)(bound.gx_rectangle_bottom + width);
}
/* clip the line bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the line, do it */
context -> gx_draw_context_clip = &clip_rect;
if (simple_line)
{
if (y_start == y_end)
{
if (brush -> gx_brush_line_pattern)
{
/* Call display driver's simple horizontal pattern line drawing function. */
display -> gx_display_driver_horizontal_pattern_line_draw(context,
clip_rect.gx_rectangle_left,
clip_rect.gx_rectangle_right,
y_start);
}
else
{
/* Call display driver's simple horizontal line drawing function. */
display -> gx_display_driver_horizontal_line_draw(context,
clip_rect.gx_rectangle_left,
clip_rect.gx_rectangle_right,
clip_rect.gx_rectangle_top,
clip_rect.gx_rectangle_bottom - clip_rect.gx_rectangle_top + 1,
brush -> gx_brush_line_color);
}
}
else
{
if (brush -> gx_brush_line_pattern)
{
/* Call display driver's simple vertical line drawing function. */
display -> gx_display_driver_vertical_pattern_line_draw(context,
clip_rect.gx_rectangle_top,
clip_rect.gx_rectangle_bottom,
x_start);
}
else
{
/* Call display driver's simple vertical line drawing function. */
display -> gx_display_driver_vertical_line_draw(context,
clip_rect.gx_rectangle_top,
clip_rect.gx_rectangle_bottom,
clip_rect.gx_rectangle_left,
clip_rect.gx_rectangle_right - clip_rect.gx_rectangle_left + 1,
brush -> gx_brush_line_color);
}
}
view = view -> gx_view_next;
continue;
}
if (anti_aliased)
{
if (brush_width == 1)
{
display -> gx_display_driver_anti_aliased_line_draw(context, x_start, y_start, x_end, y_end);
}
else
{
display -> gx_display_driver_anti_aliased_wide_line_draw(context, x_start, y_start, x_end, y_end);
}
}
else
{
if (brush_width == 1)
{
display -> gx_display_driver_simple_line_draw(context, x_start, y_start, x_end, y_end);
}
else
{
display -> gx_display_driver_simple_wide_line_draw(context, x_start, y_start, x_end, y_end);
}
}
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,84 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_memory_define PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function assigns canvas memory pointer and size */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* memory Canvas memory address */
/* memsize Canvas memory size */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_canvas_dirty_mark Set the canvas dirty flag */
/* */
/* CALLED BY */
/* */
/* Application software */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_memory_define(GX_CANVAS *canvas, GX_COLOR *memory, ULONG memsize)
{
/* change the memory pointer value */
canvas -> gx_canvas_memory = memory;
/* change the memory size */
canvas ->gx_canvas_memory_size = memsize;
/* mark the canvas dirty so that it get refreshed */
_gx_canvas_dirty_mark(canvas, GX_NULL);
/* Return successful status. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,83 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_mouse_define PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service defines mouse information for current display. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* info Mouse cursor info control */
/* block */
/* */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* [gx_display_mouse_define] Define mouse info for driver */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_MOUSE_SUPPORT)
UINT _gx_canvas_mouse_define(GX_CANVAS *canvas, GX_MOUSE_CURSOR_INFO *info)
{
GX_DISPLAY *display = canvas -> gx_canvas_display;
if (info != GX_NULL)
{
display -> gx_display_mouse_define(display, canvas, info);
return GX_SUCCESS;
}
return GX_FAILURE;
}
#endif

View File

@ -0,0 +1,84 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_mouse_hide PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service makes the mouse hidden. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* [gx_display_mouse_enable] enabled or disabled mouse */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_MOUSE_SUPPORT)
UINT _gx_canvas_mouse_hide(GX_CANVAS *canvas)
{
GX_DISPLAY *display;
display = canvas -> gx_canvas_display;
if (display -> gx_display_mouse.gx_mouse_canvas == canvas && (display -> gx_display_mouse_enable != GX_NULL))
{
display -> gx_display_mouse_enable(display, GX_FALSE);
return GX_SUCCESS;
}
return GX_FAILURE;
}
#endif

View File

@ -0,0 +1,88 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_mouse_show PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This service makes the mouse visible. */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* [gx_display_mouse_enable] enabled or disabled mouse */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_MOUSE_SUPPORT)
UINT _gx_canvas_mouse_show(GX_CANVAS *canvas)
{
GX_DISPLAY *display;
GX_MOUSE_CURSOR_INFO *mouse_info;
display = canvas -> gx_canvas_display;
mouse_info = display -> gx_display_mouse.gx_mouse_cursor_info;
if ((mouse_info != GX_NULL) && (display -> gx_display_mouse_enable != GX_NULL))
{
if (display -> gx_display_mouse.gx_mouse_canvas == canvas)
{
display -> gx_display_mouse_enable(display, GX_TRUE);
return GX_SUCCESS;
}
}
return GX_FAILURE;
}
#endif

View File

@ -0,0 +1,129 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_offset_set PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function assigns a canvas x,y display offset */
/* */
/* INPUT */
/* */
/* canvas Canvas control block */
/* x X coordinate of offset */
/* y Y coordinate of offset */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* gx_canvas_dirty_mark mark canvas as needing refresh*/
/* */
/* CALLED BY */
/* */
/* _gx_animation_start */
/* _gx_animation_update */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_offset_set(GX_CANVAS *canvas, GX_VALUE xoffset, GX_VALUE yoffset)
{
GX_RECTANGLE oldpos;
GX_CANVAS *backcanvas;
VOID (*offset_function)(INT layer, GX_VALUE x, GX_VALUE y);
/* if there is a background canvas under this one it needs
to be marked as dirty in the area
this canvas is moving from
*/
if (canvas -> gx_canvas_hardware_layer >= 0)
{
offset_function = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_offset_set;
if (offset_function)
{
offset_function(canvas -> gx_canvas_hardware_layer, xoffset, yoffset);
/* move the canvas display position */
canvas -> gx_canvas_display_offset_x = xoffset;
canvas -> gx_canvas_display_offset_y = yoffset;
return(GX_SUCCESS);
}
}
if ((canvas -> gx_canvas_status & GX_CANVAS_MANAGED) &&
canvas -> gx_canvas_created_next)
{
backcanvas = canvas -> gx_canvas_created_next;
/* find the bottom layer canvas */
while (backcanvas -> gx_canvas_created_next)
{
backcanvas = backcanvas -> gx_canvas_created_next;
}
/* calculate rectangle bounding this canvas */
oldpos.gx_rectangle_left = canvas -> gx_canvas_display_offset_x;
oldpos.gx_rectangle_top = canvas -> gx_canvas_display_offset_y;
oldpos.gx_rectangle_right = (GX_VALUE)(oldpos.gx_rectangle_left + canvas -> gx_canvas_x_resolution - 1);
oldpos.gx_rectangle_bottom = (GX_VALUE)(oldpos.gx_rectangle_top + canvas -> gx_canvas_y_resolution - 1);
/* mark the background as dirty */
_gx_canvas_dirty_mark(backcanvas, &oldpos);
}
/* move the canvas display position */
canvas -> gx_canvas_display_offset_x = xoffset;
canvas -> gx_canvas_display_offset_y = yoffset;
/* now mark the foreground canvas as dirty and modified */
_gx_canvas_dirty_mark(canvas, NULL);
return GX_SUCCESS;
}

View File

@ -0,0 +1,254 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Display Management (Display) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_pie_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This draws a pie into the currrent context. */
/* */
/* INPUT */
/* */
/* xcenter x-coord of center of circle */
/* arc */
/* ycenter y-coord of center of circle */
/* arc */
/* r Radius of circle arc */
/* start_angle The start angle of circle arc */
/* end_angle The end angle of circle arc */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define Define a rectangle */
/* _gx_utility_rectangle_overlap_detect Detect rectangle overlap */
/* [gx_display_driver_pie_fill] Display driver basic */
/* pie drawing routine */
/* [gx_display_driver_arc_draw] Display driver basic */
/* arc drawing routine */
/* _gx_display_driver_anti_aliased_arc_draw */
/* Display driver basic aliased */
/* arc drawing routine */
/* _gx_utility_circle_point_get Get point position on a circle*/
/* _gx_canvas_line_draw Draw a line */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
#if defined(GX_ARC_DRAWING_SUPPORT)
UINT _gx_canvas_pie_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle)
{
/* A pie is a fraction of a circle delimited by two lines that span from the center of the
circle to the one side each. */
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE bound;
GX_RECTANGLE clip_rect;
GX_VIEW *view;
GX_BRUSH *brush;
GX_POINT point;
INT brush_width;
VOID (*outline_function)(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
#if defined(GX_BRUSH_ALPHA_SUPPORT)
GX_UBYTE brush_alpha;
#endif
while (start_angle < 0)
{
start_angle += 360;
}
while (end_angle < 0)
{
end_angle += 360;
}
if (start_angle >= 360)
{
start_angle %= 360;
}
if (end_angle >= 360)
{
end_angle %= 360;
}
if (end_angle <= start_angle)
{
end_angle += 360;
}
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
brush = &context -> gx_draw_context_brush;
brush_width = ((INT)(brush -> gx_brush_width + 1)) >> 1;
/* Define pie bounding rectangle. */
_gx_utility_rectangle_define(&bound, (GX_VALUE)(xcenter - (INT)r - brush_width), (GX_VALUE)(ycenter - (INT)r - brush_width),
(GX_VALUE)(xcenter + (INT)r + brush_width), (GX_VALUE)(ycenter + (INT)r + brush_width));
brush_width = brush -> gx_brush_width;
/* clip the pie bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* Determine outline function to utilize.*/
outline_function = GX_NULL;
/* Determine which outline function to use.*/
if (brush_width == 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_arc_draw != GX_NULL)
{
outline_function = display -> gx_display_driver_anti_aliased_arc_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_arc_draw;
}
}
else
{
if (brush_width > 1)
{
/* if anti-alias is requested and this is supported by display, use it */
if ((brush -> gx_brush_style & GX_BRUSH_ALIAS) &&
display -> gx_display_driver_anti_aliased_wide_arc_draw)
{
outline_function = display -> gx_display_driver_anti_aliased_wide_arc_draw;
}
else
{
/* otherwise use non-aliased outline */
outline_function = display -> gx_display_driver_wide_arc_draw;
}
}
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the arc, do it */
context -> gx_draw_context_clip = &clip_rect;
if (brush_width)
{
brush_width -= 1;
brush_width >>= 1;
}
if ((brush -> gx_brush_style & (GX_BRUSH_SOLID_FILL | GX_BRUSH_PIXELMAP_FILL)) &&
(r > (UINT)brush_width))
{
display -> gx_display_driver_pie_fill(context, xcenter, ycenter, r - (UINT)brush_width, start_angle, end_angle);
}
#if defined(GX_BRUSH_ALPHA_SUPPORT)
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
if (brush -> gx_brush_width > 1)
{
context -> gx_draw_context_brush.gx_brush_alpha = GX_ALPHA_VALUE_OPAQUE;
}
#endif
if (outline_function)
{
outline_function(context, xcenter, ycenter, r, start_angle, end_angle);
}
if (r > (UINT)brush_width)
{
_gx_utility_circle_point_get(xcenter, ycenter, r - (UINT)brush_width, start_angle, &point);
/* Draw delimiting line. */
_gx_canvas_line_draw((GX_VALUE)xcenter, (GX_VALUE)ycenter, point.gx_point_x, point.gx_point_y);
_gx_utility_circle_point_get(xcenter, ycenter, r - (UINT)brush_width, end_angle, &point);
/* Draw delimiting line. */
_gx_canvas_line_draw((GX_VALUE)xcenter, (GX_VALUE)ycenter, point.gx_point_x, point.gx_point_y);
}
#if defined(GX_BRUSH_ALPHA_SUPPORT)
context -> gx_draw_context_brush.gx_brush_alpha = brush_alpha;
#endif
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}
#endif

View File

@ -0,0 +1,148 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_pixel_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw one pixel using current context */
/* */
/* INPUT */
/* */
/* position x,y coordinate to draw */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_point_detect Detect whether a pixel is */
/* inside rectangle */
/* [gx_display_driver_pixel_write] Actually write to canvas */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_widget_border_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_pixel_draw(GX_POINT position)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_VIEW *view;
GX_COLOR pixcolor;
GX_UBYTE brush_alpha;
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
/* test to see if we can draw at this position */
if (!_gx_utility_rectangle_point_detect(&context -> gx_draw_context_dirty, position))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
/* pick up the pixel color */
pixcolor = context -> gx_draw_context_brush.gx_brush_line_color;
/* test to determine if any viewport of the caller overlaps this pixel.
For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
#if defined(GX_BRUSH_ALPHA_SUPPORT)
if (brush_alpha == 0)
{
return GX_SUCCESS;
}
while (view)
{
if (_gx_utility_rectangle_point_detect(&view -> gx_view_rectangle, position))
{
if (brush_alpha == 0xff)
{
if (display -> gx_display_driver_pixel_write)
{
display -> gx_display_driver_pixel_write(context, position.gx_point_x, position.gx_point_y, pixcolor);
}
}
else
{
if (display -> gx_display_driver_pixel_blend)
{
display -> gx_display_driver_pixel_blend(context, position.gx_point_x, position.gx_point_y, pixcolor, brush_alpha);
}
}
break;
}
view = view->gx_view_next;
}
#else
while (view)
{
if (_gx_utility_rectangle_point_detect(&view -> gx_view_rectangle, position))
{
if (display -> gx_display_driver_pixel_write)
{
display -> gx_display_driver_pixel_write(context, position.gx_point_x, position.gx_point_y, pixcolor);
}
break;
}
view = view->gx_view_next;
}
#endif
/* Return successful completion. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,163 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Screen Management (Screen) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_pixelmap_blend PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to blend the specified pixelmap with */
/* background at the requested position. */
/* */
/* INPUT */
/* */
/* x_position Top-left x-coord to place */
/* pixelmap */
/* y_position Top-left y-coord to place */
/* pixelmap */
/* pixelmap Pointer to actual pixelmap */
/* to draw */
/* alpha blending value 0-255 */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* _gx_utility_rectangle_define Define a rectangle */
/* _gx_utility_rectangle_overlap_detect Detect rectangle overlap */
/* [gx_display_driver_pixelmap_draw] Driver level pixelmap blend */
/* function */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* _gx_sprite_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_pixelmap_blend(GX_VALUE x_position, GX_VALUE y_position,
GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE clip_rect;
GX_RECTANGLE bound;
GX_VIEW *view;
GX_UBYTE old_alpha;
VOID (*pmp_function)(GX_DRAW_CONTEXT *, INT, INT, GX_PIXELMAP *);
if (alpha == 0)
{
return GX_SUCCESS;
}
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
/* calculate rectangle that bounds the pixelmap */
_gx_utility_rectangle_define(&bound, x_position, y_position,
(GX_VALUE)(x_position + pixelmap -> gx_pixelmap_width - 1),
(GX_VALUE)(y_position + pixelmap -> gx_pixelmap_height - 1));
/* clip the line bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* pickup pointer to correct pixelmap blending function */
if (pixelmap -> gx_pixelmap_format == GX_COLOR_FORMAT_8BIT_ALPHAMAP)
{
pmp_function = display -> gx_display_driver_alphamap_draw;
}
else
{
pmp_function = display -> gx_display_driver_pixelmap_draw;
}
if (pmp_function == GX_NULL)
{
return GX_NOT_SUPPORTED;
}
/* Set the parameter alpha to brush alpha value. */
old_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
context -> gx_draw_context_brush.gx_brush_alpha = alpha;
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the pixelmap, do it */
/* first, set the context clip rectangle */
context -> gx_draw_context_clip = &clip_rect;
/* now pass the context and drawing params to driver level function */
pmp_function(context, x_position, y_position, pixelmap);
/* go to the next view */
view = view -> gx_view_next;
}
context -> gx_draw_context_brush.gx_brush_alpha = old_alpha;
/* Return successful completion. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,188 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Screen Management (Screen) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_system.h"
#include "gx_utility.h"
#include "gx_display.h"
#include "gx_canvas.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_pixelmap_draw PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function prepares to draw the specified pixelmap at the */
/* requested position. */
/* */
/* INPUT */
/* */
/* x_position Top-left x-coord to place */
/* pixelmap */
/* y_position Top-left y-coord to place */
/* pixelmap */
/* pixelmap Pointer to actual pixelmap */
/* to draw */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* _gx_utility_rectangle_define Define a rectangle */
/* _gx_utility_rectangle_overlap_detect Detect rectangle overlap */
/* [gx_display_driver_pixelmap_draw] The display driver pixelmap */
/* draw routine */
/* [gx_display_driver_jpeg_draw] The display driver JPEG draw */
/* routine */
/* [gx_display_driver_png_draw] The display driver PNG draw */
/* routine */
/* */
/* CALLED BY */
/* */
/* _gx_canvas_pixelmap_blend */
/* _gx_canvas_pixelmap_tile */
/* _gx_checkbox_draw */
/* _gx_icon_button_draw */
/* _gx_icon_draw */
/* _gx_pixelmap_button_draw */
/* _gx_pixelmap_prompt_draw */
/* _gx_pixelmap_slider_draw */
/* _gx_radio_button_draw */
/* _gx_scroll_thumb_draw */
/* _gx_scrollbar_draw */
/* _gx_window_draw */
/* _gx_scroll_thumb_draw */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_pixelmap_draw(GX_VALUE x_position, GX_VALUE y_position, GX_PIXELMAP *pixelmap)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_RECTANGLE clip_rect;
GX_RECTANGLE bound;
GX_VIEW *view;
VOID (*pmp_function)(GX_DRAW_CONTEXT *, INT, INT, GX_PIXELMAP *);
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
/* pick up current display driver */
display = context -> gx_draw_context_display;
/* calculate rectangle that bounds the pixelmap */
_gx_utility_rectangle_define(&bound, x_position, y_position,
(GX_VALUE)(x_position + pixelmap -> gx_pixelmap_width - 1),
(GX_VALUE)(y_position + pixelmap -> gx_pixelmap_height - 1));
/* clip the line bounding box to the dirty rectangle */
if (!_gx_utility_rectangle_overlap_detect(&bound, &context -> gx_draw_context_dirty, &bound))
{
/* nothing to draw, return */
return GX_SUCCESS;
}
/* pickup pointer to correct pixelmap drawing function */
pmp_function = GX_NULL;
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_RAW_FORMAT)
{
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
if ((pixelmap->gx_pixelmap_data[0] == 0xff) && (pixelmap->gx_pixelmap_data[1] == 0xd8))
{
/* JPEG */
pmp_function = display -> gx_display_driver_jpeg_draw;
}
else
{
if (pixelmap -> gx_pixelmap_data[1] == 'P')
{
/* PNG */
pmp_function = display -> gx_display_driver_png_draw;
}
}
#endif
}
else
{
if (pixelmap -> gx_pixelmap_format == GX_COLOR_FORMAT_8BIT_ALPHAMAP)
{
pmp_function = display -> gx_display_driver_alphamap_draw;
}
else
{
pmp_function = display -> gx_display_driver_pixelmap_draw;
}
}
if (!pmp_function)
{
/* display driver does not support requested action */
return GX_FAILURE;
}
/* test to determine if the bounding rectangle overlaps the region we are allowed to draw
into. For each view that overlaps the bounding rectangle, do some drawing.
*/
view = context -> gx_draw_context_view_head;
while (view)
{
if (!_gx_utility_rectangle_overlap_detect(&view -> gx_view_rectangle, &bound, &clip_rect))
{
view = view -> gx_view_next;
continue;
}
/* we have a view into which we can draw the pixelmap, do it */
/* first, set the context clip rectangle */
context -> gx_draw_context_clip = &clip_rect;
/* now pass the context and drawing params to driver level function */
pmp_function(context, x_position, y_position, pixelmap);
/* go to the next view */
view = view -> gx_view_next;
}
/* Return successful completion. */
return(GX_SUCCESS);
}

View File

@ -0,0 +1,110 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** GUIX Component */
/** */
/** Canvas Management (Canvas) */
/** */
/**************************************************************************/
#define GX_SOURCE_CODE
/* Include necessary system files. */
#include "gx_api.h"
#include "gx_canvas.h"
#include "gx_system.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _gx_canvas_pixelmap_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* Kenneth Maxwell, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a GX_PIXELMAP structure pointing to the */
/* canvas data. */
/* */
/* INPUT */
/* */
/* pixelmap Pointer to destination for */
/* the retrieved pixlemap */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _gx_canvas_pixelmap_get(GX_PIXELMAP *pixelmap)
{
GX_DRAW_CONTEXT *context;
GX_DISPLAY *display;
GX_CANVAS *canvas;
/* pick up the current drawing context */
context = _gx_system_current_draw_context;
if (context == GX_NULL)
{
return GX_INVALID_CONTEXT;
}
/* pick up curren canvas. */
canvas = context -> gx_draw_context_canvas;
if (canvas == GX_NULL)
{
return GX_INVALID_CANVAS;
}
/* pick up current display driver */
display = context -> gx_draw_context_display;
if (display == GX_NULL)
{
return GX_INVALID_DISPLAY;
}
memset(pixelmap, 0, sizeof(GX_PIXELMAP));
pixelmap -> gx_pixelmap_width = canvas -> gx_canvas_x_resolution;
pixelmap -> gx_pixelmap_height = canvas -> gx_canvas_y_resolution;
pixelmap -> gx_pixelmap_format = (GX_UBYTE)display -> gx_display_color_format;
pixelmap -> gx_pixelmap_data = (GX_UBYTE *)canvas -> gx_canvas_memory;
pixelmap -> gx_pixelmap_data_size = canvas -> gx_canvas_memory_size;
pixelmap -> gx_pixelmap_version_major = 1;
pixelmap -> gx_pixelmap_version_minor = 0;
/* Return successful completion. */
return(GX_SUCCESS);
}

Some files were not shown because too many files have changed in this diff Show More