module Gc(pmCreateGC, wCreateGC, createGC, createGCF, wCreateGCF, pmCreateGCF) where
import Command
import Event
--import FudgetIO
import NullF(F{-,K-})
import Xrequest
import Xtypes
--import Maptrace(ctrace)

createGC :: Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
createGC Drawable
drawable GCId
template [GCAttributes Pixel FontId]
attr =
    let cmd :: XRequest
cmd = Drawable -> GCId -> [GCAttributes Pixel FontId] -> XRequest
CreateGC Drawable
drawable GCId
template [GCAttributes Pixel FontId]
attr
        expected :: XResponse -> Maybe GCId
expected (GCCreated GCId
gc) = {-ctrace "gctrace" gc $-} GCId -> Maybe GCId
forall a. a -> Maybe a
Just GCId
gc
        expected XResponse
_ = Maybe GCId
forall a. Maybe a
Nothing
    in XRequest -> (XResponse -> Maybe GCId) -> (GCId -> f b ho) -> f b ho
forall (f :: * -> * -> *) ans b ho.
FudgetIO f =>
XRequest -> (XResponse -> Maybe ans) -> (ans -> f b ho) -> f b ho
xrequest XRequest
cmd XResponse -> Maybe GCId
expected

--createGCK :: Drawable -> GCId -> GCAttributeList -> (GCId -> K a b) -> K a b
--createGCK = createGC

createGCF :: Drawable -> GCId -> GCAttributeList -> (GCId -> F a b) -> F a b
createGCF :: Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
createGCF = Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
forall (f :: * -> * -> *) b ho.
FudgetIO f =>
Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
createGC

wCreateGC :: GCId -> [GCAttributes Pixel FontId] -> (GCId -> f b ho) -> f b ho
wCreateGC GCId
x = Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
forall (f :: * -> * -> *) b ho.
FudgetIO f =>
Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
createGC Drawable
MyWindow GCId
x
pmCreateGC :: PixmapId
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
pmCreateGC PixmapId
x = (Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
forall (f :: * -> * -> *) b ho.
FudgetIO f =>
Drawable
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
createGC (Drawable
 -> GCId
 -> [GCAttributes Pixel FontId]
 -> (GCId -> f b ho)
 -> f b ho)
-> (PixmapId -> Drawable)
-> PixmapId
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> f b ho)
-> f b ho
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PixmapId -> Drawable
Pixmap) PixmapId
x

wCreateGCF :: GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
wCreateGCF = Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
forall a b.
Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
createGCF Drawable
MyWindow
pmCreateGCF :: PixmapId
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
pmCreateGCF = Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
forall a b.
Drawable
-> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b
createGCF (Drawable
 -> GCId -> [GCAttributes Pixel FontId] -> (GCId -> F a b) -> F a b)
-> (PixmapId -> Drawable)
-> PixmapId
-> GCId
-> [GCAttributes Pixel FontId]
-> (GCId -> F a b)
-> F a b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PixmapId -> Drawable
Pixmap