summaryrefslogtreecommitdiff
path: root/src/Gtk/Types.dcl
blob: 4676e6cd9eb894bb50e7081176a1b1f223994128 (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
definition module Gtk.Types

/**
 * This module provides common types for the Gtk library.
 *
 * Most of these types map directly to Glib, Gdk, or Gtk `enum`s --- for more
 * explanation, see the Gtk+ 3 reference manual:
 * https://developer.gnome.org/gtk3/stable/
 *
 * Some types, like `GtkExpand`, map to booleans in the C libraries, and are
 * merely provided for more readable Clean code (in the case of `GtkExpand` for
 * example for `packBox`).
 */

from StdOverloaded import class fromInt, class toInt

:: GType
	// This is not exhaustive
	= GTypeBool
	| GTypeChar
	| GTypeInt
	| GTypeReal
	| GTypeString

instance toInt GType

:: GValue
	// This is not exhaustive
	= GValueBool !Bool
	| GValueChar !Char
	| GValueInt !Int
	| GValueReal !Real
	| GValueString !String

:: GdkModifier
	= ShiftMask
	| LockMask
	| ControlMask
	| Mod1Mask
	| Mod2Mask
	| Mod3Mask
	| Mod4Mask
	| Mod5Mask
	| Button1Mask
	| Button2Mask
	| Button3Mask
	| Button4Mask
	| Button5Mask
	| SuperMask
	| HyperMask
	| MetaMask

instance toInt GdkModifier
instance toInt [GdkModifier]

:: GtkAlign
	= AlignFill
	| AlignStart
	| AlignEnd
	| AlignCenter
	| AlignBaseline

instance toInt GtkAlign

:: GtkButtonsType
	= NoButtons
	| OkButton
	| CloseButton
	| CancelButton
	| YesNoButtons
	| OkCancelButtons

instance toInt GtkButtonsType

:: GtkCompletionMode
	= InlineCompletion
	| NoInlineCompletion
	| InlineSelection
	| NoInlineSelection

:: GtkCSSClass
	= Class !String

:: GtkDirection
	= StartToEnd
	| EndToStart

:: GtkExpand
	= Expand
	| NoExpand

:: GtkFileChooserAction
	= OpenAction
	| SaveAction
	| SelectFolderAction
	| CreateFolderAction

instance toInt GtkFileChooserAction

:: GtkIconSize
	= MenuIconSize
	| SmallToolbarIconSize
	| LargeToolbarIconSize
	| ButtonIconSize
	| DragAndDropIconSize
	| DialogIconSize

instance toInt GtkIconSize

:: GtkJustification
	= JustifyLeft
	| JustifyRight
	| JustifyCenter
	| JustifyFill

instance toInt GtkJustification

:: GtkLineSpacingModifier
	= PixelsAboveLines !Int
	| PixelsBelowLines !Int
	| PixelsInsideWrap !Int

:: GtkMargins =
	{ left   :: !Int
	, top    :: !Int
	, right  :: !Int
	, bottom :: !Int
	}

//* Creates a `GtkMargins` record where all margins are the same.
margin :: !Int -> GtkMargins

/**
 * Used to avoid multiple `setMarkup` functions. This is like `GtkText`, but
 * assumes that the string contains Pango markup. For an overview of the Pango
 * markup language, see the documentation:
 * https://developer.gnome.org/pygtk/stable/pango-markup-language.html
 */
:: GtkMarkup =: Markup String

:: GtkMessageType
	= InfoMessage
	| WarningMessage
	| QuestionMessage
	| ErrorMessage
	| OtherMessage

instance toInt GtkMessageType

:: GtkModal
	= Modal
	| NotModal

:: GtkOrientation
	= Horizontal
	| Vertical

:: GtkPanedHandleWidth
	= WideHandle
	| NarrowHandle

:: GtkPropagate
	= Propagate
	| StopPropagation

:: GtkResize
	= Resize
	| NoResize

:: GtkResponse
	= ResponseNone
	| ResponseReject
	| ResponseAccept
	| ResponseDeleteEvent
	| ResponseOk
	| ResponseCancel
	| ResponseClose
	| ResponseYes
	| ResponseNo
	| ResponseApply
	| ResponseHelp

//* Illegal values map to `ResponseNone`.
instance fromInt GtkResponse
instance toInt GtkResponse

:: GtkScrollbarPolicy
	= PersistentScrollbar
	| AutoScrollbar
	| NoScrollbar

instance toInt GtkScrollbarPolicy

:: GtkSensitivity
	= Sensitive
	| Insensitive

:: GtkShrink
	= Shrink
	| NoShrink

:: GtkSizeRequest =: GtkSizeRequest (!Int,!Int)

:: GtkSortable
	= Sortable
	| NotSortable

:: GtkSpacing =: Spacing Int

:: GtkStylePriority
	= StylePriorityFallback
	| StylePriorityTheme
	| StylePrioritySettings
	| StylePriorityApplication
	| StylePriorityUser

instance toInt GtkStylePriority

/**
 * Used to avoid multiple `setText` functions.
 * The string is assumed to be valid UTF-8.
 */
:: GtkText =: Text String

:: GtkTimeout
	= Milliseconds !Int
	| Seconds !Int

:: GtkTitle =: Title String

:: GtkTreeViewColumnSizing
	= OnlyGrow
	| AutoSize
	| FixedSize

instance toInt GtkTreeViewColumnSizing

:: GtkWrapMode
	= WrapNone
	| WrapChar
	| WrapWord
	| WrapWordOrChar

instance toInt GtkWrapMode