LMMS
Loading...
Searching...
No Matches
swell-menugen.h
Go to the documentation of this file.
1#ifndef _SWELL_MENUGEN_H_
2#define _SWELL_MENUGEN_H_
3
4
5/* Cockos SWELL (Simple/Small Win32 Emulation Layer for Linux/OSX)
6 Copyright (C) 2006 and later, Cockos, Inc.
7
8 This software is provided 'as-is', without any express or implied
9 warranty. In no event will the authors be held liable for any damages
10 arising from the use of this software.
11
12 Permission is granted to anyone to use this software for any purpose,
13 including commercial applications, and to alter it and redistribute it
14 freely, subject to the following restrictions:
15
16 1. The origin of this software must not be misrepresented; you must not
17 claim that you wrote the original software. If you use this software
18 in a product, an acknowledgment in the product documentation would be
19 appreciated but is not required.
20 2. Altered source versions must be plainly marked as such, and must not be
21 misrepresented as being the original software.
22 3. This notice may not be removed or altered from any source distribution.
23
24 Dynamic menu generation
25
26 Usage:
27
28 See: swell_resgen.php etc
29
30 */
31
32
33#include "swell.h"
34
35
36#ifdef BEGIN
37#undef BEGIN
38#endif
39
40#ifdef END
41#undef END
42#endif
43
44
52
53
54#define SWELL_MENUGEN_POPUP_PREFIX "/.BO^O:"
55#define SWELL_MENUGEN_ENDPOPUP "EN%%%^:"
57{
58 const char *name; // will begin with SWELL_MENUGEN_POPUP_PREFIX on submenus, and will be SWELL_MENUGEN_ENDPOPUP at the end of a submenu
59 unsigned short idx;
60 unsigned short flags;
61};
62
64{
65 public:
68 {
69 m_rec.resid=MAKEINTRESOURCE(recid);
70 m_rec.createFunc=cf;
71 m_rec._next=*h;
72 *h = &m_rec;
73 }
74};
75
76#define SWELL_DEFINE_MENU_RESOURCE_BEGIN(recid) \
77 static void __swell_menu_cf__##recid(HMENU hMenu); \
78 static SWELL_MenuGenHelper __swell_menu_cf_helper__##recid(&SWELL_curmodule_menuresource_head, __swell_menu_cf__##recid, recid); \
79 static void __swell_menu_cf__##recid(HMENU hMenu) { static const SWELL_MenuGen_Entry list[]={{NULL,0,0
80
81#define SWELL_DEFINE_MENU_RESOURCE_END(recid) } }; SWELL_GenerateMenuFromList(hMenu,list+1,sizeof(list)/sizeof(list[0])-1); }
82
83
84#define GRAYED 1
85#define INACTIVE 2
86#define POPUP }, { SWELL_MENUGEN_POPUP_PREFIX
87#define MENUITEM }, {
88#define SEPARATOR NULL, 0xffff
89#define BEGIN
90#define END }, { SWELL_MENUGEN_ENDPOPUP
91
92#endif//_SWELL_MENUGEN_H_
93
SWELL_MenuResourceIndex m_rec
Definition swell-menugen.h:66
SWELL_MenuGenHelper(SWELL_MenuResourceIndex **h, void(*cf)(HMENU), int recid)
Definition swell-menugen.h:67
Definition swell-menugen.h:57
unsigned short idx
Definition swell-menugen.h:59
unsigned short flags
Definition swell-menugen.h:60
const char * name
Definition swell-menugen.h:58
Definition swell-menugen.h:46
void(* createFunc)(HMENU hMenu)
Definition swell-menugen.h:48
struct SWELL_MenuResourceIndex * _next
Definition swell-menugen.h:49
const char * resid
Definition swell-menugen.h:47
void DWORD DWORD LPVOID DWORD cf
Definition swell-functions.h:807
SWELL_MenuResourceIndex * SWELL_curmodule_menuresource_head
Definition swell-menu-generic.cpp:1293
struct HMENU__ * HMENU
Definition swell-types.h:211
#define MAKEINTRESOURCE(x)
Definition swell-types.h:1157
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
#define void
Definition unzip.h:396