bamse-0.9.3: Bamse/Dialog.hs
--------------------------------------------------------------------
-- |
-- Module : Bamse.Dialog
-- Description : Representing MSI dialogs
-- Copyright : (c) Sigbjorn Finne, 2004-2009
-- License : BSD3
--
-- Maintainer : Sigbjorn Finne <sof@forkIO.com>
-- Stability : provisional
-- Portability : portable
--
-- Low-level representation of MSI dialogs; combines together
-- the information stored in the Control, ControlCondition,
-- ControlEvent, and Dialog tables.
--
--------------------------------------------------------------------
module Bamse.Dialog where
data Dialog
= Dialog {
dia_name :: DialogName,
-- ^ The dialog name; must be unique within an installer.
dia_ctrls :: [Control],
-- ^ The list of controls implicitly define the 'next'
-- focussing relationship between controls in a dialog.
dia_conds :: [CCondition],
dia_events :: [CEvent],
dia_pos :: Centering,
dia_size :: Size,
dia_attrs :: [DiaAttribute],
dia_title :: String,
dia_first :: ControlName, -- id of 'first' control
dia_def :: ControlName, -- id of 'default' control
dia_cancel :: ControlName, -- id of 'cancel' control
dia_after :: DialogName, -- what dialog to insert this one after...
dia_cond :: String, -- ..under these conditions.
dia_props :: [(PropertyName, String)]
-- ^ properties and initial values that are used by this
-- dialog.
}
type Centering = (Int,Int)
type Size = (Int,Int)
type Pos = (Int,Int)
type DialogName = String
type PropertyName = String
type ControlName = String
data Control
= Control
{ -- control name.
ctrl_name :: ControlName
-- what kind of control (along with control specific config.)
, ctrl_type :: ControlType
-- the property name that holds the control's value.
, ctrl_prop :: Maybe PropertyName
-- position and size (size in 'dialog/installer' units.)
, ctrl_pos :: Pos
, ctrl_size :: Size
-- initial text
, ctrl_text :: String
, ctrl_attrs :: [Attribute]
, ctrl_next :: ControlName
, ctrl_help :: String
}
{-
Re: Billboard --
displays (property-less) controls that can be dynamically added
and removed from the billboard during the install; often used
to show progress messages etc. The addition or removal of billboard
controls is controlled via the EventMapping table and the association
of controls to a billboard is done via the BBControl table.
-}
-- the type of control; whether or not the control
-- has an associated property attached to it is
data ControlType
= Billboard String
| Bitmap String
| CheckBox String -- w/property; arg is what to set property when checkbox is selected.
| ComboBox -- w/property
| DirectoryCombo -- w/property
| DirectoryList -- w/property
| EditField -- w/property
| GroupBox
| IconControl
| Line Size
| ListBox -- w/property
| ListView -- w/property
| MaskedEdit -- w/property
| PathEdit -- w/property
| ProgressBar -- w/property
| PushButton String
| RadioButtonGroup [RadioButton] -- w/property
| ScrollableText String
| Text String
| VolumeCostList
| VolumeSelectCombo -- w/property
data RadioButton
= RadioButton
String -- text
String -- property value
data Attribute
= Enabled
| Indirect
| IntegerControl
| LeftScroll
| BiDi
| RightAligned
| RightToLeftReadingOrder
| Sunken
| Visible
-- text control attributes
| FormatSize
| NoPrefix
| NoWrap
| Password
| Transparent
| UserLanguage
-- progress bar
| Progress95
-- volume and directory select combo controls
| CDRomVolume
| FixedVolume
| FloppyVolume
| RAMDiskVolume
| RemoteVolume
| RemovableVolume
-- list box and combo box controls attributes
| ComboList
| Sorted
-- edit control
| MultiLine
-- picture button control attributes
| BitmapAttr
| FixedSize
| Icon
| IconSize16
| IconSize32
| IconSize48
| ImageHandle
| PushLike
-- radio button group attributes
| HasBorder
-- volume cost list attrs
| ShowRollback
{-
| BillboardName String
| IndirectPropertyName Label
| ProgressControl Int Int String
| PropertyName Label
| PropertyValue Label
| TextControl String
| TimeRemaining Int
-}
type CCondition
= ( ControlName -- name of control
, String -- action
, String -- the condition, ought to be Expr, really.
)
type CEvent
= ( ControlName -- name of control
, ControlEvent -- the event
, String -- condition
, String -- ordering value/tag.
)
data ControlEvent
= SetProperty String String
| ActionData
| ActionText
| AddLocal String -- feature name
| AddSource String -- feature name
| CheckExistingTargetPath PropertyName
| CheckTargetPath PropertyName
| DirectoryListNew
| DirectoryListOpen
| DirectoryListUp
| DoAction String
| EnableRollback String
| EndDialog String -- one of Exit, Retry, Ignore, Return.
| IgnoreChange
| NewDialog String -- dialog name
| Reinstall String -- feature name (incl "ALL")
| ReinstallMode String
| Remove String -- feature name
| Reset
| ScriptInProgress
| SelectionAction
| SelectionBrowse
| SelectionDescription
| SelectionIcon
| SelectionNoItems
| SelectionPath
| SelectionPathOn
| SelectionSize
| SetInstallLevel Int
| SetProgress
| SetTargetPath PropertyName
| SpawnDialog String -- dialog name
| SpawnWaitDialog String -- dialog name
| TimeRemaining
| ValidateProductID
data DiaAttribute
= DialogVisible
| DialogModal
| DialogMinimize
| DialogSysModal
| DialogKeepModeless
| DialogTrackDiskSpace
| DialogUseCustomPalette
| DialogRightToLeftOrdering
| DialogRightAligned
| DialogLeftScroll
| DialogBiDi
| DialogError