1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Menu Management (Menu)                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    gx_menu.h                                           PORTABLE C      */
29 /*                                                           6.1.3        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Kenneth Maxwell, Microsoft Corporation                              */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the GUIX menu component, including all data types */
37 /*    and external references.  It is assumed that gx_api.h and gx_port.h */
38 /*    have already been included.                                         */
39 /*                                                                        */
40 /*  RELEASE HISTORY                                                       */
41 /*                                                                        */
42 /*    DATE              NAME                      DESCRIPTION             */
43 /*                                                                        */
44 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
45 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
46 /*                                            resulting in version 6.1    */
47 /*  12-31-2020     Kenneth Maxwell          Modified comment(s),          */
48 /*                                            declare menu event process, */
49 /*                                            resulting in version 6.1.3  */
50 /*                                                                        */
51 /**************************************************************************/
52 
53 #ifndef GX_MENU_H
54 #define GX_MENU_H
55 
56 /* Define menu management function prototypes.  */
57 
58 #define GX_MENU_ANIMATION_OPEN  0x01
59 #define GX_MENU_ANIMATION_CLOSE 0x02
60 
61 #define GX_MENU_OPEN_TIMER      0xf0
62 #define GX_MENU_CLOSE_TIMER     0xf1
63 
64 UINT _gx_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
65                                ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size);
66 VOID _gx_accordion_menu_draw(GX_ACCORDION_MENU *menu);
67 UINT _gx_accordion_menu_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr);
68 UINT _gx_accordion_menu_position(GX_ACCORDION_MENU *accordion);
69 
70 UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
71                      GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
72                      ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size);
73 VOID _gx_menu_draw(GX_MENU *menu);
74 UINT _gx_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr);
75 UINT _gx_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
76 UINT _gx_menu_one_level_position(GX_MENU *menu, GX_VALUE indentation);
77 UINT _gx_menu_position(GX_MENU *menu, GX_VALUE indentation);
78 UINT _gx_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
79 VOID _gx_menu_text_draw(GX_MENU *menu);
80 UINT _gx_menu_text_offset_set(GX_MENU *menu, GX_VALUE x_offset, GX_VALUE y_offset);
81 
82 /* error checking versions of menu API functions.  */
83 UINT _gxe_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
84                                 ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
85 UINT _gxe_accordion_menu_event_process(GX_ACCORDION_MENU *accordion, GX_EVENT *event_ptr);
86 UINT _gxe_accordion_menu_position(GX_ACCORDION_MENU *accordion);
87 
88 UINT _gxe_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
89                       GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
90                       ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
91 UINT _gxe_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr);
92 UINT _gxe_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
93 UINT _gxe_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
94 UINT _gxe_menu_text_offset_set(GX_MENU *menu, GX_VALUE x_offset, GX_VALUE y_offset);
95 
96 #endif
97 
98