diff --git a/examples/flags.go b/examples/flags.go
new file mode 100644
index 0000000..aba82ad
--- /dev/null
+++ b/examples/flags.go
@@ -0,0 +1,36 @@
+package main
+
+import (
+ "github.com/raff/ultralight-go"
+)
+
+func main() {
+ app := ultralight.NewApp()
+ defer app.Destroy()
+
+ window := app.NewWindow(800, 600, false, "Window", ultralight.WindowFlagBorderless|ultralight.WindowFlagResizable)
+ defer window.Destroy()
+
+ window.View().LoadHTML(`
+
+
+
+
+ Document
+
+
+
+
This window has no border!
+
click me to close the window!
+
+
+ `)
+
+ window.View().JSContext().GlobalObject().SetPropertyValue("close", func(f, this *ultralight.JSObject, args ...*ultralight.JSValue) *ultralight.JSValue {
+ app.Quit()
+ return nil
+ })
+
+ window.Focus()
+ app.Run()
+}
diff --git a/ultralight.go b/ultralight.go
index c00caf6..45e4f58 100644
--- a/ultralight.go
+++ b/ultralight.go
@@ -118,13 +118,14 @@ static inline JSObjectRef make_function_callback(JSContextRef ctx, JSStringRef n
}
*/
import "C"
-import "unsafe"
-import "unicode/utf16"
-import "unicode/utf8"
-import "reflect"
-import "bytes"
-
-import "log"
+import (
+ "bytes"
+ "log"
+ "reflect"
+ "unicode/utf16"
+ "unicode/utf8"
+ "unsafe"
+)
type JSType int
@@ -212,6 +213,15 @@ const (
CursorCustom = Cursor(C.kCursor_Custom)
)
+type WindowFlag uint
+
+const (
+ WindowFlagBorderless = WindowFlag(C.kWindowFlags_Borderless)
+ WindowFlagTitled = WindowFlag(C.kWindowFlags_Titled)
+ WindowFlagResizable = WindowFlag(C.kWindowFlags_Resizable)
+ WindowFlagMaximizable = WindowFlag(C.kWindowFlags_Maximizable)
+)
+
// App is the main application object
type App struct {
app C.ULApp
@@ -385,6 +395,21 @@ func (app *App) NewWindow(width, height uint, fullscreen bool, title string) *Wi
return win
}
+//NewWindowUsingFlags creates a new window and allows you to set your own window flags.
+func (app *App) NewWindowUsingFlags(width, height uint, fullscreen bool, title string, flags WindowFlag) *Window {
+ win := &Window{win: C.ulCreateWindow(C.ulAppGetMainMonitor(app.app),
+ C.uint(width), C.uint(height),
+ C.bool(fullscreen),
+ C.uint(flags)),
+ app: app}
+
+ C.ulAppSetWindow(app.app, win.win)
+
+ win.SetTitle(title)
+ win.NewOverlay(width, height, 0, 0)
+ return win
+}
+
// Destroy destroys the window.
func (win *Window) Destroy() {
delete(win.app.windows, win.win)