Common.dcl 3.74 KB
Newer Older
1 2 3 4 5 6
definition module iTasks.UI.Layout.Common
/**
* This module provides common alternative layout annotations
* that you can apply at strategic points in your task specifications
* to optimize the user experience for specific tasks
*/
7
import iTasks.UI.Layout
8
from iTasks.UI.Definition import :: UISide(..), :: UIDirection(..), :: UIWindowType(..), :: UIHAlign(..), :: UIVAlign(..)
9
from iTasks.UI.Prompt import :: Title, :: Label, :: Icon
10
from iTasks.WF.Definition import :: Task
11
from iTasks.WF.Combinators.Tune import class tune
12

13 14 15 16 17
/**
* Add a CSS class to customize styling
*/
addCSSClass :: String -> LayoutRule

Bas Lijnse's avatar
Bas Lijnse committed
18 19
/**
* Create a tabset with all child items as separate tabs
Mart Lubbers's avatar
Mart Lubbers committed
20
* The flag denotes whether close buttons should be lifted to the tabs
Bas Lijnse's avatar
Bas Lijnse committed
21
*/
22
arrangeWithTabs :: Bool -> LayoutRule
23

24 25 26 27 28 29 30
/**
* Extract one child item and put it in a separate 'header' panel on top of the screen
* 
* @param Index of the task in the set that will be used as header
*/
arrangeWithHeader :: !Int -> LayoutRule

Bas Lijnse's avatar
Bas Lijnse committed
31 32
/**
* Extract one child item and put it in a separate panel at the side of the screen
Bas Lijnse's avatar
Bas Lijnse committed
33 34 35 36
*
* @param Index of the task in the set that should be put in the sidebar
* @param Location of the sidebar
* @param Enable resize?
Bas Lijnse's avatar
Bas Lijnse committed
37
*/
38 39
arrangeWithSideBar :: !Int !UISide !Bool -> LayoutRule

Bas Lijnse's avatar
Bas Lijnse committed
40

Mart Lubbers's avatar
Mart Lubbers committed
41 42
/**
 * Lift actions starting with / to the menu
Mart Lubbers's avatar
Mart Lubbers committed
43
 * @param The list of paths to menu separators
Mart Lubbers's avatar
Mart Lubbers committed
44
 */
45
arrangeAsMenu :: [[Int]] -> LayoutRule
Mart Lubbers's avatar
Mart Lubbers committed
46

47 48
/**
* Divide the available screen space
Bas Lijnse's avatar
Bas Lijnse committed
49 50 51
*
* @param Direction to split the available space in
* @param Enable resize?
52
*/
53
arrangeSplit :: !UIDirection !Bool -> LayoutRule
54

Bas Lijnse's avatar
Bas Lijnse committed
55 56 57
/**
*  Turn current UI into a panel and set direction to vertical.
*/
58
arrangeVertical :: LayoutRule
59

Bas Lijnse's avatar
Bas Lijnse committed
60 61 62
/**
*  Turn current UI into a panel and set direction to vertical.
*/
63
arrangeHorizontal :: LayoutRule
64

Bas Lijnse's avatar
Bas Lijnse committed
65 66 67 68 69
/**
* Turn the UI into a wrapping framed container inside a general container
* 
* Use this is if you don't want to use the entire viewport
*/
70
frameCompact :: LayoutRule
Bas Lijnse's avatar
Bas Lijnse committed
71

Bas Lijnse's avatar
Bas Lijnse committed
72 73 74
/**
* Add a tool bar and move selected actions to it
*/ 
75
insertToolBar :: [String] -> LayoutRule
Bas Lijnse's avatar
Bas Lijnse committed
76

77
//Convenient annotatation types
Mart Lubbers's avatar
Mart Lubbers committed
78
:: ArrangeWithTabs = ArrangeWithTabs Bool
79
instance tune ArrangeWithTabs Task
80

81
:: ArrangeWithSideBar = ArrangeWithSideBar !Int !UISide !Bool
82
instance tune ArrangeWithSideBar Task
Bas Lijnse's avatar
Bas Lijnse committed
83

84 85 86
:: ArrangeWithHeader = ArrangeWithHeader !Int
instance tune ArrangeWithHeader Task

Mart Lubbers's avatar
Mart Lubbers committed
87
:: ArrangeAsMenu = ArrangeAsMenu [[Int]]
Mart Lubbers's avatar
Mart Lubbers committed
88 89
instance tune ArrangeAsMenu Task

Bas Lijnse's avatar
Bas Lijnse committed
90
:: ArrangeSplit = ArrangeSplit !UIDirection !Bool
91
instance tune ArrangeSplit Task
Bas Lijnse's avatar
Bas Lijnse committed
92

93
:: ArrangeVertical = ArrangeVertical
94
instance tune ArrangeVertical Task
95 96

:: ArrangeHorizontal = ArrangeHorizontal
97
instance tune ArrangeHorizontal Task
98

Bas Lijnse's avatar
Bas Lijnse committed
99
//Changing container types
100

101
toContainer ::                                   LayoutRule
102
toPanel     :: Bool ->                           LayoutRule
103 104
toWindow    :: UIWindowType UIVAlign UIHAlign -> LayoutRule
toEmpty     ::                                   LayoutRule
105

106 107 108 109
:: ToWindow = ToWindow UIWindowType UIVAlign UIHAlign
InWindow                :== InFloatingWindow
InFloatingWindow        :== ToWindow FloatingWindow AlignMiddle AlignCenter
InNotificationBubble    :== ToWindow NotificationBubble AlignTop AlignRight
110
instance tune ToWindow Task
111

Mart Lubbers's avatar
Mart Lubbers committed
112
:: InPanel          = InPanel Bool      //Indicate that a task should be wrapped in a panel
113
instance tune InPanel Task
Bas Lijnse's avatar
Bas Lijnse committed
114 115

:: InContainer      = InContainer       //Indicate that a task should be wrapped in a panel
116
instance tune InContainer Task
Bas Lijnse's avatar
Bas Lijnse committed
117

118
:: NoUserInterface  = NoUserInterface   //Replace the UI by an empty UI
119
instance tune NoUserInterface Task
Bas Lijnse's avatar
Bas Lijnse committed
120

121
actionToButton :: LayoutRule
Bas Lijnse's avatar
Bas Lijnse committed
122

123
setActionIcon :: (Map String String) -> LayoutRule
124

Bas Lijnse's avatar
Bas Lijnse committed
125
//Setting attributes 
126 127 128
instance tune Title Task
instance tune Label Task
instance tune Icon Task
Bas Lijnse's avatar
Bas Lijnse committed
129

Mart Lubbers's avatar
Mart Lubbers committed
130 131 132
/*
 * Format a basic editor as if it was a generic labelled iconized edtior
 */
133
toFormItem :: LayoutRule