Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Simple confirm dialog, displaying accept and close buttons and optional title. Usually embedded in a zstack component and displayed/hidden depending on context.
Similar to Monomer.Widgets.Containers.Alert, but takes two events to handle the Accept and Cancel actions.
A simple text message can be displayed with confirmMsg
, providing the message
text and the events to generate when the user interacts with the dialog:
confirmMsg "Save changes?" ConfirmAcceptEvent ConfirmCancelEvent
Alternatively, a custom widget can be provided to display as content:
customConfirm = confirm ConfirmAcceptEvent ConfirmCancelEvent where content = hstack [ label "Save changes?", filler, label fileName ]
Synopsis
- data ConfirmCfg
- data InnerConfirmEvt e
- confirm :: (WidgetModel s, WidgetEvent e) => e -> e -> WidgetNode () (InnerConfirmEvt e) -> WidgetNode s e
- confirm_ :: (WidgetModel s, WidgetEvent e) => e -> e -> [ConfirmCfg] -> WidgetNode () (InnerConfirmEvt e) -> WidgetNode s e
- confirmMsg :: (WidgetModel s, WidgetEvent e) => Text -> e -> e -> WidgetNode s e
- confirmMsg_ :: (WidgetModel s, WidgetEvent e) => Text -> e -> e -> [ConfirmCfg] -> WidgetNode s e
Configuration
data ConfirmCfg Source #
Configuration options for confirm:
titleCaption
: the title of the alert dialog.acceptCaption
: the caption of the accept button.closeCaption
: the caption of the close button.
Instances
Semigroup ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm (<>) :: ConfirmCfg -> ConfirmCfg -> ConfirmCfg # sconcat :: NonEmpty ConfirmCfg -> ConfirmCfg # stimes :: Integral b => b -> ConfirmCfg -> ConfirmCfg # | |
Monoid ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm mempty :: ConfirmCfg # mappend :: ConfirmCfg -> ConfirmCfg -> ConfirmCfg # mconcat :: [ConfirmCfg] -> ConfirmCfg # | |
Default ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm def :: ConfirmCfg # | |
CmbCancelCaption ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm cancelCaption :: Text -> ConfirmCfg Source # | |
CmbAcceptCaption ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm acceptCaption :: Text -> ConfirmCfg Source # | |
CmbTitleCaption ConfirmCfg Source # | |
Defined in Monomer.Widgets.Containers.Confirm titleCaption :: Text -> ConfirmCfg Source # |
data InnerConfirmEvt e Source #
Wraps the user event to be able to implement custom events and still be able to report to its parent.
Previously used, now kept for reference.
Instances
Eq e => Eq (InnerConfirmEvt e) Source # | |
Defined in Monomer.Widgets.Containers.Confirm (==) :: InnerConfirmEvt e -> InnerConfirmEvt e -> Bool # (/=) :: InnerConfirmEvt e -> InnerConfirmEvt e -> Bool # | |
Show e => Show (InnerConfirmEvt e) Source # | |
Defined in Monomer.Widgets.Containers.Confirm showsPrec :: Int -> InnerConfirmEvt e -> ShowS # show :: InnerConfirmEvt e -> String # showList :: [InnerConfirmEvt e] -> ShowS # |
Constructors
:: (WidgetModel s, WidgetEvent e) | |
=> e | The accept button event. |
-> e | The cancel button event. |
-> WidgetNode () (InnerConfirmEvt e) | Content to display in the dialog. |
-> WidgetNode s e | The created dialog. |
Creates a confirm dialog with the provided content.
:: (WidgetModel s, WidgetEvent e) | |
=> e | The accept button event. |
-> e | The cancel button event. |
-> [ConfirmCfg] | The config options for the dialog. |
-> WidgetNode () (InnerConfirmEvt e) | Content to display in the dialog. |
-> WidgetNode s e | The created dialog. |
Creates an alert dialog with the provided content. Accepts config.
:: (WidgetModel s, WidgetEvent e) | |
=> Text | The message to display in the dialog. |
-> e | The accept button event. |
-> e | The cancel button event. |
-> WidgetNode s e | The created dialog. |
Creates an alert dialog with a text message as content.
:: (WidgetModel s, WidgetEvent e) | |
=> Text | The message to display in the dialog. |
-> e | The accept button event. |
-> e | The cancel button event. |
-> [ConfirmCfg] | The config options for the dialog. |
-> WidgetNode s e | The created dialog. |
Creates an alert dialog with a text message as content. Accepts config.