Skip to content

Commit cc1fe60

Browse files
authored
Add inputPassword wrapper for inputText (#225)
1 parent 2029d49 commit cc1fe60

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for dear-imgui
22

3+
## UNRELEASED
4+
5+
- Added `inputPassword` wrapper for text input, which sets the flag.
6+
37
## [2.4.1]
48

59
- Fixed builds on GHC-9.10+.

src/DearImGui.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ module DearImGui
221221
, inputText
222222
, inputTextMultiline
223223
, inputTextWithHint
224+
, inputPassword
224225
, inputFloat
225226
, inputFloat2
226227
, inputFloat3
@@ -1463,6 +1464,16 @@ inputTextWithHint label hint ref bufSize =
14631464
ImGuiInputTextFlags_None
14641465

14651466

1467+
-- | Wraps @ImGui::InputText()@ and sets a `ImGuiInputTextFlags_Password` flag.
1468+
inputPassword :: (MonadIO m, HasSetter ref Text, HasGetter ref Text) => Text -> ref -> Int -> m Bool
1469+
inputPassword label ref bufSize =
1470+
withInputString ref bufSize \bufPtrLen ->
1471+
Text.withCString label \labelPtr ->
1472+
Raw.inputText
1473+
labelPtr
1474+
bufPtrLen
1475+
ImGuiInputTextFlags_Password
1476+
14661477
-- | Internal helper to prepare appropriately sized and encoded input buffer.
14671478
withInputString
14681479
:: (MonadIO m, HasSetter ref Text, HasGetter ref Text)

0 commit comments

Comments
 (0)