diff options
author | Camil Staps | 2019-10-24 08:56:51 +0200 |
---|---|---|
committer | Camil Staps | 2019-10-24 08:56:51 +0200 |
commit | 562189dc3e0a31d630ab1cd147c1d06093a96876 (patch) | |
tree | b89a26d97ccf466e4bcb29cd186a728d85877db5 | |
parent | Add set{Column,Row}Titles convenience functions for GtkSheet (diff) |
Add GtkWrapMode for GtkTextView
-rw-r--r-- | src/Gtk/Internal.dcl | 1 | ||||
-rw-r--r-- | src/Gtk/Internal.icl | 5 | ||||
-rw-r--r-- | src/Gtk/Types.dcl | 8 | ||||
-rw-r--r-- | src/Gtk/Types.icl | 8 | ||||
-rw-r--r-- | src/Gtk/Widgets.dcl | 4 | ||||
-rw-r--r-- | src/Gtk/Widgets.icl | 6 |
6 files changed, 31 insertions, 1 deletions
diff --git a/src/Gtk/Internal.dcl b/src/Gtk/Internal.dcl index fd0bbf5..94c9bc1 100644 --- a/src/Gtk/Internal.dcl +++ b/src/Gtk/Internal.dcl @@ -73,6 +73,7 @@ gtk_text_buffer_set_text :: !Pointer !String !Int !.a -> .a gtk_text_view_new :: !.a -> (!Pointer, !.a) gtk_text_view_get_buffer :: !Pointer -> Pointer gtk_text_view_set_editable :: !Pointer !Bool !.a -> .a +gtk_text_view_set_wrap_mode :: !Pointer !Int !.a -> .a gtk_widget_destroy :: !Pointer !.a -> .a gtk_widget_get_screen :: !Pointer !.a -> (!Pointer, !.a) diff --git a/src/Gtk/Internal.icl b/src/Gtk/Internal.icl index c6809d1..a4a503f 100644 --- a/src/Gtk/Internal.icl +++ b/src/Gtk/Internal.icl @@ -317,6 +317,11 @@ gtk_text_view_set_editable text_view setting env = code { ccall gtk_text_view_set_editable "pI:V:A" } +gtk_text_view_set_wrap_mode :: !Pointer !Int !.a -> .a +gtk_text_view_set_wrap_mode text_view mode env = code { + ccall gtk_text_view_set_wrap_mode "pI:V:A" +} + gtk_widget_destroy :: !Pointer !.a -> .a gtk_widget_destroy widget env = code { ccall gtk_widget_destroy "p:V:A" diff --git a/src/Gtk/Types.dcl b/src/Gtk/Types.dcl index b1231c6..31599a2 100644 --- a/src/Gtk/Types.dcl +++ b/src/Gtk/Types.dcl @@ -79,3 +79,11 @@ instance toInt GtkResponse | StylePriorityUser instance toInt GtkStylePriority + +:: GtkWrapMode + = WrapNone + | WrapChar + | WrapWord + | WrapWordOrChar + +instance toInt GtkWrapMode diff --git a/src/Gtk/Types.icl b/src/Gtk/Types.icl index 3badaa0..5248ddd 100644 --- a/src/Gtk/Types.icl +++ b/src/Gtk/Types.icl @@ -58,3 +58,11 @@ where StylePrioritySettings -> 400 StylePriorityApplication -> 600 StylePriorityUser -> 800 + +instance toInt GtkWrapMode +where + toInt mode = case mode of + WrapNone -> 0 + WrapChar -> 1 + WrapWord -> 2 + WrapWordOrChar -> 3 diff --git a/src/Gtk/Widgets.dcl b/src/Gtk/Widgets.dcl index eb6c2d0..bfed0c6 100644 --- a/src/Gtk/Widgets.dcl +++ b/src/Gtk/Widgets.dcl @@ -10,7 +10,7 @@ from Gtk.Tune import class tune from Gtk.Types import :: GtkCSSClass, :: GtkDirection, :: GtkExpand, :: GtkFileChooserAction, :: GtkLabel, :: GtkMargins, :: GtkModal, :: GtkOrientation, :: GtkPanedHandleWidth, :: GtkResize, :: GtkResponse, - :: GtkShrink, :: GtkStylePriority + :: GtkShrink, :: GtkStylePriority, :: GtkWrapMode class ptr a where @@ -116,6 +116,8 @@ instance gtkContainer GtkTextView newTextView :: GtkM GtkTextView getTextBuffer :: !GtkTextView -> GtkTextBuffer +instance tune GtkTextView GtkWrapMode + :: GtkWidget class gtkWidget a :: !a -> GtkWidget diff --git a/src/Gtk/Widgets.icl b/src/Gtk/Widgets.icl index a2a0349..adb655e 100644 --- a/src/Gtk/Widgets.icl +++ b/src/Gtk/Widgets.icl @@ -220,6 +220,12 @@ newTextView = getTextBuffer :: !GtkTextView -> GtkTextBuffer getTextBuffer text_view = gtk_text_view_get_buffer text_view +instance tune GtkTextView GtkWrapMode +where + tune mode text_view = + toState (gtk_text_view_set_wrap_mode text_view (toInt mode)) >>| + pure text_view + :: GtkWidget :== Pointer instance gtkWidget GtkWidget where gtkWidget w = w |