File: Enums.chs

package info (click to toggle)
haskell-gtk 0.11.0-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,920 kB
  • ctags: 82
  • sloc: haskell: 1,929; ansic: 714; sh: 5; makefile: 3
file content (422 lines) | stat: -rw-r--r-- 12,423 bytes parent folder | download
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
{-# LANGUAGE CPP #-}
--  -*-haskell-*-
--  GIMP Toolkit (GTK) Enumerations
--
--  Author : Axel Simon, Manuel Chakravarty
--
--  Created: 13 January 1999
--
--  Copyright (C) 1999..2005 Axel Simon, Manuel Chakravarty
--
--  This library is free software; you can redistribute it and/or
--  modify it under the terms of the GNU Lesser General Public
--  License as published by the Free Software Foundation; either
--  version 2.1 of the License, or (at your option) any later version.
--
--  This library is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--  Lesser General Public License for more details.
--
-- |
-- Maintainer  : gtk2hs-users@lists.sourceforge.net
-- Stability   : provisional
-- Portability : portable (depends on GHC)
--
-- General enumeration types.
--
module Graphics.UI.Gtk.General.Enums (
  AccelFlags(..),
  ArrowType(..),
  AttachOptions(..),
  MouseButton(..),
  ButtonBoxStyle(..),
  CalendarDisplayOptions(..),
  Click(..),
  CornerType(..),
  DeleteType(..),
  DestDefaults(..),
#if GTK_CHECK_VERSION(2,12,0)
  DragResult(..),
#endif
  DirectionType(..),
  Justification(..),
#ifndef DISABLE_DEPRECATED
  MatchType(..),
#endif
  MenuDirectionType(..),
  MetricType(..),
  MovementStep(..),
  Orientation(..),
  Packing(..), toPacking, fromPacking,
  PackType(..),
  PathPriorityType(..),
  PathType(..),
  PolicyType(..),
  PositionType(..),
  ProgressBarOrientation(..),
  ReliefStyle(..),
  ResizeMode(..),
  ScrollType(..),
  ScrollStep (..),
  SelectionMode(..),
  ShadowType(..),
  SortType(..),
  StateType(..),
#ifndef DISABLE_DEPRECATED
  SubmenuDirection(..),
  SubmenuPlacement(..),
#endif
  SpinButtonUpdatePolicy(..),
  SpinType(..),
  TargetFlags(..),
  TextDirection(..),
  TextSearchFlags(..),
  TextWindowType(..),
  ToolbarStyle(..),
  TreeViewColumnSizing(..),
  --TroughType(..),
  UpdateType(..),
  Visibility(..),
  WindowPosition(..),
  WindowType(..),
  WrapMode(..), 
  module Graphics.UI.Gtk.Gdk.Enums
  ) where

import System.Glib.Flags	(Flags)
import Graphics.UI.Gtk.Gdk.Enums

{#context lib="gtk" prefix ="gtk"#}


-- | State of an accelerator
--
{#enum AccelFlags {underscoreToCase} deriving(Bounded,Eq,Show)#}

instance Flags AccelFlags

-- | Arrow directions for the arrow widget
--
{#enum ArrowType {underscoreToCase} deriving (Eq,Show)#}

-- | Child widget attach options for table containers
--
{#enum AttachOptions {underscoreToCase} deriving(Bounded,Eq,Show)#}

instance Flags AttachOptions

-- | Mouse buttons.
--
data MouseButton = LeftButton
		 | MiddleButton
		 | RightButton
		 | OtherButton Int
		   deriving (Eq,Show)

instance Enum MouseButton where
  toEnum 1 = LeftButton
  toEnum 2 = MiddleButton
  toEnum 3 = RightButton
  toEnum n = OtherButton (fromIntegral n)
  fromEnum LeftButton   = 1
  fromEnum MiddleButton = 2
  fromEnum RightButton  = 3
  fromEnum (OtherButton n) = fromIntegral n

-- | Dictate the style that a ButtonBox uses to align it contents
--
{#enum ButtonBoxStyle {underscoreToCase} deriving (Eq,Show)#}

-- | Specify which items of a calendar should be displayed.
--
{#enum CalendarDisplayOptions {underscoreToCase} deriving(Bounded,Eq,Show)#}

instance Flags CalendarDisplayOptions

-- | Type of mouse click
--
data Click = SingleClick
	   | DoubleClick
	   | TripleClick
	   | ReleaseClick
  deriving (Eq,Show,Enum)

-- | Specifies in which corner a child widget should be placed
--
{#enum CornerType {underscoreToCase} deriving (Eq,Show)#}

-- | Editing option
--
{#enum DeleteType {underscoreToCase} deriving (Eq,Show)#}

-- | The 'DestDefaults' enumeration specifies the various types of action that
-- will be taken on behalf of the user for a drag destination site.
--
-- * 'DestDefaultMotion': If set for a widget, GTK+, during a drag over this
--   widget will check if the drag matches this widget's list of possible
--   targets and actions. GTK+ will then call
--   'Graphics.UI.Gtk.Gdk.Drag.dragStatus' as appropriate.
--
-- * 'DestDefaultHighlight': If set for a widget, GTK+ will draw a
--   highlight on this widget as long as a drag is over this widget and the
--   widget drag format and action are acceptable.
--
-- * 'DestDefaultDrop': If set for a widget, when a drop occurs, GTK+ will
--   will check if the drag matches this widget's list of possible targets and
--   actions. If so, GTK+ will call 'Graphics.UI.Gtk.Gdk.Drag.dragGetData' on
--   behalf of the widget. Whether or not the drop is successful, GTK+ will
--   call 'Graphics.UI.Gtk.Gdk.Drag.dragFinish'. If the action was a move,
--   then if the drag was successful, then @True@ will be passed for the
--   delete parameter to 'Graphics.UI.Gtk.Gdk.Drag.dragFinish'
--
-- * 'DestDefaultAll':   If set, specifies that all default actions should be
--   taken.
--
{#enum DestDefaults {underscoreToCase} deriving (Bounded,Eq,Show)#}

instance Flags DestDefaults

#if GTK_CHECK_VERSION(2,12,0)
-- | Gives an indication why a drag operation failed. The value can by
-- obtained by connecting to the 'dragFailed' signal.
--
-- * 'DragResultSuccess': The drag operation was successful
--
-- * 'DragResultNoTarget': No suitable drag target
--
-- * 'DragResultUserCancelled': The user cancelled the drag operation
--
-- * 'DragResultTimeoutExpired': The drag operation timed out
--
-- * 'DragResultGrabBroken': The pointer or keyboard grab used for the drag
--   operation was broken
--
-- * 'DragResultError': The drag operation failed due to some unspecified error
--
{#enum DragResult {underscoreToCase} deriving (Bounded,Eq,Show)#}
#endif

-- | Editing direction
--
{#enum DirectionType {underscoreToCase} deriving (Eq,Show)#}

-- | Justification for label and maybe other widgets (text?)
--
{#enum Justification {underscoreToCase} deriving (Eq,Show)#}

#ifndef DISABLE_DEPRECATED
-- | Some kind of string search options
--
{#enum MatchType {underscoreToCase} deriving (Eq,Show)#}
#endif

-- | From where was a menu item entered?
--
{#enum MenuDirectionType {underscoreToCase} deriving (Eq,Show)#}

-- | Units of measure
--
{#enum MetricType {underscoreToCase} deriving (Eq,Show)#}

-- | Movement in text widget
--
{#enum MovementStep {underscoreToCase} deriving (Eq,Show)#}

-- | Orientation is good
--
{#enum Orientation {underscoreToCase} deriving (Eq,Show)#}

-- | Packing parameters of a widget
--
-- * The 'Packing' parameter determines how the child behaves in the horizontal
--   or vertical way in an 'Graphics.UI.Gtk.Layout.HBox' or
--   'Graphics.UI.Gtk.Layout.VBox', respectively. 'PackNatural'
--   means the child is as big as it reqests. It will stay at the start of the
--   end of a 'Graphics.UI.Gtk.Layout.Box' if there is more space available.
--   All children packed with 'PackRepel' will be padded on both sides with
--   additional space. 'PackGrow' will increase the size of a widget so that it
--   covers the available space. A menu bar, for instance, should always
--   stay at the top of a window and should only occupy as little space
--   as possible. Hence it should be packed at the start of a
--  'Graphics.UI.Gtk.Layout.VBox' with
--   the packing option 'PackNatural'. The working area of a window
--   (e.g. the text area in an editor) should expand when the window is
--   resized. Here the packing option 'PackGrow' is the right choice and
--   it is irrelevant whether the main area is inserted at the start or
--   the end of a box. Finally 'PackRepel' is most useful in a window
--   where no widget can make use of excess space. Examples include a
--   dialog box without list boxes or text fields. 
--
data Packing = PackRepel
	     | PackGrow
	     | PackNatural
	     deriving (Enum,Eq,Show)

-- The conversions between our Packing type and Gtk's expand and fill
-- properties.
--
toPacking :: Bool -> Bool -> Packing
toPacking expand True = PackGrow
toPacking True   fill = PackRepel
toPacking False  fill = PackNatural

fromPacking :: Packing -> (Bool, Bool)
fromPacking PackGrow    = (True,True)
fromPacking PackRepel   = (True,False)
fromPacking PackNatural = (False,False)

-- | Packing of widgets at start or end in a box
--
{#enum PackType {underscoreToCase} deriving (Eq,Show)#}

-- | Priorities
--
{#enum PathPriorityType {underscoreToCase} deriving (Eq,Show)#}

-- | Widget identification path
--
{#enum PathType {underscoreToCase} deriving (Eq,Show)#}

-- | Scrollbar policy types (for scrolled windows)
--
{#enum PolicyType {underscoreToCase} deriving (Eq,Show)#}

-- | Position a scale's value is drawn relative to the
-- trough
--
{#enum PositionType {underscoreToCase} deriving (Eq,Show)#}

-- | Is the ProgressBar horizontally or vertically
-- directed?
--
{#enum ProgressBarOrientation {underscoreToCase} deriving (Eq,Show)#}

-- | I don't have a clue.
--
{#enum ReliefStyle {underscoreToCase} deriving (Eq,Show)#}

-- | Resize mode, for containers
--
-- * 'ResizeParent' Pass resize request to the parent
--
-- * 'ResizeQueue' Queue resizes on this widget
--
-- * 'ResizeImmediate' Perform the resizes now
--
{#enum ResizeMode {underscoreToCase} deriving (Eq,Show)#}

-- | Scrolling type
--
{#enum ScrollType {underscoreToCase} deriving (Eq,Show)#}

-- | Scrolling step
--
{#enum ScrollStep {underscoreToCase} deriving (Eq,Show)#}

-- | Mode in which selections can be performed
--
-- * There is a deprecated entry SelectionExtended which should have the same
--   value as SelectionMultiple. C2HS chokes on that construct.
--
data SelectionMode = SelectionNone
                   | SelectionSingle
                   | SelectionBrowse
                   | SelectionMultiple
                   deriving (Enum,Eq,Show)
-- {#enum SelectionMode {underscoreToCase} deriving (Eq,Show)#}

-- | Shadow types
--
{#enum ShadowType {underscoreToCase} deriving (Eq,Show)#}

-- Sort a 'Graphics.UI.Gtk.TreeList.TreeViewColumn' in ascending or descending
-- order.
--
{#enum SortType {underscoreToCase} deriving (Eq,Show)#}

-- | Widget states
--
{#enum StateType {underscoreToCase} deriving (Eq,Show)#}

#ifndef DISABLE_DEPRECATED
-- | Submenu direction policies
--
{#enum SubmenuDirection {underscoreToCase} deriving (Eq,Show)#}

-- | Submenu placement policies
--
{#enum SubmenuPlacement {underscoreToCase} deriving (Eq,Show)#}
#endif

-- | Whether to clamp or ignore illegal values.
--
{#enum SpinButtonUpdatePolicy {underscoreToCase} deriving (Eq,Show)#}

-- | Spin a SpinButton with the following method.
--
{#enum SpinType {underscoreToCase} deriving (Eq,Show)#}

-- | The 'TargetFlags' enumeration is used to specify constraints on an entry
--	 in a 'Graphics.UI.Gtk.Gdk.Selection.TargetList'. These flags are only
--	 used for drag and drop.
--
-- * If the 'TargetSameApp' flag is set, the target will only be selected for
--	 drags within a single application.
--
-- * If the 'TargetSameWidget' flag is set, the target will only be selected
--	 for drags within a single widget.
--
{#enum TargetFlags {underscoreToCase} deriving(Bounded,Eq,Show) #}

instance Flags TargetFlags

-- | Is the text written from left to right or the exotic way?
--
{#enum TextDirection {underscoreToCase} deriving (Eq,Show)#}

-- | Specify the way the search function for
--   'Graphics.UI.Gtk.Multiline.TextBuffer' works.
--
{#enum TextSearchFlags {underscoreToCase} deriving(Bounded,Eq,Show)#}

instance Flags TextSearchFlags

-- | The window type for coordinate translation.
--
{#enum TextWindowType {underscoreToCase} deriving (Eq,Show)#}

-- | Where to place the toolbar?
--
{#enum ToolbarStyle {underscoreToCase} deriving (Eq,Show)#}

-- | Wether columns of a tree or list widget can be resized.
--
{#enum TreeViewColumnSizing {underscoreToCase} deriving (Eq,Show)#}

-- hm... text editing?
--{#enum TroughType {underscoreToCase} deriving (Eq,Show)#}


-- | Updating types for range widgets (determines when the
-- @\"connectToValueChanged\"@ signal is emitted by the widget)
--
{#enum UpdateType {underscoreToCase} deriving (Eq,Show)#}

-- | Visibility
--
{#enum Visibility {underscoreToCase} deriving (Eq,Show)#}

-- | Window position types
--
{#enum WindowPosition {underscoreToCase} deriving (Eq,Show)#}

-- | Interaction of a window with window manager
--
{#enum WindowType {underscoreToCase} deriving (Eq,Show)#}

-- | Determine how lines are wrapped in a 'Graphics.UI.Gtk.Multiline.TextView'.
--
{#enum WrapMode {underscoreToCase} deriving (Eq,Show)#}