modals: define opcode numbers for opcodes

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-06-26 16:44:40 +08:00
parent a16252e0fb
commit f131a77d4e

View file

@ -77,43 +77,43 @@ pub struct DynamicNotification {
pub(crate) enum Opcode {
// these are blocking calls
/// ask a question, get a single response from a list of defined items (radio box)
PromptWithFixedResponse,
PromptWithFixedResponse = 0,
/// ask a question, get multiple responses from a list of defined items (check box)
PromptWithMultiResponse,
PromptWithMultiResponse = 1,
/// simple notification
Notification,
Notification = 2,
/// display an image
#[cfg(feature = "ditherpunk")]
Image,
Image = 3,
/// dynamic notification - a simple non-interactive notification that allows its text to be dynamically updated
DynamicNotification,
DynamicNotification = 4,
/// listen to dynamic notification - a blocking call, meant to be called from a separate thread from the control loop
ListenToDynamicNotification,
ListenToDynamicNotification = 5,
/// ask a question, get a free-form answer back
PromptWithTextResponse,
PromptWithTextResponse = 6,
/// must be used by the PromptWithTextResponse caller to acknowledge correct input
TextResponseValid,
TextResponseValid = 7,
// these are non-blocking calls
/// add an item to the radio box or check box. Note that all added items
/// are cleared after the relevant "action" call happens (PromptWith[Fixed,Multi]Response)
AddModalItem,
AddModalItem = 8,
/// get the index of the selected radio button / checkboxes
GetModalIndex,
GetModalIndex = 9,
/// raise a progress bar
StartProgress,
StartProgress = 10,
/// update the progress bar
DoUpdateProgress,
DoUpdateProgress = 11,
/// lower a progress bar
StopProgress,
StopProgress = 12,
/// update a dynamic notification's text
UpdateDynamicNotification,
UpdateDynamicNotification = 13,
/// close dynamic notification
CloseDynamicNotification,
CloseDynamicNotification = 14,
/// used by libraries to get the mutex on the server
GetMutex,
GetMutex = 15,
// these are used internally by the modals to handle intermediate state. Do not call from the outside.
// these were originally handled in a separate thread for deferred responses using busy-waits. They are
@ -121,24 +121,24 @@ pub(crate) enum Opcode {
// it does expose some of the internal API mechanics to outside processes. This is fine for the modals
// box because it's a convenience routine used by "everyone"; password boxes are always handled within
// a given secured server so that the attack surface for these do not extend into the modals boundary.
InitiateOp,
FinishProgress,
InitiateOp = 16,
FinishProgress = 17,
TextEntryReturn,
RadioReturn,
CheckBoxReturn,
NotificationReturn,
TextEntryReturn = 18,
RadioReturn = 19,
CheckBoxReturn = 20,
NotificationReturn = 21,
#[cfg(feature = "ditherpunk")]
ImageReturn,
ImageReturn = 22,
DoUpdateDynamicNotification,
DoCloseDynamicNotification,
HandleDynamicNotificationKeyhit,
DoUpdateDynamicNotification = 23,
DoCloseDynamicNotification = 24,
HandleDynamicNotificationKeyhit = 25,
ModalRedraw,
ModalKeypress,
ModalDrop,
Gutter,
ModalRedraw = 26,
ModalKeypress = 27,
ModalDrop = 28,
Gutter = 29,
Quit,
Quit = 30,
}