Skip to content

Instantly share code, notes, and snippets.

@deech
Last active February 23, 2017 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deech/e7a45b14a83a7d5740878517659c7364 to your computer and use it in GitHub Desktop.
Save deech/e7a45b14a83a7d5740878517659c7364 to your computer and use it in GitHub Desktop.
diff --git a/c-src/Fl_C.h b/c-src/Fl_C.h
index 963bc04..9485c6c 100644
--- a/c-src/Fl_C.h
+++ b/c-src/Fl_C.h
@@ -257,6 +257,7 @@ EXPORT {
FL_EXPORT_C(void ,Fl_release_widget_pointer)(fl_Widget w);
FL_EXPORT_C(void ,Fl_clear_widget_pointer)(fl_Widget w);
FL_EXPORT_C(void ,Fl_clear_widget_pointer)(fl_Widget w);
+#if FL_API_VERSION == 10304
FL_EXPORT_C(void ,Fl_set_box_color)(Fl_Color c);
FL_EXPORT_C(Fl_Color ,Fl_box_color)(Fl_Color c);
FL_EXPORT_C(int ,Fl_abi_version)();
@@ -265,6 +266,7 @@ EXPORT {
FL_EXPORT_C(const char* ,Fl_local_meta)();
FL_EXPORT_C(const char* ,Fl_local_alt)();
FL_EXPORT_C(const char* ,Fl_local_shift)();
+#endif
#ifdef __cplusplus
}
#endif
diff --git a/c-src/Fl_ImageC.h b/c-src/Fl_ImageC.h
index e74ea4e..ff6909c 100644
--- a/c-src/Fl_ImageC.h
+++ b/c-src/Fl_ImageC.h
@@ -61,7 +61,9 @@ EXPORT {
FL_EXPORT_C(void,Fl_Image_draw_with)(fl_Image image,int X,int Y,int W,int H);
FL_EXPORT_C(void, Fl_Image_draw)(fl_Image image,int X, int Y);
FL_EXPORT_C(void, Fl_Image_uncache)(fl_Image image);
+#if FL_API_VERSION == 10304
FL_EXPORT_C(int, Fl_Image_fail)(fl_Image image);
+#endif
#ifdef __cplusplus
}
#endif
diff --git a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
index f2f0a65..c5278e9 100644
--- a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
+++ b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs
@@ -534,8 +534,10 @@ module Graphics.UI.FLTK.LowLevel.Hierarchy
setTextcolor,
DownBox,
downBox,
+#if FL_API_VERSION == 10304
SetOnly,
setOnly,
+#endif
-- * MenuBar
MenuBar,
-- * SysMenuBar
@@ -562,8 +564,10 @@ module Graphics.UI.FLTK.LowLevel.Hierarchy
drawResize,
Uncache,
uncache,
+#if FL_API_VERSION == 10304
Fail,
fail,
+#endif
-- * Bitmap
Bitmap,
-- * Pixmap
@@ -2278,8 +2282,13 @@ type MenuPrimFuncs =
(SetDownBox
(GetDownColor
(SetDownColor
+#if FL_API_VERSION == 10304
(SetOnly
- ()))))))))))))))))))))))))))))))))))))))))))))))
+#endif
+ ())))))))))))))))))))))))))))))))))))))))))))))
+#if FL_API_VERSION == 10304
+ )
+#endif
type instance Functions MenuPrim = MenuPrimFuncs
@@ -2308,7 +2317,9 @@ MAKE_METHOD(SetTextsize,setTextsize)
MAKE_METHOD(GetTextcolor,getTextcolor)
MAKE_METHOD(SetTextcolor,setTextcolor)
MAKE_METHOD(DownBox,downBox)
+#if FL_API_VERSION == 10304
MAKE_METHOD(SetOnly,setOnly)
+#endif
data CMenuBar parent
type MenuBar = CMenuBar MenuPrim
@@ -2379,8 +2390,13 @@ type ImageFuncs =
(DrawResize
(Draw
(Uncache
+#if FL_API_VERSION == 10304
(Fail
- ()))))))))))))))
+#endif
+ ())))))))))))))
+#if FL_API_VERSION == 10304
+ )
+#endif
type instance Functions Image = ImageFuncs
@@ -2392,7 +2408,9 @@ MAKE_METHOD(Inactive,inactive)
MAKE_METHOD(Desaturate,desaturate)
MAKE_METHOD(DrawResize,drawResize)
MAKE_METHOD(Uncache,uncache)
+#if FL_API_VERSION == 10304
MAKE_METHOD(Fail,fail)
+#endif
data CBitmap parent
type Bitmap = CBitmap Image
diff --git a/src/Graphics/UI/FLTK/LowLevel/Image.chs b/src/Graphics/UI/FLTK/LowLevel/Image.chs
index bfdd977..3599a22 100644
--- a/src/Graphics/UI/FLTK/LowLevel/Image.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Image.chs
@@ -2,7 +2,9 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Image
(
+#if FL_API_VERSION == 10304
ImageFail(..),
+#endif
ImageFuncs(..),
defaultImageFuncs,
imageNew,
@@ -32,6 +34,7 @@ import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
+#if FL_API_VERSION == 10304
#c
enum ImageFail {
ImageErrNoImage = ERR_NO_IMAGE,
@@ -40,6 +43,7 @@ enum ImageFail {
};
#endc
{#enum ImageFail {} deriving (Show, Eq, Ord) #}
+#endif
type ColorAverageCallback = Ref Image -> Color -> Float -> IO ()
type ImageDrawCallback = Ref Image -> Position -> Size -> Maybe X -> Maybe Y -> IO ()
@@ -181,6 +185,7 @@ instance (impl ~ (Position -> IO ())) => Op (Draw ()) Image orig impl where
instance (impl ~ ( IO ())) => Op (Uncache ()) Image orig impl where
runOp _ _ image = withRef image $ \imagePtr -> uncache' imagePtr
+#if FL_API_VERSION == 10304
{#fun Fl_Image_fail as fail' { id `Ptr ()'} -> `CInt' #}
instance (impl ~ (IO (Either ImageFail ()))) => Op (Fail ()) Image orig impl where
runOp _ _ image = withRef image $ \imagePtr -> do
@@ -188,6 +193,7 @@ instance (impl ~ (IO (Either ImageFail ()))) => Op (Fail ()) Image orig impl whe
if (res == 0)
then return (Right ())
else return (Left (cToEnum res))
+#endif
-- $functions
-- @
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment