AePriorityFieldUI.c++
2.04 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <Vk/VkPopupMenu.h>
#include "GList.h"
#include "AeTypes.h"
#include "AeBinEditor.h"
#include "AeAsset.h"
#include "AeAssetBinUI.h"
#include "AeAssetUI.h"
#include "AeFieldUI.h"
#include "AeBinView.h"
AePriorityFieldUI::AePriorityFieldUI (const char * name,
Boolean isEditable,
Boolean isSelectable,
Boolean isHierarchical,
TJustify justify,
TIntGetProc getProc,
TIntSetProc setProc) :
AeIntFieldUI (name, isEditable, isSelectable, isHierarchical,
justify, getProc, setProc)
{
}
AePriorityFieldUI::AePriorityFieldUI (const char * name,
Boolean isEditable,
Boolean isSelectable,
Boolean isHierarchical,
TJustify justify,
TIntGetProc getProc,
TIntSetProc setProc,
int min, int max, int def) :
AeIntFieldUI (name, isEditable, isSelectable, isHierarchical, justify,
getProc, setProc, min, max, def)
{
}
AePriorityFieldUI::~AePriorityFieldUI (void)
{
}
void
AePriorityFieldUI::SetValue (AeAsset * asset, void * value)
{
assert (fSetProc);
fSetProc (asset, (int)value);
}
Boolean
AePriorityFieldUI::HandleButtonPress (AeBinEditor * editor,
AeAssetUI * assetUI,
XEvent * event,
TEditModifier modifier)
{
assert (editor);
assert (assetUI);
if (modifier == kModMotion)
return False;
AeBinEditor::fMenuEditor = editor;
AeBinEditor::fMenuAssetUI = assetUI;
AeBinEditor::fMenuFieldUI = this;
AeBinView * view = editor->GetView ();
addMenuItems (assetUI, view->PopupGet ());
view->PopupShow (event);
return True;
}
void
AePriorityFieldUI::addMenuItems (AeAssetUI * assetUI, VkPopupMenu * popup)
{
TString63 string;
int i;
popup->addAction ("Hi", &AeBinEditor::MenuCallback, (XtPointer)fMax);
for (i=fMax; --i>fMin; )
{
sprintf (string, "%d", i);
popup->addAction (string, &AeBinEditor::MenuCallback, (XtPointer)i);
}
popup->addAction ("Lo", &AeBinEditor::MenuCallback, (XtPointer)fMin);
}