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