summaryrefslogtreecommitdiffstats
path: root/src/app/cmd_context.rs
blob: f5a955ae4642b552c20cc01ff1020433d350f7e1 (plain)
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
use {
    super::*,
    crate::{
        command::*,
        display::{Areas, Screen},
        skin::PanelSkin,
    },
};

/// short lived wrapping of a few things which are needed for the handling
/// of a command in a panel and won't be modified during the operation.
pub struct CmdContext<'c> {
    pub cmd: &'c Command,
    pub app: &'c AppCmdContext<'c>,
    pub panel: PanelCmdContext<'c>,
}

/// the part of the immutable command execution context which comes from the app
pub struct AppCmdContext<'c> {
    pub panel_skin: &'c PanelSkin,
    pub preview_panel: Option<PanelId>, // id of the app's preview panel
    pub stage_panel: Option<PanelId>, // id of the app's preview panel
    pub screen: Screen,
    pub con: &'c AppContext,
}

/// the part of the command execution context which comes from the panel
pub struct PanelCmdContext<'c> {
    pub areas: &'c Areas,
    pub purpose: PanelPurpose,
}