summaryrefslogtreecommitdiff
path: root/src/Gtk/Widgets/Sheet.dcl
blob: ed9c335bf991e357bc815e7f2e8d339ee9ee941d (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
definition module Gtk.Widgets.Sheet

/**
 * This module provides support for GtkSheet; a spreadsheet widget. See
 * https://fpaquet.github.io/gtksheet/ for more details and installation
 * instructions. Use the 'Gtk with GtkSheet' environment.
 *
 * Note that the C library is slightly buggy.
 */

from StdMaybe import :: Maybe

from System._Pointer import :: Pointer

from Gtk.State import :: GtkM
from Gtk.Tune import class tune
from Gtk.Types import :: GtkCSSClass, :: GtkJustification
from Gtk.Widgets import
	class gtkWidget, :: GtkWidget,
	class gtkContainer, :: GtkContainer,
	:: GtkEntry

import Gtk.Widgets.Sheet.Signal

:: GtkSheet (=: GtkSheet Pointer)

instance gtkWidget GtkSheet
instance gtkContainer GtkSheet

newSheet :: !Int !Int !String -> GtkM GtkSheet

/**
 * Freezing a sheet means that the GUI will not be updated; all model updates
 * are collected and the GUI is updated in a single step when the sheet is
 * unfrozen. This is a wrapper function which freezes the sheet, executes the
 * monad, and then unfreezes the sheet again.
 */
whileFrozen :: !(GtkM a) !GtkSheet -> GtkM a

/**
 * Make sure the sheet has the given width and height by adding or deleting
 * rows and columns.
 */
ensureDimensions :: !Int !Int !GtkSheet -> GtkM GtkSheet

setColumnTitle :: !Int !String !GtkSheet -> GtkM GtkSheet
setColumnTitles :: ![String] !GtkSheet -> GtkM GtkSheet
setRowTitle :: !Int !String !GtkSheet -> GtkM GtkSheet
setRowTitles :: ![String] !GtkSheet -> GtkM GtkSheet

setCellText :: !Int !Int !String !GtkSheet -> GtkM GtkSheet
getCellText :: !Int !Int !GtkSheet -> GtkM (Maybe String)

setColumnJustification :: !GtkJustification !Int !GtkSheet -> GtkM GtkSheet
setCSSClassForRange :: !GtkCSSClass !(!Int,!Int) !(!Int,!Int) !GtkSheet -> GtkM GtkSheet
setRangeEditable :: !Bool !(!Int,!Int) !(!Int,!Int) !GtkSheet -> GtkM GtkSheet
setRowVisibility :: !Bool !Int !GtkSheet -> GtkM GtkSheet
isRowVisible :: !Int !GtkSheet -> GtkM Bool

getActiveCell :: !GtkSheet -> GtkM (Maybe (Int,Int))
setActiveCell :: !Int !Int !GtkSheet -> GtkM GtkSheet
scrollToCell :: !GtkSheetScrollMode !Int !Int !GtkSheet -> GtkM GtkSheet

getEntry :: !GtkSheet -> GtkM GtkEntry

:: GtkSheetColumnResizability
	= ColumnsResizable
	| ColumnsFixedSize

:: GtkSheetColumnSensitity
	= ColumnsSensitive
	| ColumnsInsensitive

:: GtkSheetRowResizability
	= RowsResizable
	| RowsFixedSize

:: GtkSheetRowSensitity
	= RowsSensitive
	| RowsInsensitive

:: GtkSheetScrollMode
	= CellInTopLeft
	| CellInTopRight
	| CellInBottomLeft
	| CellInBottomRight

instance tune
	GtkSheet GtkSheetColumnResizability,
	GtkSheet GtkSheetColumnSensitity,
	GtkSheet GtkSheetRowResizability,
	GtkSheet GtkSheetRowSensitity