diff options
Diffstat (limited to 'src/Gtk/Widgets')
-rw-r--r-- | src/Gtk/Widgets/Sheet.dcl | 13 | ||||
-rw-r--r-- | src/Gtk/Widgets/Sheet.icl | 24 | ||||
-rw-r--r-- | src/Gtk/Widgets/Sheet/Internal.dcl | 5 | ||||
-rw-r--r-- | src/Gtk/Widgets/Sheet/Internal.icl | 11 |
4 files changed, 53 insertions, 0 deletions
diff --git a/src/Gtk/Widgets/Sheet.dcl b/src/Gtk/Widgets/Sheet.dcl new file mode 100644 index 0000000..a567276 --- /dev/null +++ b/src/Gtk/Widgets/Sheet.dcl @@ -0,0 +1,13 @@ +definition module Gtk.Widgets.Sheet + +from Gtk.State import :: State, :: StateT, :: Identity, :: GtkState, :: GtkM +from Gtk.Widgets import + class gtkWidget, :: GtkWidget, + class gtkContainer, :: GtkContainer + +:: GtkSheet + +instance gtkWidget GtkSheet +instance gtkContainer GtkSheet + +newSheet :: !Int !Int !String -> GtkM GtkSheet diff --git a/src/Gtk/Widgets/Sheet.icl b/src/Gtk/Widgets/Sheet.icl new file mode 100644 index 0000000..9d8a50c --- /dev/null +++ b/src/Gtk/Widgets/Sheet.icl @@ -0,0 +1,24 @@ +implementation 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. + */ + +import Control.Monad +import Control.Monad.Identity +import Control.Monad.State +import System._Pointer + +import Gtk +import qualified Gtk.Widgets.Sheet.Internal as I + +:: GtkSheet :== Pointer + +instance gtkWidget GtkSheet where gtkWidget s = fromPtr s +instance gtkContainer GtkSheet where gtkContainer s = fromPtr s + +newSheet :: !Int !Int !String -> GtkM GtkSheet +newSheet nrows ncols title = + toStateR ('I'.gtk_sheet_new nrows ncols title) >>= show diff --git a/src/Gtk/Widgets/Sheet/Internal.dcl b/src/Gtk/Widgets/Sheet/Internal.dcl new file mode 100644 index 0000000..b356f5b --- /dev/null +++ b/src/Gtk/Widgets/Sheet/Internal.dcl @@ -0,0 +1,5 @@ +definition module Gtk.Widgets.Sheet.Internal + +from System._Pointer import :: Pointer + +gtk_sheet_new :: !Int !Int !String !.a -> (!Pointer, !.a) diff --git a/src/Gtk/Widgets/Sheet/Internal.icl b/src/Gtk/Widgets/Sheet/Internal.icl new file mode 100644 index 0000000..e0df1e5 --- /dev/null +++ b/src/Gtk/Widgets/Sheet/Internal.icl @@ -0,0 +1,11 @@ +implementation module Gtk.Widgets.Sheet.Internal + +import System._Pointer + +gtk_sheet_new :: !Int !Int !String !.a -> (!Pointer, !.a) +gtk_sheet_new rows cols title env = new rows cols (packString title) env +where + new :: !Int !Int !String !.a -> (!Pointer, !.a) + new _ _ _ _ = code { + ccall gtk_sheet_new "IIs:p:A" + } |