FDOSTUI
FreeDOS Text User Interface
menuitem.h
Go to the documentation of this file.
1 /*
2  MENUITEM.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __menuitem_h__
11 
12 #include "array.h"
13 #include "keyboard.h"
14 
15 #define MENUITEM_MNEMONIC_NONE (unsigned int)-1
16 
17 struct menuitem;
18 
19 typedef void (*menuitem_signal_t)(
20  struct menuitem* i_menu,
21  void* i_user_data);
22 
24 {
25  MENUITEM_NONE= (0<<0),
26  MENUITEM_VALUE= (1<<1),
31 };
32 
33 struct menuitem
34 {
35  unsigned char const* m_label;
36  unsigned int m_mnemonic_offset;
37  unsigned char const* m_accel_label;
39  unsigned int m_flags;
41  void* m_user_data;
42 };
43 
45 {
46  unsigned char const* m_label;
47  unsigned int m_mnemonic_offset;
49  struct menuitem* m_items;
50 };
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /* _mjo i_menu should be const*/
57 extern void
59  unsigned int*const o_rows,
60  unsigned int*const o_cols,
61  struct menuitem * i_menu);
62 
63 extern void
65  struct menuitem * i_menu);
66 
67 extern struct menuitem*
69  struct menuitem* i_menu);
70 
71 extern struct menuitem*
73  struct menuitem* i_menu,
74  unsigned int const i_nth);
75 
76 extern void
78  struct array*const o_array,
79  struct menuitem* i_menu);
80 
81 /* _mjo i_menu should be const*/
82 extern struct menuitem*
84  struct menuitem * i_menu,
85  enum scancodes const i_scan);
86 
87 #define menuitem_emit(i_menu) \
88  if ( (i_menu)->m_signal ) \
89  (*(i_menu)->m_signal)((i_menu), (i_menu)->m_user_data);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #define __menuitem_h__
96 #endif
menuitem_signal_t m_signal
Definition: menuitem.h:40
scancodes
ASCII Scan Codes.
Definition: keyboard.h:26
unsigned int m_mnemonic_offset
Definition: menuitem.h:36
keyboard enumerations and utility routines
enum scancodes m_accel_scancode
Definition: menuitem.h:48
A dynamic array that holds pointers to objects.
a menu item
Definition: menuitem.h:33
container to hold objects
Definition: array.h:14
unsigned int m_flags
Definition: menuitem.h:39
unsigned int m_mnemonic_offset
Definition: menuitem.h:47
a menu bar item
Definition: menuitem.h:44
unsigned char const * m_label
Definition: menuitem.h:35
enum scancodes m_accel_scancode
Definition: menuitem.h:38
unsigned char const * m_accel_label
Definition: menuitem.h:37
void * m_user_data
Definition: menuitem.h:41
struct menuitem * m_items
Definition: menuitem.h:49
unsigned char const * m_label
Definition: menuitem.h:46