-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Context: put context initialization in context.go (not NewMasterWindow)
- Loading branch information
Showing
4 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/AllenDang/giu" | ||
) | ||
|
||
const popupID = "somepopupmodal" | ||
|
||
func loop() { | ||
items := make([]string, 200) | ||
for i := range items { | ||
items[i] = fmt.Sprintf("Item %d", i) | ||
} | ||
|
||
giu.SingleWindow().Layout( | ||
giu.Row( | ||
giu.ListBox("listbox", items).Size(300, 400), | ||
giu.ListBox("listbox2", items).Size(300, 400), | ||
), | ||
giu.Popup(popupID).Layout( | ||
giu.Row( | ||
giu.Button("Do something").OnClick(func() { fmt.Println("Something done") }), | ||
giu.Button("close me").OnClick(func() { giu.CloseCurrentPopup() }), | ||
), | ||
), | ||
giu.Button("Open popup").OnClick(func() { giu.OpenPopup(popupID) }), | ||
) | ||
} | ||
|
||
func main() { | ||
wnd := giu.NewMasterWindow("#390 [bug]", 640, 480, 0) | ||
wnd.Run(loop) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/AllenDang/giu" | ||
"github.com/AllenDang/imgui-go" | ||
) | ||
|
||
func loop() { | ||
giu.SingleWindow().Layout( | ||
giu.Custom(func() { | ||
imgui.PushStyleColor(imgui.StyleColorChildBg, imgui.CurrentStyle().GetColor(imgui.StyleColorWindowBg)) | ||
if imgui.BeginChild("child") { | ||
giu.Button("button").Build() | ||
} | ||
imgui.EndChild() | ||
imgui.PopStyleColor() | ||
}), | ||
giu.Label("label"), | ||
) | ||
} | ||
|
||
func main() { | ||
wnd := giu.NewMasterWindow("native child layout [demo]", 640, 480, 0) | ||
wnd.Run(loop) | ||
} |