BankEdit.c++
2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
* File: BankEdit.c
*
* Impliments the gui for the bank editor portion of AudioEditor.
*
******************************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/Form.h>
#include <Xm/BulletinB.h>
#include "Editor.h"
#include "EditMgr.h"
#include "AssetMgr.h"
#include "Mgrs.h"
static void destroy_cb(Widget w, XtPointer client_data, XmAnyCallbackStruct *call_data);
BankEditor::BankEditor(void *theEdMgr, Display *display)
{
shellWidget = XtVaAppCreateShell("BankEditor", "XBankEditor",
topLevelShellWidgetClass, display,
XmNheight, 300,
XmNwidth, 300, NULL);
XtAddCallback(shellWidget, XmNdestroyCallback, destroy_cb, (XtPointer)theEdMgr);
theForm = XtVaCreateManagedWidget("BankForm", xmFormWidgetClass, shellWidget,
NULL);
assetList = theAssetMgr->ListBanks(&numBanks);
if(numBanks)
this->CreateBankMenu();
XtRealizeWidget(shellWidget);
}
void BankEditor::CreateBankMenu(void)
{
int c;
Widget bankMenu, subMenu, menuItem, menuItem1;
XmString menuTitle;
Arg args[8];
Cardinal argc = 0;
subMenu = XmCreatePulldownMenu(theForm, "BankMenu", NULL, 0);
for(c = 0; c < numBanks; c++)
{
menuItem = XmCreatePushButton(subMenu, assetList[c].name, NULL, 0);
XtManageChild(menuItem);
if(c == 0)
menuItem1 = menuItem;
}
menuTitle = XmStringCreateSimple("Banks");
XtSetArg(args[argc], XmNy, 10); argc++;
XtSetArg(args[argc], XmNx, 10); argc++;
XtSetArg(args[argc], XmNlabelString, menuTitle); argc++;
XtSetArg(args[argc], XmNsubMenuId, subMenu); argc++;
XtSetArg(args[argc], XmNmenuHistory, menuItem1); argc++;
bankMenu = XmCreateOptionMenu(theForm, "Banks", args, argc);
XtManageChild(bankMenu);
XmStringFree(menuTitle);
}
static void destroy_cb(Widget w, XtPointer client_data, XmAnyCallbackStruct *call_data)
{
EditMgr *theEdMgr = (EditMgr*)client_data;
theEdMgr->removeBank();
}