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 { pub(crate) enum Opcode {
// these are blocking calls // these are blocking calls
/// ask a question, get a single response from a list of defined items (radio box) /// 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) /// ask a question, get multiple responses from a list of defined items (check box)
PromptWithMultiResponse, PromptWithMultiResponse = 1,
/// simple notification /// simple notification
Notification, Notification = 2,
/// display an image /// display an image
#[cfg(feature = "ditherpunk")] #[cfg(feature = "ditherpunk")]
Image, Image = 3,
/// dynamic notification - a simple non-interactive notification that allows its text to be dynamically updated /// 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 /// 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 /// ask a question, get a free-form answer back
PromptWithTextResponse, PromptWithTextResponse = 6,
/// must be used by the PromptWithTextResponse caller to acknowledge correct input /// must be used by the PromptWithTextResponse caller to acknowledge correct input
TextResponseValid, TextResponseValid = 7,
// these are non-blocking calls // these are non-blocking calls
/// add an item to the radio box or check box. Note that all added items /// 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) /// are cleared after the relevant "action" call happens (PromptWith[Fixed,Multi]Response)
AddModalItem, AddModalItem = 8,
/// get the index of the selected radio button / checkboxes /// get the index of the selected radio button / checkboxes
GetModalIndex, GetModalIndex = 9,
/// raise a progress bar /// raise a progress bar
StartProgress, StartProgress = 10,
/// update the progress bar /// update the progress bar
DoUpdateProgress, DoUpdateProgress = 11,
/// lower a progress bar /// lower a progress bar
StopProgress, StopProgress = 12,
/// update a dynamic notification's text /// update a dynamic notification's text
UpdateDynamicNotification, UpdateDynamicNotification = 13,
/// close dynamic notification /// close dynamic notification
CloseDynamicNotification, CloseDynamicNotification = 14,
/// used by libraries to get the mutex on the server /// 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 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 // 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 // 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 // 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. // a given secured server so that the attack surface for these do not extend into the modals boundary.
InitiateOp, InitiateOp = 16,
FinishProgress, FinishProgress = 17,
TextEntryReturn, TextEntryReturn = 18,
RadioReturn, RadioReturn = 19,
CheckBoxReturn, CheckBoxReturn = 20,
NotificationReturn, NotificationReturn = 21,
#[cfg(feature = "ditherpunk")] #[cfg(feature = "ditherpunk")]
ImageReturn, ImageReturn = 22,
DoUpdateDynamicNotification, DoUpdateDynamicNotification = 23,
DoCloseDynamicNotification, DoCloseDynamicNotification = 24,
HandleDynamicNotificationKeyhit, HandleDynamicNotificationKeyhit = 25,
ModalRedraw, ModalRedraw = 26,
ModalKeypress, ModalKeypress = 27,
ModalDrop, ModalDrop = 28,
Gutter, Gutter = 29,
Quit, Quit = 30,
} }