Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
added BeginPopupContextItem
Browse files Browse the repository at this point in the history
  • Loading branch information
dertseha committed Jul 21, 2018
1 parent 1296e79 commit 50fe007
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions imgui.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,19 @@ func BeginPopupModal(name string) bool {
return BeginPopupModalV(name, nil, 0)
}

// BeginPopupContextItemV returns true if the identified mouse button was pressed
// while hovering over the last item.
func BeginPopupContextItemV(label string, mouseButton int) bool {
labelArg, labelFin := wrapString(label)
defer labelFin()
return C.iggBeginPopupContextItem(labelArg, C.int(mouseButton)) != 0
}

// BeginPopupContextItem calls BeginPopupContextItemV("", 1)
func BeginPopupContextItem() bool {
return BeginPopupContextItemV("", 1)
}

// EndPopup finshes a popup. Only call EndPopup() if BeginPopupXXX() returns true!
func EndPopup() {
C.iggEndPopup()
Expand Down
5 changes: 5 additions & 0 deletions imguiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ IggBool iggBeginPopupModal(char const *name, IggBool *open, int flags)
return ImGui::BeginPopupModal(name, openArg, flags) ? 1 : 0;
}

IggBool iggBeginPopupContextItem(char const *label, int mouseButton)
{
return ImGui::BeginPopupContextItem(label, mouseButton) ? 1 : 0;
}

void iggEndPopup(void)
{
ImGui::EndPopup();
Expand Down
1 change: 1 addition & 0 deletions imguiWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ extern IggBool iggMenuItem(char const *label, char const *shortcut, IggBool sele

extern void iggOpenPopup(char const *id);
extern IggBool iggBeginPopupModal(char const *name, IggBool *open, int flags);
extern IggBool iggBeginPopupContextItem(char const *label, int mouseButton);
extern void iggEndPopup(void);
extern void iggCloseCurrentPopup(void);

Expand Down

0 comments on commit 50fe007

Please sign in to comment.