Make value and read-only range types distinct (#143)

Fixes #142
This commit is contained in:
Alexander Bondarenko 2022-03-23 21:22:05 +03:00 committed by GitHub
parent bc590d97c5
commit 7d4f3a8b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -847,8 +847,8 @@ dragIntRange2 desc refMin refMax speed minValue maxValue minFmt maxFmt = liftIO
return changed
dragScalar
:: (HasSetter ref a, HasGetter ref a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> ref -> Float -> ref -> ref -> String -> ImGuiSliderFlags -> m Bool
:: (HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> ref -> Float -> range -> range -> String -> ImGuiSliderFlags -> m Bool
dragScalar label dataType ref vSpeed refMin refMax format flags = liftIO do
currentValue <- get ref
minValue <- get refMin
@ -877,8 +877,8 @@ dragScalar label dataType ref vSpeed refMin refMax format flags = liftIO do
return changed
dragScalarN
:: (HasSetter valueRef [a], HasGetter valueRef [a], HasGetter rangeRef a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> valueRef -> Float -> rangeRef -> rangeRef -> String -> ImGuiSliderFlags -> m Bool
:: (HasSetter ref [a], HasGetter ref [a], HasGetter range a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> ref -> Float -> range -> range -> String -> ImGuiSliderFlags -> m Bool
dragScalarN label dataType ref vSpeed refMin refMax format flags = liftIO do
currentValues <- get ref
minValue <- get refMin
@ -908,8 +908,8 @@ dragScalarN label dataType ref vSpeed refMin refMax format flags = liftIO do
return changed
sliderScalar
:: (HasSetter ref a, HasGetter ref a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> ref -> ref -> ref -> String -> ImGuiSliderFlags -> m Bool
:: (HasGetter ref a, HasSetter ref a, HasGetter range a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> ref -> range -> range -> String -> ImGuiSliderFlags -> m Bool
sliderScalar label dataType ref refMin refMax format flags = liftIO do
currentValue <- get ref
minValue <- get refMin
@ -937,8 +937,8 @@ sliderScalar label dataType ref refMin refMax format flags = liftIO do
return changed
sliderScalarN
:: (HasSetter valueRef [a], HasGetter valueRef [a], HasGetter rangeRef a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> valueRef -> rangeRef -> rangeRef -> String -> ImGuiSliderFlags -> m Bool
:: (HasSetter value [a], HasGetter value [a], HasGetter range a, Storable a, MonadIO m)
=> String -> ImGuiDataType -> value -> range -> range -> String -> ImGuiSliderFlags -> m Bool
sliderScalarN label dataType ref refMin refMax format flags = liftIO do
currentValues <- get ref
minValue <- get refMin
@ -1187,8 +1187,8 @@ vSliderInt label size ref minValue maxValue = liftIO do
return changed
vSliderScalar
:: (HasSetter ref a, HasGetter ref a, Storable a, MonadIO m)
=> String -> ImVec2 -> ImGuiDataType -> ref -> ref -> ref -> String -> ImGuiSliderFlags -> m Bool
:: (HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a, MonadIO m)
=> String -> ImVec2 -> ImGuiDataType -> ref -> range -> range -> String -> ImGuiSliderFlags -> m Bool
vSliderScalar label size dataType ref refMin refMax format flags = liftIO do
currentValue <- get ref
minValue <- get refMin
@ -1885,7 +1885,12 @@ withCStringOrNull (Just s) k = withCString s k
-- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc.
--
-- Wraps @ImGui::SetNextWindowPos()@
setNextWindowPos :: (MonadIO m, HasGetter ref ImVec2) => ref -> ImGuiCond -> Maybe ref -> m ()
setNextWindowPos
:: (MonadIO m, HasGetter ref ImVec2)
=> ref
-> ImGuiCond
-> Maybe ref -- XXX: the type should be distinct, but using `setNextWindowPos .. Nothing` is ambiguous resulting in bad UX.
-> m ()
setNextWindowPos posRef cond pivotMaybe = liftIO do
pos <- get posRef
with pos $ \posPtr ->