diff --git a/c-src/Fl_Gl_WindowC.cpp b/c-src/Fl_Gl_WindowC.cpp
--- a/c-src/Fl_Gl_WindowC.cpp
+++ b/c-src/Fl_Gl_WindowC.cpp
@@ -795,8 +795,8 @@
   FL_EXPORT_C(void,Fl_Gl_Window_set_context_valid)(fl_Gl_Window win,char v){
     (static_cast<Fl_DerivedGl_Window*>(win))->context_valid(v);
   }
-  FL_EXPORT_C(int,Fl_Gl_Window_can_do_with_m)(fl_Gl_Window win,int m){
-    return (static_cast<Fl_DerivedGl_Window*>(win))->can_do(m);
+  FL_EXPORT_C(int,Fl_Gl_Window_can_do_with_m)(int m){
+    return Fl_DerivedGl_Window::can_do(m);
   }
   FL_EXPORT_C(int,Fl_Gl_Window_can_do)(fl_Gl_Window win){
     return (static_cast<Fl_DerivedGl_Window*>(win))->can_do();
diff --git a/c-src/Fl_Gl_WindowC.h b/c-src/Fl_Gl_WindowC.h
--- a/c-src/Fl_Gl_WindowC.h
+++ b/c-src/Fl_Gl_WindowC.h
@@ -246,7 +246,7 @@
   FL_EXPORT_C(void, Fl_Gl_Window_invalidate)(fl_Gl_Window win);
   FL_EXPORT_C(char, Fl_Gl_Window_context_valid)(fl_Gl_Window win);
   FL_EXPORT_C(void, Fl_Gl_Window_set_context_valid)(fl_Gl_Window win,char v);
-  FL_EXPORT_C(int, Fl_Gl_Window_can_do_with_m)(fl_Gl_Window win,int m);
+  FL_EXPORT_C(int, Fl_Gl_Window_can_do_with_m)(int m);
   FL_EXPORT_C(int, Fl_Gl_Window_can_do)(fl_Gl_Window win);
   FL_EXPORT_C(Fl_Mode, Fl_Gl_Window_mode)(fl_Gl_Window win);
   FL_EXPORT_C(int, Fl_Gl_Window_set_mode)(fl_Gl_Window win,int a);
diff --git a/fltkhs.cabal b/fltkhs.cabal
--- a/fltkhs.cabal
+++ b/fltkhs.cabal
@@ -1,5 +1,5 @@
 name : fltkhs
-version : 0.4.1.0
+version : 0.5.0.0
 synopsis : FLTK bindings
 description:
     Low level bindings for the FLTK GUI toolkit. For installation and quick start instruction please scroll all the way down to the README.
@@ -113,7 +113,8 @@
                    Graphics.UI.FLTK.LowLevel.PNMImage
   build-depends:
                 base == 4.*,
-                bytestring
+                bytestring,
+                text >= 0.2 && < 1.3
   build-tools: c2hs
   hs-source-dirs: src
   other-modules: C2HS
diff --git a/src/Fluid/Generate.hs b/src/Fluid/Generate.hs
--- a/src/Fluid/Generate.hs
+++ b/src/Fluid/Generate.hs
@@ -442,6 +442,9 @@
     (map (\line -> indent ++ "  " ++ line ++ ";") fBody) ++
     [indent ++ "}"]
 
+pragmas :: [String]
+pragmas = [" {-# LANGUAGE OverloadedStrings #-}"]
+
 disclaimer :: [String]
 disclaimer =
   ["-- GENERATED by fltkhs-fluid, do not edit.",
@@ -454,6 +457,7 @@
   , "import Graphics.UI.FLTK.LowLevel.Fl_Types"
   , "import Graphics.UI.FLTK.LowLevel.Fl_Enumerations"
   , "import Data.Maybe"
+  , "import qualified Data.Text as T"
   ]
 
 fluidBlockG :: FluidBlock -> Maybe [String]
@@ -467,7 +471,7 @@
     Nothing -> Left (BadModuleName "")
     Just (InvalidModule m) -> Left (BadModuleName m)
     Just (ValidModule m ) ->
-      Right(intersperse "\n" (disclaimer ++ ["module " ++ m ++ " where "] ++ standardImports ++ blocksToHaskell))
+      Right(intersperse "\n" (pragmas ++ disclaimer ++ ["module " ++ m ++ " where "] ++ standardImports ++ blocksToHaskell))
   where
     blocksToHaskell :: [String]
     blocksToHaskell = foldl
diff --git a/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs b/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Adjuster_New as adjusterNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Adjuster_New_WithLabel as adjusterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-adjusterNew :: Rectangle -> Maybe String -> IO (Ref Adjuster)
+{# fun Fl_Adjuster_New_WithLabel as adjusterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+adjusterNew :: Rectangle -> Maybe T.Text -> IO (Ref Adjuster)
 adjusterNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Ask.chs b/src/Graphics/UI/FLTK/LowLevel/Ask.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Ask.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Ask.chs
@@ -14,6 +14,8 @@
 #include "Fl_AskC.h"
 import C2HS hiding (cFromEnum, cToBool,cToEnum)
 import Foreign.C.Types
+import qualified Data.Text as T
+import Graphics.UI.FLTK.LowLevel.Utils
 
 #c
 enum BeepType {
@@ -34,18 +36,18 @@
 flBeep Nothing = flBeep'
 flBeep (Just bt) = flBeepType' (fromIntegral (fromEnum bt))
 
-{# fun flc_input as flInput' { `String' } -> `()' #}
-flInput :: String -> IO ()
+{# fun flc_input as flInput' { unsafeToCString `T.Text' } -> `()' #}
+flInput :: T.Text -> IO ()
 flInput = flInput'
 
-{# fun flc_password as flPassword' { `String' } -> `()' #}
-flPassword :: String -> IO ()
+{# fun flc_password as flPassword' { unsafeToCString `T.Text' } -> `()' #}
+flPassword :: T.Text -> IO ()
 flPassword = flPassword'
 
-{# fun flc_message as flMessage' { `String' } -> `()' #}
-flMessage :: String -> IO ()
+{# fun flc_message as flMessage' { unsafeToCString `T.Text' } -> `()' #}
+flMessage :: T.Text -> IO ()
 flMessage = flMessage'
 
-{# fun flc_alert as flAlert' { `String' } -> `()' #}
-flAlert :: String -> IO ()
+{# fun flc_alert as flAlert' { unsafeToCString `T.Text' } -> `()' #}
+flAlert :: T.Text -> IO ()
 flAlert = flAlert'
diff --git a/src/Graphics/UI/FLTK/LowLevel/BMPImage.chs b/src/Graphics/UI/FLTK/LowLevel/BMPImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/BMPImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/BMPImage.chs
@@ -17,9 +17,9 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
-
-{# fun Fl_BMP_Image_New as bmpImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-bmpImageNew :: String -> IO (Either UnknownError (Ref BMPImage))
+import qualified Data.Text as T
+{# fun Fl_BMP_Image_New as bmpImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+bmpImageNew :: T.Text -> IO (Either UnknownError (Ref BMPImage))
 bmpImageNew filename' = do
   ptr <- bmpImageNew' filename'
   ref' <- (toRef ptr :: IO (Ref BMPImage))
diff --git a/src/Graphics/UI/FLTK/LowLevel/Bitmap.chs b/src/Graphics/UI/FLTK/LowLevel/Bitmap.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Bitmap.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Bitmap.chs
diff --git a/src/Graphics/UI/FLTK/LowLevel/Box.chs b/src/Graphics/UI/FLTK/LowLevel/Box.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Box.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Box.chs
@@ -26,17 +26,18 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Widget
 
 {# fun Fl_Box_New as boxNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Box_New_WithLabel as boxNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenBox_New_WithLabel as overriddenBoxNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Box_New_WithLabel as boxNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenBox_New_WithLabel as overriddenBoxNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenBox_New as overriddenBoxNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_Box_New_WithBoxtype as boxNewWithBoxtype' {cFromEnum `Boxtype',  `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenBox_New_WithBoxtype as overriddenBoxNewWithBoxtype' {cFromEnum `Boxtype',  `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Box_New_WithBoxtype as boxNewWithBoxtype' {cFromEnum `Boxtype',  `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenBox_New_WithBoxtype as overriddenBoxNewWithBoxtype' {cFromEnum `Boxtype',  `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 
 boxCustom :: Rectangle                     -- ^ The bounds of this box
-          -> Maybe String                  -- ^ Optional label
+          -> Maybe T.Text                  -- ^ Optional label
           -> Maybe (Ref Box -> IO ())      -- ^ Optional custom box drawing function
           -> Maybe (CustomWidgetFuncs Box) -- ^ Optional widget overrides
           -> IO (Ref Box)
@@ -46,12 +47,10 @@
     l'
     draw'
     funcs'
-    boxNew'
-    boxNewWithLabel'
     overriddenBoxNew'
     overriddenBoxNewWithLabel'
 
-boxCustomWithBoxtype :: Boxtype -> Rectangle -> String -> Maybe (Ref Box -> IO ()) -> Maybe (CustomWidgetFuncs Box) -> IO (Ref Box)
+boxCustomWithBoxtype :: Boxtype -> Rectangle -> T.Text -> Maybe (Ref Box -> IO ()) -> Maybe (CustomWidgetFuncs Box) -> IO (Ref Box)
 boxCustomWithBoxtype boxtype' rectangle' l' draw' funcs' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle'
     in case funcs' of
@@ -62,7 +61,7 @@
           boxNewWithBoxtype' boxtype' x_pos y_pos width height l' >>= toRef
 
 
-boxNew :: Rectangle -> Maybe String -> IO (Ref Box)
+boxNew :: Rectangle -> Maybe T.Text -> IO (Ref Box)
 boxNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -71,7 +70,7 @@
         Just l -> boxNewWithLabel' x_pos y_pos width height l >>=
                              toRef
 
-boxNewWithBoxtype :: Boxtype -> Rectangle -> String -> IO (Ref Box)
+boxNewWithBoxtype :: Boxtype -> Rectangle -> T.Text -> IO (Ref Box)
 boxNewWithBoxtype boxtype' rectangle' l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle'
     in
@@ -79,13 +78,13 @@
                              toRef
 
 {#fun Fl_Box_handle as boxHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Box orig impl where
-  runOp _ _ box event = withRef box (\p -> boxHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Box orig impl where
+  runOp _ _ box event = withRef box (\p -> boxHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 
 -- $functions
 -- @
--- handle :: 'Ref' 'Box' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Box' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
 -- @
 
 -- $hierarchy
diff --git a/src/Graphics/UI/FLTK/LowLevel/Browser.chs b/src/Graphics/UI/FLTK/LowLevel/Browser.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Browser.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Browser.chs
@@ -25,25 +25,24 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Widget
 
 {# fun Fl_Browser_New as browserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Browser_New_WithLabel as browserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenBrowser_New_WithLabel as overriddenBrowserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Browser_New_WithLabel as browserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenBrowser_New_WithLabel as overriddenBrowserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenBrowser_New as overriddenBrowserNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
-browserCustom :: Rectangle -> Maybe String -> Maybe (Ref Browser -> IO ()) -> Maybe (CustomWidgetFuncs Browser) -> IO (Ref Browser)
+browserCustom :: Rectangle -> Maybe T.Text -> Maybe (Ref Browser -> IO ()) -> Maybe (CustomWidgetFuncs Browser) -> IO (Ref Browser)
 browserCustom rectangle l' draw' funcs' =
   widgetMaker
     rectangle
     l'
     draw'
     funcs'
-    browserNew'
-    browserNewWithLabel'
     overriddenBrowserNew'
     overriddenBrowserNewWithLabel'
 
-browserNew :: Rectangle -> Maybe String -> IO (Ref Browser)
+browserNew :: Rectangle -> Maybe T.Text -> IO (Ref Browser)
 browserNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -54,8 +53,8 @@
 
 
 {#fun Fl_Browser_handle as browserHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Browser orig impl where
-  runOp _ _ browser event = withRef browser (\p -> browserHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Browser orig impl where
+  runOp _ _ browser event = withRef browser (\p -> browserHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
 {# fun Fl_Browser_Destroy as browserDestroy' { id `Ptr ()' } -> `()' #}
 instance (impl ~ (IO ())) => Op (Destroy ()) Browser orig impl where
   runOp _ _ browser = swapRef browser $ \browserPtr -> do
@@ -64,21 +63,21 @@
 {# fun Fl_Browser_remove as remove' { id `Ptr ()',`Int' } -> `()' #}
 instance (impl ~ (Int ->  IO ())) => Op (Remove ()) Browser orig impl where
   runOp _ _ browser line = withRef browser $ \browserPtr -> remove' browserPtr line
-{# fun Fl_Browser_add as add' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (Add ()) Browser orig impl where
+{# fun Fl_Browser_add as add' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (Add ()) Browser orig impl where
   runOp _ _ browser newtext = withRef browser $ \browserPtr -> add' browserPtr newtext
-{# fun Fl_Browser_insert as insert' { id `Ptr ()',`Int',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Int -> String ->  IO ())) => Op (Insert ()) Browser orig impl where
+{# fun Fl_Browser_insert as insert' { id `Ptr ()',`Int',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (Int -> T.Text ->  IO ())) => Op (Insert ()) Browser orig impl where
   runOp _ _ browser line newtext = withRef browser $ \browserPtr -> insert' browserPtr line newtext
 {# fun Fl_Browser_move as move' { id `Ptr ()',`Int',`Int' } -> `()' #}
-instance (impl ~ (Int -> Int ->  IO ())) => Op (Move ()) Browser orig impl where
-  runOp _ _ browser to from = withRef browser $ \browserPtr -> move' browserPtr to from
-{# fun Fl_Browser_load as load' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
-instance (impl ~ (String ->  IO (Int))) => Op (Load ()) Browser orig impl where
+instance (impl ~ (LineNumber -> LineNumber ->  IO ())) => Op (Move ()) Browser orig impl where
+  runOp _ _ browser (LineNumber to) (LineNumber from) = withRef browser $ \browserPtr -> move' browserPtr to from
+{# fun Fl_Browser_load as load' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
+instance (impl ~ (T.Text ->  IO (Int))) => Op (Load ()) Browser orig impl where
   runOp _ _ browser filename = withRef browser $ \browserPtr -> load' browserPtr filename
 {# fun Fl_Browser_swap as swap' { id `Ptr ()',`Int',`Int' } -> `()' #}
-instance (impl ~ (Int -> Int ->  IO ())) => Op (Swap ()) Browser orig impl where
-  runOp _ _ browser a b = withRef browser $ \browserPtr -> swap' browserPtr a b
+instance (impl ~ (LineNumber -> LineNumber ->  IO ())) => Op (Swap ()) Browser orig impl where
+  runOp _ _ browser (LineNumber a) (LineNumber b) = withRef browser $ \browserPtr -> swap' browserPtr a b
 {# fun Fl_Browser_clear as clear' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ())) => Op (Clear ()) Browser orig impl where
   runOp _ _ browser = withRef browser $ \browserPtr -> clear' browserPtr
@@ -89,53 +88,53 @@
 instance (impl ~ (Int -> Int ->  IO ())) => Op (SetSize ()) Browser orig impl where
   runOp _ _ browser w h = withRef browser $ \browserPtr -> setSize' browserPtr w h
 {# fun Fl_Browser_topline as topline' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (GetTopline ()) Browser orig impl where
-  runOp _ _ browser = withRef browser $ \browserPtr -> topline' browserPtr
+instance (impl ~ ( IO (LineNumber))) => Op (GetTopline ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> topline' browserPtr >>= return . LineNumber
 {# fun Fl_Browser_lineposition as lineposition' { id `Ptr ()',`Int', cFromEnum `LinePosition' } -> `()' #}
 instance (impl ~ (Int -> LinePosition ->  IO ())) => Op (Lineposition ()) Browser orig impl where
   runOp _ _ browser line pos = withRef browser $ \browserPtr -> lineposition' browserPtr line pos
 {# fun Fl_Browser_set_topline as setTopline' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetTopline ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> setTopline' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (SetTopline ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> setTopline' browserPtr line
 {# fun Fl_Browser_bottomline as bottomline' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetBottomline ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> bottomline' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (SetBottomline ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> bottomline' browserPtr line
 {# fun Fl_Browser_middleline as middleline' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetMiddleline ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> middleline' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (SetMiddleline ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> middleline' browserPtr line
 {# fun Fl_Browser_select_with_val as select' { id `Ptr ()',`Int', cFromBool `Bool' } -> `Int' #}
-instance (impl ~ (Int -> Bool -> IO (Int))) => Op (Select ()) Browser orig impl where
-  runOp _ _ browser selectType line = withRef browser $ \browserPtr -> select' browserPtr selectType line
+instance (impl ~ (LineNumber -> Bool -> IO (Either NoChange ()))) => Op (Select ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) selectType = withRef browser $ \browserPtr -> select' browserPtr line selectType >>= return . successOrNoChange
 {# fun Fl_Browser_selected as selected' { id `Ptr ()',`Int' } -> `Bool' cToBool #}
-instance (impl ~ (Int ->  IO (Bool))) => Op (Selected ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> selected' browserPtr line
+instance (impl ~ (LineNumber ->  IO (Bool))) => Op (Selected ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> selected' browserPtr line
 {# fun Fl_Browser_show_with_line as showWithLine' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (ShowWidgetLine ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> showWithLine' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (ShowWidgetLine ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> showWithLine' browserPtr line
 {# fun Fl_Browser_show as show' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ())) => Op (ShowWidget ()) Browser orig impl where
   runOp _ _ browser = withRef browser $ \browserPtr -> show' browserPtr
 {# fun Fl_Browser_hide_with_line as hideWithLine' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (HideLine ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> hideWithLine' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (HideLine ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> hideWithLine' browserPtr line
 {# fun Fl_Browser_hide as hide' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ())) => Op (Hide ()) Browser orig impl where
   runOp _ _ browser = withRef browser $ \browserPtr -> hide' browserPtr
-{# fun Fl_Browser_visible as visible' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Int ->  IO (Int))) => Op (Visible ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> visible' browserPtr line
+{# fun Fl_Browser_visible as visible' { id `Ptr ()',`Int' } -> `Bool' cToBool #}
+instance (impl ~ (LineNumber ->  IO (Bool))) => Op (Visible ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> visible' browserPtr line
 {# fun Fl_Browser_value as value' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (GetValue ()) Browser orig impl where
-  runOp _ _ browser = withRef browser $ \browserPtr -> value' browserPtr
+instance (impl ~ ( IO (LineNumber))) => Op (GetValue ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> value' browserPtr >>= return . LineNumber
 {# fun Fl_Browser_set_value as setValue' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetValue ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> setValue' browserPtr line
-{# fun Fl_Browser_text as text' { id `Ptr ()',`Int' } -> `String' unsafeFromCString #}
-instance (impl ~ (Int ->  IO (String))) => Op (GetText ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> text' browserPtr line
-{# fun Fl_Browser_set_text as setText' { id `Ptr ()',`Int', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Int -> String ->  IO ())) => Op (SetText ()) Browser orig impl where
-  runOp _ _ browser line newtext = withRef browser $ \browserPtr -> setText' browserPtr line newtext
+instance (impl ~ (LineNumber ->  IO ())) => Op (SetValue ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> setValue' browserPtr line
+{# fun Fl_Browser_text as text' { id `Ptr ()',`Int' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (LineNumber ->  IO T.Text)) => Op (GetText ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> text' browserPtr line
+{# fun Fl_Browser_set_text as setText' { id `Ptr ()',`Int', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (LineNumber -> T.Text ->  IO ())) => Op (SetText ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) newtext = withRef browser $ \browserPtr -> setText' browserPtr line newtext
 {# fun Fl_Browser_format_char as formatChar' { id `Ptr ()' } -> `CChar' id #}
 instance (impl ~ ( IO (Char))) => Op (GetFormatChar ()) Browser orig impl where
   runOp _ _ browser = withRef browser $ \browserPtr -> formatChar' browserPtr >>= return . castCCharToChar
@@ -169,38 +168,38 @@
       ptr <- newArray ((map fromIntegral arr) :: [CInt])
       setColumnWidths' browserPtr (castPtr ptr)
 {# fun Fl_Browser_displayed as displayed' { id `Ptr ()',`Int' } -> `Bool' cToBool #}
-instance (impl ~ (Int ->  IO (Bool))) => Op (Displayed ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> displayed' browserPtr line
+instance (impl ~ (LineNumber ->  IO (Bool))) => Op (Displayed ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> displayed' browserPtr line
 {# fun Fl_Browser_make_visible as makeVisible' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (MakeVisible ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> makeVisible' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (MakeVisible ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> makeVisible' browserPtr line
 {# fun Fl_Browser_set_icon as setIcon' { id `Ptr ()',`Int',id `Ptr ()' } -> `()' #}
-instance (impl ~ (Int -> Ref Image ->  IO ())) => Op (SetIcon ()) Browser orig impl where
-  runOp _ _ browser line icon = withRef browser $ \browserPtr -> withRef icon $ \iconPtr -> setIcon' browserPtr line iconPtr
+instance (impl ~ (LineNumber -> Ref Image ->  IO ())) => Op (SetIcon ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) icon = withRef browser $ \browserPtr -> withRef icon $ \iconPtr -> setIcon' browserPtr line iconPtr
 {# fun Fl_Browser_icon as icon' { id `Ptr ()',`Int' } -> `Ptr ()' id #}
-instance (impl ~ (Int ->  IO (Maybe (Ref Image)))) => Op (GetIcon ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> icon' browserPtr line >>= toMaybeRef
+instance (impl ~ (LineNumber ->  IO (Maybe (Ref Image)))) => Op (GetIcon ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> icon' browserPtr line >>= toMaybeRef
 {# fun Fl_Browser_remove_icon as removeIcon' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (RemoveIcon ()) Browser orig impl where
-  runOp _ _ browser line = withRef browser $ \browserPtr -> removeIcon' browserPtr line
+instance (impl ~ (LineNumber ->  IO ())) => Op (RemoveIcon ()) Browser orig impl where
+  runOp _ _ browser (LineNumber line) = withRef browser $ \browserPtr -> removeIcon' browserPtr line
 {# fun Fl_Browser_deselect as deselect' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (Deselect ()) Browser orig impl where
-  runOp _ _ browser = withRef browser $ \browserPtr -> deselect' browserPtr
+instance (impl ~ ( IO (Either NoChange ()))) => Op (Deselect ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> deselect' browserPtr >>= return . successOrNoChange
 {# fun Fl_Browser_deselect_with_docallbacks as deselectWithDocallbacks' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Int ->  IO (Int))) => Op (DeselectAndCallback ()) Browser orig impl where
-  runOp _ _ browser docallbacks = withRef browser $ \browserPtr -> deselectWithDocallbacks' browserPtr docallbacks
+instance (impl ~ (IO (Either NoChange ()))) => Op (DeselectAndCallback ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> deselectWithDocallbacks' browserPtr 1 >>= return . successOrNoChange
 {# fun Fl_Browser_position as position' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (GetPosition ()) Browser orig impl where
-  runOp _ _ browser = withRef browser $ \browserPtr -> position' browserPtr
+instance (impl ~ ( IO (PixelPosition))) => Op (GetPosition ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> position' browserPtr >>= return . PixelPosition
 {# fun Fl_Browser_set_position as setPosition' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetPosition ()) Browser orig impl where
-  runOp _ _ browser pos = withRef browser $ \browserPtr -> setPosition' browserPtr pos
+instance (impl ~ (PixelPosition ->  IO ())) => Op (SetPosition ()) Browser orig impl where
+  runOp _ _ browser (PixelPosition pos) = withRef browser $ \browserPtr -> setPosition' browserPtr pos
 {# fun Fl_Browser_hposition as hposition' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (GetHposition ()) Browser orig impl where
-  runOp _ _ browser = withRef browser $ \browserPtr -> hposition' browserPtr
+instance (impl ~ ( IO (PixelPosition))) => Op (GetHposition ()) Browser orig impl where
+  runOp _ _ browser = withRef browser $ \browserPtr -> hposition' browserPtr >>= return . PixelPosition
 {# fun Fl_Browser_set_hposition as setHposition' { id `Ptr ()',`Int' } -> `()' #}
-instance (impl ~ (Int ->  IO ())) => Op (SetHposition ()) Browser orig impl where
-  runOp _ _ browser int = withRef browser $ \browserPtr -> setHposition' browserPtr int
+instance (impl ~ (PixelPosition ->  IO ())) => Op (SetHposition ()) Browser orig impl where
+  runOp _ _ browser (PixelPosition int) = withRef browser $ \browserPtr -> setHposition' browserPtr int
 {# fun Fl_Browser_has_scrollbar as hasScrollbar' { id `Ptr ()' } -> `ScrollbarMode' cToEnum #}
 instance (impl ~ ( IO (ScrollbarMode))) => Op (GetHasScrollbar ()) Browser orig impl where
   runOp _ _ browser = withRef browser $ \browserPtr -> hasScrollbar' browserPtr
@@ -252,17 +251,17 @@
 
 -- $functions
 -- @
--- add :: 'Ref' 'Browser' -> 'String' -> 'IO' ()
+-- add :: 'Ref' 'Browser' -> 'T.Text' -> 'IO' ()
 --
 -- clear :: 'Ref' 'Browser' -> 'IO' ()
 --
--- deselect :: 'Ref' 'Browser' -> 'IO' ('Int')
+-- deselect :: 'Ref' 'Browser' -> 'IO' ('Either' 'NoChange' ())
 --
--- deselectAndCallback :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('Int')
+-- deselectAndCallback :: 'Ref' 'Browser' -> 'IO' ('Either' 'NoChange' ())
 --
 -- destroy :: 'Ref' 'Browser' -> 'IO' ()
 --
--- displayed :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('Bool')
+-- displayed :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ('Bool')
 --
 -- getColumnChar :: 'Ref' 'Browser' -> 'IO' ('Char')
 --
@@ -272,11 +271,11 @@
 --
 -- getHasScrollbar :: 'Ref' 'Browser' -> 'IO' ('ScrollbarMode')
 --
--- getHposition :: 'Ref' 'Browser' -> 'IO' ('Int')
+-- getHposition :: 'Ref' 'Browser' -> 'IO' ('PixelPosition')
 --
--- getIcon :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('Maybe' ('Ref' 'Image'))
+-- getIcon :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ('Maybe' ('Ref' 'Image'))
 --
--- getPosition :: 'Ref' 'Browser' -> 'IO' ('Int')
+-- getPosition :: 'Ref' 'Browser' -> 'IO' ('PixelPosition')
 --
 -- getScrollbarSize :: 'Ref' 'Browser' -> 'IO' ('Int')
 --
@@ -284,7 +283,7 @@
 --
 -- getSize :: 'Ref' 'Browser' -> 'IO' ('Int')
 --
--- getText :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('String')
+-- getText :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' 'T.Text'
 --
 -- getTextcolor :: 'Ref' 'Browser' -> 'IO' ('Color')
 --
@@ -292,37 +291,37 @@
 --
 -- getTextsize :: 'Ref' 'Browser' -> 'IO' ('FontSize')
 --
--- getTopline :: 'Ref' 'Browser' -> 'IO' ('Int')
+-- getTopline :: 'Ref' 'Browser' -> 'IO' ('LineNumber')
 --
 -- getType_ :: 'Ref' 'Browser' -> 'IO' ('BrowserType')
 --
--- getValue :: 'Ref' 'Browser' -> 'IO' ('Int')
+-- getValue :: 'Ref' 'Browser' -> 'IO' ('LineNumber')
 --
--- handle :: 'Ref' 'Browser' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Browser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
 --
 -- hide :: 'Ref' 'Browser' -> 'IO' ()
 --
--- hideLine :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- hideLine :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
--- insert :: 'Ref' 'Browser' -> 'Int' -> 'String' -> 'IO' ()
+-- insert :: 'Ref' 'Browser' -> 'Int' -> 'T.Text' -> 'IO' ()
 --
 -- lineposition :: 'Ref' 'Browser' -> 'Int' -> 'LinePosition' -> 'IO' ()
 --
--- load :: 'Ref' 'Browser' -> 'String' -> 'IO' ('Int')
+-- load :: 'Ref' 'Browser' -> 'T.Text' -> 'IO' ('Int')
 --
--- makeVisible :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- makeVisible :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
--- move :: 'Ref' 'Browser' -> 'Int' -> 'Int' -> 'IO' ()
+-- move :: 'Ref' 'Browser' -> 'LineNumber' -> 'LineNumber' -> 'IO' ()
 --
 -- remove :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
 --
--- removeIcon :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- removeIcon :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
--- select :: 'Ref' 'Browser' -> 'Int' -> 'Bool' -> 'IO' ('Int')
+-- select :: 'Ref' 'Browser' -> 'LineNumber' -> 'Bool' -> 'IO' ('Either' 'NoChange' ())
 --
--- selected :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('Bool')
+-- selected :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ('Bool')
 --
--- setBottomline :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setBottomline :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
 -- setColumnChar :: 'Ref' 'Browser' -> 'Char' -> 'IO' ()
 --
@@ -330,15 +329,15 @@
 --
 -- setFormatChar :: 'Ref' 'Browser' -> 'Char' -> 'IO' ()
 --
--- setHasScrollbar :: 'Ref' 'Browser' -> 'ScrollbarMode'>- 'IO' ()
+-- setHasScrollbar :: 'Ref' 'Browser' -> 'ScrollbarMode' -> 'IO' ()
 --
--- setHposition :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setHposition :: 'Ref' 'Browser' -> 'PixelPosition' -> 'IO' ()
 --
--- setIcon :: 'Ref' 'Browser' -> 'Int' -> 'Ref' 'Image' -> 'IO' ()
+-- setIcon :: 'Ref' 'Browser' -> 'LineNumber' -> 'Ref' 'Image' -> 'IO' ()
 --
--- setMiddleline :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setMiddleline :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
--- setPosition :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setPosition :: 'Ref' 'Browser' -> 'PixelPosition' -> 'IO' ()
 --
 -- setScrollbarSize :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
 --
@@ -346,7 +345,7 @@
 --
 -- setSize :: 'Ref' 'Browser' -> 'Int' -> 'Int' -> 'IO' ()
 --
--- setText :: 'Ref' 'Browser' -> 'Int' -> 'String' -> 'IO' ()
+-- setText :: 'Ref' 'Browser' -> 'LineNumber' -> 'T.Text' -> 'IO' ()
 --
 -- setTextcolor :: 'Ref' 'Browser' -> 'Color' -> 'IO' ()
 --
@@ -354,23 +353,23 @@
 --
 -- setTextsize :: 'Ref' 'Browser' -> 'FontSize' -> 'IO' ()
 --
--- setTopline :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setTopline :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
 -- setType :: 'Ref' 'Browser' -> 'BrowserType' -> 'IO' ()
 --
--- setValue :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- setValue :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
 -- showWidget :: 'Ref' 'Browser' -> 'IO' ()
 --
--- showWidgetLine :: 'Ref' 'Browser' -> 'Int' -> 'IO' ()
+-- showWidgetLine :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ()
 --
 -- sort :: 'Ref' 'Browser' -> 'IO' ()
 --
 -- sortWithSortType :: 'Ref' 'Browser' -> 'SortType' -> 'IO' ()
 --
--- swap :: 'Ref' 'Browser' -> 'Int' -> 'Int' -> 'IO' ()
+-- swap :: 'Ref' 'Browser' -> 'LineNumber' -> 'LineNumber' -> 'IO' ()
 --
--- visible :: 'Ref' 'Browser' -> 'Int' -> 'IO' ('Int')
+-- visible :: 'Ref' 'Browser' -> 'LineNumber' -> 'IO' ('Bool')
 -- @
 
 -- $hierarchy
diff --git a/src/Graphics/UI/FLTK/LowLevel/Button.chs b/src/Graphics/UI/FLTK/LowLevel/Button.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Button.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Button.chs
@@ -27,14 +27,13 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
-{# fun Fl_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenButton_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenButton_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenButton_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 buttonCustom :: Rectangle                         -- ^ The bounds of this button
-             -> Maybe String                      -- ^ The button label
+             -> Maybe T.Text                      -- ^ The button label
              -> Maybe (Ref Button -> IO ())       -- ^ Optional custom drawing function
              -> Maybe (CustomWidgetFuncs Button)  -- ^ Optional custom widget functions
              -> IO (Ref Button)
@@ -44,20 +43,16 @@
     l'
     draw'
     funcs'
-    widgetNew'
-    widgetNewWithLabel'
     overriddenWidgetNew'
     overriddenWidgetNewWithLabel'
 
-buttonNew :: Rectangle -> Maybe String -> IO (Ref Button)
+buttonNew :: Rectangle -> Maybe T.Text -> IO (Ref Button)
 buttonNew rectangle l' =
   widgetMaker
     rectangle
     l'
     Nothing
     Nothing
-    widgetNew'
-    widgetNewWithLabel'
     overriddenWidgetNew'
     overriddenWidgetNewWithLabel'
 
@@ -71,11 +66,11 @@
 instance (impl ~ (( IO ()))) => Op (DrawSuper ()) Button orig impl where
   runOp _ _ button = withRef button $ \buttonPtr -> drawSuper' buttonPtr
 {# fun Fl_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ ((Event ->  IO (Int)))) => Op (HandleSuper ()) Button orig impl where
-  runOp _ _ button event = withRef button $ \buttonPtr -> handleSuper' buttonPtr (fromIntegral (fromEnum event))
+instance (impl ~ ((Event ->  IO (Either UnknownEvent ())))) => Op (HandleSuper ()) Button orig impl where
+  runOp _ _ button event = withRef button $ \buttonPtr -> handleSuper' buttonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
 {#fun Fl_Button_handle as buttonHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ ((Event -> IO Int))) => Op (Handle ()) Button orig impl where
-  runOp _ _ button event = withRef button (\p -> buttonHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ ((Event -> IO (Either UnknownEvent ())))) => Op (Handle ()) Button orig impl where
+  runOp _ _ button event = withRef button (\p -> buttonHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ ((Rectangle -> IO ()))) => Op (ResizeSuper ()) Button orig impl where
   runOp _ _ button rectangle =
@@ -190,9 +185,9 @@
 --
 -- getValue :: 'Ref' 'Button' -> ( 'IO' ('Bool'))
 --
--- handle :: 'Ref' 'Button' -> ('Event' -> 'IO' 'Int')
+-- handle :: 'Ref' 'Button' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
--- handleSuper :: 'Ref' 'Button' -> ('Int' -> 'IO' ('Int'))
+-- handleSuper :: 'Ref' 'Button' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- hide :: 'Ref' 'Button' -> ( 'IO' ())
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs b/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs
@@ -21,10 +21,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Check_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Check_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-checkButtonNew :: Rectangle -> Maybe String -> IO (Ref CheckButton)
+{# fun Fl_Check_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+checkButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref CheckButton)
 checkButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Choice.chs b/src/Graphics/UI/FLTK/LowLevel/Choice.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Choice.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Choice.chs
@@ -24,11 +24,12 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
 {# fun Fl_Choice_New as choiceNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Choice_New_WithLabel as choiceNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-choiceNew :: Rectangle -> Maybe String -> IO (Ref Choice)
+{# fun Fl_Choice_New_WithLabel as choiceNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+choiceNew :: Rectangle -> Maybe T.Text -> IO (Ref Choice)
 choiceNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -56,8 +57,8 @@
               withRef menu_item $ \menu_itemPtr ->
                   valueWithItem' menu_Ptr menu_itemPtr
 {#fun Fl_Choice_handle as menu_Handle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Choice orig impl where
-  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Choice orig impl where
+  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 -- $Choicefunctions
 --
@@ -66,7 +67,7 @@
 --
 -- getValue :: 'Ref' 'Choice' -> 'IO' ('MenuItemIndex')
 --
--- handle :: 'Ref' 'Choice' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Choice' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
 --
 -- setValue :: 'Ref' 'Choice' -> 'MenuItemReference' -> 'IO' ('Int')
 -- @
diff --git a/src/Graphics/UI/FLTK/LowLevel/Clock.chs b/src/Graphics/UI/FLTK/LowLevel/Clock.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Clock.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Clock.chs
@@ -30,6 +30,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Data.Char
 #c
 enum ClockType {
@@ -47,9 +48,9 @@
 data ClockSinceEpoch = ClockSinceEpoch Second
 data ClockSetTimeType = ClockSetByTime ClockByTime | ClockSetSinceEpoch ClockSinceEpoch
 {# fun Fl_Clock_New as clockNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Clock_New_WithLabel as clockNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_Clock_New_WithClockType as clockNewWithClockType' { id `CUChar', `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-clockNew :: Rectangle -> Maybe String -> IO (Ref Clock)
+{# fun Fl_Clock_New_WithLabel as clockNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_Clock_New_WithClockType as clockNewWithClockType' { id `CUChar', `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+clockNew :: Rectangle -> Maybe T.Text -> IO (Ref Clock)
 clockNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -57,7 +58,7 @@
                              toRef
         Just l -> clockNewWithLabel' x_pos y_pos width height l >>=
                              toRef
-clockNewWithType :: ClockType -> Rectangle -> String -> IO (Ref Clock)
+clockNewWithType :: ClockType -> Rectangle -> T.Text -> IO (Ref Clock)
 clockNewWithType clocktype' rectangle' label' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle'
     in
@@ -87,8 +88,8 @@
     return $ ClockByTime (Hour hour') (Minute minute') (Second second')
 
 {#fun Fl_Clock_handle as menu_Handle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Clock orig impl where
-  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Clock orig impl where
+  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Clock_set_type as setType' { id `Ptr ()',`Word8' } -> `()' #}
 instance (impl ~ (ClockType ->  IO ())) => Op (SetType ()) Clock orig impl where
@@ -106,7 +107,7 @@
 --
 -- getValueSinceEpoch :: 'Ref' 'Clock' -> 'IO' 'ClockSinceEpoch'
 --
--- handle :: 'Ref' 'Clock' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Clock' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setValue :: 'Ref' 'Clock' -> 'ClockSetTimeType' -> 'IO' ()
 -- @
diff --git a/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs b/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs
@@ -25,11 +25,12 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Data.List
 
 {# fun Fl_Color_Chooser_New as colorchooserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Color_Chooser_New_WithLabel as colorchooserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-colorChooserNew :: Rectangle -> Maybe String -> IO (Ref ColorChooser)
+{# fun Fl_Color_Chooser_New_WithLabel as colorchooserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+colorChooserNew :: Rectangle -> Maybe T.Text -> IO (Ref ColorChooser)
 colorChooserNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -141,9 +142,9 @@
        v''' <- peek vPtr
        return (Just (Between0And6 (realToFrac h'''),Between0And1 (realToFrac s'''),Between0And1 (realToFrac v''')))
 
-{# fun flc_color_chooser_with_m as flc_color_chooser_with_m' {`String' , id `Ptr CDouble', id `Ptr CDouble', id `Ptr CDouble', `Int' } -> `Int' #}
-{# fun flc_color_chooser_with_uchar_m as flc_color_chooser_with_uchar_m' {`String' , id `Ptr CUChar', id `Ptr CUChar', id `Ptr CUChar', `Int' } -> `Int' #}
-flcColorChooser :: String ->
+{# fun flc_color_chooser_with_m as flc_color_chooser_with_m' {unsafeToCString `T.Text' , id `Ptr CDouble', id `Ptr CDouble', id `Ptr CDouble', `Int' } -> `Int' #}
+{# fun flc_color_chooser_with_uchar_m as flc_color_chooser_with_uchar_m' {unsafeToCString `T.Text' , id `Ptr CUChar', id `Ptr CUChar', id `Ptr CUChar', `Int' } -> `Int' #}
+flcColorChooser :: T.Text ->
                    ColorChooserRGB ->
                    Maybe ColorChooserMode ->
                    IO (Maybe ColorChooserRGB)
diff --git a/src/Graphics/UI/FLTK/LowLevel/CopySurface.chs b/src/Graphics/UI/FLTK/LowLevel/CopySurface.chs
--- a/src/Graphics/UI/FLTK/LowLevel/CopySurface.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/CopySurface.chs
@@ -21,6 +21,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Copy_Surface_New as copySurfaceNew' {`Int', `Int'} -> `Ptr ()' id #}
 copySurfaceNew :: Size -> IO (Ref CopySurface)
@@ -30,8 +31,8 @@
 instance (impl ~ (IO ())) => Op (Destroy ()) CopySurface orig impl where
   runOp _ _ copy_surface = withRef copy_surface $ \copy_surfacePtr -> copySurfaceDestroy' copy_surfacePtr
 
-{# fun Fl_Copy_Surface_class_name as className' { id `Ptr () ' } -> `String' unsafeFromCString #}
-instance (impl ~ (IO (String))) => Op (ClassName ()) Image orig impl where
+{# fun Fl_Copy_Surface_class_name as className' { id `Ptr () ' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (IO (T.Text))) => Op (ClassName ()) Image orig impl where
   runOp _ _ copy_surface = withRef copy_surface $ \copy_surfacePtr -> className' copy_surfacePtr
 
 {# fun Fl_Copy_Surface_set_current as setCurrent' { id `Ptr ()' } -> `()' #}
diff --git a/src/Graphics/UI/FLTK/LowLevel/Counter.chs b/src/Graphics/UI/FLTK/LowLevel/Counter.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Counter.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Counter.chs
@@ -26,6 +26,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 #c
 enum CounterType {
   NormalCounterType = FL_NORMAL_COUNTERC,
@@ -34,8 +35,8 @@
 #endc
 {#enum CounterType {} deriving (Show, Eq) #}
 {# fun Fl_Counter_New as counterNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Counter_New_WithLabel as counterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-counterNew :: Rectangle -> Maybe String -> IO (Ref Counter)
+{# fun Fl_Counter_New_WithLabel as counterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+counterNew :: Rectangle -> Maybe T.Text -> IO (Ref Counter)
 counterNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -51,8 +52,8 @@
     return nullPtr
 
 {#fun Fl_Counter_handle as counterHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Counter orig impl where
-  runOp _ _ counter event = withRef counter (\p -> counterHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Counter orig impl where
+  runOp _ _ counter event = withRef counter (\p -> counterHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
 {# fun Fl_Counter_lstep as lstep' { id `Ptr ()',`Double' } -> `()' #}
 instance (impl ~ (Double ->  IO ())) => Op (SetLstep ()) Counter orig impl where
   runOp _ _ counter lstep = withRef counter $ \counterPtr -> lstep' counterPtr lstep
@@ -92,7 +93,7 @@
 --
 -- getTextsize :: 'Ref' 'Counter' -> 'IO' 'FontSize'
 --
--- handle :: 'Ref' 'Counter' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Counter' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setLstep :: 'Ref' 'Counter' -> 'Double' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Dial.chs b/src/Graphics/UI/FLTK/LowLevel/Dial.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Dial.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Dial.chs
@@ -25,7 +25,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
-
+import qualified Data.Text as T
 #c
 enum DialType {
   NormalDialType = FL_NORMAL_DIALC,
@@ -35,8 +35,8 @@
 #endc
 {#enum DialType {} deriving (Show, Eq) #}
 {# fun Fl_Dial_New as dialNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Dial_New_WithLabel as dialNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-dialNew :: Rectangle -> Maybe String -> IO (Ref Dial)
+{# fun Fl_Dial_New_WithLabel as dialNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+dialNew :: Rectangle -> Maybe T.Text -> IO (Ref Dial)
 dialNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -64,8 +64,8 @@
 instance (impl ~ ( IO (Angle))) => Op (GetAngle2 ()) Dial orig impl where
   runOp _ _ dial = withRef dial $ \dialPtr -> angle2' dialPtr >>= return . Angle
 {#fun Fl_Dial_handle as dialHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Dial orig impl where
-  runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Dial orig impl where
+  runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 instance (impl ~ ( Angle -> Angle -> IO ())) => Op (SetAngles ()) Dial orig impl where
   runOp _ _ dial a1' a2' = do
     setAngle1 dial a1'
@@ -86,7 +86,7 @@
 --
 -- getAngle2 :: 'Ref' 'Dial' -> 'IO' 'Angle'
 --
--- handle :: 'Ref' 'Dial' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Dial' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setAngle1 :: 'Ref' 'Dial' -> 'Angle' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/DoubleWindow.chs b/src/Graphics/UI/FLTK/LowLevel/DoubleWindow.chs
--- a/src/Graphics/UI/FLTK/LowLevel/DoubleWindow.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/DoubleWindow.chs
@@ -21,6 +21,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Widget
 import Graphics.UI.FLTK.LowLevel.Window
@@ -29,11 +30,11 @@
 
 {# fun Fl_OverriddenDouble_Window_New as overriddenWindowNew' {`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenDouble_Window_NewXY as overriddenWindowNewXY' {`Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenDouble_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenDouble_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenDouble_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenDouble_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 doubleWindowCustom :: Size                              -- ^ Size of this window
                    -> Maybe Position                    -- ^ Optional position of this window
-                   -> Maybe String                      -- ^ Optional label
+                   -> Maybe T.Text                      -- ^ Optional label
                    -> Maybe (Ref DoubleWindow -> IO ()) -- ^ Optional table drawing routine
                    -> CustomWidgetFuncs DoubleWindow    -- ^ Custom widget overrides
                    -> CustomWindowFuncs DoubleWindow    -- ^ Custom window overrides
@@ -51,7 +52,7 @@
     overriddenWindowNewXY'
     overriddenWindowNewXYWithLabel'
 
-doubleWindowNew :: Size -> Maybe Position -> Maybe String -> IO (Ref DoubleWindow)
+doubleWindowNew :: Size -> Maybe Position -> Maybe T.Text -> IO (Ref DoubleWindow)
 doubleWindowNew size position title =
   windowMaker
     size
@@ -74,8 +75,8 @@
   runOp _ _ window = withRef window $ \windowPtr -> drawSuper' windowPtr
 
 {# fun Fl_Double_Window_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) DoubleWindow orig impl where
-  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event))
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) DoubleWindow orig impl where
+  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
 
 {# fun Fl_Double_Window_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) DoubleWindow orig impl where
@@ -105,8 +106,8 @@
 
 {#fun Fl_Double_Window_handle as windowHandle'
       { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) DoubleWindow orig impl where
-  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) DoubleWindow orig impl where
+  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Double_Window_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) DoubleWindow orig impl where
@@ -122,7 +123,7 @@
 --
 -- flushSuper :: 'Ref' 'DoubleWindow' -> 'IO' ()
 --
--- handle :: 'Ref' 'DoubleWindow' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'DoubleWindow' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- handleSuper :: 'Ref' 'DoubleWindow' -> 'Int' -> 'IO' 'Int'
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Draw.chs b/src/Graphics/UI/FLTK/LowLevel/Draw.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Draw.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Draw.chs
@@ -125,6 +125,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Data.ByteString
 
@@ -205,10 +206,10 @@
 flcPoint (Position (X x_pos') (Y y_pos')) = flcPoint' x_pos' y_pos'
 
 {# fun flc_line_style_with_width_dashes as flcLineStyleWithWidthDashes' {cFromEnum `LineStyle', `Int', id `Ptr CChar' } -> `()' #}
-flcLineStyle :: LineStyle -> Maybe Int -> Maybe String -> IO ()
+flcLineStyle :: LineStyle -> Maybe Int -> Maybe T.Text -> IO ()
 flcLineStyle style width' dashes' = do
   let _width = maybe 0 id width'
-  _dashes <- maybe (return nullPtr) newCString dashes'
+  _dashes <- maybe (return nullPtr) copyTextToCString dashes'
   flcLineStyleWithWidthDashes' style _width _dashes
 
 {# fun flc_rect as flcRect' { `Int',`Int',`Int',`Int' } -> `()' #}
@@ -419,80 +420,80 @@
 flcDescent ::  IO (Int)
 flcDescent  = flcDescent'
 
-{# fun flc_width as flcWidth' { `String' } -> `Double' #}
-flcWidth :: String ->  IO (Double)
+{# fun flc_width as flcWidth' { unsafeToCString `T.Text' } -> `Double' #}
+flcWidth :: T.Text ->  IO (Double)
 flcWidth txt = flcWidth' txt
 
-{# fun flc_width_with_n as flcWidthWithN' { `String',`Int' } -> `Double' #}
-flcWidthWithN :: String -> Int ->  IO (Double)
+{# fun flc_width_with_n as flcWidthWithN' { unsafeToCString `T.Text',`Int' } -> `Double' #}
+flcWidthWithN :: T.Text -> Int ->  IO (Double)
 flcWidthWithN txt n = flcWidthWithN' txt n
 
 {# fun flc_width_with_c as flcWidthWithC' { `Int' } -> `Double' #}
 flcWidthWithC :: Int ->  IO (Double)
 flcWidthWithC c = flcWidthWithC' c
 
-{# fun flc_text_extents as flcTextExtents' { `String',alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv* } -> `()' #}
-flcTextExtents :: String -> IO (Rectangle)
+{# fun flc_text_extents as flcTextExtents' { unsafeToCString `T.Text',alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv* } -> `()' #}
+flcTextExtents :: T.Text -> IO (Rectangle)
 flcTextExtents s  = flcTextExtents' s >>= \(rectangle') -> return $ (toRectangle rectangle')
 
-{# fun flc_text_extents_with_n as flcTextExtentsWithN' { `String',`Int',alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv* } -> `()' #}
-flcTextExtentsWithN :: String -> Int ->  IO (Rectangle)
+{# fun flc_text_extents_with_n as flcTextExtentsWithN' { unsafeToCString `T.Text',`Int',alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv*,alloca- `Int' peekIntConv* } -> `()' #}
+flcTextExtentsWithN :: T.Text -> Int ->  IO (Rectangle)
 flcTextExtentsWithN t n  = flcTextExtentsWithN' t n >>= \(rectangle') -> return $ (toRectangle rectangle')
 
-{# fun flc_latin1_to_local as flcLatin1ToLocal' { `String' } -> `String' unsafeFromCString #}
-flcLatin1ToLocal :: String ->  IO (String)
+{# fun flc_latin1_to_local as flcLatin1ToLocal' { unsafeToCString `T.Text' } -> `T.Text' unsafeFromCString #}
+flcLatin1ToLocal :: T.Text ->  IO  T.Text
 flcLatin1ToLocal t = flcLatin1ToLocal' t
 
-{# fun flc_latin1_to_local_with_n as flcLatin1ToLocalWithN' { `String',`Int' } -> `String' unsafeFromCString #}
-flcLatin1ToLocalWithN :: String -> Int ->  IO (String)
+{# fun flc_latin1_to_local_with_n as flcLatin1ToLocalWithN' { unsafeToCString `T.Text',`Int' } -> `T.Text' unsafeFromCString #}
+flcLatin1ToLocalWithN :: T.Text -> Int ->  IO  T.Text
 flcLatin1ToLocalWithN t n = flcLatin1ToLocalWithN' t n
 
-{# fun flc_local_to_latin1 as flcLocalToLatin1' { `String' } -> `String' unsafeFromCString #}
-flcLocalToLatin1 :: String ->  IO (String)
+{# fun flc_local_to_latin1 as flcLocalToLatin1' { unsafeToCString `T.Text' } -> `T.Text' unsafeFromCString #}
+flcLocalToLatin1 :: T.Text ->  IO  T.Text
 flcLocalToLatin1 t = flcLocalToLatin1' t
 
-{# fun flc_local_to_latin1_with_n as flcLocalToLatin1WithN' { `String',`Int' } -> `String' unsafeFromCString #}
-flcLocalToLatin1WithN :: String -> Int ->  IO (String)
+{# fun flc_local_to_latin1_with_n as flcLocalToLatin1WithN' { unsafeToCString `T.Text',`Int' } -> `T.Text' unsafeFromCString #}
+flcLocalToLatin1WithN :: T.Text -> Int ->  IO  T.Text
 flcLocalToLatin1WithN t n = flcLocalToLatin1WithN' t n
 
-{# fun flc_mac_roman_to_local as flcMacRomanToLocal' { `String' } -> `String' unsafeFromCString #}
-flcMacRomanToLocal :: String ->  IO (String)
+{# fun flc_mac_roman_to_local as flcMacRomanToLocal' { unsafeToCString `T.Text' } -> `T.Text' unsafeFromCString #}
+flcMacRomanToLocal :: T.Text ->  IO  T.Text
 flcMacRomanToLocal t = flcMacRomanToLocal' t
 
-{# fun flc_mac_roman_to_local_with_n as flcMacRomanToLocalWithN' { `String',`Int' } -> `String' unsafeFromCString #}
-flcMacRomanToLocalWithN :: String -> Int ->  IO (String)
+{# fun flc_mac_roman_to_local_with_n as flcMacRomanToLocalWithN' { unsafeToCString `T.Text',`Int' } -> `T.Text' unsafeFromCString #}
+flcMacRomanToLocalWithN :: T.Text -> Int ->  IO  T.Text
 flcMacRomanToLocalWithN t n = flcMacRomanToLocalWithN' t n
 
-{# fun flc_local_to_mac_roman as flcLocalToMacRoman' { `String' } -> `String' unsafeFromCString #}
-flcLocalToMacRoman :: String ->  IO (String)
+{# fun flc_local_to_mac_roman as flcLocalToMacRoman' { unsafeToCString `T.Text' } -> `T.Text' unsafeFromCString #}
+flcLocalToMacRoman :: T.Text ->  IO  T.Text
 flcLocalToMacRoman t = flcLocalToMacRoman' t
 
-{# fun flc_local_to_mac_roman_with_n as flcLocalToMacRomanWithN' { `String',`Int' } -> `String' unsafeFromCString #}
-flcLocalToMacRomanWithN :: String -> Int ->  IO (String)
+{# fun flc_local_to_mac_roman_with_n as flcLocalToMacRomanWithN' { unsafeToCString `T.Text',`Int' } -> `T.Text' unsafeFromCString #}
+flcLocalToMacRomanWithN :: T.Text -> Int ->  IO  T.Text
 flcLocalToMacRomanWithN t n = flcLocalToMacRomanWithN' t n
 
-{# fun flc_draw as flcDraw' { `String',`Int',`Int' } -> `()' #}
-flcDraw :: String -> Position ->  IO ()
+{# fun flc_draw as flcDraw' { unsafeToCString `T.Text',`Int',`Int' } -> `()' #}
+flcDraw :: T.Text -> Position ->  IO ()
 flcDraw str (Position (X x_pos') (Y y_pos')) = flcDraw' str x_pos' y_pos'
 
-{# fun flc_draw_with_angle as flcDrawWithAngle' { `Int',`String',`Int',`Int' } -> `()' #}
-flcDrawWithAngle :: Int -> String -> Position ->  IO ()
+{# fun flc_draw_with_angle as flcDrawWithAngle' { `Int',unsafeToCString `T.Text',`Int',`Int' } -> `()' #}
+flcDrawWithAngle :: Int -> T.Text -> Position ->  IO ()
 flcDrawWithAngle angle str (Position (X x_pos') (Y y_pos')) = flcDrawWithAngle' angle str x_pos' y_pos'
 
-{# fun flc_draw_with_n as flcDrawWithN' { `String',`Int',`Int',`Int' } -> `()' #}
-flcDrawWithN :: String -> Int -> Position ->  IO ()
+{# fun flc_draw_with_n as flcDrawWithN' { unsafeToCString `T.Text',`Int',`Int',`Int' } -> `()' #}
+flcDrawWithN :: T.Text -> Int -> Position ->  IO ()
 flcDrawWithN str n (Position (X x_pos') (Y y_pos')) = flcDrawWithN' str n x_pos' y_pos'
 
-{# fun flc_draw_with_n_angle as flcDrawWithNAngle' { `Int',`String',`Int',`Int',`Int' } -> `()' #}
-flcDrawWithNAngle :: Int -> String -> Int -> Position ->  IO ()
+{# fun flc_draw_with_n_angle as flcDrawWithNAngle' { `Int',unsafeToCString `T.Text',`Int',`Int',`Int' } -> `()' #}
+flcDrawWithNAngle :: Int -> T.Text -> Int -> Position ->  IO ()
 flcDrawWithNAngle angle str n (Position (X x_pos') (Y y_pos')) = flcDrawWithNAngle' angle str n x_pos' y_pos'
 
-{# fun flc_rtl_draw as flcRtlDraw' { `String',`Int',`Int',`Int' } -> `()' #}
-flcRtlDraw :: String -> Int -> Position ->  IO ()
+{# fun flc_rtl_draw as flcRtlDraw' { unsafeToCString `T.Text',`Int',`Int',`Int' } -> `()' #}
+flcRtlDraw :: T.Text -> Int -> Position ->  IO ()
 flcRtlDraw str n (Position (X x_pos') (Y y_pos')) = flcRtlDraw' str n x_pos' y_pos'
 
-{# fun flc_measure_with_draw_symbols as flcMeasureWithDrawSymbols' { `String', id `Ptr CInt', id `Ptr CInt', `CInt' } -> `()' #}
-flcMeasure :: String -> Bool -> Bool -> IO (Size)
+{# fun flc_measure_with_draw_symbols as flcMeasureWithDrawSymbols' { unsafeToCString `T.Text', id `Ptr CInt', id `Ptr CInt', `CInt' } -> `()' #}
+flcMeasure :: T.Text -> Bool -> Bool -> IO (Size)
 flcMeasure str word_wrap draw_symbols =
   alloca $ \widthPtr' ->
   alloca $ \heightPtr' ->
@@ -506,9 +507,9 @@
   then poke widthPtr' 1 >> doit
   else doit
 
-{# fun flc_draw_with_img_draw_symbols as flcDrawWithImgDrawSymbols' { `String',`Int',`Int',`Int',`Int',`Int', id `Ptr ()',`Bool' } -> `()' #}
-{# fun flc_draw_with_callthis_img_draw_symbols as flcDrawWithCallthisImgDrawSymbols' { `String',`Int',`Int',`Int',`Int',`Int', id `FunPtr DrawCallbackPrim', id `Ptr ()',`Bool' } -> `()' #}
-flcDrawInBoxWithImageReference' ::  String -> Rectangle -> Alignments -> Maybe DrawCallback -> Ptr () -> Maybe Bool -> IO ()
+{# fun flc_draw_with_img_draw_symbols as flcDrawWithImgDrawSymbols' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int',`Int', id `Ptr ()',`Bool' } -> `()' #}
+{# fun flc_draw_with_callthis_img_draw_symbols as flcDrawWithCallthisImgDrawSymbols' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int',`Int', id `FunPtr DrawCallbackPrim', id `Ptr ()',`Bool' } -> `()' #}
+flcDrawInBoxWithImageReference' ::  T.Text -> Rectangle -> Alignments -> Maybe DrawCallback -> Ptr () -> Maybe Bool -> IO ()
 flcDrawInBoxWithImageReference' string' rectangle' align' draw_callback' image_ptr draw_flags' =
   let (x_pos', y_pos', width', height') = fromRectangle rectangle' in
   case draw_callback' of
@@ -517,20 +518,20 @@
   Just c' -> do
              fptr <- toDrawCallback c'
              flcDrawWithCallthisImgDrawSymbols' string' x_pos' y_pos' width' height' (alignmentsToInt align') fptr image_ptr (maybe False id draw_flags')
-flcDrawInBoxWithImageReference :: (Parent a Image) => String -> Rectangle -> Alignments -> Maybe DrawCallback -> Ref a -> Maybe Bool -> IO ()
+flcDrawInBoxWithImageReference :: (Parent a Image) => T.Text -> Rectangle -> Alignments -> Maybe DrawCallback -> Ref a -> Maybe Bool -> IO ()
 flcDrawInBoxWithImageReference string' rectangle' align' draw_callback' image' draw_flags'
   = withRef image' $ \imagePtr' -> flcDrawInBoxWithImageReference' string' rectangle' align' draw_callback' imagePtr' draw_flags'
 
-flcDrawInBox :: String -> Rectangle -> Alignments -> Maybe DrawCallback -> Maybe Bool -> IO ()
+flcDrawInBox :: T.Text -> Rectangle -> Alignments -> Maybe DrawCallback -> Maybe Bool -> IO ()
 flcDrawInBox string' rectangle' align' draw_callback' draw_flags'
   = flcDrawInBoxWithImageReference' string' rectangle' align' draw_callback' (castPtr nullPtr) draw_flags'
 
-{# fun flc_frame as flcFrame' { `String',`Int',`Int',`Int',`Int' } -> `()' #}
-flcFrame :: String -> Rectangle ->  IO ()
+{# fun flc_frame as flcFrame' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int' } -> `()' #}
+flcFrame :: T.Text -> Rectangle ->  IO ()
 flcFrame s rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcFrame' s x_pos' y_pos' width' height'
 
-{# fun flc_frame2 as flcFrame2' { `String',`Int',`Int',`Int',`Int' } -> `()' #}
-flcFrame2 :: String -> Rectangle ->  IO ()
+{# fun flc_frame2 as flcFrame2' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int' } -> `()' #}
+flcFrame2 :: T.Text -> Rectangle ->  IO ()
 flcFrame2 s rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcFrame2' s x_pos' y_pos' width' height'
 
 {# fun flc_draw_box as flcDrawBox' { cFromEnum `Boxtype',`Int',`Int',`Int',`Int',cFromColor `Color' } -> `()' #}
@@ -614,12 +615,12 @@
                          return (result, toSize (width', height'))
                       )
 
-{# fun flc_shortcut_label as flcShortcutLabel' { `Int' } -> `String' unsafeFromCString #}
-flcShortcutLabel :: Int ->  IO (String)
+{# fun flc_shortcut_label as flcShortcutLabel' { `Int' } -> `T.Text' unsafeFromCString #}
+flcShortcutLabel :: Int ->  IO  T.Text
 flcShortcutLabel shortcut = flcShortcutLabel' shortcut
 
-{# fun flc_old_shortcut as flcOldShortcut' { `String' } -> `Int' #}
-flcOldShortcut :: String -> IO (Int)
+{# fun flc_old_shortcut as flcOldShortcut' { unsafeToCString `T.Text' } -> `Int' #}
+flcOldShortcut :: T.Text -> IO (Int)
 flcOldShortcut s = flcOldShortcut' s
 
 {# fun flc_overlay_rect as flcOverlayRect' { `Int',`Int',`Int',`Int' } -> `()' #}
@@ -662,6 +663,6 @@
 flcResetSpot ::  IO ()
 flcResetSpot  = flcResetSpot'
 
-{# fun flc_draw_symbol as flcDrawSymbol' { `String',`Int',`Int',`Int',`Int',cFromColor `Color' } -> `Int' #}
-flcDrawSymbol :: String -> Rectangle -> Color ->  IO (Int)
+{# fun flc_draw_symbol as flcDrawSymbol' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int',cFromColor `Color' } -> `Int' #}
+flcDrawSymbol :: T.Text -> Rectangle -> Color ->  IO (Int)
 flcDrawSymbol label rectangle color' = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcDrawSymbol' label x_pos' y_pos' width' height' color'
diff --git a/src/Graphics/UI/FLTK/LowLevel/FL.chs b/src/Graphics/UI/FLTK/LowLevel/FL.chs
--- a/src/Graphics/UI/FLTK/LowLevel/FL.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/FL.chs
@@ -180,6 +180,8 @@
                                                    setScrollbarSize
                                                   )
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
+import qualified Data.Text.Foreign as TF
 import qualified System.IO.Unsafe as Unsafe (unsafePerformIO)
 #c
  enum Option {
@@ -247,10 +249,10 @@
 {# fun Fl_version as version
   {} -> `Double' #}
 {# fun Fl_help as help
-  {} -> `String' unsafeFromCString #}
+  {} -> `T.Text' unsafeFromCString #}
 
-display :: String -> IO ()
-display text = withCString text $ \str -> {#call Fl_display as fl_display #} str
+display :: T.Text -> IO ()
+display text = TF.withCStringLen text $ \(str,_) -> {#call Fl_display as fl_display #} str
 {# fun Fl_visual as visual
   {cFromEnum `Mode'} -> `Bool' cToBool #}
 #if !defined(__APPLE__)
@@ -282,11 +284,11 @@
                     (fromIntegral g)
                     (fromIntegral b)
 {# fun pure Fl_scheme as scheme
-  {} -> `String' unsafeFromCString #}
-setScheme :: String -> IO Int
-setScheme sch = withCString sch $ \str -> {#call Fl_set_scheme as fl_set_scheme #} str >>= return . fromIntegral
-isScheme :: String -> IO Bool
-isScheme sch = withCString sch $ \str -> {#call Fl_is_scheme as fl_is_scheme #} str >>= return . toBool
+  {} -> `T.Text' unsafeFromCString #}
+setScheme :: T.Text -> IO Int
+setScheme sch = TF.withCStringLen sch $ \(str,_) -> {#call Fl_set_scheme as fl_set_scheme #} str >>= return . fromIntegral
+isScheme :: T.Text -> IO Bool
+isScheme sch = TF.withCStringLen sch $ \(str,_) -> {#call Fl_is_scheme as fl_is_scheme #} str >>= return . toBool
 {# fun Fl_wait as wait
        {  } -> `Int' #}
 {# fun Fl_set_wait as setWait
@@ -413,7 +415,7 @@
 {# fun Fl_get_key as getKey
        {cFromKeyType `KeyType' } -> `Bool' toBool #}
 {# fun Fl_event_text as eventText
-       {  } -> `String' unsafeFromCString #}
+       {  } -> `T.Text' unsafeFromCString #}
 {# fun Fl_event_length as eventLength
        {  } -> `Int' #}
 {# fun Fl_compose as compose
@@ -530,9 +532,9 @@
       poke ptrToCallbackPtr callbackPtr
       setEventDispatch' ptrToCallbackPtr
 {# fun Fl_copy as copy
-       { `String',`Int' } -> `()' supressWarningAboutRes #}
+       { unsafeToCString `T.Text',`Int' } -> `()' supressWarningAboutRes #}
 {# fun Fl_copy_with_destination as copyWithDestination
-       { `String',`Int',`Int' } -> `()' supressWarningAboutRes #}
+       { unsafeToCString `T.Text',`Int',`Int' } -> `()' supressWarningAboutRes #}
 {# fun Fl_paste_with_source as pasteWithSource
        { id `Ptr ()',`Int' } -> `()' supressWarningAboutRes #}
 paste :: (Parent a Widget) => Ref a -> Maybe Int -> IO ()
@@ -689,26 +691,26 @@
 removeFromColormap Nothing c = freeColor' c
 #endif
 {# fun Fl_get_font as getFont
-       { cFromFont `Font' } -> `String' unsafeFromCString #}
+       { cFromFont `Font' } -> `T.Text' unsafeFromCString #}
 {# fun Fl_get_font_name_with_attributes as getFontNameWithAttributes'
-       { cFromFont `Font', alloca- `Maybe FontAttribute' toAttribute* } -> `String' unsafeFromCString #}
+       { cFromFont `Font', alloca- `Maybe FontAttribute' toAttribute* } -> `T.Text' unsafeFromCString #}
 toAttribute :: Ptr CInt -> IO (Maybe FontAttribute)
 toAttribute ptr =
         do
           attributeCode <- peekIntConv ptr
           return $ cToFontAttribute attributeCode
-getFontName :: Font -> IO (String, Maybe FontAttribute)
+getFontName :: Font -> IO (T.Text, Maybe FontAttribute)
 getFontName f = getFontNameWithAttributes' f
 {# fun Fl_get_font_sizes as getFontSizes
        { cFromFont `Font', alloca- `Int' peekIntConv* } -> `Int' #}
 {# fun Fl_set_font_by_string as setFontByString
-       { cFromFont `Font', unsafeToCString `String' } -> `()' supressWarningAboutRes #}
+       { cFromFont `Font', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
 {# fun Fl_set_font_by_font as setFontByFont
        { cFromFont `Font',cFromFont `Font' } -> `()' supressWarningAboutRes #}
 {# fun Fl_set_fonts as setFonts
        {  } -> `Font' cToFont #}
 {# fun Fl_set_fonts_with_string as setFontsWithString
-       { `String' } -> `Font' cToFont #}
+       { unsafeToCString `T.Text' } -> `Font' cToFont #}
 
 {# fun Fl_add_fd_with_when as addFdWhen'
        {
diff --git a/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs b/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
--- a/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
+++ b/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
@@ -754,7 +754,7 @@
 -- And run `cmake` via `stack`:
 --
 -- @
--- > STACK_YAML=\<path-to-hello-world-skeleton\>/stack-windows.yaml stack exec cmake -- -DOPTION_BUILD_SHARED_LIBS=On .. -G "MSYS Makefiles"
+-- > stack exec cmake -- -DOPTION_BUILD_SHARED_LIBS=On .. -G "MSYS Makefiles"
 -- @
 --
 -- If you are confused about the 'STACK_YAML' environment variable please see the "GHC 7.10.3 And Beyond (Windows Only)" in the "Obstacles" section above.
@@ -810,8 +810,8 @@
 -- Now we can to build it:
 --
 -- @
--- > STACK_YAML=stack-windows.yaml stack setup
--- > STACK_YAML=stack-windows.yaml stack install
+-- > stack setup
+-- > stack install
 -- @
 -- If you are confused about the 'STACK_YAML' environment variable please see the "GHC 7.10.3 And Beyond (Windows Only)" in the "Obstacles" section above.
 --
@@ -828,9 +828,8 @@
 -- If all goes well there should be an incredibly unimpressive executable 'fltkhs-hello-world' in the 'stack' path. It can be invoked like:
 --
 -- @
--- > STACK_YAML=stack-windows.yaml stack exec fltkhs-hello-world
+-- > stack exec fltkhs-hello-world
 -- @
--- If you are confused about the 'STACK_YAML' environment variable please see the "GHC 7.10.3 And Beyond (Windows Only)" in the "Obstacles" section above.
 --
 
 -- $Demos
@@ -966,7 +965,7 @@
 -- (4) function arguments which are pointers to be filled are not exposed to the
 -- API user. For instance, a common C++ idiom is to return a string by taking a
 -- pointer to some initialized but empty chunk of memory and filling it up. The
--- corresponding Haskell function just returns a 'String'.
+-- corresponding Haskell function just returns a 'Data.Text'.
 --
 --
 -- It is hoped that until the documentation becomes more self-sustaining the
diff --git a/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs b/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs
--- a/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs
@@ -31,10 +31,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 {# pointer *Fl_File_Sort_F as FileSortF #}
 {# fun Fl_File_Browser_New as fileBrowserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_File_Browser_New_WithLabel as fileBrowserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-fileBrowserNew :: Rectangle -> Maybe String -> IO (Ref FileBrowser)
+{# fun Fl_File_Browser_New_WithLabel as fileBrowserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+fileBrowserNew :: Rectangle -> Maybe T.Text -> IO (Ref FileBrowser)
 fileBrowserNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -49,11 +50,11 @@
 {# fun Fl_File_Browser_iconsize as iconsize' { id `Ptr ()' } -> `CUChar' id #}
 instance (impl ~ ( IO (CUChar))) => Op (GetIconsize ()) FileBrowser orig impl where
   runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> iconsize' fileBrowserPtr
-{# fun Fl_File_Browser_set_filter as setFilter' { id `Ptr ()', `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetFilter ()) FileBrowser orig impl where
+{# fun Fl_File_Browser_set_filter as setFilter' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetFilter ()) FileBrowser orig impl where
   runOp _ _ fileBrowser text = withRef fileBrowser $ \fileBrowserPtr -> setFilter' fileBrowserPtr text
-{# fun Fl_File_Browser_filter as filter' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetFilter ()) FileBrowser orig impl where
+{# fun Fl_File_Browser_filter as filter' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetFilter ()) FileBrowser orig impl where
   runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> filter' fileBrowserPtr
 {# fun Fl_File_Browser_set_textsize as setTextsize' { id `Ptr ()', id `CInt' } -> `()' #}
 instance (impl ~ (FontSize ->  IO ())) => Op (SetTextsize ()) FileBrowser orig impl where
@@ -67,8 +68,8 @@
 {# fun Fl_File_Browser_filetype as filetype' { id `Ptr ()' } -> `Word8' #}
 instance (impl ~ IO (FileBrowserType)) => Op (GetFiletype ()) FileBrowser orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> filetype' widgetPtr >>= return . toEnum . fromInteger . toInteger
-{# fun Fl_File_Browser_load as load' { id `Ptr ()', `String', id `FileSortF' } -> `CInt' id #}
-instance (impl ~ (String -> FileSortF -> IO (Either UnknownError ()))) => Op (Load ()) FileBrowser orig impl where
+{# fun Fl_File_Browser_load as load' { id `Ptr ()', unsafeToCString `T.Text', id `FileSortF' } -> `CInt' id #}
+instance (impl ~ (T.Text -> FileSortF -> IO (Either UnknownError ()))) => Op (Load ()) FileBrowser orig impl where
   runOp _ _ widget dir sortF = withRef widget $ \widgetPtr -> do
                                status <- load' widgetPtr dir sortF
                                return (if (status == 0) then (Left UnknownError) else (Right ()))
@@ -96,17 +97,17 @@
 -- @
 -- getFiletype :: 'Ref' 'FileBrowser' -> 'IO' ('FileBrowserType')
 --
--- getFilter :: 'Ref' 'FileBrowser' -> 'IO' ('String')
+-- getFilter :: 'Ref' 'FileBrowser' -> 'IO' 'T.Text'
 --
 -- getIconsize :: 'Ref' 'FileBrowser' -> 'IO' ('CUChar')
 --
 -- getTextsize :: 'Ref' 'FileBrowser' -> 'IO' ('FontSize')
 --
--- load :: 'Ref' 'FileBrowser' -> 'String' -> 'FileSortF' -> 'IO' ('Either' 'UnknownError' ())
+-- load :: 'Ref' 'FileBrowser' -> 'T.Text' -> 'FileSortF' -> 'IO' ('Either' 'UnknownError' ())
 --
 -- setFiletype :: 'Ref' 'FileBrowser' -> 'FileBrowserType' -> 'IO' ()
 --
--- setFilter :: 'Ref' 'FileBrowser' -> 'String' -> 'IO' ()
+-- setFilter :: 'Ref' 'FileBrowser' -> 'T.Text' -> 'IO' ()
 --
 -- setIconsize :: 'Ref' 'FileBrowser' -> 'CUChar' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/FileInput.chs b/src/Graphics/UI/FLTK/LowLevel/FileInput.chs
--- a/src/Graphics/UI/FLTK/LowLevel/FileInput.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/FileInput.chs
@@ -21,11 +21,12 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 
 {# fun Fl_File_Input_New as fileInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_File_Input_New_WithLabel as fileInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-fileInputNew :: Rectangle -> Maybe String -> IO (Ref FileInput)
+{# fun Fl_File_Input_New_WithLabel as fileInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+fileInputNew :: Rectangle -> Maybe T.Text -> IO (Ref FileInput)
 fileInputNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -46,11 +47,11 @@
 {# fun Fl_File_Input_set_errorcolor as setErrorColor' { id `Ptr ()',cFromColor `Color' } -> `()' #}
 instance (impl ~ (Color ->  IO ())) => Op (SetErrorColor ()) FileInput orig impl where
   runOp _ _ fileInput b = withRef fileInput $ \fileInputPtr -> setErrorColor' fileInputPtr b
-{# fun Fl_File_Input_set_value as setValue' { id `Ptr ()', unsafeToCString `String'} -> `()' #}
-instance (impl ~ (String -> IO ())) => Op (SetValue ()) FileInput orig impl where
+{# fun Fl_File_Input_set_value as setValue' { id `Ptr ()', unsafeToCString `T.Text'} -> `()' #}
+instance (impl ~ (T.Text -> IO ())) => Op (SetValue ()) FileInput orig impl where
   runOp _ _ fileInput s = withRef fileInput $ \fileInputPtr -> setValue' fileInputPtr s
-{# fun Fl_File_Input_value as getValue' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ (IO (String))) => Op (GetValue ()) FileInput orig impl where
+{# fun Fl_File_Input_value as getValue' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (IO T.Text)) => Op (GetValue ()) FileInput orig impl where
   runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> getValue' fileInputPtr
 
 -- $hierarchy
@@ -70,11 +71,11 @@
 --
 -- getErrorColor :: 'Ref' 'FileInput' -> 'IO' ('Color')
 --
--- getValue :: 'Ref' 'FileInput' -> 'IO' ('String')
---
+-- getValue :: 'Ref' 'FileInput' -> 'IO' 'T.Text'
+  --
 -- setDownBox :: 'Ref' 'FileInput' -> 'Boxtype' -> 'IO' ()
 --
 -- setErrorColor :: 'Ref' 'FileInput' -> 'Color' -> 'IO' ()
 --
--- setValue :: 'Ref' 'FileInput' -> 'String' -> 'IO' ()
+-- setValue :: 'Ref' 'FileInput' -> 'T.Text' -> 'IO' ()
 -- @
diff --git a/src/Graphics/UI/FLTK/LowLevel/FillDial.chs b/src/Graphics/UI/FLTK/LowLevel/FillDial.chs
--- a/src/Graphics/UI/FLTK/LowLevel/FillDial.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/FillDial.chs
@@ -15,9 +15,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
+import qualified Data.Text as T
 
-{# fun Fl_Fill_Dial_New as fillDialNew' { `Int',`Int',`Int',`Int', unsafeToCString `String' } -> `Ptr ()' id #}
-fillDialNew :: Rectangle -> String -> IO (Ref FillDial)
+{# fun Fl_Fill_Dial_New as fillDialNew' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text' } -> `Ptr ()' id #}
+fillDialNew :: Rectangle -> T.Text -> IO (Ref FillDial)
 fillDialNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in
diff --git a/src/Graphics/UI/FLTK/LowLevel/FillSlider.chs b/src/Graphics/UI/FLTK/LowLevel/FillSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/FillSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/FillSlider.chs
@@ -17,10 +17,11 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
+import qualified Data.Text as T
 
 {# fun Fl_Fill_Slider_New as fillSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Fill_Slider_New_WithLabel as fillSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-fillSliderNew :: Rectangle -> Maybe String -> IO (Ref FillSlider)
+{# fun Fl_Fill_Slider_New_WithLabel as fillSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+fillSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref FillSlider)
 fillSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Fl_Enumerations.chs b/src/Graphics/UI/FLTK/LowLevel/Fl_Enumerations.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Fl_Enumerations.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Fl_Enumerations.chs
@@ -40,7 +40,9 @@
      Cursor(..),
      -- * Various modes
      Mode(..),
+     Modes(..),
      single,
+     allModes,
      -- * Alignment
      Alignments(..),
      AlignType(..),
@@ -642,7 +644,7 @@
 glutCursorFullCrossHair :: GlutCursor
 glutCursorFullCrossHair = GlutCursorCrosshair
 {#enum Cursor {} deriving (Show) #}
-{#enum Mode   {} deriving (Show) #}
+{#enum Mode   {} deriving (Show,Eq,Ord) #}
 {#enum AlignType {} deriving (Show, Eq, Ord) #}
 newtype Alignments = Alignments [AlignType] deriving Show
 alignCenter :: Alignments
@@ -1056,7 +1058,22 @@
 
 single :: Mode
 single = ModeRGB
-
+newtype Modes = Modes [Mode] deriving (Show,Eq,Ord)
+allModes :: [Mode]
+allModes =
+  [
+    ModeRGB,
+    ModeIndex,
+    ModeDouble,
+    ModeAccum,
+    ModeAlpha,
+    ModeDepth,
+    ModeStencil,
+    ModeRGB8,
+    ModeMultisample,
+    ModeStereo,
+    ModeFakeSingle
+  ]
 
 -- Fl_LabelType
 
diff --git a/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs b/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
@@ -14,6 +14,7 @@
 import Debug.Trace
 import Control.Exception
 import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
+import qualified Data.Text as T
 #if defined(CALLSTACK_AVAILABLE) || defined(HASCALLSTACK_AVAILABLE)
 import GHC.Stack
 #endif
@@ -280,7 +281,7 @@
 type ImageCopyCallbackPrim       = Ptr () -> CInt -> CInt -> IO (Ptr ())
 type GlobalEventHandlerPrim      = CInt -> IO CInt
 type GlobalEventHandlerF         = Event -> IO Int
-type DrawCallback                = String -> Position -> IO ()
+type DrawCallback                = T.Text -> Position -> IO ()
 type DrawCallbackPrim            = CString -> CInt -> CInt -> CInt -> IO ()
 type TextBufferCallback          = FunPtr (Ptr () -> IO ())
 type FileChooserCallback         = FunPtr (Ptr () -> Ptr () -> IO())
@@ -289,7 +290,7 @@
 type BoxDrawFPrim                = CInt -> CInt -> CInt -> CInt -> FlColor -> IO ()
 type FDHandlerPrim               = CInt -> Ptr () -> IO ()
 type FDHandler                   = CInt -> IO ()
-type TextModifyCb                = Int -> Int -> Int -> Int -> String -> IO ()
+type TextModifyCb                = Int -> Int -> Int -> Int -> T.Text -> IO ()
 type TextModifyCbPrim            = CInt -> CInt -> CInt -> CInt -> Ptr CChar -> Ptr () -> IO ()
 type TextPredeleteCb             = BufferOffset -> Int -> IO ()
 type TextPredeleteCbPrim         = CInt -> CInt -> Ptr () -> IO ()
@@ -328,9 +329,11 @@
 data ByXY = ByXY ByX ByY deriving Show
 data Intersection = Contained | Partial deriving Show
 data Size = Size Width Height deriving (Eq, Show)
+newtype LineNumber = LineNumber Int deriving (Eq,Show,Ord)
+newtype PixelPosition = PixelPosition Int deriving (Eq,Show,Ord)
 data KeyType = SpecialKeyType SpecialKey | NormalKeyType Char deriving (Show, Eq)
 data ShortcutKeySequence = ShortcutKeySequence [EventState] KeyType deriving Show
-data Shortcut = KeySequence ShortcutKeySequence | KeyFormat String deriving Show
+data Shortcut = KeySequence ShortcutKeySequence | KeyFormat T.Text deriving Show
 data KeyBindingKeySequence = KeyBindingKeySequence (Maybe [EventState]) KeyType deriving Show
 newtype Between0And1 = Between0And1 Double deriving Show
 newtype Between0And6 = Between0And6 Double deriving Show
@@ -338,10 +341,15 @@
                     | ScreenNumber Int
                     | ScreenPosition Position deriving Show
 newtype FontSize = FontSize CInt deriving Show
-newtype PixmapHs = PixmapHs [String] deriving Show
+newtype PixmapHs = PixmapHs [T.Text] deriving Show
 data BitmapHs = BitmapHs B.ByteString Size deriving Show
 data Clipboard = InternalClipboard | SharedClipboard deriving Show
+data UnknownEvent = UnknownEvent deriving Show
+successOrUnknownEvent :: Int -> Either UnknownEvent ()
+successOrUnknownEvent status = if (status == 0) then Left UnknownEvent else Right ()
 data UnknownError = UnknownError deriving Show
+successOrUnknownError :: a -> Bool -> (a -> IO b) -> IO (Either UnknownError b)
+successOrUnknownError a pred' tr = if pred' then return (Left UnknownError) else tr a >>= return . Right
 data NotFound = NotFound deriving Show
 data OutOfRange = OutOfRange deriving Show
 successOrOutOfRange :: a -> Bool -> (a -> IO b) -> IO (Either OutOfRange b)
diff --git a/src/Graphics/UI/FLTK/LowLevel/GIFImage.chs b/src/Graphics/UI/FLTK/LowLevel/GIFImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/GIFImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/GIFImage.chs
@@ -17,9 +17,9 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
-
-{# fun Fl_GIF_Image_New as gifImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-gifImageNew :: String -> IO (Either UnknownError (Ref GIFImage))
+import qualified Data.Text as T
+{# fun Fl_GIF_Image_New as gifImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+gifImageNew :: T.Text -> IO (Either UnknownError (Ref GIFImage))
 gifImageNew filename' = do
   ptr <- gifImageNew' filename'
   ref' <- (toRef ptr :: IO (Ref GIFImage))
diff --git a/src/Graphics/UI/FLTK/LowLevel/Gl.chs b/src/Graphics/UI/FLTK/LowLevel/Gl.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Gl.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Gl.chs
@@ -28,6 +28,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
+import qualified Data.Text as T
 {# fun flc_gl_start   as glStart   { } -> `()' #}
 {# fun flc_gl_finish  as glFinish  { } -> `()' #}
 {# fun flc_gl_height  as glHeight  { } -> `()' #}
@@ -46,40 +47,40 @@
 glFont :: Font -> Int ->  IO ()
 glFont fontid size = flcGlFont' fontid size
 
-{# fun flc_gl_width as flcGlWidth' { `String' } -> `Double' #}
-glWidth :: String ->  IO (Double)
+{# fun flc_gl_width as flcGlWidth' { unsafeToCString `T.Text' } -> `Double' #}
+glWidth :: T.Text ->  IO (Double)
 glWidth str = flcGlWidth' str
 
-{# fun flc_gl_width_with_n as flcGlWidthWithN' { `String',`Int' } -> `Double' #}
-glWidthChars :: String -> Int ->  IO (Double)
+{# fun flc_gl_width_with_n as flcGlWidthWithN' { unsafeToCString `T.Text',`Int' } -> `Double' #}
+glWidthChars :: T.Text -> Int ->  IO (Double)
 glWidthChars str n = flcGlWidthWithN' str n
 
 {# fun flc_gl_width_with_uchar_str as flcGlWidthWithUcharStr' { castCharToCUChar `Char' } -> `Double' #}
 glWidthChar :: Char ->  IO (Double)
 glWidthChar str = flcGlWidthWithUcharStr' str
 
-{# fun flc_gl_draw as flcGlDraw' { `String' } -> `()' #}
-glDraw :: String ->  IO ()
+{# fun flc_gl_draw as flcGlDraw' { unsafeToCString `T.Text' } -> `()' #}
+glDraw :: T.Text ->  IO ()
 glDraw str = flcGlDraw' str
 
-{# fun flc_gl_draw_with_n as flcGlDrawWithN' { `String',`Int' } -> `()' #}
-glDrawChars :: String -> Int ->  IO ()
+{# fun flc_gl_draw_with_n as flcGlDrawWithN' { unsafeToCString `T.Text',`Int' } -> `()' #}
+glDrawChars :: T.Text -> Int ->  IO ()
 glDrawChars str n = flcGlDrawWithN' str n
 
-{# fun flc_gl_draw_with_xy as flcGlDrawWithXy' { `String',`Float',`Float' } -> `()' #}
-glDrawAt :: String -> Float -> Float ->  IO ()
+{# fun flc_gl_draw_with_xy as flcGlDrawWithXy' { unsafeToCString `T.Text',`Float',`Float' } -> `()' #}
+glDrawAt :: T.Text -> Float -> Float ->  IO ()
 glDrawAt str x y = flcGlDrawWithXy' str x y
 
-{# fun flc_gl_draw_with_nxy as flcGlDrawWithNxy' { `String',`Int',`Float',`Float' } -> `()' #}
-glDrawCharsAt :: String -> Int -> Float -> Float ->  IO ()
+{# fun flc_gl_draw_with_nxy as flcGlDrawWithNxy' { unsafeToCString `T.Text',`Int',`Float',`Float' } -> `()' #}
+glDrawCharsAt :: T.Text -> Int -> Float -> Float ->  IO ()
 glDrawCharsAt str n x y = flcGlDrawWithNxy' str n x y
 
-{# fun flc_gl_draw_with_xywh_align as flcGlDrawWithXywhAlign' { `String',`Int',`Int',`Int',`Int',cFromEnum `AlignType' } -> `()' #}
-glDrawInBox :: String -> Rectangle -> AlignType ->  IO ()
+{# fun flc_gl_draw_with_xywh_align as flcGlDrawWithXywhAlign' { unsafeToCString `T.Text',`Int',`Int',`Int',`Int',cFromEnum `AlignType' } -> `()' #}
+glDrawInBox :: T.Text -> Rectangle -> AlignType ->  IO ()
 glDrawInBox str rectangle align = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcGlDrawWithXywhAlign' str x_pos' y_pos' width' height' align
 
-{# fun flc_gl_measure as flcGlMeasure' { `String',`Int',`Int' } -> `()' #}
-glMeasure :: String -> Position ->  IO ()
+{# fun flc_gl_measure as flcGlMeasure' { unsafeToCString `T.Text',`Int',`Int' } -> `()' #}
+glMeasure :: T.Text -> Position ->  IO ()
 glMeasure str (Position (X x_pos') (Y y_pos')) = flcGlMeasure' str x_pos' y_pos'
 
 {# fun flc_gl_draw_image_with_d_ld as flcGlDrawImageWithDLd' { id `Ptr CUChar',`Int',`Int',`Int',`Int',`Int', `Int'} -> `()' #}
diff --git a/src/Graphics/UI/FLTK/LowLevel/GlWindow.chs b/src/Graphics/UI/FLTK/LowLevel/GlWindow.chs
--- a/src/Graphics/UI/FLTK/LowLevel/GlWindow.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/GlWindow.chs
@@ -3,7 +3,8 @@
 module Graphics.UI.FLTK.LowLevel.GlWindow
     (
      glWindowNew,
-     glWindowCustom
+     glWindowCustom,
+     glWindowCanDo
      -- * Hierarchy
      --
      -- $hierarchy
@@ -17,6 +18,7 @@
 #include "Fl_Double_WindowC.h"
 #include "Fl_Gl_WindowC.h"
 import Foreign
+import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
@@ -24,15 +26,15 @@
 import Graphics.UI.FLTK.LowLevel.Widget
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
-import C2HS hiding (cFromEnum, toBool,cToEnum)
+import qualified Data.Text as T
 
 {# fun Fl_OverriddenGl_Window_New as overriddenWindowNew' {`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenGl_Window_NewXY as overriddenWindowNewXY' {`Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenGl_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenGl_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenGl_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenGl_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 glWindowCustom :: Size                           -- ^ The size of this window
                -> Maybe Position                 -- ^ The position of this window
-               -> Maybe String                   -- ^ The window label
+               -> Maybe T.Text                   -- ^ The window label
                -> Maybe (Ref GlWindow -> IO ())  -- ^ Optional custom drawing function
                -> CustomWidgetFuncs GlWindow     -- ^ other custom widget functions
                -> CustomWindowFuncs GlWindow     -- ^ Other custom window functions
@@ -49,7 +51,7 @@
     overriddenWindowNewWithLabel'
     overriddenWindowNewXY'
     overriddenWindowNewXYWithLabel'
-glWindowNew :: Size -> Maybe Position -> Maybe String -> IO (Ref GlWindow)
+glWindowNew :: Size -> Maybe Position -> Maybe T.Text -> IO (Ref GlWindow)
 glWindowNew size position title =
   windowMaker
     size
@@ -63,6 +65,9 @@
     overriddenWindowNewXY'
     overriddenWindowNewXYWithLabel'
 
+{# fun Fl_Gl_Window_can_do_with_m as canDoWithM' { `Int'} -> `Bool' cToBool #}
+glWindowCanDo :: Mode -> IO Bool
+glWindowCanDo m = canDoWithM' (fromEnum m)
 {# fun Fl_Gl_Window_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #}
 instance (impl ~ ( IO ())) => Op (DrawSuper ()) GlWindow orig impl where
   runOp _ _ self = withRef self $ \selfPtr -> drawSuper' selfPtr
@@ -95,11 +100,11 @@
     let (x_pos', y_pos', width', height') = fromRectangle rectangle' in
     withRef win $ \winPtr -> resize' winPtr x_pos' y_pos' width' height'
 {# fun Fl_Gl_Window_handle as handle' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (Handle ()) GlWindow orig impl where
-  runOp _ _ self event = withRef self $ \selfPtr -> handle' selfPtr event
+instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) GlWindow orig impl where
+  runOp _ _ self event = withRef self $ \selfPtr -> handle' selfPtr event >>= return  . successOrUnknownEvent
 {# fun Fl_Gl_Window_handle_super as handleSuper' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) GlWindow orig impl where
-  runOp _ _ self event = withRef self $ \selfPtr -> handleSuper' selfPtr event
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) GlWindow orig impl where
+  runOp _ _ self event = withRef self $ \selfPtr -> handleSuper' selfPtr event >>= return . successOrUnknownEvent
 {# fun Fl_Gl_Window_Destroy as windowDestroy' { id `Ptr ()' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (IO ())) => Op (Destroy ()) GlWindow orig impl where
   runOp _ _ win = withRef win $ \winPtr -> windowDestroy' winPtr
@@ -118,18 +123,15 @@
 {# fun Fl_Gl_Window_set_context_valid as setContextValid' { id `Ptr ()', fromBool `Bool' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Bool ->  IO ())) => Op (SetContextValid ()) GlWindow orig impl where
   runOp _ _ win v = withRef win $ \winPtr -> setContextValid' winPtr v
-{# fun Fl_Gl_Window_can_do_with_m as canDoWithM' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Int ->  IO (Int))) => Op (CanDoWithM ()) GlWindow orig impl where
-  runOp _ _ win m = withRef win $ \winPtr -> canDoWithM' winPtr m
-{# fun Fl_Gl_Window_can_do as canDo' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (CanDo ()) GlWindow orig impl where
+{# fun Fl_Gl_Window_can_do as canDo' { id `Ptr ()' } -> `Bool' cToBool #}
+instance (impl ~ ( IO (Bool))) => Op (CanDo ()) GlWindow orig impl where
   runOp _ _ win = withRef win $ \winPtr -> canDo' winPtr
-{# fun Fl_Gl_Window_mode as mode' { id `Ptr ()' } -> `Mode' cToEnum #}
+{# fun Fl_Gl_Window_mode as mode' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (Mode))) => Op (GetMode ()) GlWindow orig impl where
-  runOp _ _ win = withRef win $ \winPtr -> mode' winPtr
-{# fun Fl_Gl_Window_set_mode as setMode' { id `Ptr ()',cFromEnum `Mode' } -> `Int' #}
-instance (impl ~ (Mode ->  IO (Int))) => Op (SetMode ()) GlWindow orig impl where
-  runOp _ _ win a = withRef win $ \winPtr -> setMode' winPtr a
+  runOp _ _ win = withRef win $ \winPtr -> mode' winPtr >>= return . toEnum
+{# fun Fl_Gl_Window_set_mode as setMode' { id `Ptr ()',`Int' } -> `Int' #}
+instance (impl ~ (Modes ->  IO ())) => Op (SetMode ()) GlWindow orig impl where
+  runOp _ _ win a = withRef win $ \winPtr -> setMode' winPtr (modesToInt a) >> return ()
 {# fun Fl_Gl_Window_context as context' { id `Ptr ()' } -> `Ref GlContext' unsafeToRef #}
 instance (impl ~ ( IO (Ref GlContext))) => Op (GetContext ()) GlWindow orig impl where
   runOp _ _ win = withRef win $ \winPtr -> context' winPtr
@@ -145,8 +147,8 @@
 {# fun Fl_Gl_Window_ortho as ortho' { id `Ptr ()' } -> `()' supressWarningAboutRes #}
 instance (impl ~ ( IO ())) => Op (Ortho ()) GlWindow orig impl where
   runOp _ _ win = withRef win $ \winPtr -> ortho' winPtr
-{# fun Fl_Gl_Window_can_do_overlay as canDoOverlay' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (CanDoOverlay ()) GlWindow orig impl where
+{# fun Fl_Gl_Window_can_do_overlay as canDoOverlay' { id `Ptr ()' } -> `Bool' cToBool #}
+instance (impl ~ ( IO (Bool))) => Op (CanDoOverlay ()) GlWindow orig impl where
   runOp _ _ win = withRef win $ \winPtr -> canDoOverlay' winPtr
 {# fun Fl_Gl_Window_redraw_overlay as redrawOverlay' { id `Ptr ()' } -> `()' supressWarningAboutRes #}
 instance (impl ~ ( IO ())) => Op (RedrawOverlay ()) GlWindow orig impl where
@@ -160,12 +162,9 @@
 
 -- $GlWindowfunctions
 -- @
---
--- canDo :: 'Ref' 'GlWindow' -> 'IO' 'Int'
---
--- canDoOverlay :: 'Ref' 'GlWindow' -> 'IO' 'Int'
+-- canDo :: 'Ref' 'GlWindow' -> 'IO' ('Bool')
 --
--- canDoWithM :: 'Ref' 'GlWindow' -> 'Int' -> 'IO' 'Int'
+-- canDoOverlay :: 'Ref' 'GlWindow' -> 'IO' ('Bool')
 --
 -- destroy :: 'Ref' 'GlWindow' -> 'IO' ()
 --
@@ -177,15 +176,15 @@
 --
 -- getContext :: 'Ref' 'GlWindow' -> 'IO' ('Ref' 'GlContext')
 --
--- getContextValid :: 'Ref' 'GlWindow' -> 'IO' 'Bool'
+-- getContextValid :: 'Ref' 'GlWindow' -> 'IO' ('Bool')
 --
--- getMode :: 'Ref' 'GlWindow' -> 'IO' 'Mode'
+-- getMode :: 'Ref' 'GlWindow' -> 'IO' ('Mode')
 --
--- getValid :: 'Ref' 'GlWindow' -> 'IO' 'Bool'
+-- getValid :: 'Ref' 'GlWindow' -> 'IO' ('Bool')
 --
--- handle :: 'Ref' 'GlWindow' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'GlWindow' -> 'Event' -> 'IO' ('Int')
 --
--- handleSuper :: 'Ref' 'GlWindow' -> 'Event' -> 'IO' 'Int'
+-- handleSuper :: 'Ref' 'GlWindow' -> 'Event' -> 'IO' ('Int')
 --
 -- hide :: 'Ref' 'GlWindow' -> 'IO' ()
 --
@@ -211,7 +210,7 @@
 --
 -- setContextWithDestroyFlag :: 'Ref' 'GlWindow' -> 'Ref' 'GlContext' -> 'Bool' -> 'IO' ()
 --
--- setMode :: 'Ref' 'GlWindow' -> 'Mode' -> 'IO' 'Int'
+-- setMode :: 'Ref' 'GlWindow' -> 'Modes' -> 'IO' ()
 --
 -- setValid :: 'Ref' 'GlWindow' -> 'Bool' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Group.chs b/src/Graphics/UI/FLTK/LowLevel/Group.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Group.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Group.chs
@@ -22,6 +22,7 @@
 import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
 import Foreign.C.Types
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
@@ -36,8 +37,8 @@
 groupCurrent = groupCurrent' >>= toMaybeRef
 
 {# fun Fl_Group_New as groupNew' {  `Int',`Int', `Int', `Int'} -> `Ptr ()' id #}
-{# fun Fl_Group_New_WithLabel as groupNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-groupNew :: Rectangle -> Maybe String -> IO (Ref Group)
+{# fun Fl_Group_New_WithLabel as groupNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+groupNew :: Rectangle -> Maybe T.Text -> IO (Ref Group)
 groupNew rectangle label' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case label' of
@@ -120,12 +121,12 @@
 instance (impl ~ ( IO (Int))) => Op (Children ()) Group orig impl where
   runOp _ _ group = withRef group $ \groupPtr -> children' groupPtr
 
-{# fun Fl_Group_set_clip_children as setClipChildren' { id `Ptr ()',`Int' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (Int ->  IO ())) => Op (SetClipChildren ()) Group orig impl where
+{# fun Fl_Group_set_clip_children as setClipChildren' { id `Ptr ()', cFromBool `Bool' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (Bool ->  IO ())) => Op (SetClipChildren ()) Group orig impl where
   runOp _ _ group c = withRef group $ \groupPtr -> setClipChildren' groupPtr c
 
-{# fun Fl_Group_clip_children as clipChildren' { id `Ptr ()' } -> `Int' #}
-instance (impl ~ ( IO (Int))) => Op (ClipChildren ()) Group orig impl where
+{# fun Fl_Group_clip_children as clipChildren' { id `Ptr ()' } -> `Bool' cToBool #}
+instance (impl ~ ( IO (Bool))) => Op (ClipChildren ()) Group orig impl where
   runOp _ _ group = withRef group $ \groupPtr -> clipChildren' groupPtr
 
 {# fun Fl_Group_focus as focus' { id `Ptr ()',id `Ptr ()' } -> `()' supressWarningAboutRes #}
@@ -163,7 +164,7 @@
 --
 -- clear :: 'Ref' 'Group' -> 'IO' ()
 --
--- clipChildren :: 'Ref' 'Group' -> 'IO' ('Int')
+-- clipChildren :: 'Ref' 'Group' -> 'IO' ('Bool')
 --
 -- ddfdesignKludge :: 'Ref' 'Group' -> 'IO' ('Maybe' ('Ref' 'Widget'))
 --
@@ -197,7 +198,7 @@
 --
 -- removeWidget:: ('Parent' a 'Widget') => 'Ref' 'Group' -> 'Ref' a -> 'IO' ()
 --
--- setClipChildren :: 'Ref' 'Group' -> 'Int' -> 'IO' ()
+-- setClipChildren :: 'Ref' 'Group' -> 'Bool' -> 'IO' ()
 --
 -- setNotResizable :: 'Ref' 'Group' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
--- a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
+++ b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
@@ -846,8 +846,6 @@
          getContextValid,
          SetContextValid,
          setContextValid,
-         CanDoWithM,
-         canDoWithM,
          CanDo,
          canDo,
          GetContext,
@@ -2965,7 +2963,6 @@
   (Invalidate
   (GetContextValid
   (SetContextValid
-  (CanDoWithM
   (CanDo
   (GetMode
   (SetMode
@@ -2978,7 +2975,7 @@
   (RedrawOverlay
   (HideOverlay
   (MakeOverlayCurrent
-  ()))))))))))))))))))))))))))))))
+  ())))))))))))))))))))))))))))))
 
 type instance Functions GlWindow = GlWindowFuncs
 
@@ -2987,7 +2984,6 @@
 MAKE_METHOD(Invalidate,invalidate)
 MAKE_METHOD(GetContextValid,getContextValid)
 MAKE_METHOD(SetContextValid,setContextValid)
-MAKE_METHOD(CanDoWithM,canDoWithM)
 MAKE_METHOD(CanDo,canDo)
 MAKE_METHOD(GetContext,getContext)
 MAKE_METHOD(SetContext,setContext)
diff --git a/src/Graphics/UI/FLTK/LowLevel/HorFillSlider.chs b/src/Graphics/UI/FLTK/LowLevel/HorFillSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/HorFillSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/HorFillSlider.chs
@@ -17,10 +17,11 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
+import qualified Data.Text as T
 
 {# fun Fl_Hor_Fill_Slider_New as horFillSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Hor_Fill_Slider_New_WithLabel as horFillSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-horFillSliderNew :: Rectangle -> Maybe String -> IO (Ref HorFillSlider)
+{# fun Fl_Hor_Fill_Slider_New_WithLabel as horFillSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+horFillSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref HorFillSlider)
 horFillSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/HorNiceSlider.chs b/src/Graphics/UI/FLTK/LowLevel/HorNiceSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/HorNiceSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/HorNiceSlider.chs
@@ -17,10 +17,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Hor_Nice_Slider_New as horNiceSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Hor_Nice_Slider_New_WithLabel as horNiceSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-horNiceSliderNew :: Rectangle -> Maybe String -> IO (Ref HorNiceSlider)
+{# fun Fl_Hor_Nice_Slider_New_WithLabel as horNiceSliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+horNiceSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref HorNiceSlider)
 horNiceSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/HorSlider.chs b/src/Graphics/UI/FLTK/LowLevel/HorSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/HorSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/HorSlider.chs
@@ -17,10 +17,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Hor_Slider_New as horSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Hor_Slider_New_WithLabel as horSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-horSliderNew :: Rectangle -> Maybe String -> IO (Ref HorSlider)
+{# fun Fl_Hor_Slider_New_WithLabel as horSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+horSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref HorSlider)
 horSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/HorValueSlider.chs b/src/Graphics/UI/FLTK/LowLevel/HorValueSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/HorValueSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/HorValueSlider.chs
@@ -17,10 +17,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Hor_Value_Slider_New as horValueSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Hor_Value_Slider_New_WithLabel as horValueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-horValueSliderNew :: Rectangle -> Maybe String -> IO (Ref HorValueSlider)
+{# fun Fl_Hor_Value_Slider_New_WithLabel as horValueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+horValueSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref HorValueSlider)
 horValueSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Image.chs b/src/Graphics/UI/FLTK/LowLevel/Image.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Image.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Image.chs
diff --git a/src/Graphics/UI/FLTK/LowLevel/ImageSurface.chs b/src/Graphics/UI/FLTK/LowLevel/ImageSurface.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ImageSurface.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ImageSurface.chs
@@ -22,6 +22,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Image_Surface_New as imageSurfaceNew' {`Int', `Int'} -> `Ptr ()' id #}
 imageSurfaceNew :: Size -> IO (Ref ImageSurface)
@@ -31,8 +32,8 @@
 instance (impl ~ (IO ())) => Op (Destroy ()) ImageSurface orig impl where
   runOp _ _ image_surface = withRef image_surface $ \image_surfacePtr -> imageSurfaceDestroy' image_surfacePtr
 
-{# fun Fl_Image_Surface_class_name as className' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (ClassName ()) ImageSurface orig impl where
+{# fun Fl_Image_Surface_class_name as className' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (T.Text))) => Op (ClassName ()) ImageSurface orig impl where
   runOp _ _ image_surface = withRef image_surface $ \image_surfacePtr -> className' image_surfacePtr
 
 {# fun Fl_Image_Surface_set_current as setCurrent' { id `Ptr ()' } -> `()' #}
@@ -51,7 +52,7 @@
 
 -- $functions
 -- @
--- className :: 'Ref' 'ImageSurface' -> 'IO' ('String')
+-- className :: 'Ref' 'ImageSurface' -> 'IO' ('T.Text')
 --
 -- destroy :: 'Ref' 'ImageSurface' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Input.chs b/src/Graphics/UI/FLTK/LowLevel/Input.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Input.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Input.chs
@@ -32,6 +32,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 #c
 enum FlInputType {
   FlNormalInput = FL_NORMAL_INPUT,
@@ -43,16 +44,16 @@
 #endc
 {#enum FlInputType {}#}
 {# fun Fl_Input_New as inputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Input_New_WithLabel as inputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Input_New_WithLabel as inputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Multiline_Input_New as multilineInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Multiline_Input_New_WithLabel as multilineInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Multiline_Input_New_WithLabel as multilineInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Float_Input_New as floatInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Float_Input_New_WithLabel as floatInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Float_Input_New_WithLabel as floatInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Int_Input_New as intInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Int_Input_New_WithLabel as intInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Int_Input_New_WithLabel as intInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Secret_Input_New as secretInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Secret_Input_New_WithLabel as secretInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-inputNew :: Rectangle -> Maybe String -> Maybe FlInputType -> IO (Ref Input)
+{# fun Fl_Secret_Input_New_WithLabel as secretInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+inputNew :: Rectangle -> Maybe T.Text -> Maybe FlInputType -> IO (Ref Input)
 inputNew rectangle l' flInputType =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
         constructor = case flInputType of
@@ -73,7 +74,7 @@
 
 {#fun Fl_Input_handle as inputHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
 {#fun Fl_Secret_Input_handle as secretInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Input orig impl where
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Input orig impl where
   runOp _ _ input event =
     withRef
       input
@@ -83,28 +84,29 @@
            FlSecretInput -> secretInputHandle' p (fromIntegral . fromEnum $ event)
            _             -> inputHandle' p (fromIntegral . fromEnum $ event)
       )
+    >>= return . successOrUnknownEvent
 
 {# fun Fl_Widget_set_type as setType' { id `Ptr ()',`Word8' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (FlInputType ->  IO ())) => Op (SetType ()) Input orig impl where
   runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t)
 
-{# fun Fl_Input_set_value as setValue' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-{# fun Fl_Input_set_value_with_length as setValueWithLength' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance (impl ~ (String -> Maybe Int -> IO (Int))) => Op (SetValue ()) Input orig impl where
+{# fun Fl_Input_set_value as setValue' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+{# fun Fl_Input_set_value_with_length as setValueWithLength' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance (impl ~ (T.Text -> Maybe Int -> IO (Int))) => Op (SetValue ()) Input orig impl where
   runOp _ _ input text l' =
     case l' of
      Nothing -> withRef input $ \inputPtr -> setValue' inputPtr text
      Just l -> withRef input $ \inputPtr -> setValueWithLength' inputPtr text l
-{# fun Fl_Input_static_value as staticValue' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-{# fun Fl_Input_static_value_with_length as staticValueWithLength' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance (impl ~ (String -> Maybe Int ->  IO (Either NoChange ()))) => Op (StaticValue ()) Input orig impl where
+{# fun Fl_Input_static_value as staticValue' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+{# fun Fl_Input_static_value_with_length as staticValueWithLength' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance (impl ~ (T.Text -> Maybe Int ->  IO (Either NoChange ()))) => Op (StaticValue ()) Input orig impl where
   runOp _ _ input text l'= do
     status' <- case l' of
       Nothing -> withRef input $ \inputPtr -> staticValue' inputPtr text
       Just l -> withRef input $ \inputPtr -> staticValueWithLength' inputPtr text l
     return $ successOrNoChange status'
-{# fun Fl_Input_value as value' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetValue ()) Input orig impl where
+{# fun Fl_Input_value as value' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetValue ()) Input orig impl where
   runOp _ _ input = withRef input $ \inputPtr -> value' inputPtr
 {# fun Fl_Input_index as index' { id `Ptr ()',`Int' } -> `Int' #}
 instance (impl ~ (Int ->  IO (Char))) => Op (Index ()) Input orig impl where
@@ -138,8 +140,8 @@
 {# fun Fl_Input_set_mark as setMark' { id `Ptr ()',`Int' } -> `Int' #}
 instance (impl ~ (Int ->  IO (Either NoChange ()))) => Op (SetMark ()) Input orig impl where
   runOp _ _ input m = withRef input $ \inputPtr -> setMark' inputPtr m >>= return . successOrNoChange
-{# fun Fl_Input_replace as replace' { id `Ptr ()',`Int',`Int', unsafeToCString `String' } -> `Int' #}
-instance (impl ~ (Int -> Int -> String ->  IO (Either NoChange ()))) => Op (Replace ()) Input orig impl where
+{# fun Fl_Input_replace as replace' { id `Ptr ()',`Int',`Int', unsafeToCString `T.Text' } -> `Int' #}
+instance (impl ~ (Int -> Int -> T.Text ->  IO (Either NoChange ()))) => Op (Replace ()) Input orig impl where
   runOp _ _ input b e text = withRef input $ \inputPtr -> replace' inputPtr b e  text >>= return . successOrNoChange
 {# fun Fl_Input_cut as cut' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (Either NoChange ()))) => Op (Cut ()) Input orig impl where
@@ -150,11 +152,11 @@
 {# fun Fl_Input_cut_range as cutRange' { id `Ptr ()',`Int',`Int' } -> `Int' #}
 instance (impl ~ (Int -> Int ->  IO (Either NoChange ()))) => Op (CutRange ()) Input orig impl where
   runOp _ _ input a b = withRef input $ \inputPtr -> cutRange' inputPtr a b >>= return . successOrNoChange
-{# fun Fl_Input_insert as insert' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-instance (impl ~ (String ->  IO (Either NoChange ()))) => Op (Insert ()) Input orig impl where
+{# fun Fl_Input_insert as insert' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+instance (impl ~ (T.Text ->  IO (Either NoChange ()))) => Op (Insert ()) Input orig impl where
   runOp _ _ input t = withRef input $ \inputPtr -> insert' inputPtr t >>= return . successOrNoChange
-{# fun Fl_Input_insert_with_length as insertWithLength' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance (impl ~ (String -> Int ->  IO (Either NoChange ()))) => Op (InsertWithLength ()) Input orig impl where
+{# fun Fl_Input_insert_with_length as insertWithLength' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance (impl ~ (T.Text -> Int ->  IO (Either NoChange ()))) => Op (InsertWithLength ()) Input orig impl where
   runOp _ _ input t l = withRef input $ \inputPtr -> insertWithLength' inputPtr t l >>= return . successOrNoChange
 {# fun Fl_Input_copy as copy' { id `Ptr ()',`Int' } -> `Int' #}
 instance (impl ~ (Clipboard ->  IO (Either NoChange ()))) => Op (Copy ()) Input orig impl where
@@ -227,7 +229,6 @@
 
 -- $Input
 -- @
---
 -- copy :: 'Ref' 'Input' -> 'Clipboard' -> 'IO' ('Either' 'NoChange' ())
 --
 -- copyCuts :: 'Ref' 'Input' -> 'IO' ('Either' 'NoChange' ())
@@ -264,19 +265,19 @@
 --
 -- getTextsize :: 'Ref' 'Input' -> 'IO' ('FontSize')
 --
--- getValue :: 'Ref' 'Input' -> 'IO' ('String')
+-- getValue :: 'Ref' 'Input' -> 'IO' 'T.Text'
 --
 -- getWrap :: 'Ref' 'Input' -> 'IO' ('Int')
 --
--- handle :: 'Ref' 'Input' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Input' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- index :: 'Ref' 'Input' -> 'Int' -> 'IO' ('Char')
 --
--- insert :: 'Ref' 'Input' -> 'String' -> 'IO' ('Either' 'NoChange' ())
+-- insert :: 'Ref' 'Input' -> 'T.Text' -> 'IO' ('Either' 'NoChange' ())
 --
--- insertWithLength :: 'Ref' 'Input' -> 'String' -> 'Int' -> 'IO' ('Either' 'NoChange' ())
+-- insertWithLength :: 'Ref' 'Input' -> 'T.Text' -> 'Int' -> 'IO' ('Either' 'NoChange' ())
 --
--- replace :: 'Ref' 'Input' -> 'Int' -> 'Int' -> 'String' -> 'IO' ('Either' 'NoChange' ())
+-- replace :: 'Ref' 'Input' -> 'Int' -> 'Int' -> 'T.Text' -> 'IO' ('Either' 'NoChange' ())
 --
 -- setCursorColor :: 'Ref' 'Input' -> 'Color' -> 'IO' ()
 --
@@ -304,14 +305,13 @@
 --
 -- setType :: 'Ref' 'Input' -> 'FlInputType' -> 'IO' ()
 --
--- setValue :: 'Ref' 'Input' -> 'String' -> 'Maybe' 'Int' -> 'IO' ('Int')
+-- setValue :: 'Ref' 'Input' -> 'T.Text' -> 'Maybe' 'Int' -> 'IO' ('Int')
 --
 -- setWrap :: 'Ref' 'Input' -> 'Int' -> 'IO' ()
 --
--- staticValue :: 'Ref' 'Input' -> 'String' -> 'Maybe' 'Int' -> 'IO' ('Either' 'NoChange' ())
+-- staticValue :: 'Ref' 'Input' -> 'T.Text' -> 'Maybe' 'Int' -> 'IO' ('Either' 'NoChange' ())
 --
 -- undo :: 'Ref' 'Input' -> 'IO' ('Either' 'NoChange' ())
---
 -- @
 
 
diff --git a/src/Graphics/UI/FLTK/LowLevel/IntInput.chs b/src/Graphics/UI/FLTK/LowLevel/IntInput.chs
--- a/src/Graphics/UI/FLTK/LowLevel/IntInput.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/IntInput.chs
@@ -16,10 +16,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Int_Input_New as intInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Int_Input_New_WithLabel as intInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-intInputNew :: Rectangle -> Maybe String -> IO (Ref IntInput)
+{# fun Fl_Int_Input_New_WithLabel as intInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+intInputNew :: Rectangle -> Maybe T.Text -> IO (Ref IntInput)
 intInputNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/JPEGImage.chs b/src/Graphics/UI/FLTK/LowLevel/JPEGImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/JPEGImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/JPEGImage.chs
@@ -19,13 +19,13 @@
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
 import qualified Data.ByteString as B
-
-{# fun Fl_JPEG_Image_New as jpegImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-{# fun Fl_JPEG_Image_New_WithData as jpegImageNewWithData' { unsafeToCString `String', id `Ptr CUChar' } -> `Ptr ()' id #}
-jpegImageNew :: String -> IO (Either UnknownError (Ref JPEGImage))
+import qualified Data.Text as T
+{# fun Fl_JPEG_Image_New as jpegImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+{# fun Fl_JPEG_Image_New_WithData as jpegImageNewWithData' { unsafeToCString `T.Text', id `Ptr CUChar' } -> `Ptr ()' id #}
+jpegImageNew :: T.Text -> IO (Either UnknownError (Ref JPEGImage))
 jpegImageNew filename' = jpegImageNew' filename' >>= toRef >>= checkImage
 
-jpegImageNewWithData :: String -> B.ByteString -> IO (Either UnknownError (Ref JPEGImage))
+jpegImageNewWithData :: T.Text -> B.ByteString -> IO (Either UnknownError (Ref JPEGImage))
 jpegImageNewWithData l' data' = do
   jpeg' <- copyByteStringToCString data'
   jpegImageNewWithData' l' (castPtr jpeg') >>= toRef >>= checkImage
diff --git a/src/Graphics/UI/FLTK/LowLevel/LightButton.chs b/src/Graphics/UI/FLTK/LowLevel/LightButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/LightButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/LightButton.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Light_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Light_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-lightButtonNew :: Rectangle -> Maybe String -> IO (Ref LightButton)
+{# fun Fl_Light_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+lightButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref LightButton)
 lightButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/LineDial.chs b/src/Graphics/UI/FLTK/LowLevel/LineDial.chs
--- a/src/Graphics/UI/FLTK/LowLevel/LineDial.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/LineDial.chs
@@ -15,10 +15,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Line_Dial_New as lineDialNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Line_Dial_New_WithLabel as lineDialNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-lineDialNew :: Rectangle -> Maybe String -> IO (Ref LineDial)
+{# fun Fl_Line_Dial_New_WithLabel as lineDialNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+lineDialNew :: Rectangle -> Maybe T.Text -> IO (Ref LineDial)
 lineDialNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs b/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs
--- a/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs
@@ -17,18 +17,17 @@
 #include "Fl_Menu_BarC.h"
 import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
 import Foreign.C.Types
-import Graphics.UI.FLTK.LowLevel.Widget
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.MenuItem
-import qualified Data.ByteString.Char8 as C
 
 {# fun Fl_Menu_Bar_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Menu_Bar_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-menuBarNew :: Rectangle -> Maybe String -> IO (Ref MenuBar)
+{# fun Fl_Menu_Bar_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+menuBarNew :: Rectangle -> Maybe T.Text -> IO (Ref MenuBar)
 menuBarNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -44,8 +43,8 @@
                              widgetDestroy' menuBarPtr >>
                              return nullPtr
 {#fun Fl_Menu_Bar_handle as menuBarHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) MenuBar orig impl where
-  runOp _ _ menuBar event = withRef menuBar (\p -> menuBarHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuBar orig impl where
+  runOp _ _ menuBar event = withRef menuBar (\p -> menuBarHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 
 -- $functions
@@ -54,7 +53,7 @@
 --
 -- destroy :: 'Ref' 'MenuBar' -> 'IO' ()
 --
--- handle :: 'Ref' 'MenuBar' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'MenuBar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- @
 
diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs b/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs
@@ -24,6 +24,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
 #c
@@ -40,8 +41,8 @@
 {#enum MenuButtonType {} deriving (Show, Eq) #}
 
 {# fun Fl_Menu_Button_New as menuButtonNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Menu_Button_New_WithLabel as menuButtonNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-menuButtonNew :: Rectangle -> Maybe String -> IO (Ref MenuButton)
+{# fun Fl_Menu_Button_New_WithLabel as menuButtonNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+menuButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref MenuButton)
 menuButtonNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -56,8 +57,8 @@
     menuButtonDestroy' winPtr
     return nullPtr
 {#fun Fl_Menu_Button_handle as menuButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) MenuButton orig impl where
-  runOp _ _ menu_bar event = withRef menu_bar (\p -> menuButtonHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuButton orig impl where
+  runOp _ _ menu_bar event = withRef menu_bar (\p -> menuButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {#fun Fl_Menu_Button_popup as menuButtonPopup' { id `Ptr ()' } -> `Ptr ()' id #}
 instance (impl ~ ( IO (Maybe (Ref MenuItem)))) => Op (Popup ()) MenuButton orig impl where
   runOp _ _ menu_bar = withRef menu_bar (\p -> menuButtonPopup' p >>= toMaybeRef)
@@ -67,7 +68,7 @@
 --
 -- destroy :: 'Ref' 'MenuButton' -> 'IO' ()
 --
--- handle :: 'Ref' 'MenuButton' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'MenuButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- popup :: 'Ref' 'MenuButton' -> 'IO' ('Maybe' ('Ref' 'MenuItem'))
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuItem.chs b/src/Graphics/UI/FLTK/LowLevel/MenuItem.chs
--- a/src/Graphics/UI/FLTK/LowLevel/MenuItem.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/MenuItem.chs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
+{-# LANGUAGE OverloadedStrings, CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 module Graphics.UI.FLTK.LowLevel.MenuItem
   (
@@ -28,10 +28,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 newtype MenuItemIndex = MenuItemIndex Int
 data MenuItemPointer = forall a. (Parent a MenuItem) => MenuItemPointer (Ref a)
-newtype MenuItemName = MenuItemName String
+newtype MenuItemName = MenuItemName T.Text
 data MenuItemReference = MenuItemByIndex MenuItemIndex | MenuItemByPointer MenuItemPointer
 data MenuItemLocator = MenuItemPointerLocator MenuItemPointer | MenuItemNameLocator MenuItemName
 
@@ -56,16 +57,16 @@
 instance (impl ~  IO (Maybe (Ref MenuItem))) => Op (GetFirst ()) MenuItem orig impl where
   runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> first' menu_itemPtr >>=toMaybeRef
 
-{# fun Fl_Menu_Item_label as label' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~  IO (String)) => Op (GetLabel ()) MenuItem orig impl where
+{# fun Fl_Menu_Item_label as label' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~  IO T.Text) => Op (GetLabel ()) MenuItem orig impl where
   runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> label' menu_itemPtr
 
-{# fun Fl_Menu_Item_set_label as setLabel' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetLabel ()) MenuItem orig impl where
+{# fun Fl_Menu_Item_set_label as setLabel' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetLabel ()) MenuItem orig impl where
   runOp _ _ menu_item a = withRef menu_item $ \menu_itemPtr -> setLabel' menu_itemPtr a
 
-{# fun Fl_Menu_Item_set_label_with_labeltype as setLabelWithLabeltype' { id `Ptr ()',cFromEnum `Labeltype', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Labeltype -> String ->  IO ())) => Op (SetLabelWithLabeltype ()) MenuItem orig impl where
+{# fun Fl_Menu_Item_set_label_with_labeltype as setLabelWithLabeltype' { id `Ptr ()',cFromEnum `Labeltype', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (Labeltype -> T.Text ->  IO ())) => Op (SetLabelWithLabeltype ()) MenuItem orig impl where
   runOp _ _ menu_item labeltype b = withRef menu_item $ \menu_itemPtr -> setLabelWithLabeltype' menu_itemPtr labeltype b
 
 {# fun Fl_Menu_Item_labeltype as labeltype' { id `Ptr ()' } -> `Labeltype' cToEnum #}
@@ -196,8 +197,8 @@
 instance (impl ~ (MenuItemFlags ->  IO ())) => Op (SetFlags ()) MenuItem orig impl where
   runOp _ _ menu_item flags = withRef menu_item $ \menu_itemPtr -> setFlags' menu_itemPtr (menuItemFlagsToInt flags)
 
-{# fun Fl_Menu_Item_text as text' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetText ()) MenuItem orig impl where
+{# fun Fl_Menu_Item_text as text' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetText ()) MenuItem orig impl where
   runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> text' menu_itemPtr
 
 {# fun Fl_Menu_Item_pulldown_with_args as pulldownWithArgs' { id `Ptr ()',`Int',`Int',`Int',`Int',id `Ptr ()', id `Ptr ()', id `Ptr ()', fromBool `Bool'} -> `Ptr ()' id #}
@@ -213,12 +214,12 @@
      pulldownWithArgs' menu_itemPtr x_pos y_pos width height pickedPtr template_menuPtr titlePtr menu_bar >>= toMaybeRef
 
 {# fun Fl_Menu_Item_popup_with_args as popupWithArgs' { id `Ptr ()',`Int',`Int', id `Ptr CChar' , id `Ptr ()', id `Ptr ()'} -> `Ptr ()' id #}
-instance (Parent a MenuItem, Parent b MenuPrim, Parent c MenuItem, impl ~ (Position -> Maybe String -> Maybe (Ref a) -> Maybe (Ref b) -> IO (Maybe (Ref c)))) => Op (Popup ()) MenuItem orig impl where
+instance (Parent a MenuItem, Parent b MenuPrim, Parent c MenuItem, impl ~ (Position -> Maybe T.Text -> Maybe (Ref a) -> Maybe (Ref b) -> IO (Maybe (Ref c)))) => Op (Popup ()) MenuItem orig impl where
   runOp _ _ menu_item (Position (X x_pos) (Y y_pos)) title picked' template_menu =
     withRef menu_item $ \menu_itemPtr ->
     withMaybeRef picked' $ \pickedPtr ->
     withMaybeRef template_menu $ \template_menuPtr ->
-    maybeNew newCString title >>= \titlePtr ->
+    maybeNew copyTextToCString title >>= \titlePtr ->
     popupWithArgs' menu_itemPtr x_pos y_pos titlePtr pickedPtr template_menuPtr >>= toMaybeRef
 
 {# fun Fl_Menu_Item_test_shortcut as testShortcut' { id `Ptr ()' } -> `Ptr ()' id #}
@@ -239,12 +240,12 @@
 addMenuItem ::
   (Parent menuItem MenuItem) =>
   Either (Ref MenuPrim) (Ref MenuItem) ->
-  String ->
+  T.Text ->
   Maybe Shortcut ->
   Maybe (Ref menuItem -> IO ()) ->
   MenuItemFlags ->
-  (Ptr () -> String -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
-  (Ptr () -> String -> String -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
+  (Ptr () -> T.Text -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
+  (Ptr () -> T.Text -> T.Text -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
   IO (MenuItemIndex)
 addMenuItem refMenuOrMenuItem name shortcut cb flags addWithFlags addWithShortcutnameFlags =
      either
@@ -266,7 +267,7 @@
                       (castFunPtr ptr)
                       combinedFlags
                    KeyFormat format' ->
-                     if (not $ null format') then
+                     if (not $ T.null format') then
                        addWithShortcutnameFlags
                        menu_Ptr
                        name
@@ -283,14 +284,14 @@
                       combinedFlags
         return (MenuItemIndex idx')
 
-{# fun Fl_Menu_Item_insert_with_flags as insertWithFlags' { id `Ptr ()',`Int', unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
-{# fun Fl_Menu_Item_add_with_flags as addWithFlags' { id `Ptr ()', unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
-{# fun Fl_Menu_Item_add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `String', unsafeToCString `String',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-instance (Parent a MenuItem, impl ~ (String -> Maybe Shortcut -> Maybe (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) MenuItem orig impl where
+{# fun Fl_Menu_Item_insert_with_flags as insertWithFlags' { id `Ptr ()',`Int', unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
+{# fun Fl_Menu_Item_add_with_flags as addWithFlags' { id `Ptr ()', unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
+{# fun Fl_Menu_Item_add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+instance (Parent a MenuItem, impl ~ (T.Text -> Maybe Shortcut -> Maybe (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) MenuItem orig impl where
   runOp _ _ menu_item name shortcut cb flags =
     addMenuItem (Right menu_item) name shortcut cb flags addWithFlags' addWithShortcutnameFlags'
 
-instance (Parent a MenuItem, impl ~ (Int -> String -> Maybe ShortcutKeySequence -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) MenuItem orig impl where
+instance (Parent a MenuItem, impl ~ (Int -> T.Text -> Maybe ShortcutKeySequence -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) MenuItem orig impl where
   runOp _ _ menu_item index' name ks cb flags =
     withRef menu_item $ \menu_itemPtr ->
       let combinedFlags = menuItemFlagsToInt flags
@@ -317,14 +318,13 @@
 
 -- $functions
 -- @
---
 -- activate :: 'Ref' 'MenuItem' -> 'IO' ()
 --
 -- active :: 'Ref' 'MenuItem' -> 'IO' ('Bool')
 --
 -- activevisible :: 'Ref' 'MenuItem' -> 'IO' ('Bool')
 --
--- add:: ('Parent' a 'MenuItem') => 'Ref' 'MenuItem' -> 'String' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- add:: ('Parent' a 'MenuItem') => 'Ref' 'MenuItem' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
 -- checkbox :: 'Ref' 'MenuItem' -> 'IO' ('Bool')
 --
@@ -346,7 +346,7 @@
 --
 -- getFlags :: 'Ref' 'MenuItem' -> 'IO' ('Maybe' 'MenuItemFlags')
 --
--- getLabel :: 'Ref' 'MenuItem' -> 'IO' ('String')
+-- getLabel :: 'Ref' 'MenuItem' -> 'IO' 'T.Text'
 --
 -- getLabelcolor :: 'Ref' 'MenuItem' -> 'IO' ('Color')
 --
@@ -360,13 +360,13 @@
 --
 -- getSize :: 'Ref' 'MenuItem' -> 'IO' ('Int')
 --
--- getText :: 'Ref' 'MenuItem' -> 'IO' ('String')
+-- getText :: 'Ref' 'MenuItem' -> 'IO' 'T.Text'
 --
 -- getValue :: 'Ref' 'MenuItem' -> 'IO' ('Int')
 --
 -- hide :: 'Ref' 'MenuItem' -> 'IO' ()
 --
--- insert:: ('Parent' a 'MenuItem') => 'Ref' 'MenuItem' -> 'Int' -> 'String' -> 'Maybe' 'ShortcutKeySequence' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- insert:: ('Parent' a 'MenuItem') => 'Ref' 'MenuItem' -> 'Int' -> 'T.Text' -> 'Maybe' 'ShortcutKeySequence' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
 -- measure:: ('Parent' a 'MenuPrim') => 'Ref' 'MenuItem' -> 'Ref' a -> 'IO' ('Size')
 --
@@ -374,7 +374,7 @@
 --
 -- nextWithStep:: ('Parent' a 'MenuItem') => 'Ref' 'MenuItem' -> 'Int' -> 'IO' ('Maybe' ('Ref' a))
 --
--- popup:: ('Parent' a 'MenuItem', 'Parent' b 'MenuPrim', 'Parent' c 'MenuItem') => 'Ref' 'MenuItem' -> 'Position' -> 'Maybe' 'String' -> 'Maybe' ('Ref' a) -> 'Maybe' ('Ref' b) -> 'IO' ('Maybe' ('Ref' c))
+-- popup:: ('Parent' a 'MenuItem', 'Parent' b 'MenuPrim', 'Parent' c 'MenuItem') => 'Ref' 'MenuItem' -> 'Position' -> 'Maybe' 'T.Text' -> 'Maybe' ('Ref' a) -> 'Maybe' ('Ref' b) -> 'IO' ('Maybe' ('Ref' c))
 --
 -- pulldown:: ('Parent' a 'MenuPrim', 'Parent' b 'MenuItem', 'Parent' c 'MenuItem') => 'Ref' 'MenuItem' -> 'Rectangle' -> 'Maybe' ('Ref' a) -> 'Maybe' ('Ref' b) -> 'Maybe' ('Ref' c) -> 'Maybe' 'Bool' -> 'IO' ('Maybe' ('Ref' 'MenuItem'))
 --
@@ -386,9 +386,9 @@
 --
 -- setFlags :: 'Ref' 'MenuItem' -> 'MenuItemFlags' -> 'IO' ()
 --
--- setLabel :: 'Ref' 'MenuItem' -> 'String' -> 'IO' ()
+-- setLabel :: 'Ref' 'MenuItem' -> 'T.Text' -> 'IO' ()
 --
--- setLabelWithLabeltype :: 'Ref' 'MenuItem' -> 'Labeltype' -> 'String' -> 'IO' ()
+-- setLabelWithLabeltype :: 'Ref' 'MenuItem' -> 'Labeltype' -> 'T.Text' -> 'IO' ()
 --
 -- setLabelcolor :: 'Ref' 'MenuItem' -> 'Color' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs b/src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs
--- a/src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs
@@ -25,27 +25,26 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.MenuItem
 import qualified Data.ByteString.Char8 as C
 
 {# fun Fl_Menu__New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Menu__New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenMenu__New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Menu__New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenMenu__New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenMenu__New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
-menu_Custom :: Rectangle -> Maybe String -> Maybe (CustomWidgetFuncs MenuPrim) -> IO (Ref MenuPrim)
+menu_Custom :: Rectangle -> Maybe T.Text -> Maybe (CustomWidgetFuncs MenuPrim) -> IO (Ref MenuPrim)
 menu_Custom rectangle l' funcs' =
   widgetMaker
     rectangle
     l'
     Nothing
     funcs'
-    widgetNew'
-    widgetNewWithLabel'
     overriddenWidgetNew'
     overriddenWidgetNewWithLabel'
 
-menu_New :: Rectangle -> Maybe String -> IO (Ref MenuPrim)
+menu_New :: Rectangle -> Maybe T.Text -> IO (Ref MenuPrim)
 menu_New rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -62,11 +61,11 @@
                              widgetDestroy' menu_Ptr >>
                              return nullPtr
 {# fun Fl_Menu__handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) MenuPrim orig impl where
-  runOp _ _ menu_ event = withRef menu_ $ \menu_Ptr -> handleSuper' menu_Ptr (fromIntegral (fromEnum event))
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) MenuPrim orig impl where
+  runOp _ _ menu_ event = withRef menu_ $ \menu_Ptr -> handleSuper' menu_Ptr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
 {#fun Fl_Menu__handle as menu_Handle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) MenuPrim orig impl where
-  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuPrim orig impl where
+  runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Menu__resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) MenuPrim orig impl where
   runOp _ _ menu_ rectangle =
@@ -92,7 +91,7 @@
 
 {# fun Fl_Menu__item_pathname_with_finditem as itemPathnameWithFinditem' { id `Ptr ()',id `Ptr CChar',`Int',id `Ptr ()' } -> `Int' #}
 {# fun Fl_Menu__item_pathname as itemPathname' { id `Ptr ()',id `Ptr CChar',`Int' } -> `Int' #}
-instance (Parent a MenuItem, impl ~ (Ref a -> IO (Maybe String))) => Op (ItemPathname ()) MenuPrim orig impl where
+instance (Parent a MenuItem, impl ~ (Ref a -> IO (Maybe T.Text))) => Op (ItemPathname ()) MenuPrim orig impl where
   runOp _ _ menu_ menu_item' =
     withRef menu_ $
     \ menu_Ref ->
@@ -101,8 +100,8 @@
        if (retVal' == -1)
          then return Nothing
          else do
-           b' <- C.packCString (castPtr ptr)
-           return $ Just (C.unpack b')
+           b' <- cStringToText ptr
+           return $ Just b'
 instance (impl ~ (IO (Maybe String))) => Op (ItemPathnameRecent ()) MenuPrim orig impl where
   runOp _ _ menu_ =
     withRef menu_ $ \menu_Ptr ->
@@ -117,7 +116,7 @@
 {# fun Fl_Menu__picked as picked' { id `Ptr ()',id `Ptr ()' } -> `Ptr ()' id #}
 instance (Parent a MenuItem, Parent b MenuItem, impl ~ (Ref a -> IO (Maybe (Ref b)))) => Op (Picked ()) MenuPrim orig impl where
   runOp _ _ menu_ item = withRef menu_ $ \menu_Ptr -> withRef item $ \itemPtr -> picked' menu_Ptr itemPtr >>= toMaybeRef
-{# fun Fl_Menu__find_index_with_name as findIndexWithName' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
+{# fun Fl_Menu__find_index_with_name as findIndexWithName' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
 {# fun Fl_Menu__find_index_with_item as findIndexWithItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 instance (impl ~ (MenuItemLocator -> IO (Maybe Int))) => Op (FindIndex ()) MenuPrim orig impl where
   runOp _ _ menu_ menu_item_referene =
@@ -162,12 +161,12 @@
   (Parent a MenuPrim) =>
   Ref MenuPrim ->
   Int ->
-  String ->
+  T.Text ->
   Maybe Shortcut ->
   (Ref a -> IO ()) ->
   MenuItemFlags ->
-  (Ptr () -> Int -> String -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
-  (Ptr () -> Int -> String  -> String -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
+  (Ptr () -> Int -> T.Text -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
+  (Ptr () -> Int -> T.Text -> T.Text -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
   IO (MenuItemIndex)
 insertMenuItem menu_ index' name shortcut cb flags insertWithFlags'' insertWithShortcutnameFlags'' =
   withRef menu_ $ \menu_Ptr -> do
@@ -184,7 +183,7 @@
                   (castFunPtr ptr)
                   combinedFlags
                KeyFormat format' ->
-                 if (not $ null format') then
+                 if (not $ T.null format') then
                    insertWithShortcutnameFlags''
                      menu_Ptr
                      index'
@@ -203,17 +202,17 @@
                  combinedFlags
     return (MenuItemIndex idx')
 
-{# fun Fl_Menu__insert_with_flags as insertWithFlags' { id `Ptr ()',`Int',unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
-{# fun Fl_Menu__insert_with_shortcutname_flags as insertWithShortcutnameFlags' { id `Ptr ()',`Int',unsafeToCString `String', unsafeToCString `String',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-instance (Parent a MenuPrim, impl ~ ( Int -> String -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) MenuPrim orig impl where
+{# fun Fl_Menu__insert_with_flags as insertWithFlags' { id `Ptr ()',`Int',unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
+{# fun Fl_Menu__insert_with_shortcutname_flags as insertWithShortcutnameFlags' { id `Ptr ()',`Int',unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+instance (Parent a MenuPrim, impl ~ ( Int -> T.Text -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) MenuPrim orig impl where
   runOp _ _ menu_ index' name shortcut cb flags = insertMenuItem menu_ index' name shortcut cb flags insertWithFlags' insertWithShortcutnameFlags'
 
-{# fun Fl_Menu__add_with_name as add' { id `Ptr ()',unsafeToCString `String'} -> `()' #}
-instance (impl ~ (String -> IO ())) => Op (AddName ()) MenuPrim orig impl where
+{# fun Fl_Menu__add_with_name as add' { id `Ptr ()',unsafeToCString `T.Text'} -> `()' #}
+instance (impl ~ (T.Text -> IO ())) => Op (AddName ()) MenuPrim orig impl where
   runOp _ _ menu_ name' = withRef menu_ $ \menu_Ptr -> add' menu_Ptr name'
-{# fun Fl_Menu__add_with_flags as addWithFlags' { id `Ptr ()',unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-{# fun Fl_Menu__add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `String', unsafeToCString `String',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-instance (Parent a MenuItem, impl ~ ( String -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) MenuPrim orig (impl) where
+{# fun Fl_Menu__add_with_flags as addWithFlags' { id `Ptr ()',unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+{# fun Fl_Menu__add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+instance (Parent a MenuItem, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) MenuPrim orig (impl) where
   runOp _ _ menu_ name shortcut cb flags =
     addMenuItem (Left menu_) name shortcut cb flags addWithFlags' addWithShortcutnameFlags'
 
@@ -229,8 +228,8 @@
 {# fun Fl_Menu__clear_submenu as clearSubmenu' { id `Ptr ()',`Int' } -> `Int' #}
 instance (impl ~ (Int ->  IO (Either OutOfRange ()))) => Op (ClearSubmenu ()) MenuPrim orig impl where
   runOp _ _ menu_ index' = withRef menu_ $ \menu_Ptr -> clearSubmenu' menu_Ptr index' >>= \ret' -> if ret' == -1 then return (Left OutOfRange) else return (Right ())
-{# fun Fl_Menu__replace as replace' { id `Ptr ()',`Int', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Int -> String ->  IO ())) => Op (Replace ()) MenuPrim orig impl where
+{# fun Fl_Menu__replace as replace' { id `Ptr ()',`Int', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (Int -> T.Text ->  IO ())) => Op (Replace ()) MenuPrim orig impl where
   runOp _ _ menu_ index' name = withRef menu_ $ \menu_Ptr -> replace' menu_Ptr index' name
 {# fun Fl_Menu__remove as remove' { id `Ptr ()',`Int' } -> `()' #}
 instance (impl ~ (Int  ->  IO ())) => Op (Remove ()) MenuPrim orig impl where
@@ -262,11 +261,11 @@
           (MenuItemByPointer (MenuItemPointer menu_item)) ->
               withRef menu_item $ \menu_itemPtr ->
                   valueWithItem' menu_Ptr menu_itemPtr
-{# fun Fl_Menu__text as text' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetText ()) MenuPrim orig impl where
+{# fun Fl_Menu__text as text' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetText ()) MenuPrim orig impl where
   runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> text' menu_Ptr
-{# fun Fl_Menu__text_with_index as textWithIndex' { id `Ptr ()',`Int' } -> `String' unsafeFromCString #}
-instance (impl ~ (Int ->  IO (String))) => Op (GetTextWithIndex ()) MenuPrim orig impl where
+{# fun Fl_Menu__text_with_index as textWithIndex' { id `Ptr ()',`Int' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (Int ->  IO T.Text)) => Op (GetTextWithIndex ()) MenuPrim orig impl where
   runOp _ _ menu_ i = withRef menu_ $ \menu_Ptr -> textWithIndex' menu_Ptr i
 {# fun Fl_Menu__textfont as textfont' { id `Ptr ()' } -> `Font' cToFont #}
 instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) MenuPrim orig impl where
@@ -302,9 +301,9 @@
 -- $functions
 -- @
 --
--- add:: ('Parent' a 'MenuItem') => 'Ref' 'MenuPrim' -> 'String' -> 'Maybe' 'Shortcut' -> ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- add:: ('Parent' a 'MenuItem') => 'Ref' 'MenuPrim' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
--- addName :: 'Ref' 'MenuPrim' -> 'String' -> 'IO' ()
+-- addName :: 'Ref' 'MenuPrim' -> 'T.Text' -> 'IO' ()
 --
 -- clear :: 'Ref' 'MenuPrim' -> 'IO' ()
 --
@@ -320,15 +319,15 @@
 --
 -- getDownColor :: 'Ref' 'MenuPrim' -> 'IO' ('Color')
 --
--- getMenu :: 'Ref' 'MenuPrim' -> 'IO' ['Ref' 'MenuItem']
+-- getMenu :: 'Ref' 'MenuPrim' -> 'IO' [('Maybe' ('Ref' 'MenuItem']))
 --
--- getMode :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' ('Int')
+-- getMode :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' ('Maybe' 'MenuItemFlags')
 --
 -- getSize :: 'Ref' 'MenuPrim' -> 'IO' ('Int')
 --
--- getText :: 'Ref' 'MenuPrim' -> 'IO' ('String')
+-- getText :: 'Ref' 'MenuPrim' -> 'IO' 'T.Text'
 --
--- getTextWithIndex :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' ('String')
+-- getTextWithIndex :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' 'T.Text'
 --
 -- getTextcolor :: 'Ref' 'MenuPrim' -> 'IO' ('Color')
 --
@@ -340,17 +339,17 @@
 --
 -- global :: 'Ref' 'MenuPrim' -> 'IO' ()
 --
--- handle :: 'Ref' 'MenuPrim' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'MenuPrim' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
--- handleSuper :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' ('Int')
+-- handleSuper :: 'Ref' 'MenuPrim' -> 'Event' -> 'IO' ('Int')
 --
 -- hide :: 'Ref' 'MenuPrim' -> 'IO' ()
 --
 -- hideSuper :: 'Ref' 'MenuPrim' -> 'IO' ()
 --
--- insert:: ('Parent' a 'MenuPrim') => 'Ref' 'MenuPrim' -> 'Int' -> 'String' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- insert:: ('Parent' a 'MenuPrim') => 'Ref' 'MenuPrim' -> 'Int' -> 'T.Text' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
--- itemPathname:: ('Parent' a 'MenuItem') => 'Ref' 'MenuPrim' -> 'Ref' a -> 'IO' ('Maybe' 'String')
+-- itemPathname:: ('Parent' a 'MenuItem') => 'Ref' 'MenuPrim' -> 'Ref' a -> 'IO' ('Maybe' 'T.Text')
 --
 -- itemPathnameRecent :: 'Ref' 'MenuPrim' -> 'IO' ('Maybe' 'String')
 --
@@ -360,7 +359,7 @@
 --
 -- remove :: 'Ref' 'MenuPrim' -> 'Int' -> 'IO' ()
 --
--- replace :: 'Ref' 'MenuPrim' -> 'Int' -> 'String' -> 'IO' ()
+-- replace :: 'Ref' 'MenuPrim' -> 'Int' -> 'T.Text' -> 'IO' ()
 --
 -- resize :: 'Ref' 'MenuPrim' -> 'Rectangle' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/NativeFileChooser.chs b/src/Graphics/UI/FLTK/LowLevel/NativeFileChooser.chs
--- a/src/Graphics/UI/FLTK/LowLevel/NativeFileChooser.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/NativeFileChooser.chs
@@ -26,6 +26,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 #c
 enum NativeFileChooserType {
@@ -96,34 +97,34 @@
 {# fun Fl_Native_File_Chooser_count as count' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (Int))) => Op (GetCount ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> count' chooserPtr
-{# fun Fl_Native_File_Chooser_filename as filename' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetFilename ()) NativeFileChooser orig impl where
+{# fun Fl_Native_File_Chooser_filename as filename' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetFilename ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> filename' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_filename_with_i as filenameWithI' { id `Ptr ()',`Int' } -> `String' unsafeFromCString #}
-instance (impl ~ (Int ->  IO (Maybe String))) => Op (GetFilenameAt ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_filename_with_i as filenameWithI' { id `Ptr ()',`Int' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (Int ->  IO (Maybe T.Text))) => Op (GetFilenameAt ()) NativeFileChooser orig impl where
    runOp _ _ chooser i = withRef chooser $ \chooserPtr -> filenameWithI' chooserPtr i >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_set_directory as setDirectory' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetDirectory ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_set_directory as setDirectory' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetDirectory ()) NativeFileChooser orig impl where
    runOp _ _ chooser val = withRef chooser $ \chooserPtr -> setDirectory' chooserPtr val
-{# fun Fl_Native_File_Chooser_directory as directory' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetDirectory ()) NativeFileChooser orig impl where
+{# fun Fl_Native_File_Chooser_directory as directory' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetDirectory ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> directory' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_set_title as setTitle' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetTitle ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_set_title as setTitle' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetTitle ()) NativeFileChooser orig impl where
    runOp _ _ chooser title'' = withRef chooser $ \chooserPtr -> setTitle' chooserPtr title''
-{# fun Fl_Native_File_Chooser_title as title' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetTitle ()) NativeFileChooser orig impl where
+{# fun Fl_Native_File_Chooser_title as title' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetTitle ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> title' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_filter as filter' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetFilter ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_filter as filter' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetFilter ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> filter' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_set_filter as setFilter' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetFilter ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_set_filter as setFilter' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetFilter ()) NativeFileChooser orig impl where
    runOp _ _ chooser filter'' = withRef chooser $ \chooserPtr -> setFilter' chooserPtr filter''
 {# fun Fl_Native_File_Chooser_filters as filters' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (Int))) => Op (Filters ()) NativeFileChooser orig impl where
@@ -134,17 +135,17 @@
 {# fun Fl_Native_File_Chooser_filter_value as filterValue' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (Int))) => Op (GetFilterValue ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> filterValue' chooserPtr
-{# fun Fl_Native_File_Chooser_set_preset_file as setPresetFile' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetPresetFile ()) NativeFileChooser orig impl where
+{# fun Fl_Native_File_Chooser_set_preset_file as setPresetFile' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetPresetFile ()) NativeFileChooser orig impl where
    runOp _ _ chooser preset' = withRef chooser $ \chooserPtr -> setPresetFile' chooserPtr preset'
-{# fun Fl_Native_File_Chooser_preset_file as presetFile' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetPresetFile ()) NativeFileChooser orig impl where
+{# fun Fl_Native_File_Chooser_preset_file as presetFile' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetPresetFile ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> presetFile' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
-{# fun Fl_Native_File_Chooser_errmsg as errmsg' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetErrmsg ()) NativeFileChooser orig impl where
+     if (T.null s) then return Nothing else return (Just s)
+{# fun Fl_Native_File_Chooser_errmsg as errmsg' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetErrmsg ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> errmsg' chooserPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
+     if (T.null s) then return Nothing else return (Just s)
 {# fun Fl_Native_File_Chooser_show as show' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( IO (NativeFileChooserUserAction))) => Op (ShowWidget ()) NativeFileChooser orig impl where
    runOp _ _ chooser = withRef chooser $ \chooserPtr -> do
@@ -168,37 +169,37 @@
 --
 -- getCount :: 'Ref' 'NativeFileChooser' -> 'IO' ('Int')
 --
--- getDirectory :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getDirectory :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
--- getErrmsg :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getErrmsg :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
--- getFilename :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getFilename :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
--- getFilenameAt :: 'Ref' 'NativeFileChooser' -> 'Int' -> 'IO' ('Maybe' 'String')
+-- getFilenameAt :: 'Ref' 'NativeFileChooser' -> 'Int' -> 'IO' ('Maybe' 'T.Text')
 --
--- getFilter :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getFilter :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
 -- getFilterValue :: 'Ref' 'NativeFileChooser' -> 'IO' ('Int')
 --
 -- getOptions :: 'Ref' 'NativeFileChooser' -> 'IO' (['NativeFileChooserOption')]
 --
--- getPresetFile :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getPresetFile :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
--- getTitle :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'String')
+-- getTitle :: 'Ref' 'NativeFileChooser' -> 'IO' ('Maybe' 'T.Text')
 --
 -- getType_ :: 'Ref' 'NativeFileChooser' -> 'IO' ('NativeFileChooserType')
 --
--- setDirectory :: 'Ref' 'NativeFileChooser' -> 'String' -> 'IO' ()
+-- setDirectory :: 'Ref' 'NativeFileChooser' -> 'T.Text' -> 'IO' ()
 --
--- setFilter :: 'Ref' 'NativeFileChooser' -> 'String' -> 'IO' ()
+-- setFilter :: 'Ref' 'NativeFileChooser' -> 'T.Text' -> 'IO' ()
 --
 -- setFilterValue :: 'Ref' 'NativeFileChooser' -> 'Int' -> 'IO' ()
 --
 -- setOptions :: 'Ref' 'NativeFileChooser' -> ['NativeFileChooserOption'] -> 'IO' ()
 --
--- setPresetFile :: 'Ref' 'NativeFileChooser' -> 'String' -> 'IO' ()
+-- setPresetFile :: 'Ref' 'NativeFileChooser' -> 'T.Text' -> 'IO' ()
 --
--- setTitle :: 'Ref' 'NativeFileChooser' -> 'String' -> 'IO' ()
+-- setTitle :: 'Ref' 'NativeFileChooser' -> 'T.Text' -> 'IO' ()
 --
 -- setType :: 'Ref' 'NativeFileChooser' -> 'NativeFileChooserType' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/NiceSlider.chs b/src/Graphics/UI/FLTK/LowLevel/NiceSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/NiceSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/NiceSlider.chs
@@ -16,10 +16,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Nice_Slider_New as niceSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Nice_Slider_New_WithLabel as niceSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-niceSliderNew :: Rectangle -> Maybe String -> IO (Ref NiceSlider)
+{# fun Fl_Nice_Slider_New_WithLabel as niceSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+niceSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref NiceSlider)
 niceSliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Output.chs b/src/Graphics/UI/FLTK/LowLevel/Output.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Output.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Output.chs
@@ -26,6 +26,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 #c
 enum FlOutputType {
   FlNormalOutput = FL_NORMAL_OUTPUT,
@@ -34,10 +35,10 @@
 #endc
 {#enum FlOutputType {}#}
 {# fun Fl_Output_New as outputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Output_New_WithLabel as outputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Output_New_WithLabel as outputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Multiline_Output_New as multilineOutputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Multiline_Output_New_WithLabel as multilineOutputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-outputNew :: Rectangle -> Maybe String -> Maybe FlOutputType -> IO (Ref Output)
+{# fun Fl_Multiline_Output_New_WithLabel as multilineOutputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+outputNew :: Rectangle -> Maybe T.Text -> Maybe FlOutputType -> IO (Ref Output)
 outputNew rectangle l' flOutputType =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
         constructor = case flOutputType of
diff --git a/src/Graphics/UI/FLTK/LowLevel/OverlayWindow.chs b/src/Graphics/UI/FLTK/LowLevel/OverlayWindow.chs
--- a/src/Graphics/UI/FLTK/LowLevel/OverlayWindow.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/OverlayWindow.chs
@@ -19,14 +19,15 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import C2HS hiding (cFromEnum, toBool,cToEnum)
 
-{# fun Fl_Overlay_Window_New_WithLabel as windowNewWithLabel' { `Int', `Int', unsafeToCString `String', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
+{# fun Fl_Overlay_Window_New_WithLabel as windowNewWithLabel' { `Int', `Int', unsafeToCString `T.Text', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
 {# fun Fl_Overlay_Window_New as windowNew' { `Int', `Int', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
-{# fun Fl_Overlay_Window_NewXY_WithLabel as windowNewWithXYLabel' { `Int', `Int', `Int', `Int', unsafeToCString `String', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
+{# fun Fl_Overlay_Window_NewXY_WithLabel as windowNewWithXYLabel' { `Int', `Int', `Int', `Int', unsafeToCString `T.Text', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
 {# fun Fl_Overlay_Window_NewXY as windowNewWithXY' { `Int', `Int', `Int', `Int', id `FunPtr CallbackPrim' } -> `Ptr ()' id #}
 
-overlayWindowNew :: forall a. (Parent a OverlayWindow) => Size -> Maybe String -> Maybe Position -> (Ref a -> IO ()) -> IO (Ref OverlayWindow)
+overlayWindowNew :: forall a. (Parent a OverlayWindow) => Size -> Maybe T.Text -> Maybe Position -> (Ref a -> IO ()) -> IO (Ref OverlayWindow)
 overlayWindowNew (Size (Width width') (Height height')) title' position' callback' =
     do
       fptr <- toCallbackPrim callback'
diff --git a/src/Graphics/UI/FLTK/LowLevel/PNGImage.chs b/src/Graphics/UI/FLTK/LowLevel/PNGImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/PNGImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/PNGImage.chs
@@ -19,13 +19,13 @@
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
 import qualified Data.ByteString as B
-
-{# fun Fl_PNG_Image_New as pngImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-{# fun Fl_PNG_Image_New_WithData as pngImageNewWithData' { unsafeToCString `String', id `Ptr CUChar', `Int' } -> `Ptr ()' id #}
-pngImageNew :: String -> IO (Either UnknownError (Ref PNGImage))
+import qualified Data.Text as T
+{# fun Fl_PNG_Image_New as pngImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+{# fun Fl_PNG_Image_New_WithData as pngImageNewWithData' { unsafeToCString `T.Text', id `Ptr CUChar', `Int' } -> `Ptr ()' id #}
+pngImageNew :: T.Text -> IO (Either UnknownError (Ref PNGImage))
 pngImageNew filename' = pngImageNew' filename' >>= toRef >>= checkImage
 
-pngImageNewWithData :: String -> B.ByteString -> IO (Either UnknownError (Ref PNGImage))
+pngImageNewWithData :: T.Text -> B.ByteString -> IO (Either UnknownError (Ref PNGImage))
 pngImageNewWithData l' data' = do
   png' <- copyByteStringToCString data'
   pngImageNewWithData' l' (castPtr png') (B.length data') >>= toRef >>= checkImage
diff --git a/src/Graphics/UI/FLTK/LowLevel/PNMImage.chs b/src/Graphics/UI/FLTK/LowLevel/PNMImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/PNMImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/PNMImage.chs
@@ -17,9 +17,9 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
-
-{# fun Fl_PNM_Image_New as pnmImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-pnmImageNew :: String -> IO (Either UnknownError (Ref PNMImage))
+import qualified Data.Text as T
+{# fun Fl_PNM_Image_New as pnmImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+pnmImageNew :: T.Text -> IO (Either UnknownError (Ref PNMImage))
 pnmImageNew filename' = do
   ptr <- pnmImageNew' filename'
   ref' <- (toRef ptr :: IO (Ref PNMImage))
diff --git a/src/Graphics/UI/FLTK/LowLevel/Pack.chs b/src/Graphics/UI/FLTK/LowLevel/Pack.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Pack.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Pack.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Pack_New as packNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Pack_New_WithLabel as packNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-packNew :: Rectangle -> Maybe String -> IO (Ref Pack)
+{# fun Fl_Pack_New_WithLabel as packNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+packNew :: Rectangle -> Maybe T.Text -> IO (Ref Pack)
 packNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Pixmap.chs b/src/Graphics/UI/FLTK/LowLevel/Pixmap.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Pixmap.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Pixmap.chs
diff --git a/src/Graphics/UI/FLTK/LowLevel/Positioner.chs b/src/Graphics/UI/FLTK/LowLevel/Positioner.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Positioner.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Positioner.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Positioner_New as positionerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Positioner_New_WithLabel as positionerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-positionerNew :: Rectangle -> Maybe String -> IO (Ref Positioner)
+{# fun Fl_Positioner_New_WithLabel as positionerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+positionerNew :: Rectangle -> Maybe T.Text -> IO (Ref Positioner)
 positionerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -42,8 +43,8 @@
     return nullPtr
 
 {#fun Fl_Positioner_handle as positionerHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Positioner orig impl where
-  runOp _ _ positioner event = withRef positioner (\p -> positionerHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Positioner orig impl where
+  runOp _ _ positioner event = withRef positioner (\p -> positionerHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Positioner_set_xvalue as setXvalue' { id `Ptr ()',`Double' } -> `()' #}
 instance (impl ~ (Double ->  IO ())) => Op (SetXvalue ()) Positioner orig impl where
   runOp _ _ positioner xvalue = withRef positioner $ \positionerPtr -> setXvalue' positionerPtr xvalue
@@ -110,7 +111,7 @@
 --
 -- getYvalue :: 'Ref' 'Positioner' -> 'IO' 'Double'
 --
--- handle :: 'Ref' 'Positioner' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Positioner' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setXbounds :: 'Ref' 'Positioner' -> 'Double' -> 'Double' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Progress.chs b/src/Graphics/UI/FLTK/LowLevel/Progress.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Progress.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Progress.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Progress_New as progressNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Progress_New_WithLabel as progressNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-progressNew :: Rectangle -> Maybe String -> IO (Ref Progress)
+{# fun Fl_Progress_New_WithLabel as progressNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+progressNew :: Rectangle -> Maybe T.Text -> IO (Ref Progress)
 progressNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/RadioLightButton.chs b/src/Graphics/UI/FLTK/LowLevel/RadioLightButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/RadioLightButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/RadioLightButton.chs
@@ -17,10 +17,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Radio_Light_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Radio_Light_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-radioLightButtonNew :: Rectangle -> Maybe String -> IO (Ref RadioLightButton)
+{# fun Fl_Radio_Light_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+radioLightButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref RadioLightButton)
 radioLightButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs b/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Repeat_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Repeat_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-repeatButtonNew :: Rectangle -> Maybe String -> IO (Ref RepeatButton)
+{# fun Fl_Repeat_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+repeatButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref RepeatButton)
 repeatButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -41,8 +42,8 @@
                      return nullPtr
 
 {#fun Fl_Repeat_Button_handle as handle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ ( Event -> IO Int)) => Op (Handle ()) RepeatButton orig impl where
-  runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) RepeatButton orig impl where
+  runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {#fun Fl_Repeat_Button_deactivate as deactivate' { id `Ptr ()'} -> `()' supressWarningAboutRes #}
 instance (impl ~ ( IO ())) => Op (Deactivate ()) RepeatButton orig impl where
@@ -55,7 +56,7 @@
 --
 -- destroy :: 'Ref' 'RepeatButton' -> 'IO' ()
 --
--- handle :: 'Ref' 'RepeatButton' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'RepeatButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- @
 
diff --git a/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs b/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Return_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Return_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-returnButtonNew :: Rectangle -> Maybe String -> IO (Ref ReturnButton)
+{# fun Fl_Return_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+returnButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref ReturnButton)
 returnButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -41,14 +42,14 @@
                      return nullPtr
 
 {#fun Fl_Return_Button_handle as handle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ ( Event -> IO Int)) => Op (Handle ()) ReturnButton orig impl where
-  runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ReturnButton orig impl where
+  runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 -- $functions
 -- @
 --
 -- destroy :: 'Ref' 'ReturnButton' -> 'IO' ()
 --
--- handle :: 'Ref' 'ReturnButton' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'ReturnButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- @
 
diff --git a/src/Graphics/UI/FLTK/LowLevel/Roller.chs b/src/Graphics/UI/FLTK/LowLevel/Roller.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Roller.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Roller.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Roller_New as rollerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Roller_New_WithLabel as rollerNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-rollerNew :: Rectangle -> Maybe String -> IO (Ref Roller)
+{# fun Fl_Roller_New_WithLabel as rollerNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+rollerNew :: Rectangle -> Maybe T.Text -> IO (Ref Roller)
 rollerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -42,15 +43,15 @@
     return nullPtr
 
 {#fun Fl_Roller_handle as rollerHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Roller orig impl where
-  runOp _ _ roller event = withRef roller (\p -> rollerHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Roller orig impl where
+  runOp _ _ roller event = withRef roller (\p -> rollerHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 -- $functions
 -- @
 --
 -- destroy :: 'Ref' 'Roller' -> 'IO' ()
 --
--- handle :: 'Ref' 'Roller' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Roller' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 -- @
 
 -- $hierarchy
diff --git a/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs b/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Round_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Round_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-roundButtonNew :: Rectangle -> Maybe String -> IO (Ref RoundButton)
+{# fun Fl_Round_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+roundButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref RoundButton)
 roundButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs b/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs
@@ -24,10 +24,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Scrollbar_New as scrollbarNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Scrollbar_New_WithLabel as scrollbarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-scrollbarNew :: Rectangle -> Maybe String -> IO (Ref Scrollbar)
+{# fun Fl_Scrollbar_New_WithLabel as scrollbarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+scrollbarNew :: Rectangle -> Maybe T.Text -> IO (Ref Scrollbar)
 scrollbarNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -56,8 +57,8 @@
 
 {#fun Fl_Scrollbar_handle as scrollbarHandle'
       { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Scrollbar orig impl where
-  runOp _ _ scrollbar event = withRef scrollbar (\p -> scrollbarHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Scrollbar orig impl where
+  runOp _ _ scrollbar event = withRef scrollbar (\p -> scrollbarHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Widget_set_type as setType' { id `Ptr ()',`Word8' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (ScrollbarType ->  IO ())) => Op (SetType ()) Scrollbar orig impl where
@@ -74,7 +75,7 @@
 --
 -- getType_ :: 'Ref' 'Scrollbar' -> 'IO' ('ScrollbarType')
 --
--- handle :: 'Ref' 'Scrollbar' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Scrollbar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setLinesize :: 'Ref' 'Scrollbar' -> 'LineSize' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs b/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs
@@ -22,11 +22,12 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 
 {# fun Fl_Scroll_New as scrollNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Scroll_New_WithLabel as scrollNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-scrolledNew :: Rectangle -> Maybe String -> IO (Ref Scrolled)
+{# fun Fl_Scroll_New_WithLabel as scrollNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+scrolledNew :: Rectangle -> Maybe T.Text -> IO (Ref Scrolled)
 scrolledNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -62,8 +63,8 @@
 instance (impl ~ (Rectangle ->  IO ())) => Op (Resize ()) Scrolled orig impl where
    runOp _ _ widget rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef widget $ \scrollPtr -> resize' scrollPtr x_pos' y_pos' width' height'
 {# fun Fl_Scroll_handle as handle' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (Handle ()) Scrolled orig impl where
-   runOp _ _ widget event = withRef widget $ \scrollPtr -> handle' scrollPtr (fromIntegral (fromEnum event))
+instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) Scrolled orig impl where
+   runOp _ _ widget event = withRef widget $ \scrollPtr -> handle' scrollPtr (fromIntegral (fromEnum event)) >>= return  . successOrUnknownEvent
 
 -- $hierarchy
 -- @
diff --git a/src/Graphics/UI/FLTK/LowLevel/SelectBrowser.chs b/src/Graphics/UI/FLTK/LowLevel/SelectBrowser.chs
--- a/src/Graphics/UI/FLTK/LowLevel/SelectBrowser.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/SelectBrowser.chs
@@ -16,10 +16,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Select_Browser_New as selectBrowserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Select_Browser_New_WithLabel as selectBrowserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-selectBrowserNew :: Rectangle -> Maybe String -> IO (Ref SelectBrowser)
+{# fun Fl_Select_Browser_New_WithLabel as selectBrowserNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+selectBrowserNew :: Rectangle -> Maybe T.Text -> IO (Ref SelectBrowser)
 selectBrowserNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/SimpleCounter.chs b/src/Graphics/UI/FLTK/LowLevel/SimpleCounter.chs
--- a/src/Graphics/UI/FLTK/LowLevel/SimpleCounter.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/SimpleCounter.chs
@@ -15,10 +15,10 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
-
+import qualified Data.Text as T
 {# fun Fl_Simple_Counter_New as simpleCounterNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Simple_Counter_New_WithLabel as simpleCounterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-simpleCounterNew :: Rectangle -> Maybe String -> IO (Ref SimpleCounter)
+{# fun Fl_Simple_Counter_New_WithLabel as simpleCounterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+simpleCounterNew :: Rectangle -> Maybe T.Text -> IO (Ref SimpleCounter)
 simpleCounterNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs b/src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs
--- a/src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs
@@ -21,6 +21,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Widget
 import Graphics.UI.FLTK.LowLevel.Window
@@ -28,11 +29,11 @@
 
 {# fun Fl_OverriddenSingle_Window_New as overriddenWindowNew' {`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenSingle_Window_NewXY as overriddenWindowNewXY' {`Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenSingle_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenSingle_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenSingle_Window_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenSingle_Window_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 singleWindowCustom :: Size                                 -- ^ Size of this window
                    -> Maybe Position                       -- ^ Optional position of this window
-                   -> Maybe String                         -- ^ Optional label
+                   -> Maybe T.Text                         -- ^ Optional label
                    -> Maybe (Ref SingleWindow -> IO ())    -- ^ Optional custom drawing function
                    -> CustomWidgetFuncs SingleWindow       -- ^ Custom widget overrides
                    -> CustomWindowFuncs SingleWindow       -- ^ Custom window overrides
@@ -50,7 +51,7 @@
     overriddenWindowNewXY'
     overriddenWindowNewXYWithLabel'
 
-singleWindowNew :: Size -> Maybe Position -> Maybe String -> IO (Ref SingleWindow)
+singleWindowNew :: Size -> Maybe Position -> Maybe T.Text -> IO (Ref SingleWindow)
 singleWindowNew size position title =
   windowMaker
     size
@@ -73,8 +74,8 @@
   runOp _ _ window = withRef window $ \windowPtr -> drawSuper' windowPtr
 
 {# fun Fl_Single_Window_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) SingleWindow orig impl where
-  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event))
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) SingleWindow orig impl where
+  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
 
 {# fun Fl_Single_Window_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) SingleWindow orig impl where
@@ -104,8 +105,8 @@
 
 {#fun Fl_Single_Window_handle as windowHandle'
       { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) SingleWindow orig impl where
-  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) SingleWindow orig impl where
+  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Single_Window_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) SingleWindow orig impl where
@@ -121,7 +122,7 @@
 --
 -- flushSuper :: 'Ref' 'SingleWindow' -> 'IO' ()
 --
--- handle :: 'Ref' 'SingleWindow' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'SingleWindow' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- handleSuper :: 'Ref' 'SingleWindow' -> 'Int' -> 'IO' 'Int'
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Slider.chs b/src/Graphics/UI/FLTK/LowLevel/Slider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Slider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Slider.chs
@@ -22,11 +22,12 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
 {# fun Fl_Slider_New as sliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Slider_New_WithLabel as sliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-sliderNew :: Rectangle -> Maybe String -> IO (Ref Slider)
+{# fun Fl_Slider_New_WithLabel as sliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+sliderNew :: Rectangle -> Maybe T.Text -> IO (Ref Slider)
 sliderNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -41,8 +42,8 @@
                                         sliderDestroy' winPtr
                                         return nullPtr
 {#fun Fl_Slider_handle as sliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Slider orig impl where
-  runOp _ _ slider event = withRef slider (\p -> sliderHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Slider orig impl where
+  runOp _ _ slider event = withRef slider (\p -> sliderHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Slider_bounds as bounds' { id `Ptr ()',`Double',`Double' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Double -> Double ->  IO ())) => Op (Bounds ()) Slider orig impl where
   runOp _ _ slider a b = withRef slider $ \sliderPtr -> bounds' sliderPtr a b
@@ -78,7 +79,7 @@
 --
 -- getSliderSize :: 'Ref' 'Slider' -> 'Double' -> 'IO' ()
 --
--- handle :: 'Ref' 'Slider' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Slider' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- scrollvalue :: 'Ref' 'Slider' -> 'Int' -> 'Int' -> 'Int' -> 'Int' -> 'IO' 'Int'
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Spinner.chs b/src/Graphics/UI/FLTK/LowLevel/Spinner.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Spinner.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Spinner.chs
@@ -26,6 +26,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 #c
 enum SpinnerType {
   IntSpinnerType = FL_INT_INPUTC,
@@ -34,8 +35,8 @@
 #endc
 {#enum SpinnerType {} deriving (Show, Eq) #}
 {# fun Fl_Spinner_New as spinnerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Spinner_New_WithLabel as spinnerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-spinnerNew :: Rectangle -> Maybe String -> IO (Ref Spinner)
+{# fun Fl_Spinner_New_WithLabel as spinnerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+spinnerNew :: Rectangle -> Maybe T.Text -> IO (Ref Spinner)
 spinnerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -45,8 +46,8 @@
                                toRef
 
 {#fun Fl_Spinner_handle as spinnerHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Spinner orig impl where
-  runOp _ _ spinner event = withRef spinner (\p -> spinnerHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Spinner orig impl where
+  runOp _ _ spinner event = withRef spinner (\p -> spinnerHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Spinner_set_textfont as setTextfont' { id `Ptr ()',cFromFont `Font' } -> `()' #}
 instance (impl ~ (Font ->  IO ())) => Op (SetTextfont ()) Spinner orig impl where
   runOp _ _ spinner text = withRef spinner $ \spinnerPtr -> setTextfont' spinnerPtr text
@@ -71,13 +72,13 @@
 {# fun Fl_Spinner_type as type' { id `Ptr ()' } -> `Word8' #}
 instance (impl ~ IO (SpinnerType)) => Op (GetType_ ()) Spinner orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger
-{# fun Fl_Spinner_set_format as set_format' { id `Ptr ()', `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (SetFormat ()) Spinner orig impl where
+{# fun Fl_Spinner_set_format as set_format' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetFormat ()) Spinner orig impl where
   runOp _ _ spinner f = withRef spinner $ \spinnerPtr -> set_format' spinnerPtr f
-{# fun Fl_Spinner_format as format' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (Maybe String))) => Op (GetFormat ()) Spinner orig impl where
+{# fun Fl_Spinner_format as format' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO (Maybe T.Text))) => Op (GetFormat ()) Spinner orig impl where
    runOp _ _ spinner = withRef spinner $ \spinnerPtr -> format' spinnerPtr >>= \s ->
-     if (null s) then return Nothing else return (Just s)
+     if (T.null s) then return Nothing else return (Just s)
 {# fun Fl_Spinner_value as value' { id `Ptr ()' } -> `Double' #}
 instance (impl ~ ( IO (Double))) => Op (GetValue ()) Spinner orig impl where
   runOp _ _ spinner = withRef spinner $ \spinnerPtr -> value' spinnerPtr
@@ -121,7 +122,7 @@
 
 -- $functions
 -- @
--- getFormat :: 'Ref' 'Spinner' -> 'IO' ('Maybe' 'String')
+-- getFormat :: 'Ref' 'Spinner' -> 'IO' ('Maybe' 'T.Text')
 --
 -- getMaximum :: 'Ref' 'Spinner' -> 'IO' ('Double')
 --
@@ -139,11 +140,11 @@
 --
 -- getValue :: 'Ref' 'Spinner' -> 'IO' ('Double')
 --
--- handle :: 'Ref' 'Spinner' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Spinner' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- range :: 'Ref' 'Spinner' -> 'Double' -> 'Double' -> 'IO' ()
 --
--- setFormat :: 'Ref' 'Spinner' -> 'String' -> 'IO' ()
+-- setFormat :: 'Ref' 'Spinner' -> 'T.Text' -> 'IO' ()
 --
 -- setMaximum :: 'Ref' 'Spinner' -> 'Double' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs b/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs
--- a/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs
@@ -22,13 +22,14 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.MenuItem
 import Graphics.UI.FLTK.LowLevel.MenuPrim
 
 {# fun Fl_Sys_Menu_Bar_New as sysMenuBarNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Sys_Menu_Bar_New_WithLabel as sysMenuBarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-sysMenuBarNew :: Rectangle -> Maybe String -> IO (Ref SysMenuBar)
+{# fun Fl_Sys_Menu_Bar_New_WithLabel as sysMenuBarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+sysMenuBarNew :: Rectangle -> Maybe T.Text -> IO (Ref SysMenuBar)
 sysMenuBarNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -42,13 +43,13 @@
     sysMenuBarDestroy' winPtr
     return nullPtr
 {#fun Fl_Sys_Menu_Bar_handle as sysMenuBarHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ ( Event -> IO Int)) => Op (Handle ()) SysMenuBar orig impl where
-  runOp _ _ menu_bar event = withRef menu_bar (\p -> sysMenuBarHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) SysMenuBar orig impl where
+  runOp _ _ menu_bar event = withRef menu_bar (\p -> sysMenuBarHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Sys_Menu_Bar_remove as remove' { id `Ptr ()',`Int' } -> `()' #}
 instance (impl ~ (Int  ->  IO ())) => Op (Remove ()) SysMenuBar orig impl where
   runOp _ _ menu_ index' = withRef menu_ $ \menu_Ptr -> remove' menu_Ptr index'
-{# fun Fl_Sys_Menu_Bar_replace as replace' { id `Ptr ()',`Int', unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Int -> String ->  IO ())) => Op (Replace ()) SysMenuBar orig impl where
+{# fun Fl_Sys_Menu_Bar_replace as replace' { id `Ptr ()',`Int', unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (Int -> T.Text ->  IO ())) => Op (Replace ()) SysMenuBar orig impl where
   runOp _ _ menu_ index' name = withRef menu_ $ \menu_Ptr -> replace' menu_Ptr index' name
 {# fun Fl_Sys_Menu_Bar_clear as clear' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ())) => Op (Clear ()) SysMenuBar orig impl where
@@ -77,27 +78,27 @@
         withRefs items $ \menu_itemsPtr ->
             menuWithM' menu_Ptr menu_itemsPtr (length items)
 
-{# fun Fl_Sys_Menu_Bar_add_with_name as add' { id `Ptr ()',unsafeToCString `String'} -> `()' #}
-instance (impl ~ (String -> IO ())) => Op (AddName ()) SysMenuBar orig impl where
+{# fun Fl_Sys_Menu_Bar_add_with_name as add' { id `Ptr ()',unsafeToCString `T.Text'} -> `()' #}
+instance (impl ~ (T.Text -> IO ())) => Op (AddName ()) SysMenuBar orig impl where
   runOp _ _ menu_ name' = withRef menu_ $ \menu_Ptr -> add' menu_Ptr name'
 
-{# fun Fl_Sys_Menu_Bar_add_with_flags as addWithFlags' { id `Ptr ()',unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-{# fun Fl_Sys_Menu_Bar_add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `String', unsafeToCString `String',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-instance (Parent a MenuItem, impl ~ ( String -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) SysMenuBar orig (impl) where
+{# fun Fl_Sys_Menu_Bar_add_with_flags as addWithFlags' { id `Ptr ()',unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+{# fun Fl_Sys_Menu_Bar_add_with_shortcutname_flags as addWithShortcutnameFlags' { id `Ptr ()', unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+instance (Parent a MenuItem, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) SysMenuBar orig (impl) where
   runOp _ _ menu_ name shortcut cb flags =
     addMenuItem (Left (safeCast menu_)) name shortcut cb flags addWithFlags' addWithShortcutnameFlags'
 
-{# fun Fl_Sys_Menu_Bar_insert_with_flags as insertWithFlags' { id `Ptr ()',`Int',unsafeToCString `String',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
-{# fun Fl_Sys_Menu_Bar_insert_with_shortcutname_flags as insertWithShortcutnameFlags' { id `Ptr ()',`Int',unsafeToCString `String', unsafeToCString `String',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
-instance (Parent a MenuPrim, impl ~ ( Int -> String -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) SysMenuBar orig impl where
+{# fun Fl_Sys_Menu_Bar_insert_with_flags as insertWithFlags' { id `Ptr ()',`Int',unsafeToCString `T.Text',id `CInt',id `FunPtr CallbackWithUserDataPrim',`Int'} -> `Int' #}
+{# fun Fl_Sys_Menu_Bar_insert_with_shortcutname_flags as insertWithShortcutnameFlags' { id `Ptr ()',`Int',unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #}
+instance (Parent a MenuPrim, impl ~ ( Int -> T.Text -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) SysMenuBar orig impl where
   runOp _ _ menu_ index' name shortcut cb flags = insertMenuItem (safeCast menu_) index' name shortcut cb flags insertWithFlags' insertWithShortcutnameFlags'
 
 -- $functions
 -- @
 --
--- add:: ('Parent' a 'MenuItem') => 'Ref' 'SysMenuBar' -> 'String' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- add:: ('Parent' a 'MenuItem') => 'Ref' 'SysMenuBar' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
--- addName :: 'Ref' 'SysMenuBar' -> 'String' -> 'IO' ()
+-- addName :: 'Ref' 'SysMenuBar' -> 'T.Text' -> 'IO' ()
 --
 -- clear :: 'Ref' 'SysMenuBar' -> 'IO' ()
 --
@@ -105,21 +106,21 @@
 --
 -- destroy :: 'Ref' 'SysMenuBar' -> 'IO' ()
 --
--- getMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'IO' ('Int')
+-- getMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'IO' ('Maybe' 'MenuItemFlags')
 --
 -- global :: 'Ref' 'SysMenuBar' -> 'IO' ()
 --
--- handle :: 'Ref' 'SysMenuBar' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'SysMenuBar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
--- insert:: ('Parent' a 'MenuPrim') => 'Ref' 'SysMenuBar' -> 'Int' -> 'String' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
+-- insert:: ('Parent' a 'MenuPrim') => 'Ref' 'SysMenuBar' -> 'Int' -> 'T.Text' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex')
 --
 -- remove :: 'Ref' 'SysMenuBar' -> 'Int' -> 'IO' ()
 --
--- replace :: 'Ref' 'SysMenuBar' -> 'Int' -> 'String' -> 'IO' ()
+-- replace :: 'Ref' 'SysMenuBar' -> 'Int' -> 'T.Text' -> 'IO' ()
 --
 -- setMenu :: 'Ref' 'SysMenuBar' -> ['Ref' 'MenuItem'] -> 'IO' ()
 --
--- setMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'Int' -> 'IO' ()
+-- setMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'MenuItemFlags' -> 'IO' ()
 --
 -- setShortcut :: 'Ref' 'SysMenuBar' -> 'Int' -> 'ShortcutKeySequence' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Table.chs b/src/Graphics/UI/FLTK/LowLevel/Table.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Table.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Table.chs
@@ -34,6 +34,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 data Row = Row Int
 data Column = Column Int
 data TableCoordinate = TableCoordinate Row Column
@@ -119,9 +120,9 @@
    return ptr
 
 {# fun Fl_Table_New as tableNew' {  `Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_Table_New_WithLabel as tableNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Table_New_WithLabel as tableNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 tableCustom :: Rectangle                                                            -- ^ Bounds of this table
-            -> Maybe String                                                         -- ^ Optional label
+            -> Maybe T.Text                                                         -- ^ Optional label
             -> Maybe (Ref Table -> IO ())                                           -- ^ Optional custom table drawing function
             -> (Ref Table -> TableContext -> TableCoordinate -> Rectangle -> IO ()) -- ^ Custom table cell drawing function
             -> CustomWidgetFuncs Table                                              -- ^ Widget overrides
@@ -336,8 +337,8 @@
 instance (impl ~ (  IO ())) => Op (Draw ()) Table orig impl where
   runOp _ _ table = withRef table $ \tablePtr -> draw' tablePtr
 {# fun Fl_Table_handle as handle' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ ( Event ->  IO (Int))) => Op (Handle ()) Table orig impl where
-  runOp _ _ table event = withRef table $ \tablePtr -> handle' tablePtr event
+instance (impl ~ ( Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) Table orig impl where
+  runOp _ _ table event = withRef table $ \tablePtr -> handle' tablePtr event >>= return  . successOrUnknownEvent
 {# fun Fl_Table_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #}
 instance (impl ~ ( Rectangle ->  IO ())) => Op (ResizeSuper ()) Table orig impl where
   runOp _ _ table rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef table $ \tablePtr -> resizeSuper' tablePtr x_pos' y_pos' width' height'
diff --git a/src/Graphics/UI/FLTK/LowLevel/TableRow.chs b/src/Graphics/UI/FLTK/LowLevel/TableRow.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TableRow.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TableRow.chs
@@ -25,12 +25,13 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 data TableRowSelectFlag = TableRowSelect | TableRowDeselect | TableRowToggle
 
 {# fun Fl_OverriddenTable_Row_New as tableRowNew' {  `Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenTable_Row_New_WithLabel as tableRowNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
-tableRowNew :: Rectangle -> Maybe String -> Maybe (Ref TableRow -> IO ()) -> (Ref TableRow -> TableContext -> TableCoordinate -> Rectangle -> IO ()) -> CustomWidgetFuncs TableRow -> CustomTableFuncs TableRow -> IO (Ref TableRow)
+{# fun Fl_OverriddenTable_Row_New_WithLabel as tableRowNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
+tableRowNew :: Rectangle -> Maybe T.Text -> Maybe (Ref TableRow -> IO ()) -> (Ref TableRow -> TableContext -> TableCoordinate -> Rectangle -> IO ()) -> CustomWidgetFuncs TableRow -> CustomTableFuncs TableRow -> IO (Ref TableRow)
 tableRowNew rectangle label' draw' drawCell' customWidgetFuncs' customTableFuncs' =
     do
       let (x_pos, y_pos, width, height) = fromRectangle rectangle
@@ -70,11 +71,11 @@
 instance (impl ~ (Int ->  IO ())) => Op (SetColsSuper ()) TableRow orig impl where
   runOp _ _ table val = withRef table $ \tablePtr -> setColsSuper' tablePtr val
 {# fun Fl_Table_Row_handle_super as handleSuper' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) TableRow orig impl where
-   runOp _ _ table event = withRef table $ \tablePtr -> handleSuper' tablePtr event
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) TableRow orig impl where
+   runOp _ _ table event = withRef table $ \tablePtr -> handleSuper' tablePtr event >>= return . successOrUnknownEvent
 {# fun Fl_Table_Row_handle as handle' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (Handle ()) TableRow orig impl where
-  runOp _ _ table event = withRef table $ \tablePtr -> handle' tablePtr event
+instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) TableRow orig impl where
+  runOp _ _ table event = withRef table $ \tablePtr -> handle' tablePtr event >>= return  . successOrUnknownEvent
 {# fun Fl_Table_Row_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #}
 instance (impl ~ (Rectangle ->  IO ())) => Op (ResizeSuper ()) TableRow orig impl where
   runOp _ _ table rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef table $ \tablePtr -> resizeSuper' tablePtr x_pos' y_pos' width' height'
diff --git a/src/Graphics/UI/FLTK/LowLevel/Tabs.chs b/src/Graphics/UI/FLTK/LowLevel/Tabs.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Tabs.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Tabs.chs
@@ -23,13 +23,14 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
 data TabsHeightOffset = TabsAtTop (Maybe Int) | TabsAtBottom (Maybe Int)
 
 {# fun Fl_Tabs_New as tabsNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Tabs_New_WithLabel as tabsNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-tabsNew :: Rectangle -> Maybe String -> IO (Ref Tabs)
+{# fun Fl_Tabs_New_WithLabel as tabsNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+tabsNew :: Rectangle -> Maybe T.Text -> IO (Ref Tabs)
 tabsNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -37,8 +38,8 @@
         Just l -> tabsNewWithLabel' x_pos y_pos width height l >>= toRef
 
 {# fun Fl_Tabs_handle as handle' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Tabs orig impl where
-  runOp _ _ tabs event = withRef tabs (\p -> handle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tabs orig impl where
+  runOp _ _ tabs event = withRef tabs (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Tabs_value as value' { id `Ptr ()' } -> `Ptr ()' id #}
 instance (impl ~ (IO (Maybe (Ref Widget)))) => Op (GetValue ()) Tabs orig impl where
@@ -89,7 +90,7 @@
 --
 -- getValue :: 'Ref' 'Tabs' -> 'IO' ('Maybe' ('Ref' 'Widget'))
 --
--- handle :: 'Ref' 'Tabs' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Tabs' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setPush:: ('Parent' a 'Widget') => 'Ref' 'Tabs' -> 'Maybe' ( 'Ref' a ) -> 'IO' ('Either' 'NoChange' ())
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/TextBuffer.chs b/src/Graphics/UI/FLTK/LowLevel/TextBuffer.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TextBuffer.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TextBuffer.chs
@@ -21,6 +21,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 {# fun Fl_Text_Buffer_New as new' {} -> `Ptr ()' id #}
 {# fun Fl_Text_Buffer_New_With_RequestedSize as newRequestedSize' {`Int'}-> `Ptr ()' id #}
 {# fun Fl_Text_Buffer_New_With_PreferredGapSize as newPreferredGapSize' {`Int'} -> `Ptr ()' id #}
@@ -42,20 +43,20 @@
 {# fun Fl_Text_Buffer_input_file_was_transcoded as inputFileWasTranscoded' { id `Ptr ()' } -> `Bool' cToBool #}
 instance ( impl ~ (  IO (Bool))) => Op (InputFileWasTranscoded ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> inputFileWasTranscoded' text_bufferPtr
-{# fun Fl_Text_Buffer_file_encoding_warning_message as fileEncodingWarningMessage' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance ( impl ~ (  IO (String))) => Op (FileEncodingWarningMessage ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_file_encoding_warning_message as fileEncodingWarningMessage' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ (  IO T.Text)) => Op (FileEncodingWarningMessage ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> fileEncodingWarningMessage' text_bufferPtr
 {# fun Fl_Text_Buffer_length as length' { id `Ptr ()' } -> `Int' #}
 instance ( impl ~ (  IO (Int))) => Op (GetLength ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> length' text_bufferPtr
-{# fun Fl_Text_Buffer_text as text' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance ( impl ~ (  IO (String))) => Op (GetText ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_text as text' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ (  IO T.Text)) => Op (GetText ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> text' text_bufferPtr
-{# fun Fl_Text_Buffer_set_text as setText' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( String ->  IO ())) => Op (SetText ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_set_text as setText' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( T.Text ->  IO ())) => Op (SetText ()) TextBuffer orig impl where
    runOp _ _ text_buffer text = withRef text_buffer $ \text_bufferPtr -> setText' text_bufferPtr text
-{# fun Fl_Text_Buffer_text_range as textRange' { id `Ptr ()',`Int',`Int' } -> `String' unsafeFromCString #}
-instance ( impl ~ ( BufferRange ->  IO (String))) => Op (TextRange ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_text_range as textRange' { id `Ptr ()',`Int',`Int' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ ( BufferRange ->  IO T.Text)) => Op (TextRange ()) TextBuffer orig impl where
    runOp _ _ text_buffer (BufferRange (BufferOffset start') (BufferOffset end')) = withRef text_buffer $ \text_bufferPtr -> textRange' text_bufferPtr start' end'
 {# fun Fl_Text_Buffer_char_at as charAt' { id `Ptr ()',`Int' } -> `Int' #}
 instance ( impl ~ ( BufferOffset ->  IO (Char))) => Op (CharAt ()) TextBuffer orig impl where
@@ -63,17 +64,17 @@
 {# fun Fl_Text_Buffer_byte_at as byteAt' { id `Ptr ()',`Int' } -> `Char' castCCharToChar #}
 instance ( impl ~ ( BufferOffset ->  IO Char)) => Op (ByteAt ()) TextBuffer orig impl where
   runOp _ _ text_buffer (BufferOffset pos) = withRef text_buffer $ \text_bufferPtr -> byteAt' text_bufferPtr pos
-{# fun Fl_Text_Buffer_insert as insert' { id `Ptr ()',`Int', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( BufferOffset -> String ->  IO ())) => Op (Insert ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_insert as insert' { id `Ptr ()',`Int', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( BufferOffset -> T.Text ->  IO ())) => Op (Insert ()) TextBuffer orig impl where
   runOp _ _ text_buffer (BufferOffset pos) text = withRef text_buffer $ \text_bufferPtr -> insert' text_bufferPtr pos text
-{# fun Fl_Text_Buffer_append as append' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( String ->  IO ())) => Op (AppendToBuffer ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_append as append' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( T.Text ->  IO ())) => Op (AppendToBuffer ()) TextBuffer orig impl where
    runOp _ _ text_buffer t = withRef text_buffer $ \text_bufferPtr -> append' text_bufferPtr t
 {# fun Fl_Text_Buffer_remove as remove' { id `Ptr ()',`Int',`Int' } -> `()' #}
 instance ( impl ~ ( BufferRange ->  IO ())) => Op (Remove ()) TextBuffer orig impl where
    runOp _ _ text_buffer (BufferRange (BufferOffset start') (BufferOffset end')) = withRef text_buffer $ \text_bufferPtr -> remove' text_bufferPtr start' end'
-{# fun Fl_Text_Buffer_replace as replace' { id `Ptr ()',`Int',`Int', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( BufferRange -> String ->  IO ())) => Op (Replace ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_replace as replace' { id `Ptr ()',`Int',`Int', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( BufferRange -> T.Text ->  IO ())) => Op (Replace ()) TextBuffer orig impl where
    runOp _ _ text_buffer (BufferRange (BufferOffset start') (BufferOffset end')) text = withRef text_buffer $ \text_bufferPtr -> replace' text_bufferPtr start' end' text
 {# fun Fl_Text_Buffer_copy as copy' { id `Ptr ()',id `Ptr ()',`Int',`Int',`Int' } -> `()' #}
 instance ( Parent a TextBuffer, impl ~ ( Ref a -> BufferRange -> BufferOffset ->  IO ())) => Op (Copy ()) TextBuffer orig impl where
@@ -91,54 +92,54 @@
 instance ( impl ~ (Bool ->  IO ())) => Op (CanUndo ()) TextBuffer orig impl where
    runOp _ _ text_buffer flag = withRef text_buffer $ \text_bufferPtr -> canUndoWithFlag' text_bufferPtr flag
 
-{# fun Fl_Text_Buffer_insertfile as insertfile' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> BufferOffset -> IO (Either DataProcessingError ()))) => Op (Insertfile ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_insertfile as insertfile' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> BufferOffset -> IO (Either DataProcessingError ()))) => Op (Insertfile ()) TextBuffer orig impl where
    runOp _ _ text_buffer file (BufferOffset pos) =
       withRef text_buffer $ \text_bufferPtr ->
       insertfile' text_bufferPtr file pos >>= return . successOrDataProcessingError
 
-{# fun Fl_Text_Buffer_insertfile_with_buflen as insertfileWithBuflen' { id `Ptr ()', unsafeToCString `String',`Int',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> BufferOffset -> Int -> IO (Either DataProcessingError ()))) => Op (InsertfileWithBuflen ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_insertfile_with_buflen as insertfileWithBuflen' { id `Ptr ()', unsafeToCString `T.Text',`Int',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> BufferOffset -> Int -> IO (Either DataProcessingError ()))) => Op (InsertfileWithBuflen ()) TextBuffer orig impl where
    runOp _ _ text_buffer file (BufferOffset pos) buflen =
       withRef text_buffer $ \text_bufferPtr ->
       insertfileWithBuflen' text_bufferPtr file pos buflen >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_appendfile as appendfile' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-instance ( impl ~ ( String ->  IO (Either DataProcessingError ()))) => Op (Appendfile ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_appendfile as appendfile' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+instance ( impl ~ ( T.Text ->  IO (Either DataProcessingError ()))) => Op (Appendfile ()) TextBuffer orig impl where
    runOp _ _ text_buffer file =
      withRef text_buffer $ \text_bufferPtr ->
      appendfile' text_bufferPtr file >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_appendfile_with_buflen as appendfileWithBuflen' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> Int ->  IO (Either DataProcessingError ()))) => Op (AppendfileWithBuflen ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_appendfile_with_buflen as appendfileWithBuflen' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> Int ->  IO (Either DataProcessingError ()))) => Op (AppendfileWithBuflen ()) TextBuffer orig impl where
    runOp _ _ text_buffer file buflen =
      withRef text_buffer $ \text_bufferPtr ->
      appendfileWithBuflen' text_bufferPtr file buflen >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_loadfile as loadfile' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-instance ( impl ~ ( String ->  IO (Either DataProcessingError ()))) => Op (Loadfile ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_loadfile as loadfile' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+instance ( impl ~ ( T.Text ->  IO (Either DataProcessingError ()))) => Op (Loadfile ()) TextBuffer orig impl where
    runOp _ _ text_buffer file =
      withRef text_buffer $ \text_bufferPtr ->
      loadfile' text_bufferPtr file >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_loadfile_with_buflen as loadfileWithBuflen' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> Int ->  IO (Either DataProcessingError ()))) => Op (LoadfileWithBuflen ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_loadfile_with_buflen as loadfileWithBuflen' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> Int ->  IO (Either DataProcessingError ()))) => Op (LoadfileWithBuflen ()) TextBuffer orig impl where
    runOp _ _ text_buffer file buflen =
      withRef text_buffer $ \text_bufferPtr ->
      loadfileWithBuflen' text_bufferPtr file buflen >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_outputfile as outputfile' { id `Ptr ()', unsafeToCString `String',`Int',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> BufferRange ->  IO (Either DataProcessingError ()))) => Op (Outputfile ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_outputfile as outputfile' { id `Ptr ()', unsafeToCString `T.Text',`Int',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> BufferRange ->  IO (Either DataProcessingError ()))) => Op (Outputfile ()) TextBuffer orig impl where
    runOp _ _ text_buffer file (BufferRange (BufferOffset start') (BufferOffset end')) =
      withRef text_buffer $ \text_bufferPtr ->
      outputfile' text_bufferPtr file start' end' >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_outputfile_with_buflen as outputfileWithBuflen' { id `Ptr ()', unsafeToCString `String',`Int',`Int',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> BufferRange -> Int ->  IO (Either DataProcessingError ()))) => Op (OutputfileWithBuflen ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_outputfile_with_buflen as outputfileWithBuflen' { id `Ptr ()', unsafeToCString `T.Text',`Int',`Int',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> BufferRange -> Int ->  IO (Either DataProcessingError ()))) => Op (OutputfileWithBuflen ()) TextBuffer orig impl where
    runOp _ _ text_buffer file (BufferRange (BufferOffset start') (BufferOffset end')) buflen =
      withRef text_buffer $ \text_bufferPtr ->
      outputfileWithBuflen' text_bufferPtr file start' end' buflen >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_savefile as savefile' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-instance ( impl ~ ( String ->  IO (Either DataProcessingError ()))) => Op (Savefile ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_savefile as savefile' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+instance ( impl ~ ( T.Text ->  IO (Either DataProcessingError ()))) => Op (Savefile ()) TextBuffer orig impl where
    runOp _ _ text_buffer file =
      withRef text_buffer $ \text_bufferPtr ->
      savefile' text_bufferPtr file >>= return . successOrDataProcessingError
-{# fun Fl_Text_Buffer_savefile_with_buflen as savefileWithBuflen' { id `Ptr ()', unsafeToCString `String',`Int' } -> `Int' #}
-instance ( impl ~ ( String -> Int ->  IO (Either DataProcessingError ()))) => Op (SavefileWithBuflen ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_savefile_with_buflen as savefileWithBuflen' { id `Ptr ()', unsafeToCString `T.Text',`Int' } -> `Int' #}
+instance ( impl ~ ( T.Text -> Int ->  IO (Either DataProcessingError ()))) => Op (SavefileWithBuflen ()) TextBuffer orig impl where
    runOp _ _ text_buffer file buflen =
      withRef text_buffer $ \text_bufferPtr ->
      savefileWithBuflen' text_bufferPtr file buflen >>= return . successOrDataProcessingError
@@ -163,14 +164,14 @@
      withRef text_buffer $ \text_bufferPtr ->
      selectionPosition' text_bufferPtr >>= \(start',end') ->
      return (BufferRange (BufferOffset start') (BufferOffset end'))
-{# fun Fl_Text_Buffer_selection_text as selectionText' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance ( impl ~ (  IO (String))) => Op (SelectionText ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_selection_text as selectionText' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ (  IO T.Text)) => Op (SelectionText ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> selectionText' text_bufferPtr
 {# fun Fl_Text_Buffer_remove_selection as removeSelection' { id `Ptr ()' } -> `()' #}
 instance ( impl ~ (  IO ())) => Op (RemoveSelection ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> removeSelection' text_bufferPtr
-{# fun Fl_Text_Buffer_replace_selection as replaceSelection' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( String ->  IO ())) => Op (ReplaceSelection ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_replace_selection as replaceSelection' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( T.Text ->  IO ())) => Op (ReplaceSelection ()) TextBuffer orig impl where
    runOp _ _ text_buffer text = withRef text_buffer $ \text_bufferPtr -> replaceSelection' text_bufferPtr text
 {# fun Fl_Text_Buffer_secondary_select as secondarySelect' { id `Ptr ()',`Int',`Int' } -> `()' #}
 instance ( impl ~ ( BufferRange ->  IO ())) => Op (SecondarySelect ()) TextBuffer orig impl where
@@ -187,14 +188,14 @@
      withRef text_buffer $ \text_bufferPtr ->
      secondarySelectionPosition' text_bufferPtr >>= \(start',end') ->
      return (BufferRange (BufferOffset start') (BufferOffset end'))
-{# fun Fl_Text_Buffer_secondary_selection_text as secondarySelectionText' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance ( impl ~ (  IO (String))) => Op (SecondarySelectionText ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_secondary_selection_text as secondarySelectionText' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ (  IO T.Text)) => Op (SecondarySelectionText ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> secondarySelectionText' text_bufferPtr
 {# fun Fl_Text_Buffer_remove_secondary_selection as removeSecondarySelection' { id `Ptr ()' } -> `()' #}
 instance ( impl ~ (  IO ())) => Op (RemoveSecondarySelection ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> removeSecondarySelection' text_bufferPtr
-{# fun Fl_Text_Buffer_replace_secondary_selection as replaceSecondarySelection' { id `Ptr ()', unsafeToCString `String' } -> `()' #}
-instance ( impl ~ ( String ->  IO ())) => Op (ReplaceSecondarySelection ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_replace_secondary_selection as replaceSecondarySelection' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' #}
+instance ( impl ~ ( T.Text ->  IO ())) => Op (ReplaceSecondarySelection ()) TextBuffer orig impl where
    runOp _ _ text_buffer text = withRef text_buffer $ \text_bufferPtr -> replaceSecondarySelection' text_bufferPtr text
 {# fun Fl_Text_Buffer_set_highlight as setHighlight' { id `Ptr ()',`Int',`Int' } -> `()' #}
 instance ( impl ~ ( BufferRange ->  IO ())) => Op (SetHighlight ()) TextBuffer orig impl where
@@ -210,8 +211,8 @@
    runOp _ _ text_buffer =
      withRef text_buffer $ \text_bufferPtr ->
      statusToBufferRange (highlightPosition' text_bufferPtr)
-{# fun Fl_Text_Buffer_highlight_text as highlightText' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance ( impl ~ (  IO (String))) => Op (HighlightText ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_highlight_text as highlightText' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance ( impl ~ (  IO T.Text)) => Op (HighlightText ()) TextBuffer orig impl where
    runOp _ _ text_buffer = withRef text_buffer $ \text_bufferPtr -> highlightText' text_bufferPtr
 {# fun Fl_Text_Buffer_add_modify_callback as addModifyCallback' { id `Ptr ()',id `FunPtr TextModifyCbPrim',id `Ptr ()' } -> `()' #}
 instance (impl ~ (TextModifyCb -> IO (FunPtr ()))) => Op (AddModifyCallback ()) TextBuffer orig impl where
@@ -305,8 +306,8 @@
      if (status' == 0)
        then return (Left NotFound)
        else peekIntConv intPtr >>= return . Right . BufferOffset
-{# fun Fl_Text_Buffer_search_forward_with_matchcase as searchForwardWithMatchcase' { id `Ptr ()',`Int', unsafeToCString `String',id `Ptr CInt', cFromBool `Bool' } -> `Int' #}
-instance ( impl ~ (BufferOffset -> String -> Bool ->  IO (Either NotFound BufferOffset))) => Op (SearchForwardWithMatchcase ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_search_forward_with_matchcase as searchForwardWithMatchcase' { id `Ptr ()',`Int', unsafeToCString `T.Text',id `Ptr CInt', cFromBool `Bool' } -> `Int' #}
+instance ( impl ~ (BufferOffset -> T.Text -> Bool ->  IO (Either NotFound BufferOffset))) => Op (SearchForwardWithMatchcase ()) TextBuffer orig impl where
   runOp _ _ text_buffer (BufferOffset startpos) searchstring matchcase =
      withRef text_buffer $ \text_bufferPtr ->
      alloca $ \intPtr -> do
@@ -314,8 +315,8 @@
      if (status' == 0)
        then return (Left NotFound)
        else peekIntConv intPtr >>= return .  Right . BufferOffset
-{# fun Fl_Text_Buffer_search_backward_with_matchcase as searchBackwardWithMatchcase' { id `Ptr ()',`Int', unsafeToCString `String',id `Ptr CInt', cFromBool `Bool' } -> `Int' #}
-instance ( impl ~ (BufferOffset -> String -> Bool ->  IO (Either NotFound BufferOffset))) => Op (SearchBackwardWithMatchcase ()) TextBuffer orig impl where
+{# fun Fl_Text_Buffer_search_backward_with_matchcase as searchBackwardWithMatchcase' { id `Ptr ()',`Int', unsafeToCString `T.Text',id `Ptr CInt', cFromBool `Bool' } -> `Int' #}
+instance ( impl ~ (BufferOffset -> T.Text -> Bool ->  IO (Either NotFound BufferOffset))) => Op (SearchBackwardWithMatchcase ()) TextBuffer orig impl where
   runOp _ _ text_buffer (BufferOffset startpos) searchstring matchcase =
      withRef text_buffer $ \text_bufferPtr ->
      alloca $ \intPtr -> do
@@ -368,11 +369,11 @@
 --
 -- addPredeleteCallback :: 'Ref' 'TextBuffer' -> 'TextPredeleteCb' -> 'IO' ('FunPtr' ())
 --
--- appendToBuffer :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ()
+-- appendToBuffer :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ()
 --
--- appendfile :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ('Either' 'DataProcessingError' ())
+-- appendfile :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- appendfileWithBuflen :: 'Ref' 'TextBuffer' -> 'String' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
+-- appendfileWithBuflen :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
 --
 -- byteAt :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'IO' 'Char'
 --
@@ -392,7 +393,7 @@
 --
 -- destroy :: 'Ref' 'TextBuffer' -> 'IO' ()
 --
--- fileEncodingWarningMessage :: 'Ref' 'TextBuffer' -> 'IO' ('String')
+-- fileEncodingWarningMessage :: 'Ref' 'TextBuffer' -> 'IO' 'T.Text'
 --
 -- findcharBackward :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'Char' -> 'IO' ('Either' 'NotFound' 'BufferOffset')
 --
@@ -404,21 +405,21 @@
 --
 -- getTabDistance :: 'Ref' 'TextBuffer' -> 'IO' ('Int')
 --
--- getText :: 'Ref' 'TextBuffer' -> 'IO' ('String')
+-- getText :: 'Ref' 'TextBuffer' -> 'IO' 'T.Text'
 --
 -- highlightPosition :: 'Ref' 'TextBuffer' -> 'IO' ('Maybe' 'BufferRange')
 --
 -- highlightSelection :: 'Ref' 'TextBuffer' -> 'IO' ('Maybe' ('Ref' 'TextSelection'))
 --
--- highlightText :: 'Ref' 'TextBuffer' -> 'IO' ('String')
+-- highlightText :: 'Ref' 'TextBuffer' -> 'IO' 'T.Text'
 --
 -- inputFileWasTranscoded :: 'Ref' 'TextBuffer' -> 'IO' ('Bool')
 --
--- insert :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'String' -> 'IO' ()
+-- insert :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'T.Text' -> 'IO' ()
 --
--- insertfile :: 'Ref' 'TextBuffer' -> 'String' -> 'BufferOffset' -> 'IO' ('Either' 'DataProcessingError' ())
+-- insertfile :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'BufferOffset' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- insertfileWithBuflen :: 'Ref' 'TextBuffer' -> 'String' -> 'BufferOffset' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
+-- insertfileWithBuflen :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'BufferOffset' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
 --
 -- lineEnd :: 'Ref' 'TextBuffer' -> 'Int' -> 'IO' ('Either' 'OutOfRange' 'BufferOffset')
 --
@@ -426,17 +427,17 @@
 --
 -- lineText :: 'Ref' 'TextBuffer' -> 'Int' -> 'IO' ('Either' 'OutOfRange' 'String')
 --
--- loadfile :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ('Either' 'DataProcessingError' ())
+-- loadfile :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- loadfileWithBuflen :: 'Ref' 'TextBuffer' -> 'String' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
+-- loadfileWithBuflen :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
 --
 -- nextChar :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'IO' 'BufferOffset'
 --
 -- nextCharClipped :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'IO' ('BufferOffset')
 --
--- outputfile :: 'Ref' 'TextBuffer' -> 'String' -> 'BufferRange' -> 'IO' ('Either' 'DataProcessingError' ())
+-- outputfile :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'BufferRange' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- outputfileWithBuflen :: 'Ref' 'TextBuffer' -> 'String' -> 'BufferRange' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
+-- outputfileWithBuflen :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'BufferRange' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
 --
 -- prevChar :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'IO' ('Either' 'OutOfRange' 'BufferOffset')
 --
@@ -454,21 +455,21 @@
 --
 -- removeSelection :: 'Ref' 'TextBuffer' -> 'IO' ()
 --
--- replace :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'String' -> 'IO' ()
+-- replace :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'T.Text' -> 'IO' ()
 --
--- replaceSecondarySelection :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ()
+-- replaceSecondarySelection :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ()
 --
--- replaceSelection :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ()
+-- replaceSelection :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ()
 --
 -- rewindLines :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'Int' -> 'IO' ('Int')
 --
--- savefile :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ('Either' 'DataProcessingError' ())
+-- savefile :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- savefileWithBuflen :: 'Ref' 'TextBuffer' -> 'String' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
+-- savefileWithBuflen :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'Int' -> 'IO' ('Either' 'DataProcessingError' ())
 --
--- searchBackwardWithMatchcase :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'String' -> 'Bool' -> 'IO' ('Either' 'NotFound' 'BufferOffset')
+-- searchBackwardWithMatchcase :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'T.Text' -> 'Bool' -> 'IO' ('Either' 'NotFound' 'BufferOffset')
 --
--- searchForwardWithMatchcase :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'String' -> 'Bool' -> 'IO' ('Either' 'NotFound' 'BufferOffset')
+-- searchForwardWithMatchcase :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'T.Text' -> 'Bool' -> 'IO' ('Either' 'NotFound' 'BufferOffset')
 --
 -- secondarySelect :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'IO' ()
 --
@@ -478,7 +479,7 @@
 --
 -- secondarySelectionPosition :: 'Ref' 'TextBuffer' -> 'IO' 'BufferRange'
 --
--- secondarySelectionText :: 'Ref' 'TextBuffer' -> 'IO' ('String')
+-- secondarySelectionText :: 'Ref' 'TextBuffer' -> 'IO' 'T.Text'
 --
 -- secondaryUnselect :: 'Ref' 'TextBuffer' -> 'IO' ()
 --
@@ -488,19 +489,19 @@
 --
 -- selectionPosition :: 'Ref' 'TextBuffer' -> 'IO' ('BufferRange')
 --
--- selectionText :: 'Ref' 'TextBuffer' -> 'IO' ('String')
+-- selectionText :: 'Ref' 'TextBuffer' -> 'IO' 'T.Text'
 --
 -- setHighlight :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'IO' ()
 --
 -- setTabDistance :: 'Ref' 'TextBuffer' -> 'Int' -> 'IO' ()
 --
--- setText :: 'Ref' 'TextBuffer' -> 'String' -> 'IO' ()
+-- setText :: 'Ref' 'TextBuffer' -> 'T.Text' -> 'IO' ()
 --
 -- skipDisplayedCharacters :: 'Ref' 'TextBuffer' -> 'BufferOffset'>- 'Int' -> 'IO' ('BufferOffset')
 --
 -- skipLines :: 'Ref' 'TextBuffer' -> 'BufferOffset' -> 'Int' -> 'IO' ('BufferOffset')
 --
--- textRange :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'IO' ('String')
+-- textRange :: 'Ref' 'TextBuffer' -> 'BufferRange' -> 'IO' 'T.Text'
 --
 -- undo :: 'Ref' 'TextBuffer' -> 'IO' ('Either' 'NoChange' 'BufferOffset')
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs b/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs
@@ -25,6 +25,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import qualified Foreign.ForeignPtr.Unsafe as Unsafe
 
 mkStyleTableEntriesPtr :: (Parent a TextDisplay) => Ref a -> [StyleTableEntry] -> IO (ForeignPtr [StyleTableEntry])
@@ -52,8 +53,8 @@
 indexStyleTableEntries = zip ['A'..]
 
 {# fun Fl_Text_Display_New as textDisplayNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Text_Display_New_WithLabel as textDisplayNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-textDisplayNew :: Rectangle -> Maybe String -> IO (Ref TextDisplay)
+{# fun Fl_Text_Display_New_WithLabel as textDisplayNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+textDisplayNew :: Rectangle -> Maybe T.Text -> IO (Ref TextDisplay)
 textDisplayNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -72,8 +73,8 @@
     let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
     resize' text_displayPtr x_pos y_pos w_pos h_pos
 {# fun Fl_Text_Display_handle as handle' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (Handle ()) TextDisplay orig impl where
-   runOp _ _ text_display e = withRef text_display $ \text_displayPtr -> handle' text_displayPtr (fromEnum e)
+instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) TextDisplay orig impl where
+   runOp _ _ text_display e = withRef text_display $ \text_displayPtr -> handle' text_displayPtr (fromEnum e) >>= return  . successOrUnknownEvent
 {# fun Fl_Text_Display_set_buffer as setBuffer' { id `Ptr ()',id `Ptr ()' } -> `()' #}
 instance (Parent a TextBuffer, impl ~ (Maybe ( Ref a ) ->  IO ())) => Op (SetBuffer ()) TextDisplay orig impl where
    runOp _ _ text_display buf = withRef text_display $ \text_displayPtr -> withMaybeRef buf $ \bufPtr -> setBuffer' text_displayPtr bufPtr
@@ -86,8 +87,8 @@
 {# fun Fl_Text_Display_scroll as scroll' { id `Ptr ()',`Int',`Int' } -> `()' #}
 instance (impl ~ (Int -> BufferOffset ->  IO ())) => Op (Scroll ()) TextDisplay orig impl where
   runOp _ _ text_display toplinenum (BufferOffset  horizoffset) = withRef text_display $ \text_displayPtr -> scroll' text_displayPtr toplinenum horizoffset
-{# fun Fl_Text_Display_overstrike as overstrike' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (Overstrike ()) TextDisplay orig impl where
+{# fun Fl_Text_Display_overstrike as overstrike' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (Overstrike ()) TextDisplay orig impl where
    runOp _ _ text_display text = withRef text_display $ \text_displayPtr -> overstrike' text_displayPtr text
 {# fun Fl_Text_Display_set_insert_position as setInsertPosition' { id `Ptr ()',`Int' } -> `()' #}
 instance (impl ~ (BufferOffset ->  IO ())) => Op (SetInsertPosition ()) TextDisplay orig impl where
@@ -269,11 +270,11 @@
 {# fun linenumber_align as linenumberAlign' { id `Ptr ()' } -> `AlignType' cToEnum #}
 instance (impl ~ ( IO (AlignType))) => Op (GetLinenumberAlign ()) TextDisplay orig impl where
    runOp _ _ text_display = withRef text_display $ \text_displayPtr -> linenumberAlign' text_displayPtr
-{# fun set_linenumber_format as setLinenumberFormat' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ())) => Op (SetLinenumberFormat ()) TextDisplay orig impl where
+{# fun set_linenumber_format as setLinenumberFormat' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetLinenumberFormat ()) TextDisplay orig impl where
    runOp _ _ text_display val = withRef text_display $ \text_displayPtr -> setLinenumberFormat' text_displayPtr val
-{# fun linenumber_format as linenumberFormat' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetLinenumberFormat ()) TextDisplay orig impl where
+{# fun linenumber_format as linenumberFormat' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig impl where
    runOp _ _ text_display = withRef text_display $ \text_displayPtr -> linenumberFormat' text_displayPtr
 
 -- $hierarchy
@@ -303,7 +304,7 @@
 --
 -- getLinenumberFont :: 'Ref' 'TextDisplay' -> 'IO' ('Font')
 --
--- getLinenumberFormat :: 'Ref' 'TextDisplay' -> 'IO' ('String')
+-- getLinenumberFormat :: 'Ref' 'TextDisplay' -> 'IO' 'T.Text'
 --
 -- getLinenumberSize :: 'Ref' 'TextDisplay' -> 'IO' ('FontSize')
 --
@@ -341,7 +342,7 @@
 --
 -- nextWord :: 'Ref' 'TextDisplay' -> 'IO' ()
 --
--- overstrike :: 'Ref' 'TextDisplay' -> 'String' -> 'IO' ()
+-- overstrike :: 'Ref' 'TextDisplay' -> 'T.Text' -> 'IO' ()
 --
 -- positionStyle :: 'Ref' 'TextDisplay' -> 'BufferOffset' -> 'Int' -> 'Int' -> 'IO' 'TextDisplayStyle'
 --
@@ -373,7 +374,7 @@
 --
 -- setLinenumberFont :: 'Ref' 'TextDisplay' -> 'Font' -> 'IO' ()
 --
--- setLinenumberFormat :: 'Ref' 'TextDisplay' -> 'String' -> 'IO' ()
+-- setLinenumberFormat :: 'Ref' 'TextDisplay' -> 'T.Text' -> 'IO' ()
 --
 -- setLinenumberSize :: 'Ref' 'TextDisplay' -> 'FontSize' -> 'IO' ()
 --
@@ -386,6 +387,8 @@
 -- setShortcut :: 'Ref' 'TextDisplay' -> 'ShortcutKeySequence' -> 'IO' ()
 --
 -- setTextcolor :: 'Ref' 'TextDisplay' -> 'Color' -> 'IO' ()
+--
+-- setTextfont :: 'Ref' 'TextDisplay' -> 'Font' -> 'IO' ()
 --
 -- setTextsize :: 'Ref' 'TextDisplay' -> 'FontSize' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs b/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs
@@ -28,6 +28,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Utils
 import Data.List
 
@@ -104,8 +105,8 @@
       go (accum ++ [currKb]) next'
 
 {# fun Fl_Text_Editor_New as textEditorNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Text_Editor_New_WithLabel as textEditorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-textEditorNew :: Rectangle -> Maybe String -> IO (Ref TextEditor)
+{# fun Fl_Text_Editor_New_WithLabel as textEditorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+textEditorNew :: Rectangle -> Maybe T.Text -> IO (Ref TextEditor)
 textEditorNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -113,8 +114,8 @@
         Just l -> textEditorNewWithLabel' x_pos y_pos width height l >>= toRef
 
 {# fun Fl_Text_Editor_handle as handle' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (Handle ()) TextEditor orig impl where
-   runOp _ _ text_editor e = withRef text_editor $ \text_editorPtr -> handle' text_editorPtr (fromEnum e)
+instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) TextEditor orig impl where
+   runOp _ _ text_editor e = withRef text_editor $ \text_editorPtr -> handle' text_editorPtr (fromEnum e) >>= return  . successOrUnknownEvent
 {# fun Fl_Text_Editor_Destroy as textEditorDestroy' { id `Ptr ()' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (IO ())) => Op (Destroy ()) TextEditor orig impl where
   runOp _ _ editor = swapRef editor $ \editorPtr -> do
@@ -161,7 +162,7 @@
 --
 -- getInsertMode :: 'Ref' 'TextEditor' -> 'IO' 'Bool'
 --
--- handle :: 'Ref' 'TextEditor' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'TextEditor' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- replaceKeyBindings :: 'Ref' 'TextEditor' -> ['KeyBinding'] -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Tile.chs b/src/Graphics/UI/FLTK/LowLevel/Tile.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Tile.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Tile.chs
@@ -24,10 +24,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Tile_New as tileNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Tile_New_WithLabel as tileNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-tileNew :: Rectangle -> Maybe String -> IO (Ref Tile)
+{# fun Fl_Tile_New_WithLabel as tileNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+tileNew :: Rectangle -> Maybe T.Text -> IO (Ref Tile)
 tileNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -49,12 +50,12 @@
     setPosition' tilePtr x_pos y_pos w_pos h_pos
 
 {#fun Fl_Tile_handle as tileHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Tile orig impl where
-  runOp _ _ tile event = withRef tile (\p -> tileHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tile orig impl where
+  runOp _ _ tile event = withRef tile (\p -> tileHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 -- $functions
 -- @
--- handle :: 'Ref' 'Tile' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Tile' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- resize :: 'Ref' 'Tile' -> 'Rectangle' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Timer.chs b/src/Graphics/UI/FLTK/LowLevel/Timer.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Timer.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Timer.chs
@@ -25,21 +25,22 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
-{# fun Fl_Timer_New as timerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-timerNew :: Rectangle -> String -> IO (Ref Timer)
+{# fun Fl_Timer_New as timerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+timerNew :: Rectangle -> T.Text -> IO (Ref Timer)
 timerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in timerNewWithLabel' x_pos y_pos width height l' >>= toRef
-{# fun Fl_Value_Timer_New as valueTimerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-valueTimerNew :: Rectangle -> String -> IO (Ref ValueTimer)
+{# fun Fl_Value_Timer_New as valueTimerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+valueTimerNew :: Rectangle -> T.Text -> IO (Ref ValueTimer)
 valueTimerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in
     valueTimerNewWithLabel' x_pos y_pos width height l' >>= toRef
 
-{# fun Fl_Hidden_Timer_New as hiddenTimerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-hiddenTimerNew :: Rectangle -> String -> IO (Ref HiddenTimer)
+{# fun Fl_Hidden_Timer_New as hiddenTimerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+hiddenTimerNew :: Rectangle -> T.Text -> IO (Ref HiddenTimer)
 hiddenTimerNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in
@@ -51,8 +52,8 @@
                                         timerDestroy' winPtr
                                         return nullPtr
 {#fun Fl_Timer_handle as timerHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Timer orig impl where
-  runOp _ _ timer event = withRef timer (\p -> timerHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Timer orig impl where
+  runOp _ _ timer event = withRef timer (\p -> timerHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Timer_direction as direction' { id `Ptr ()' } -> `CChar' id #}
 instance (impl ~ ( IO (CountDirection))) => Op (GetDirection ()) Timer orig impl where
   runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> direction' adjusterPtr >>= return . ccharToCountDirection
@@ -83,7 +84,7 @@
 --
 -- getValue :: 'Ref' 'Timer' -> 'IO' 'Double'
 --
--- handle :: 'Ref' 'Timer' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Timer' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setDirection :: 'Ref' 'Timer' -> 'CountDirection' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/ToggleButton.chs b/src/Graphics/UI/FLTK/LowLevel/ToggleButton.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ToggleButton.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ToggleButton.chs
@@ -22,10 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Toggle_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Toggle_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-toggleButtonNew :: Rectangle -> Maybe String -> IO (Ref ToggleButton)
+{# fun Fl_Toggle_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+toggleButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref ToggleButton)
 toggleButtonNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/Tree.chs b/src/Graphics/UI/FLTK/LowLevel/Tree.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Tree.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Tree.chs
@@ -22,11 +22,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
-import qualified Data.ByteString.Char8 as C
+import qualified Data.Text as T
 
 {# fun Fl_Tree_New as treeNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Tree_New_WithLabel as treeNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-treeNew :: Rectangle -> Maybe String -> IO (Ref Tree)
+{# fun Fl_Tree_New_WithLabel as treeNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+treeNew :: Rectangle -> Maybe T.Text -> IO (Ref Tree)
 treeNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -41,34 +41,34 @@
     return nullPtr
 
 {# fun Fl_Tree_handle as handle' { id `Ptr ()', cFromEnum `Event' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int)) ) => Op (Handle ()) Tree orig impl where
-  runOp _ _ tree e = withRef tree $ \treePtr -> handle' treePtr e
+instance (impl ~ (Event ->  IO (Either UnknownEvent ())) ) => Op (Handle ()) Tree orig impl where
+  runOp _ _ tree e = withRef tree $ \treePtr -> handle' treePtr e >>= return  . successOrUnknownEvent
 {# fun Fl_Tree_draw as draw' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ()) ) => Op (Draw ()) Tree orig impl where
   runOp _ _ tree = withRef tree $ \treePtr -> draw' treePtr
 {# fun Fl_Tree_show_self as showSelf' { id `Ptr ()' } -> `()' #}
 instance (impl ~ ( IO ()) ) => Op (ShowSelf ()) Tree orig impl where
   runOp _ _ tree = withRef tree $ \treePtr -> showSelf' treePtr
-{# fun Fl_Tree_root_label as rootLabel' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (String ->  IO ()) ) => Op (RootLabel ()) Tree orig impl where
+{# fun Fl_Tree_root_label as rootLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (T.Text ->  IO ()) ) => Op (RootLabel ()) Tree orig impl where
   runOp _ _ tree new_label = withRef tree $ \treePtr -> rootLabel' treePtr new_label
 {# fun Fl_Tree_root as root' { id `Ptr ()' } -> `Ptr ()' id #}
 instance (impl ~ ( IO (Maybe (Ref TreeItem))) ) => Op (Root ()) Tree orig impl where
   runOp _ _  tree = withRef tree $ \treePtr -> root' treePtr >>= toMaybeRef
-{# fun Fl_Tree_add as add' { id `Ptr ()',unsafeToCString `String' } -> `Ptr ()' id #}
-{# fun Fl_Tree_add_with_item_name as addWithItemName' { id `Ptr ()',id `Ptr ()',unsafeToCString `String' } -> `Ptr ()' id #}
-instance (impl ~ (String ->  IO (Maybe (Ref TreeItem)))) => Op (Add ()) Tree orig impl where
+{# fun Fl_Tree_add as add' { id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}
+{# fun Fl_Tree_add_with_item_name as addWithItemName' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}
+instance (impl ~ (T.Text ->  IO (Maybe (Ref TreeItem)))) => Op (Add ()) Tree orig impl where
   runOp _ _  tree path' = withRef tree $ \treePtr -> add' treePtr path' >>= toMaybeRef
-instance (Parent a TreeItem, impl ~ (String -> Ref a -> IO (Maybe (Ref TreeItem)))) => Op (AddAt ()) Tree orig impl where
+instance (Parent a TreeItem, impl ~ (T.Text -> Ref a -> IO (Maybe (Ref TreeItem)))) => Op (AddAt ()) Tree orig impl where
   runOp _ _ tree path' item' =
     withRef tree  $ \treePtr ->
     withRef item' $ \itemPtr ->
     addWithItemName' treePtr itemPtr path' >>= toMaybeRef
-{# fun Fl_Tree_insert_above as insertAbove' { id `Ptr ()',id `Ptr ()',unsafeToCString `String' } -> `Ptr ()' id #}
-instance (Parent a TreeItem, impl ~ (Ref a -> String ->  IO (Maybe (Ref a)))) => Op (InsertAbove ()) Tree orig impl where
+{# fun Fl_Tree_insert_above as insertAbove' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}
+instance (Parent a TreeItem, impl ~ (Ref a -> T.Text ->  IO (Maybe (Ref a)))) => Op (InsertAbove ()) Tree orig impl where
   runOp _ _  tree above name = withRef tree $ \treePtr -> withRef above $ \abovePtr -> insertAbove' treePtr abovePtr name >>= toMaybeRef
-{# fun Fl_Tree_insert as insert' { id `Ptr ()',id `Ptr ()',unsafeToCString `String',`Int' } -> `Ptr ()' id #}
-instance (Parent a TreeItem, impl ~ (Ref a -> String -> Int ->  IO (Maybe (Ref a)))) => Op (Insert ()) Tree orig impl where
+{# fun Fl_Tree_insert as insert' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text',`Int' } -> `Ptr ()' id #}
+instance (Parent a TreeItem, impl ~ (Ref a -> T.Text -> Int ->  IO (Maybe (Ref a)))) => Op (Insert ()) Tree orig impl where
   runOp _ _ tree item name pos = withRef tree $ \treePtr -> withRef item $ \itemPtr -> insert' treePtr itemPtr name pos >>= toMaybeRef
 {# fun Fl_Tree_remove as remove' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 instance (impl ~ (Ref TreeItem  ->  IO (Either TreeItemNotFound ())) ) => Op (Remove ()) Tree orig impl where
@@ -81,11 +81,11 @@
 {# fun Fl_Tree_clear_children as clearChildren' { id `Ptr ()',id `Ptr ()' } -> `()' #}
 instance (Parent a TreeItem, impl ~ (Ref a ->  IO ()) ) => Op (ClearChildren ()) Tree orig impl where
   runOp _ _ tree item = withRef tree $ \treePtr -> withRef item $ \itemPtr -> clearChildren' treePtr itemPtr
-{# fun Fl_Tree_find_item as findItem' { id `Ptr ()',unsafeToCString `String' } -> `Ptr ()' id #}
-instance (impl ~ (String ->  IO (Maybe (Ref TreeItem))) ) => Op (FindItem ()) Tree orig impl where
+{# fun Fl_Tree_find_item as findItem' { id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}
+instance (impl ~ (T.Text ->  IO (Maybe (Ref TreeItem))) ) => Op (FindItem ()) Tree orig impl where
   runOp _ _ tree path = withRef tree $ \treePtr -> findItem' treePtr path >>= toMaybeRef
 {# fun Fl_Tree_item_pathname as itemPathname' { id `Ptr ()', id `Ptr CChar', `Int', id `Ptr ()'} -> `Int' #}
-instance (Parent a TreeItem, impl ~ (Ref a ->  IO (Maybe String)) ) => Op (ItemPathname ()) Tree orig impl where
+instance (Parent a TreeItem, impl ~ (Ref a ->  IO (Maybe T.Text)) ) => Op (ItemPathname ()) Tree orig impl where
   runOp _ _ tree item =
     withRef tree $ \treePtr ->
     withRef item $ \itemPtr ->
@@ -94,8 +94,8 @@
     if retVal' < 0
       then return Nothing
       else do
-       b' <- C.packCString (castPtr pathPtr)
-       return $ Just (C.unpack b')
+       b' <- cStringToText (castPtr pathPtr)
+       return (Just b')
 {# fun Fl_Tree_item_clicked as itemClicked' { id `Ptr ()' } -> `Ptr ()' id #}
 instance (impl ~ ( IO (Maybe (Ref TreeItem))) ) => Op (ItemClicked ()) Tree orig impl where
   runOp _ _ tree = withRef tree $ \treePtr -> itemClicked' treePtr >>= toMaybeRef
@@ -142,8 +142,8 @@
   runOp _ _ tree item dir = withRef tree $ \treePtr -> withRef item $ \itemPtr -> nextSelectedItemWithItemDirection' treePtr itemPtr (maybe 0 (fromIntegral . fromEnum) dir) >>= toMaybeRef
 {# fun Fl_Tree_open_with_item as openWithItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 {# fun Fl_Tree_open_with_item_docallback as openWithItemDocallback' { id `Ptr ()',id `Ptr ()', cFromBool `Bool' } -> `Int' #}
-{# fun Fl_Tree_open_with_path as openWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
-{# fun Fl_Tree_open_with_path_docallback as openWithPathDocallback' { id `Ptr ()', unsafeToCString `String', cFromBool `Bool' } -> `Int' #}
+{# fun Fl_Tree_open_with_path as openWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
+{# fun Fl_Tree_open_with_path_docallback as openWithPathDocallback' { id `Ptr ()', unsafeToCString `T.Text', cFromBool `Bool' } -> `Int' #}
 instance (impl ~ (TreeItemLocator -> IO ()) ) => Op (Open ()) Tree orig impl where
   runOp _ _ tree_item locator' =
     withRef tree_item $ \tree_itemPtr ->
@@ -164,8 +164,8 @@
   runOp _ _ tree item docallback = withRef tree $ \treePtr -> withRef item $ \itemPtr -> openToggleWithDocallback' treePtr itemPtr docallback
 {# fun Fl_Tree_close_with_item as closeWithItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 {# fun Fl_Tree_close_with_item_docallback as closeWithItemDocallback' { id `Ptr ()',id `Ptr ()', cFromBool `Bool' } -> `Int' #}
-{# fun Fl_Tree_close_with_path as closeWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
-{# fun Fl_Tree_close_with_path_docallback as closeWithPathDocallback' { id `Ptr ()',unsafeToCString `String', cFromBool `Bool' } -> `Int' #}
+{# fun Fl_Tree_close_with_path as closeWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
+{# fun Fl_Tree_close_with_path_docallback as closeWithPathDocallback' { id `Ptr ()',unsafeToCString `T.Text', cFromBool `Bool' } -> `Int' #}
 instance (impl ~ (TreeItemLocator -> IO ()) ) => Op (Close ()) Tree orig impl where
   runOp _ _ tree_item locator' =
     withRef tree_item $ \tree_itemPtr ->
@@ -179,7 +179,7 @@
       TreeItemPointerLocator (TreeItemPointer itemRef) -> withRef itemRef $ \itemRefPtr -> closeWithItemDocallback' tree_itemPtr itemRefPtr docallback' >> return ()
       TreeItemNameLocator (TreeItemName n') -> closeWithPathDocallback' tree_itemPtr n' docallback' >> return ()
 {# fun Fl_Tree_is_open_with_item as isOpenWithItem' { id `Ptr ()',id `Ptr ()' } -> `Bool' cToBool #}
-{# fun Fl_Tree_is_open_with_path as isOpenWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Bool' cToBool  #}
+{# fun Fl_Tree_is_open_with_path as isOpenWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Bool' cToBool  #}
 instance (impl ~ (TreeItemLocator ->  IO (Bool)) ) => Op (IsOpen ()) Tree orig impl where
   runOp _ _ tree locator' = withRef tree $ \treePtr ->
     case locator' of
@@ -187,7 +187,7 @@
       TreeItemNameLocator (TreeItemName n') ->
         isOpenWithPath' treePtr n'
 {# fun Fl_Tree_is_close_with_item as isCloseWithItem' { id `Ptr ()',id `Ptr ()' } -> `Bool' cToBool #}
-{# fun Fl_Tree_is_close_with_path as isCloseWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Bool' cToBool  #}
+{# fun Fl_Tree_is_close_with_path as isCloseWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Bool' cToBool  #}
 instance (impl ~ (TreeItemLocator ->  IO (Bool)) ) => Op (IsClose ()) Tree orig impl where
   runOp _ _ tree locator' = withRef tree $ \treePtr ->
     case locator' of
@@ -195,8 +195,8 @@
       TreeItemNameLocator (TreeItemName n') -> isCloseWithPath' treePtr n'
 {# fun Fl_Tree_select_with_item as selectWithItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 {# fun Fl_Tree_select_with_item_docallback as selectWithItemDocallback' { id `Ptr ()',id `Ptr ()',cFromBool `Bool' } -> `Int' #}
-{# fun Fl_Tree_select_with_path as selectWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
-{# fun Fl_Tree_select_with_path_docallback as selectWithPathDocallback' { id `Ptr ()',unsafeToCString `String',cFromBool `Bool' } -> `Int' #}
+{# fun Fl_Tree_select_with_path as selectWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
+{# fun Fl_Tree_select_with_path_docallback as selectWithPathDocallback' { id `Ptr ()',unsafeToCString `T.Text',cFromBool `Bool' } -> `Int' #}
 instance (impl ~ (TreeItemLocator  ->  IO (Int)) ) => Op (Select ()) Tree orig impl where
   runOp _ _ tree locator' =
     withRef tree $ \treePtr ->
@@ -217,8 +217,8 @@
   runOp _ _ tree item docallback = withRef tree $ \treePtr -> withRef item $ \itemPtr -> selectToggleWithDocallback' treePtr itemPtr docallback
 {# fun Fl_Tree_deselect_with_item as deselectWithItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 {# fun Fl_Tree_deselect_with_item_docallback as deselectWithItemDocallback' { id `Ptr ()',id `Ptr ()',cFromBool `Bool' } -> `Int' #}
-{# fun Fl_Tree_deselect_with_path as deselectWithPath' { id `Ptr ()', unsafeToCString `String'} -> `Int' #}
-{# fun Fl_Tree_deselect_with_path_docallback as deselectWithPathDocallback' { id `Ptr ()',unsafeToCString `String',cFromBool `Bool' } -> `Int' #}
+{# fun Fl_Tree_deselect_with_path as deselectWithPath' { id `Ptr ()', unsafeToCString `T.Text'} -> `Int' #}
+{# fun Fl_Tree_deselect_with_path_docallback as deselectWithPathDocallback' { id `Ptr ()',unsafeToCString `T.Text',cFromBool `Bool' } -> `Int' #}
 instance (impl ~ (TreeItemLocator  ->  IO (Int)) ) => Op (Deselect ()) Tree orig impl where
   runOp _ _ tree locator' =
     withRef tree $ \treePtr ->
@@ -256,7 +256,7 @@
 instance (impl ~ ( IO (Maybe (Ref TreeItem))) ) => Op (GetItemFocus ()) Tree orig impl where
   runOp _ _ tree = withRef tree $ \treePtr -> getItemFocus' treePtr >>= toMaybeRef
 {# fun Fl_Tree_is_selected_with_item as isSelectedWithItem' { id `Ptr ()',id `Ptr ()' } -> `Bool' cToBool #}
-{# fun Fl_Tree_is_selected_with_path as isSelectedWithPath' { id `Ptr ()',unsafeToCString `String' } -> `Bool' cToBool #}
+{# fun Fl_Tree_is_selected_with_path as isSelectedWithPath' { id `Ptr ()',unsafeToCString `T.Text' } -> `Bool' cToBool #}
 instance (impl ~ (TreeItemLocator ->  IO (Bool)) ) => Op (IsSelected ()) Tree orig impl where
   runOp _ _ tree locator' = withRef tree $ \treePtr ->
     case locator' of
@@ -445,9 +445,9 @@
 
 -- $functions
 -- @
--- add :: 'Ref' 'Tree' -> 'String' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- add :: 'Ref' 'Tree' -> 'T.Text' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- addAt:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'String' -> 'Ref' a -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- addAt:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'T.Text' -> 'Ref' a -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
 -- clear :: 'Ref' 'Tree' -> 'IO' ()
 --
@@ -473,7 +473,7 @@
 --
 -- draw :: 'Ref' 'Tree' -> 'IO' ()
 --
--- findItem :: 'Ref' 'Tree' -> 'String' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- findItem :: 'Ref' 'Tree' -> 'T.Text' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
 -- firstSelectedItem :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
@@ -535,9 +535,9 @@
 --
 -- handle :: 'Ref' 'Tree' -> 'Event' -> 'IO' ('Int')
 --
--- insert:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'String' -> 'Int' -> 'IO' ('Maybe' ('Ref' a))
+-- insert:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'T.Text' -> 'Int' -> 'IO' ('Maybe' ('Ref' a))
 --
--- insertAbove:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'String' -> 'IO' ('Maybe' ('Ref' a))
+-- insertAbove:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'T.Text' -> 'IO' ('Maybe' ('Ref' a))
 --
 -- isClose :: 'Ref' 'Tree' -> 'TreeItemLocator' -> 'IO' ('Bool')
 --
@@ -551,7 +551,7 @@
 --
 -- itemClicked :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- itemPathname:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'IO' ('Maybe' 'String')
+-- itemPathname:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'IO' ('Maybe' 'T.Text')
 --
 -- lastSelectedItem :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
@@ -583,7 +583,7 @@
 --
 -- root :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- rootLabel :: 'Ref' 'Tree' -> 'String' -> 'IO' ()
+-- rootLabel :: 'Ref' 'Tree' -> 'T.Text' -> 'IO' ()
 --
 -- select :: 'Ref' 'Tree' -> 'TreeItemLocator' -> 'IO' ('Int')
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/TreeItem.chs b/src/Graphics/UI/FLTK/LowLevel/TreeItem.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TreeItem.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TreeItem.chs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
+{-# LANGUAGE OverloadedStrings, CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 module Graphics.UI.FLTK.LowLevel.TreeItem
   (
@@ -34,10 +34,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 newtype TreeItemIndex = TreeItemIndex Int
 data TreeItemPointer = forall a. (Parent a TreeItem) => TreeItemPointer (Ref a)
-newtype TreeItemName = TreeItemName String
+newtype TreeItemName = TreeItemName T.Text
 data TreeItemReference = TreeItemByIndex TreeItemIndex | TreeItemByPointer TreeItemPointer
 data TreeItemLocator = TreeItemPointerLocator TreeItemPointer | TreeItemNameLocator TreeItemName
 data MoveError = NoParent | NoIndexFound | IndexRangeError | CouldNotDeparent | CouldNotReparent
@@ -75,16 +76,16 @@
 {# fun Fl_Tree_Item_h as h' { id `Ptr ()' } -> `Int' #}
 instance (impl ~ IO Int) => Op (GetH ()) TreeItem orig impl where
   runOp _ _ tree_item = withRef tree_item $ \tree_itemPtr -> h' tree_itemPtr
-{# fun Fl_Tree_Item_show_self_with_indent as showSelfWithIndent' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ (Maybe String -> IO ())) => Op (ShowSelf ()) TreeItem orig impl where
+{# fun Fl_Tree_Item_show_self_with_indent as showSelfWithIndent' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ (Maybe T.Text -> IO ())) => Op (ShowSelf ()) TreeItem orig impl where
   runOp _ _ tree_item indent = case indent of
     Just s' -> withRef tree_item $ \tree_itemPtr -> showSelfWithIndent' tree_itemPtr s'
     Nothing -> withRef tree_item $ \tree_itemPtr -> showSelfWithIndent' tree_itemPtr ""
-{# fun Fl_Tree_Item_set_label as setLabel' { id `Ptr ()',unsafeToCString `String' } -> `()' #}
-instance (impl ~ ( String ->  IO ())) => Op (SetLabel ()) TreeItem orig impl where
+{# fun Fl_Tree_Item_set_label as setLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}
+instance (impl ~ ( T.Text ->  IO ())) => Op (SetLabel ()) TreeItem orig impl where
   runOp _ _ tree_item val = withRef tree_item $ \tree_itemPtr -> setLabel' tree_itemPtr val
-{# fun Fl_Tree_Item_label as label' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ (IO (String))) => Op (GetLabel ()) TreeItem orig impl where
+{# fun Fl_Tree_Item_label as label' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (IO T.Text)) => Op (GetLabel ()) TreeItem orig impl where
   runOp _ _ tree_item = withRef tree_item $ \tree_itemPtr -> label' tree_itemPtr
 {# fun Fl_Tree_Item_set_labelfont as setLabelfont' { id `Ptr ()',cFromFont `Font' } -> `()' #}
 instance (impl ~ ( Font ->  IO ())) => Op (SetLabelfont ()) TreeItem orig impl where
@@ -132,7 +133,7 @@
 instance (impl ~ (IO (Bool))) => Op (HasChildren ()) TreeItem orig impl where
   runOp _ _ tree_item = withRef tree_item $ \tree_itemPtr -> hasChildren' tree_itemPtr
 
-{# fun Fl_Tree_Item_find_child as findChild' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
+{# fun Fl_Tree_Item_find_child as findChild' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
 {# fun Fl_Tree_Item_find_child_by_item as findChildByItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
 instance (impl ~ ( TreeItemLocator ->  IO (Maybe TreeItemIndex))) => Op (FindChild ()) TreeItem orig impl where
   runOp _ _ tree_item locator' = withRef tree_item $ \tree_itemPtr -> do
@@ -142,7 +143,7 @@
     if idx' == -1 then return Nothing else (return $ Just (TreeItemIndex idx'))
 
 {# fun Fl_Tree_Item_remove_child_by_item as removeChildByItem' { id `Ptr ()',id `Ptr ()' } -> `Int' #}
-{# fun Fl_Tree_Item_remove_child as removeChild' { id `Ptr ()',unsafeToCString `String' } -> `Int' #}
+{# fun Fl_Tree_Item_remove_child as removeChild' { id `Ptr ()',unsafeToCString `T.Text' } -> `Int' #}
 instance (impl ~ ( TreeItemLocator ->  IO (Either UnknownError ()))) => Op (RemoveChild ()) TreeItem orig impl where
   runOp _ _ tree_item locator' = withRef tree_item $ \tree_itemPtr -> do
      status' <- case locator' of
@@ -161,16 +162,16 @@
     status' <- swapChildrenByTreeItem' tree_itemPtr aPtr bPtr
     if (status' == 0) then return (Left TreeItemNotFound) else return (Right ())
 {# fun Fl_Tree_Item_find_child_item as findChildItem' { id `Ptr ()',id `Ptr (Ptr CChar)' } -> `Ptr ()' id #}
-instance (impl ~ ([String] ->  IO (Maybe (Ref TreeItem)))) => Op (FindInChildren ()) TreeItem orig impl where
+instance (impl ~ ([T.Text] ->  IO (Maybe (Ref TreeItem)))) => Op (FindInChildren ()) TreeItem orig impl where
   runOp _ _ tree_item path_ = withRef tree_item $ \tree_itemPtr -> withStrings path_ $ \pathPtr -> findChildItem' tree_itemPtr (castPtr pathPtr) >>= toMaybeRef
 {# fun Fl_Tree_Item_find_item as findItem' { id `Ptr ()',id `Ptr (Ptr CChar)' } -> `Ptr ()' id #}
-instance (impl ~ ( [String] ->  IO (Maybe (Ref TreeItem)))) => Op (FindItem ()) TreeItem orig impl where
+instance (impl ~ ( [T.Text] ->  IO (Maybe (Ref TreeItem)))) => Op (FindItem ()) TreeItem orig impl where
   runOp _ _ tree_item path =
     withRef tree_item $ \tree_itemPtr ->
       withStrings path (\pathPtr -> findItem' tree_itemPtr (castPtr pathPtr) >>= toMaybeRef)
 {# fun Fl_Tree_Item_add_with as addWith' {id `Ptr ()', id `Ptr ()', id `Ptr CChar', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_Tree_Item_add_with_at as addWithAt' {id `Ptr ()', id `Ptr ()', id `Ptr ()' , id `Ptr (Ptr CChar)'} -> `Ptr ()' id #}
-{# fun Fl_Tree_Item_add as add' {id `Ptr ()', id `Ptr ()', unsafeToCString `String'} -> `Ptr ()' id #}
+{# fun Fl_Tree_Item_add as add' {id `Ptr ()', id `Ptr ()', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 {# fun Fl_Tree_Item_add_at as addAt' {id `Ptr ()', id `Ptr ()', id `Ptr (Ptr CChar)' } -> `Ptr ()' id #}
 instance (Parent a TreeItem, Parent b TreePrefs, impl ~ (Ref b  -> TreeItemLocator ->  IO (Maybe (Ref a)))) => Op (Add ()) TreeItem orig impl where
   runOp _ _ tree_item prefs arr =
@@ -178,23 +179,23 @@
       case arr of
         TreeItemNameLocator (TreeItemName n') -> add' tree_itemPtr prefsPtr n' >>= toMaybeRef
         TreeItemPointerLocator (TreeItemPointer p') -> withRef p' $ \p'Ptr -> addWith' tree_itemPtr prefsPtr (castPtr nullPtr) p'Ptr >>= toMaybeRef
-instance (Parent a TreeItem, Parent b TreePrefs, impl ~ (Ref b  ->  [String] -> Maybe (Ref a) -> IO (Maybe (Ref a)))) => Op (AddAt ()) TreeItem orig impl where
+instance (Parent a TreeItem, Parent b TreePrefs, impl ~ (Ref b  ->  [T.Text] -> Maybe (Ref a) -> IO (Maybe (Ref a)))) => Op (AddAt ()) TreeItem orig impl where
   runOp _ _ tree_item prefs path item' =
     withRef tree_item $ \tree_itemPtr -> withRef prefs $ \prefsPtr ->
     withStrings path $ \pathPtr ->
       case item' of
         Nothing -> addAt' tree_itemPtr prefsPtr (castPtr pathPtr) >>= toMaybeRef
         Just i' -> withRef i' $ \i'Ptr -> addWithAt' tree_itemPtr prefsPtr i'Ptr pathPtr >>= toMaybeRef
-{# fun Fl_Tree_Item_insert as insert' { id `Ptr ()',id `Ptr ()',unsafeToCString `String' } -> `Ptr ()' id #}
-{# fun Fl_Tree_Item_insert_with_pos as insertWithPos' { id `Ptr ()',id `Ptr ()',unsafeToCString `String',`Int' } -> `Ptr ()' id #}
-instance (Parent a TreePrefs, impl ~ (Ref a  -> String ->  Maybe Int -> IO (Maybe (Ref TreeItem)))) => Op (Insert ()) TreeItem orig impl where
+{# fun Fl_Tree_Item_insert as insert' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}
+{# fun Fl_Tree_Item_insert_with_pos as insertWithPos' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text',`Int' } -> `Ptr ()' id #}
+instance (Parent a TreePrefs, impl ~ (Ref a  -> T.Text ->  Maybe Int -> IO (Maybe (Ref TreeItem)))) => Op (Insert ()) TreeItem orig impl where
   runOp _ _ tree_item prefs new_label pos' =
     withRef tree_item $ \tree_itemPtr -> withRef prefs $ \prefsPtr ->
       case pos' of
         Nothing -> insert' tree_itemPtr prefsPtr new_label >>= toMaybeRef
         Just p' -> insertWithPos' tree_itemPtr prefsPtr new_label p' >>= toMaybeRef
-{# fun Fl_Tree_Item_insert_above as insertAbove' { id `Ptr ()',id `Ptr ()', unsafeToCString `String' } -> `Ptr ()' id #}
-instance (Parent a TreePrefs, impl ~ (Ref a -> String ->  IO (Maybe (Ref TreeItem)))) => Op (InsertAbove ()) TreeItem orig impl where
+{# fun Fl_Tree_Item_insert_above as insertAbove' { id `Ptr ()',id `Ptr ()', unsafeToCString `T.Text' } -> `Ptr ()' id #}
+instance (Parent a TreePrefs, impl ~ (Ref a -> T.Text ->  IO (Maybe (Ref TreeItem)))) => Op (InsertAbove ()) TreeItem orig impl where
   runOp _ _ tree_item prefs new_label =
     withRef tree_item $
     \tree_itemPtr ->
@@ -353,7 +354,7 @@
 --
 -- add:: ('Parent' a 'TreeItem', 'Parent' b 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' b -> 'TreeItemLocator' -> 'IO' ('Maybe' ('Ref' a))
 --
--- addAt:: ('Parent' a 'TreeItem', 'Parent' b 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' b -> ['String'] -> 'Maybe' ('Ref' a) -> 'IO' ('Maybe' ('Ref' a))
+-- addAt:: ('Parent' a 'TreeItem', 'Parent' b 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' b -> ['T.Text'] -> 'Maybe' ('Ref' a) -> 'IO' ('Maybe' ('Ref' a))
 --
 -- child :: 'Ref' 'TreeItem' -> 'Int' -> 'IO' ('Maybe' ('Ref' 'Widget'))
 --
@@ -379,15 +380,15 @@
 --
 -- findClicked:: ('Parent' a 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' a -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- findInChildren :: 'Ref' 'TreeItem' -> ['String'] -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- findInChildren :: 'Ref' 'TreeItem' -> ['T.Text'] -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- findItem :: 'Ref' 'TreeItem' -> ['String'] -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- findItem :: 'Ref' 'TreeItem' -> ['T.Text'] -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
 -- getDepth :: 'Ref' 'TreeItem' -> 'IO' ('Int')
 --
 -- getH :: 'Ref' 'TreeItem' -> 'IO' 'Int'
 --
--- getLabel :: 'Ref' 'TreeItem' -> 'IO' ('String')
+-- getLabel :: 'Ref' 'TreeItem' -> 'IO' 'T.Text'
 --
 -- getLabelbgcolor :: 'Ref' 'TreeItem' -> 'IO' ('Color')
 --
@@ -413,9 +414,9 @@
 --
 -- hasChildren :: 'Ref' 'TreeItem' -> 'IO' ('Bool')
 --
--- insert:: ('Parent' a 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' a -> 'String' -> 'Maybe' 'Int' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- insert:: ('Parent' a 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' a -> 'T.Text' -> 'Maybe' 'Int' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
--- insertAbove:: ('Parent' a 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' a -> 'String' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
+-- insertAbove:: ('Parent' a 'TreePrefs') => 'Ref' 'TreeItem' -> 'Ref' a -> 'T.Text' -> 'IO' ('Maybe' ('Ref' 'TreeItem'))
 --
 -- isActive :: 'Ref' 'TreeItem' -> 'IO' ('Bool')
 --
@@ -469,7 +470,7 @@
 --
 -- selectWithVal :: 'Ref' 'TreeItem' -> 'Int' -> 'IO' ()
 --
--- setLabel :: 'Ref' 'TreeItem' -> 'String' -> 'IO' ()
+-- setLabel :: 'Ref' 'TreeItem' -> 'T.Text' -> 'IO' ()
 --
 -- setLabelbgcolor :: 'Ref' 'TreeItem' -> 'Color' -> 'IO' ()
 --
@@ -487,7 +488,7 @@
 --
 -- setWidget:: ('Parent' a 'Widget') => 'Ref' 'TreeItem' -> 'Maybe' ( 'Ref' a ) -> 'IO' ()
 --
--- showSelf :: 'Ref' 'TreeItem' -> 'Maybe' 'String' -> 'IO' ()
+-- showSelf :: 'Ref' 'TreeItem' -> 'Maybe' 'T.Text' -> 'IO' ()
 --
 -- swapChildren :: 'Ref' 'TreeItem' -> 'Int' -> 'Int' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/TreePrefs.chs b/src/Graphics/UI/FLTK/LowLevel/TreePrefs.chs
--- a/src/Graphics/UI/FLTK/LowLevel/TreePrefs.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/TreePrefs.chs
diff --git a/src/Graphics/UI/FLTK/LowLevel/Utils.hs b/src/Graphics/UI/FLTK/LowLevel/Utils.hs
--- a/src/Graphics/UI/FLTK/LowLevel/Utils.hs
+++ b/src/Graphics/UI/FLTK/LowLevel/Utils.hs
@@ -1,14 +1,25 @@
+{-# LANGUAGE CPP, OverloadedStrings #-}
+#ifdef CALLSTACK_AVAILABLE
+{-# LANGUAGE ImplicitParams #-}
+#endif
+
 module Graphics.UI.FLTK.LowLevel.Utils where
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Data.List
+import qualified Data.Text.Foreign as TF
+import qualified Data.Text.Encoding as E
 import Foreign
 import qualified Foreign.Concurrent as FC
 import Foreign.C
-import qualified Data.ByteString.Char8 as C
 import qualified Data.ByteString as B
 import qualified System.IO.Unsafe as Unsafe
+import Debug.Trace
+#if defined(CALLSTACK_AVAILABLE) || defined(HASCALLSTACK_AVAILABLE)
+import GHC.Stack
+#endif
 
 foreign import ccall "wrapper"
         mkWidgetCallbackPtr :: CallbackWithUserDataPrim -> IO (FunPtr CallbackWithUserDataPrim)
@@ -123,7 +134,7 @@
 toDrawCallback :: DrawCallback -> IO (FunPtr DrawCallbackPrim)
 toDrawCallback f = mkDrawCallbackPrimPtr
                    (\string' length' x' y' -> do
-                      str' <- peekCStringLen (string', fromIntegral length')
+                      str' <- TF.peekCStringLen (string', fromIntegral length')
                       f str' (Position (X (fromIntegral x')) (Y (fromIntegral y'))))
 
 toBoxDrawF :: BoxDrawFPrim -> BoxDrawF
@@ -155,7 +166,7 @@
   mkTextModifyCb
     (
       \pos' nInserted' nDeleted' nRestyled' stringPtr _ ->
-       peekCString stringPtr >>=
+       cStringToText stringPtr >>=
        f (fromIntegral pos')
          (fromIntegral nInserted')
          (fromIntegral nDeleted')
@@ -248,17 +259,27 @@
 unsafeToMaybeRef :: Ptr () -> Maybe (Ref a)
 unsafeToMaybeRef = Unsafe.unsafePerformIO . toMaybeRef
 
-unsafeToCString :: String -> CString
-unsafeToCString s = Unsafe.unsafePerformIO (newCString s)
+unsafeToCString :: T.Text -> CString
+unsafeToCString t = Unsafe.unsafePerformIO (copyTextToCString t)
 
-unsafeFromCString :: CString -> String
-unsafeFromCString cstring =
-  Unsafe.unsafePerformIO (
-    if (cstring == nullPtr)
-    then return ""
-    else peekCString cstring >>= return
-    )
+unsafeFromCString :: CString -> T.Text
+unsafeFromCString cstring = Unsafe.unsafePerformIO (cStringToText cstring)
 
+#ifdef CALLSTACK_AVAILABLE
+cStringToText :: (?loc :: CallStack) => CString -> IO T.Text
+#elif HASCALLSTACK_AVAILABLE
+cStringToText :: (HasCallStack) => CString -> IO T.Text
+#else
+cStringToText :: CString -> IO T.Text
+#endif
+cStringToText cstring =
+    if (cstring == nullPtr) then return ""
+    else do
+      byteString <- B.packCString cstring
+      either (\e -> traceStack (show e) (error ""))
+             return
+             (E.decodeUtf8' byteString)
+
 toMaybeRef :: Ptr () -> IO (Maybe (Ref a))
 toMaybeRef ptr' = if ptr' == nullPtr then return Nothing else toRef ptr' >>= return . Just
 
@@ -297,12 +318,17 @@
   then Nothing
   else Just $ (MenuItemFlags . extract allMenuItemFlags . fromIntegral) flags'
 
+modesToInt :: Modes -> Int
+modesToInt (Modes ms) = combine ms
+intToModes :: Int -> Modes
+intToModes modeCode = Modes (extract allModes (fromIntegral modeCode))
+
 withByteStrings :: [B.ByteString] -> (Ptr (Ptr CChar) -> IO a) -> IO a
 withByteStrings bs f = B.useAsCString (foldl1 B.append bs) (\ptr -> new ptr >>= f)
 
 withPixmap :: PixmapHs -> ((Ptr (Ptr CChar)) -> IO a) -> IO a
 withPixmap (PixmapHs strings) f = do
-  cStrings <- sequence (map newCString strings)
+  cStrings <- sequence (map copyTextToCString strings)
   ptr <- newArray cStrings
   f ptr
 
@@ -312,14 +338,20 @@
      bitmap
      (\ptr -> f ptr width' height')
 
-withStrings :: [String] -> (Ptr (Ptr CChar) -> IO a) -> IO a
-withStrings ss f = withByteStrings (map C.pack ss) f
+withStrings :: [T.Text] -> (Ptr (Ptr CChar) -> IO a) -> IO a
+withStrings ss f = TF.withCStringLen (T.concat ss) (\(cstring,_) -> new cstring >>= f) -- withByteStrings (map C.pack ss) f
 
 copyByteStringToCString :: B.ByteString -> IO CString
 copyByteStringToCString bs =
   B.useAsCStringLen bs
     (\(cstring, len) -> do
-        dest <- mallocArray len
-        copyArray dest cstring len
+        dest <- mallocArray (len + 1)
+        copyArray dest cstring (len + 1)
         return dest
     )
+
+copyTextToCString :: T.Text -> IO CString
+copyTextToCString t =
+  let bs = E.encodeUtf8 t
+  in
+    copyByteStringToCString bs
diff --git a/src/Graphics/UI/FLTK/LowLevel/Valuator.chs b/src/Graphics/UI/FLTK/LowLevel/Valuator.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Valuator.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Valuator.chs
@@ -26,6 +26,7 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Widget
 import Data.Ratio
 #c
@@ -36,22 +37,20 @@
 #endc
 {#enum ValuatorType {} deriving (Show, Eq) #}
 {# fun Fl_Valuator_New as valuatorNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Valuator_New_WithLabel as valuatorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenValuator_New_WithLabel as overriddenValuatorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_Valuator_New_WithLabel as valuatorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenValuator_New_WithLabel as overriddenValuatorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenValuator_New as overriddenValuatorNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
-valuatorCustom :: Rectangle -> Maybe String -> Maybe (Ref Valuator -> IO ()) -> Maybe (CustomWidgetFuncs Valuator) -> IO (Ref Valuator)
+valuatorCustom :: Rectangle -> Maybe T.Text -> Maybe (Ref Valuator -> IO ()) -> Maybe (CustomWidgetFuncs Valuator) -> IO (Ref Valuator)
 valuatorCustom rectangle l' draw' funcs' =
   widgetMaker
     rectangle
     l'
     draw'
     funcs'
-    valuatorNew'
-    valuatorNewWithLabel'
     overriddenValuatorNew'
     overriddenValuatorNewWithLabel'
 
-valuatorNew :: Rectangle -> Maybe String -> IO (Ref Valuator)
+valuatorNew :: Rectangle -> Maybe T.Text -> IO (Ref Valuator)
 valuatorNew rectangle l' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -72,11 +71,11 @@
 instance (impl ~ (( IO ()))) => Op (HideSuper ()) Valuator orig impl where
   runOp _ _ button = withRef button $ \buttonPtr -> hideSuper' buttonPtr
 {#fun Fl_Valuator_handle as valuatorHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Valuator orig impl where
-  runOp _ _ valuator event = withRef valuator (\p -> valuatorHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Valuator orig impl where
+  runOp _ _ valuator event = withRef valuator (\p -> valuatorHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {#fun Fl_Valuator_handle_super as valuatorHandleSuper' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (HandleSuper ()) Valuator orig impl where
-  runOp _ _ valuator event = withRef valuator (\p -> valuatorHandleSuper' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Valuator orig impl where
+  runOp _ _ valuator event = withRef valuator (\p -> valuatorHandleSuper' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
 {# fun Fl_Valuator_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle ->  IO ())) => Op (ResizeSuper ()) Valuator orig impl where
   runOp _ _ valuator rectangle = withRef valuator $ \valuatorPtr -> do
@@ -120,8 +119,8 @@
 {# fun Fl_Valuator_set_value as setValue' { id `Ptr ()',`Double' } -> `Int' #}
 instance (impl ~ (Double ->  IO (Int))) => Op (SetValue ()) Valuator orig impl where
   runOp _ _ valuator v = withRef valuator $ \valuatorPtr -> setValue' valuatorPtr v
-{# fun Fl_Valuator_format as format' { id `Ptr ()', unsafeToCString `String' } -> `Int' #}
-instance (impl ~ (String ->  IO (Int))) => Op (SetFormat ()) Valuator orig impl where
+{# fun Fl_Valuator_format as format' { id `Ptr ()', unsafeToCString `T.Text' } -> `Int' #}
+instance (impl ~ (T.Text ->  IO (Int))) => Op (SetFormat ()) Valuator orig impl where
   runOp _ _ valuator f = withRef valuator $ \valuatorPtr -> format' valuatorPtr f
 {# fun Fl_Valuator_round as round' { id `Ptr ()',`Double' } -> `Double' #}
 instance (impl ~ (Double ->  IO (Double))) => Op (Round ()) Valuator orig impl where
@@ -157,9 +156,9 @@
 --
 -- getValue :: 'Ref' 'Valuator' -> 'IO' ('Double')
 --
--- handle :: 'Ref' 'Valuator' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Valuator' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
--- handleSuper :: 'Ref' 'Valuator' -> 'Event' -> 'IO' 'Int'
+-- handleSuper :: 'Ref' 'Valuator' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- hide :: 'Ref' 'Valuator' -> ( 'IO' ())
 --
@@ -177,7 +176,7 @@
 --
 -- round :: 'Ref' 'Valuator' -> 'Double' -> 'IO' ('Double')
 --
--- setFormat :: 'Ref' 'Valuator' -> 'String' -> 'IO' ('Int')
+-- setFormat :: 'Ref' 'Valuator' -> 'T.Text' -> 'IO' ('Int')
 --
 -- setMaximum :: 'Ref' 'Valuator' -> 'Double' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs b/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Value_Input_New as valueInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Value_Input_New_WithLabel as valueInputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-valueInputNew :: Rectangle -> Maybe String -> IO (Ref ValueInput)
+{# fun Fl_Value_Input_New_WithLabel as valueInputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+valueInputNew :: Rectangle -> Maybe T.Text -> IO (Ref ValueInput)
 valueInputNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -41,8 +42,8 @@
     valueInputDestroy' winPtr
     return nullPtr
 {#fun Fl_Value_Input_handle as valueInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) ValueInput orig impl where
-  runOp _ _ valueInput event = withRef valueInput (\p -> valueInputHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueInput orig impl where
+  runOp _ _ valueInput event = withRef valueInput (\p -> valueInputHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Value_Input_soft as soft' { id `Ptr ()' } -> `Bool' cToBool #}
 instance (impl ~ ( IO (Bool))) => Op (GetSoft ()) ValueInput orig impl where
   runOp _ _ value_input = withRef value_input $ \value_inputPtr -> soft' value_inputPtr
@@ -92,7 +93,7 @@
 --
 -- getTextsize :: 'Ref' 'ValueInput' -> 'IO' ('FontSize')
 --
--- handle :: 'Ref' 'ValueInput' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'ValueInput' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- resize :: 'Ref' 'ValueInput' -> 'Rectangle' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs b/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Value_Output_New as valueOutputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Value_Output_New_WithLabel as valueOutputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String'} -> `Ptr ()' id #}
-valueOutputNew :: Rectangle -> Maybe String -> IO (Ref ValueOutput)
+{# fun Fl_Value_Output_New_WithLabel as valueOutputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #}
+valueOutputNew :: Rectangle -> Maybe T.Text -> IO (Ref ValueOutput)
 valueOutputNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -42,8 +43,8 @@
     return nullPtr
 
 {#fun Fl_Value_Output_handle as valueOutputHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) ValueOutput orig impl where
-  runOp _ _ valueOutput event = withRef valueOutput (\p -> valueOutputHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueOutput orig impl where
+  runOp _ _ valueOutput event = withRef valueOutput (\p -> valueOutputHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Value_Output_soft as soft' { id `Ptr ()' } -> `Bool' cToBool #}
 instance (impl ~ ( IO (Bool))) => Op (GetSoft ()) ValueOutput orig impl where
   runOp _ _ value_input = withRef value_input $ \value_inputPtr -> soft' value_inputPtr
@@ -84,7 +85,7 @@
 --
 -- getTextsize :: 'Ref' 'ValueOutput' -> 'IO' ('FontSize')
 --
--- handle :: 'Ref' 'ValueOutput' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'ValueOutput' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- resize :: 'Ref' 'ValueOutput' -> 'Rectangle' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs b/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs
--- a/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs
@@ -23,10 +23,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Value_Slider_New as valueSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Value_Slider_New_WithLabel as valueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-valueSliderNew :: Rectangle -> Maybe String -> IO (Ref ValueSlider)
+{# fun Fl_Value_Slider_New_WithLabel as valueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+valueSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref ValueSlider)
 valueSliderNew rectangle l'=
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case l' of
@@ -34,7 +35,7 @@
         Just l -> valueSliderNewWithLabel' x_pos y_pos width height l >>= toRef
 
 -- {# fun Fl_Hor_Value_Slider_New as horValueSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
--- {# fun Fl_Hor_Value_Slider_New_WithLabel as horValueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
+-- {# fun Fl_Hor_Value_Slider_New_WithLabel as horValueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
 -- horValueSliderNew :: Rectangle -> Maybe String -> IO (HorValueSlider ())
 -- horValueSliderNew rectangle l'=
 --     let (x_pos, y_pos, width, height) = fromRectangle rectangle
@@ -48,8 +49,8 @@
     valueSliderDestroy' winPtr
     return nullPtr
 {#fun Fl_Value_Slider_handle as valueSliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) ValueSlider orig impl where
-  runOp _ _ valueSlider event = withRef valueSlider (\p -> valueSliderHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueSlider orig impl where
+  runOp _ _ valueSlider event = withRef valueSlider (\p -> valueSliderHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 {# fun Fl_Value_Slider_textfont as textfont' { id `Ptr ()' } -> `Font' cToFont #}
 instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) ValueSlider orig impl where
   runOp _ _ value_slider = withRef value_slider $ \value_sliderPtr -> textfont' value_sliderPtr
@@ -80,7 +81,7 @@
 --
 -- getTextsize :: 'Ref' 'ValueSlider' -> 'IO' 'FontSize'
 --
--- handle :: 'Ref' 'ValueSlider' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'ValueSlider' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- setTextcolor :: 'Ref' 'ValueSlider' -> 'Color' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Widget.chs b/src/Graphics/UI/FLTK/LowLevel/Widget.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Widget.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Widget.chs
@@ -28,6 +28,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Types
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 
 type RectangleFPrim              = Ptr () -> CInt -> CInt -> CInt -> CInt -> IO ()
@@ -48,7 +49,7 @@
   fptr <- wrapNonNull wPtr "Null Pointer. toRectangleFPrim"
   f (wrapInRef fptr) rectangle
 
-toEventHandlerPrim :: (Ref a -> Event -> IO Int) ->
+toEventHandlerPrim :: (Ref a -> Event -> IO (Either UnknownEvent ())) ->
                       IO (FunPtr (Ptr () -> CInt -> IO CInt))
 toEventHandlerPrim f = mkWidgetEventHandler $
                        \wPtr eventNumber ->
@@ -56,7 +57,7 @@
                             in do
                             fptr <- wrapNonNull wPtr "Null Pointer: toEventHandlerPrim"
                             result <- f (wrapInRef fptr) event
-                            return $ fromIntegral result
+                            return (either (\_ -> fromIntegral (0::CInt)) (const (fromIntegral (1::CInt))) result)
 
 -- | Overrideable 'Widget' functions
 -- | Do not create this directly. Instead use `defaultWidgetCustomFuncs`
@@ -64,7 +65,7 @@
     CustomWidgetFuncs
     {
      -- | See <http://www.fltk.org/doc-1.3/classFl__Widget.html#a9cb17cc092697dfd05a3fab55856d218 Fl_Widget::handle>
-    handleCustom :: Maybe (Ref a -> Event -> IO Int)
+    handleCustom :: Maybe (Ref a -> Event -> IO (Either UnknownEvent ()))
      -- | See <http://www.fltk.org/doc-1.3/classFl__Widget.html#aca98267e7a9b94f699ebd27d9f59e8bb Fl_Widget::resize>
     ,resizeCustom :: Maybe (Ref a -> Rectangle -> IO ())
      -- | See <http://www.fltk.org/doc-1.3/classFl__Widget.html#ab572c6fbc922bf3268b72cf9e2939606 Fl_Widget::show>
@@ -119,15 +120,13 @@
 -- Only of interest to 'Widget' contributors.
 widgetMaker :: forall a. (Parent a Widget) =>
                Rectangle                                                          -- ^ Position and size
-               -> Maybe String                                                    -- ^ Title
+               -> Maybe T.Text                                                    -- ^ Title
                -> Maybe (Ref a -> IO ())                                          -- ^ Custom drawing function
                -> Maybe (CustomWidgetFuncs a)                                     -- ^ Custom functions
-               -> (Int -> Int -> Int -> Int -> IO ( Ptr ()))                      -- ^ Foreign constructor to call if neither title nor custom functions are given
-               -> (Int -> Int -> Int -> Int -> String -> IO ( Ptr () ))           -- ^ Foreign constructor to call if only title is given
                -> (Int -> Int -> Int -> Int -> Ptr () -> IO ( Ptr () ))           -- ^ Foreign constructor to call if only custom functions are given
-               -> (Int -> Int -> Int -> Int -> String -> Ptr () -> IO ( Ptr () )) -- ^ Foreign constructor to call if both title and custom functions are given
+               -> (Int -> Int -> Int -> Int -> T.Text -> Ptr () -> IO ( Ptr () )) -- ^ Foreign constructor to call if both title and custom functions are given
                -> IO (Ref a)                                                      -- ^ Reference to the widget
-widgetMaker rectangle _label' draw' customFuncs' new' newWithLabel' newWithCustomFuncs' newWithCustomFuncsLabel' =
+widgetMaker rectangle _label' draw' customFuncs' newWithCustomFuncs' newWithCustomFuncsLabel' =
   do
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     ptr <- customWidgetFunctionStruct draw' (maybe defaultCustomWidgetFuncs id customFuncs')
@@ -136,13 +135,11 @@
                     _label'
     toRef widget
 
-{# fun Fl_Widget_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #}
-{# fun Fl_Widget_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenWidget_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenWidget_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenWidget_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 -- | Widget constructor.
 widgetCustom :: Rectangle                   -- ^ The bounds of this widget
-                -> Maybe String             -- ^ The widget label
+                -> Maybe T.Text             -- ^ The widget label
                 -> (Ref Widget -> IO ())    -- ^ Custom drawing function
                 -> CustomWidgetFuncs Widget -- ^ Other custom functions
                 -> IO (Ref Widget)
@@ -152,8 +149,6 @@
     l'
     (Just draw')
     (Just funcs')
-    widgetNew'
-    widgetNewWithLabel'
     overriddenWidgetNew'
     overriddenWidgetNewWithLabel'
 
@@ -164,8 +159,8 @@
     return nullPtr
 
 {#fun Fl_Widget_handle as widgetHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Widget orig impl where
-  runOp _ _ widget event = withRef widget (\p -> widgetHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Widget orig impl where
+  runOp _ _ widget event = withRef widget (\p -> widgetHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {#fun Fl_Widget_parent as widgetParent' { id `Ptr ()'} -> `Ptr ()' id #}
 instance (impl ~  IO (Maybe (Ref Group))) => Op (GetParent ()) Widget orig impl where
@@ -252,14 +247,14 @@
 {# fun Fl_Widget_set_selection_color as setSelectionColor' { id `Ptr ()',cFromColor `Color' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Color ->  IO ())) => Op (SetSelectionColor ()) Widget orig impl where
   runOp _ _ widget a = withRef widget $ \widgetPtr -> setSelectionColor' widgetPtr a
-{# fun Fl_Widget_label as label' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ IO (String)) => Op (GetLabel ()) Widget orig impl where
+{# fun Fl_Widget_label as label' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ IO T.Text) => Op (GetLabel ()) Widget orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> label' widgetPtr
-{# fun Fl_Widget_copy_label as copyLabel' { id `Ptr ()', unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (CopyLabel ()) Widget orig impl where
+{# fun Fl_Widget_copy_label as copyLabel' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (CopyLabel ()) Widget orig impl where
   runOp _ _ widget new_label = withRef widget $ \widgetPtr -> copyLabel' widgetPtr new_label
-{# fun Fl_Widget_set_label as setLabel' { id `Ptr ()', unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ ( String -> IO ())) => Op (SetLabel ()) Widget orig impl where
+{# fun Fl_Widget_set_label as setLabel' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ ( T.Text -> IO ())) => Op (SetLabel ()) Widget orig impl where
   runOp _ _ widget text = withRef widget $ \widgetPtr -> setLabel' widgetPtr text
 {# fun Fl_Widget_labeltype as labeltype' { id `Ptr ()' } -> `Labeltype' cToEnum #}
 instance (impl ~ (IO (Labeltype))) => Op (GetLabeltype ()) Widget orig impl where
@@ -297,14 +292,14 @@
 {# fun Fl_Widget_set_deimage as setDeimage' { id `Ptr ()',id `Ptr ()'} -> `()' supressWarningAboutRes #}
 instance (Parent a Image, impl ~ (Maybe( Ref a ) ->  IO ())) => Op (SetDeimage ()) Widget orig impl where
   runOp _ _ widget pix = withRef widget $ \widgetPtr -> withMaybeRef pix $ \pixPtr -> setDeimage' widgetPtr pixPtr
-{# fun Fl_Widget_tooltip as tooltip' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ (IO (String))) => Op (GetTooltip ()) Widget orig impl where
+{# fun Fl_Widget_tooltip as tooltip' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ (IO T.Text)) => Op (GetTooltip ()) Widget orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> tooltip' widgetPtr
-{# fun Fl_Widget_copy_tooltip as copyTooltip' { id `Ptr ()', unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ ( String ->  IO ())) => Op (CopyTooltip ()) Widget orig impl where
+{# fun Fl_Widget_copy_tooltip as copyTooltip' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ ( T.Text ->  IO ())) => Op (CopyTooltip ()) Widget orig impl where
   runOp _ _ widget text = withRef widget $ \widgetPtr -> copyTooltip' widgetPtr text
-{# fun Fl_Widget_set_tooltip as setTooltip' { id `Ptr ()', unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ ( String ->  IO ())) => Op (SetTooltip ()) Widget orig impl where
+{# fun Fl_Widget_set_tooltip as setTooltip' { id `Ptr ()', unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ ( T.Text ->  IO ())) => Op (SetTooltip ()) Widget orig impl where
   runOp _ _ widget text = withRef widget $ \widgetPtr -> setTooltip' widgetPtr text
 {# fun Fl_Widget_when as when' { id `Ptr ()' } -> `CInt' id #}
 instance (impl ~ IO [When]) => Op (GetWhen ()) Widget orig impl where
@@ -510,14 +505,16 @@
 --
 -- contains:: ('Parent' a 'Widget') => 'Ref' 'Widget' -> 'Ref' a -> 'IO' 'Int'
 --
--- copyLabel :: 'Ref' 'Widget' -> 'String' -> 'IO' ()
+-- copyLabel :: 'Ref' 'Widget' -> 'T.Text' -> 'IO' ()
 --
--- copyTooltip :: 'Ref' 'Widget' -> 'String' -> 'IO' ()
+-- copyTooltip :: 'Ref' 'Widget' -> 'T.Text' -> 'IO' ()
 --
 -- deactivate :: 'Ref' 'Widget' -> 'IO' ()
 --
 -- destroy :: 'Ref' 'Widget' -> 'IO' ()
 --
+-- doCallback :: 'Ref' 'Widget' -> 'IO' ()
+--
 -- drawBackdrop :: 'Ref' 'Widget' -> 'IO' ()
 --
 -- drawBox :: 'Ref' 'Widget' -> 'IO' ()
@@ -546,7 +543,7 @@
 --
 -- getImage :: 'Ref' 'Widget' -> 'IO' ('Ref' 'Image')
 --
--- getLabel :: 'Ref' 'Widget' -> 'IO' ('String')
+-- getLabel :: 'Ref' 'Widget' -> 'IO' 'T.Text'
 --
 -- getLabelcolor :: 'Ref' 'Widget' -> 'IO' ('Color')
 --
@@ -560,11 +557,11 @@
 --
 -- getParent :: 'Ref' 'Widget' -> 'IO' ('Maybe' ('Ref' 'Group'))
 --
--- getRectangle:: ('FindOp' orig ('GetX' ()) ('Match' obj), 'FindOp' orig ('GetY' ()) ('Match' obj), 'FindOp' orig ('GetW' ()) ('Match' obj), 'FindOp' orig ('GetH' ()) ('Match' obj), 'Op' ('GetX' ()) obj orig ('IO' 'Int',) 'Op' ('GetY' ()) obj orig ('IO' 'Int',) 'Op' ('GetW' ()) obj orig ('IO' 'Int',) 'Op' ('GetH' ()) obj orig ('IO' 'Int',)) => 'Ref' 'Widget' -> 'IO' 'Rectangle'
+-- getRectangle:: ('Match' obj ~ 'FindOp' orig orig ('GetX' ()), 'Match' obj ~ 'FindOp' orig orig ('GetY' ()), 'Match' obj ~ 'FindOp' orig orig ('GetW' ()), 'Match' obj ~ 'FindOp' orig orig ('GetH' ()), 'Op' ('GetX' ()) obj orig ('IO' 'Int',) 'Op' ('GetY' ()) obj orig ('IO' 'Int',) 'Op' ('GetW' ()) obj orig ('IO' 'Int',) 'Op' ('GetH' ()) obj orig ('IO' 'Int',)) => 'Ref' 'Widget' -> 'IO' 'Rectangle'
 --
 -- getSelectionColor :: 'Ref' 'Widget' -> 'IO' ('Color')
 --
--- getTooltip :: 'Ref' 'Widget' -> 'IO' ('String')
+-- getTooltip :: 'Ref' 'Widget' -> 'IO' 'T.Text'
 --
 -- getTopWindow :: 'Ref' 'Widget' -> 'IO' ('Maybe' ('Ref' 'Window'))
 --
@@ -588,7 +585,7 @@
 --
 -- getY :: 'Ref' 'Widget' -> 'IO' ('Int')
 --
--- handle :: 'Ref' 'Widget' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Widget' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
 -- hasCallback :: 'Ref' 'Widget' -> 'IO' ('Bool')
 --
@@ -628,7 +625,7 @@
 --
 -- setImage:: ('Parent' a 'Image') => 'Ref' 'Widget' -> 'Maybe'( 'Ref' a ) -> 'IO' ()
 --
--- setLabel :: 'Ref' 'Widget' -> 'String' -> 'IO' ()
+-- setLabel :: 'Ref' 'Widget' -> 'T.Text' -> 'IO' ()
 --
 -- setLabelcolor :: 'Ref' 'Widget' -> 'Color' -> 'IO' ()
 --
@@ -644,7 +641,7 @@
 --
 -- setSelectionColor :: 'Ref' 'Widget' -> 'Color' -> 'IO' ()
 --
--- setTooltip :: 'Ref' 'Widget' -> 'String' -> 'IO' ()
+-- setTooltip :: 'Ref' 'Widget' -> 'T.Text' -> 'IO' ()
 --
 -- setType :: 'Ref' 'Widget' -> 'Word8' -> 'IO' ()
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Window.chs b/src/Graphics/UI/FLTK/LowLevel/Window.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Window.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Window.chs
@@ -32,6 +32,7 @@
 import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Widget
 
@@ -88,14 +89,14 @@
 windowMaker :: forall a b. (Parent a Window, Parent b Widget) =>
                Size ->
                Maybe Position ->
-               Maybe String ->
+               Maybe T.Text ->
                Maybe (Ref b -> IO ()) ->
                CustomWidgetFuncs b ->
                CustomWindowFuncs a ->
                (Int -> Int -> Ptr () -> IO (Ptr ())) ->
-               (Int -> Int -> String -> Ptr () -> IO (Ptr ())) ->
+               (Int -> Int -> T.Text -> Ptr () -> IO (Ptr ())) ->
                (Int -> Int -> Int -> Int -> Ptr () -> IO (Ptr ())) ->
-               (Int -> Int -> Int -> Int -> String -> Ptr () -> IO (Ptr ())) ->
+               (Int -> Int -> Int -> Int -> T.Text -> Ptr () -> IO (Ptr ())) ->
                IO (Ref a)
 windowMaker (Size (Width w) (Height h))
             position
@@ -119,11 +120,11 @@
 
 {# fun Fl_OverriddenWindow_New as overriddenWindowNew' {`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}
 {# fun Fl_OverriddenWindow_NewXY as overriddenWindowNewXY' {`Int',`Int', `Int', `Int', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenWindow_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
-{# fun Fl_OverriddenWindow_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `String', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenWindow_NewXY_WithLabel as overriddenWindowNewXYWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
+{# fun Fl_OverriddenWindow_New_WithLabel as overriddenWindowNewWithLabel' { `Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}
 windowCustom :: Size                        -- ^ Size of this window
              -> Maybe Position              -- ^ Optional position of this window
-             -> Maybe String                -- ^ Optional label
+             -> Maybe T.Text                -- ^ Optional label
              -> Maybe (Ref Window -> IO ()) -- ^ Optional table drawing routine
              -> CustomWidgetFuncs Window    -- ^ Custom widget overrides
              -> CustomWindowFuncs Window    -- ^ Custom window overrides
@@ -141,7 +142,7 @@
     overriddenWindowNewXY'
     overriddenWindowNewXYWithLabel'
 
-windowNew :: Size -> Maybe Position -> Maybe String -> IO (Ref Window)
+windowNew :: Size -> Maybe Position -> Maybe T.Text -> IO (Ref Window)
 windowNew size position title =
   windowMaker
     size
@@ -164,8 +165,8 @@
   runOp _ _ window = withRef window $ \windowPtr -> drawSuper' windowPtr
 
 {# fun Fl_Window_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #}
-instance (impl ~ (Event ->  IO (Int))) => Op (HandleSuper ()) Window orig impl where
-  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event))
+instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Window orig impl where
+  runOp _ _ window event = withRef window $ \windowPtr -> handleSuper' windowPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
 
 {# fun Fl_Window_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Window orig impl where
@@ -190,8 +191,8 @@
   runOp _ _ window = withRef window (\p -> windowShow' p)
 
 {#fun Fl_Window_handle as windowHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
-instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Window orig impl where
-  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event))
+instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Window orig impl where
+  runOp _ _ window event = withRef window (\p -> windowHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
 
 {# fun Fl_Window_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
 instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Window orig impl where
@@ -312,36 +313,36 @@
       structPtr <- optionalSizeRangeArgsToStruct args
       sizeRangeWithArgs' winPtr minw' minh' structPtr
 
-{# fun Fl_Window_label as label' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetLabel ()) Window orig impl where
+{# fun Fl_Window_label as label' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetLabel ()) Window orig impl where
   runOp _ _ win = withRef win $ \winPtr -> label' winPtr
 
-{# fun Fl_Window_iconlabel as iconlabel' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetIconlabel ()) Window orig impl where
+{# fun Fl_Window_iconlabel as iconlabel' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetIconlabel ()) Window orig impl where
   runOp _ _ win = withRef win $ \winPtr -> iconlabel' winPtr
 
-{# fun Fl_Window_set_label as setLabel' { id `Ptr ()',unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (SetLabel ()) Window orig impl where
+{# fun Fl_Window_set_label as setLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetLabel ()) Window orig impl where
   runOp _ _ win l' = withRef win $ \winPtr -> setLabel' winPtr l'
 
-{# fun Fl_Window_set_iconlabel as setIconlabel' { id `Ptr ()',unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (SetIconlabel ()) Window orig impl where
+{# fun Fl_Window_set_iconlabel as setIconlabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetIconlabel ()) Window orig impl where
   runOp _ _ win l' = withRef win $ \winPtr -> setIconlabel' winPtr l'
 
-{# fun Fl_Window_set_label_with_iconlabel as setLabelWithIconlabel' { id `Ptr ()',unsafeToCString `String',unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String -> String ->  IO ())) => Op (SetLabelWithIconlabel ()) Window orig impl where
+{# fun Fl_Window_set_label_with_iconlabel as setLabelWithIconlabel' { id `Ptr ()',unsafeToCString `T.Text',unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text -> T.Text ->  IO ())) => Op (SetLabelWithIconlabel ()) Window orig impl where
   runOp _ _ win label iconlabel = withRef win $ \winPtr -> setLabelWithIconlabel' winPtr label iconlabel
 
-{# fun Fl_Window_copy_label as copyLabel' { id `Ptr ()',unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (CopyLabel ()) Window orig impl where
+{# fun Fl_Window_copy_label as copyLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (CopyLabel ()) Window orig impl where
   runOp _ _ win a = withRef win $ \winPtr -> copyLabel' winPtr a
 
-{# fun Fl_Window_xclass as xclass' { id `Ptr ()' } -> `String' unsafeFromCString #}
-instance (impl ~ ( IO (String))) => Op (GetXclass ()) Window orig impl where
+{# fun Fl_Window_xclass as xclass' { id `Ptr ()' } -> `T.Text' unsafeFromCString #}
+instance (impl ~ ( IO T.Text)) => Op (GetXclass ()) Window orig impl where
   runOp _ _ win = withRef win $ \winPtr -> xclass' winPtr
 
-{# fun Fl_Window_set_xclass as setXclass' { id `Ptr ()',unsafeToCString `String' } -> `()' supressWarningAboutRes #}
-instance (impl ~ (String ->  IO ())) => Op (SetXclass ()) Window orig impl where
+{# fun Fl_Window_set_xclass as setXclass' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' supressWarningAboutRes #}
+instance (impl ~ (T.Text ->  IO ())) => Op (SetXclass ()) Window orig impl where
   runOp _ _ win c = withRef win $ \winPtr -> setXclass' winPtr c
 
 {# fun Fl_Window_icon as icon' { id `Ptr ()' } -> `Ptr ()' id #}
@@ -466,7 +467,7 @@
 --
 -- clearBorder :: 'Ref' 'Window' -> 'IO' ()
 --
--- copyLabel :: 'Ref' 'Window' -> 'String' -> 'IO' ()
+-- copyLabel :: 'Ref' 'Window' -> 'T.Text' -> 'IO' ()
 --
 -- destroy :: 'Ref' 'Window' -> 'IO' ()
 --
@@ -494,9 +495,9 @@
 --
 -- getIcon :: 'Ref' 'Window' -> 'IO' ('Maybe' ('Ref' 'Image'))
 --
--- getIconlabel :: 'Ref' 'Window' -> 'IO' ('String')
+-- getIconlabel :: 'Ref' 'Window' -> 'IO' 'T.Text'
 --
--- getLabel :: 'Ref' 'Window' -> 'IO' ('String')
+-- getLabel :: 'Ref' 'Window' -> 'IO' 'T.Text'
 --
 -- getMenuWindow :: 'Ref' 'Window' -> 'IO' ('Bool')
 --
@@ -510,13 +511,13 @@
 --
 -- getXRoot :: 'Ref' 'Window' -> 'IO' ('Int')
 --
--- getXclass :: 'Ref' 'Window' -> 'IO' ('String')
+-- getXclass :: 'Ref' 'Window' -> 'IO' 'T.Text'
 --
 -- getYRoot :: 'Ref' 'Window' -> 'IO' ('Int')
 --
--- handle :: 'Ref' 'Window' -> 'Event' -> 'IO' 'Int'
+-- handle :: 'Ref' 'Window' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
 --
--- handleSuper :: 'Ref' 'Window' -> 'Int' -> 'IO' ('Int')
+-- handleSuper :: 'Ref' 'Window' -> 'Event' -> 'IO' ('Int')
 --
 -- hide :: 'Ref' 'Window' -> 'IO' ()
 --
@@ -550,11 +551,11 @@
 --
 -- setIcon:: ('Parent' a 'Image') => 'Ref' 'Window' -> 'Maybe'( 'Ref' a ) -> 'IO' ()
 --
--- setIconlabel :: 'Ref' 'Window' -> 'String' -> 'IO' ()
+-- setIconlabel :: 'Ref' 'Window' -> 'T.Text' -> 'IO' ()
 --
--- setLabel :: 'Ref' 'Window' -> 'String' -> 'IO' ()
+-- setLabel :: 'Ref' 'Window' -> 'T.Text' -> 'IO' ()
 --
--- setLabelWithIconlabel :: 'Ref' 'Window' -> 'String' -> 'String' -> 'IO' ()
+-- setLabelWithIconlabel :: 'Ref' 'Window' -> 'T.Text' -> 'T.Text' -> 'IO' ()
 --
 -- setMenuWindow :: 'Ref' 'Window' -> 'IO' ()
 --
@@ -568,7 +569,7 @@
 --
 -- setType :: 'Ref' 'Window' -> 'WindowType' -> 'IO' ()
 --
--- setXclass :: 'Ref' 'Window' -> 'String' -> 'IO' ()
+-- setXclass :: 'Ref' 'Window' -> 'T.Text' -> 'IO' ()
 --
 -- showWidget :: 'Ref' 'Window' -> 'IO' ()
 --
@@ -581,4 +582,5 @@
 -- sizeRangeWithArgs :: 'Ref' 'Window' -> 'Int' -> 'Int' -> 'OptionalSizeRangeArgs' -> 'IO' ()
 --
 -- waitForExpose :: 'Ref' 'Window' -> 'IO' ()
+
 -- @
diff --git a/src/Graphics/UI/FLTK/LowLevel/Wizard.chs b/src/Graphics/UI/FLTK/LowLevel/Wizard.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Wizard.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Wizard.chs
@@ -21,10 +21,11 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.Dispatch
+import qualified Data.Text as T
 
 {# fun Fl_Wizard_New as wizardNew' {  `Int',`Int', `Int', `Int'} -> `Ptr ()' id #}
-{# fun Fl_Wizard_New_WithLabel as wizardNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `String'} -> `Ptr ()' id #}
-wizardNew :: Rectangle -> Maybe String -> IO (Ref Wizard)
+{# fun Fl_Wizard_New_WithLabel as wizardNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
+wizardNew :: Rectangle -> Maybe T.Text -> IO (Ref Wizard)
 wizardNew rectangle label' =
     let (x_pos, y_pos, width, height) = fromRectangle rectangle
     in case label' of
diff --git a/src/Graphics/UI/FLTK/LowLevel/XBMImage.chs b/src/Graphics/UI/FLTK/LowLevel/XBMImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/XBMImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/XBMImage.chs
@@ -17,9 +17,9 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
-
-{# fun Fl_XBM_Image_New as xbmImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-xbmImageNew :: String -> IO (Either UnknownError (Ref XBMImage))
+import qualified Data.Text as T
+{# fun Fl_XBM_Image_New as xbmImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+xbmImageNew :: T.Text -> IO (Either UnknownError (Ref XBMImage))
 xbmImageNew filename' = do
   ptr <- xbmImageNew' filename'
   ref' <- (toRef ptr :: IO (Ref XBMImage))
diff --git a/src/Graphics/UI/FLTK/LowLevel/XPMImage.chs b/src/Graphics/UI/FLTK/LowLevel/XPMImage.chs
--- a/src/Graphics/UI/FLTK/LowLevel/XPMImage.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/XPMImage.chs
@@ -17,9 +17,9 @@
 import Graphics.UI.FLTK.LowLevel.Utils
 import Graphics.UI.FLTK.LowLevel.Hierarchy
 import Graphics.UI.FLTK.LowLevel.RGBImage
-
-{# fun Fl_XPM_Image_New as xpmImageNew' { unsafeToCString `String' } -> `Ptr ()' id #}
-xpmImageNew :: String -> IO (Either UnknownError (Ref XPMImage))
+import qualified Data.Text as T
+{# fun Fl_XPM_Image_New as xpmImageNew' { unsafeToCString `T.Text' } -> `Ptr ()' id #}
+xpmImageNew :: T.Text -> IO (Either UnknownError (Ref XPMImage))
 xpmImageNew filename' = do
   ptr <- xpmImageNew' filename'
   ref' <- (toRef ptr :: IO (Ref XPMImage))
diff --git a/src/TestPrograms/Buttons.hs b/src/TestPrograms/Buttons.hs
--- a/src/TestPrograms/Buttons.hs
+++ b/src/TestPrograms/Buttons.hs
@@ -1,7 +1,9 @@
+{-# LANGUAGE OverloadedStrings #-}
 module Main where
 
 import Graphics.UI.FLTK.LowLevel.FL
 import Graphics.UI.FLTK.LowLevel.FLTKHS
+import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
 
 main :: IO ()
 main = do
diff --git a/src/TestPrograms/TestCall.hs b/src/TestPrograms/TestCall.hs
--- a/src/TestPrograms/TestCall.hs
+++ b/src/TestPrograms/TestCall.hs
@@ -17,7 +17,7 @@
   print "drawOverride"
   drawSuper wptr
 
-addButton :: Int -> Int -> String -> IO (Ref Button)
+addButton :: Int -> Int -> T.Text -> IO (Ref Button)
 addButton x_pos y_pos label = do
   button <- buttonNew
               (Rectangle (Position (X x_pos) (Y y_pos)) (Size (Width 80) (Height 30)) )
