Boxer icon indicating copy to clipboard operation
Boxer copied to clipboard

File update request

Open hyperdregon opened this issue 3 years ago • 1 comments

Update of boxer_win.cpp

(Bug fix)

` #include <boxer/boxer.h> #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <Windows.h>

namespace boxer {

namespace {

UINT getIcon(Style style) { switch (style) { case Style::Info: return MB_ICONINFORMATION; case Style::Warning: return MB_ICONWARNING; case Style::Error: return MB_ICONERROR; case Style::Question: return MB_ICONQUESTION; default: return MB_ICONINFORMATION; } }

UINT getButtons(Buttons buttons) { switch (buttons) { case Buttons::OK: case Buttons::Quit: // There is no 'Quit' button on Windows :( return MB_OK; case Buttons::OKCancel: return MB_OKCANCEL; case Buttons::YesNo: return MB_YESNO; default: return MB_OK; } }

Selection getSelection(int response, Buttons buttons) { switch (response) { case IDOK: return buttons == Buttons::Quit ? Selection::Quit : Selection::OK; case IDCANCEL: return Selection::Cancel; case IDYES: return Selection::Yes; case IDNO: return Selection::No; default: return Selection::None; } }

} // namespace

Selection show(const char *message, const char *title, Style style, Buttons buttons) { UINT flags = MB_TASKMODAL;

flags |= getIcon(style); flags |= getButtons(buttons);

return getSelection(MessageBoxA(nullptr, message, title, flags), buttons); }

} // namespace boxer `

hyperdregon avatar May 27 '22 14:05 hyperdregon

Thanks for the suggestion! Could you submit the code change as a pull request?

Thanks!

aaronmjacobs avatar May 28 '22 04:05 aaronmjacobs

But what does this fix?

Ryder17z avatar Oct 30 '22 00:10 Ryder17z

please explain what the change does ???

Ryder17z avatar Jan 18 '23 12:01 Ryder17z

The change swapped the call from MessageBox to MessageBoxA (the ASCII variant). As of d872cd24d3068f8ac8a10dd1df3f2239ccd1747c and 8f6b579c15747fa5a035a0d25a92eeccc0a0ed5f the code supports UTF-8, making the suggested change no longer relevant.

aaronmjacobs avatar Jan 19 '23 04:01 aaronmjacobs

Okay thanks for the explanation.

On Thu, 19 Jan 2023, 05:04 Aaron Jacobs, @.***> wrote:

The change swapped the call from MessageBox to MessageBoxA (the ASCII variant). As of d872cd2 https://github.com/aaronmjacobs/Boxer/commit/d872cd24d3068f8ac8a10dd1df3f2239ccd1747c and 8f6b579 https://github.com/aaronmjacobs/Boxer/commit/8f6b579c15747fa5a035a0d25a92eeccc0a0ed5f the code supports UTF-8, making the suggested change no longer relevant.

— Reply to this email directly, view it on GitHub https://github.com/aaronmjacobs/Boxer/issues/9#issuecomment-1396411160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPIOP2T6EXAHJEZC3T6ZRDWTC4MLANCNFSM5XEMXPSQ . You are receiving this because you commented.Message ID: @.***>

Ryder17z avatar Jan 19 '23 06:01 Ryder17z