gowi

package module
v0.0.0-...-db71158 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2018 License: MIT Imports: 8 Imported by: 0

README

gowi

Gui for golang, UI created by ResEdit

Code

import ( "github.com/sumorf/gowi" . "github.com/sumorf/gowi/declarative" "fmt" )

type MyMainWindow struct { *gowi.MainWindow label1 *gowi.Label button1 *gowi.Button }

func main() { app := gowi.New()

mw := new(MyMainWindow)

m := MainWindow{
    AssignTo:&mw.MainWindow,
    ID:1000,
    Controls:[]Control{
        Button{
            AssignTo:&mw.button1,
            ID:1001,
            OnClicked:func() {
                fmt.Println("Button clicked.")
                mw.SetWindowText("Clicked")
            },
        },
    },
}
m.Create()
m.Show()

mw.SetWindowText("Hello")
app.Run()

}

Screenshots

How to design:

ResEdit

Run:

Running screenshot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppInstance

func GetAppInstance() win.HINSTANCE

Get application instance handle

func RegMsgHandler

func RegMsgHandler(window Window)

func UnRegMsgHandler

func UnRegMsgHandler(hwnd win.HWND)

Types

type Application

type Application struct {
}

func New

func New() *Application

func (*Application) Run

func (e *Application) Run() int

Run the main message loop

type Button

type Button struct {
	WindowBase
	OnClicked func()
	Clicked   *gosig.Signal
}

func NewButton

func NewButton(window MainWindow, id uintptr) *Button

func (*Button) WndProc

func (w *Button) WndProc(msg uint32, wparam, lparam uintptr) uintptr

type EventHandler

type EventHandler func()

type Icon

type Icon struct {
	// contains filtered or unexported fields
}

Icon is a bitmap that supports transparency and combining multiple variants of an image in different resolutions.

func IconApplication

func IconApplication() *Icon

func IconError

func IconError() *Icon

func IconInformation

func IconInformation() *Icon

func IconQuestion

func IconQuestion() *Icon

func IconShield

func IconShield() *Icon

func IconWarning

func IconWarning() *Icon
func IconWinLogo() *Icon

func NewIconFromFile

func NewIconFromFile(filePath string) (*Icon, error)

NewIconFromFile returns a new Icon, using the specified icon image file.

func NewIconFromImage

func NewIconFromImage(im image.Image) (ic *Icon, err error)

func NewIconFromResource

func NewIconFromResource(resName string) (ic *Icon, err error)

NewIconFromResource returns a new Icon, using the specified icon resource.

func (*Icon) Destroy

func (i *Icon) Destroy() bool

func (*Icon) Dispose

func (i *Icon) Dispose() error

Dispose releases the operating system resources associated with the Icon.

func (*Icon) Handle

func (i *Icon) Handle() win.HICON

type Label

type Label struct {
	WindowBase
}

func NewLabel

func NewLabel(window MainWindow, id uintptr) *Label

func (*Label) WndProc

func (w *Label) WndProc(msg uint32, wparam, lparam uintptr) uintptr

type LineEdit

type LineEdit struct {
	WindowBase
}

func NewLineEdit

func NewLineEdit(window MainWindow, id uintptr) *LineEdit

func (*LineEdit) WndProc

func (e *LineEdit) WndProc(msg uint32, wparam, lparam uintptr) uintptr

type ListView

type ListView struct {
	WindowBase
}

func NewListView

func NewListView(window MainWindow, id uintptr) *ListView

func (*ListView) WndProc

func (e *ListView) WndProc(msg uint32, wparam, lparam uintptr) uintptr

type MainWindow

type MainWindow struct {
	WindowBase
}

Dialog class

func (*MainWindow) AsWindowBase

func (w *MainWindow) AsWindowBase() *MainWindow

func (*MainWindow) Connect

func (w *MainWindow) Connect(sig *gosig.Signal, slot interface{})

func (*MainWindow) Create

func (w *MainWindow) Create(idd uintptr)

type Rect

type Rect struct {
	X, Y, Width, Height int
}

func (Rect) ToRECT

func (r Rect) ToRECT() win.RECT

type TabControl

type TabControl struct {
	WindowBase
}

func NewTabControl

func NewTabControl(window MainWindow, id uintptr) *TabControl

func (*TabControl) WndProc

func (w *TabControl) WndProc(msg uint32, wparam, lparam uintptr) uintptr

type Window

type Window interface {
	AsWindowBase() *WindowBase

	InitWindow(window MainWindow, id uintptr)

	Handle() win.HWND

	GetWindowText() string

	SetWindowText(title string)

	SetIcon(iconType int, icon *Icon)

	Show()

	Hide()

	ShowMinimized()

	ShowMaximized()

	ShowFullScreen()

	ShowNormal()

	IsEnabled() bool

	IsVisible() bool

	SetVisible(value bool)

	SetEnabled(b bool)

	SetDisabled(disable bool)

	SetFocus()

	Bounds() Rect

	SetBounds(value Rect)

	Close()

	WndProc(msg uint32, wparam, lparam uintptr) uintptr
}

Window

func GetMsgHandler

func GetMsgHandler(hwnd win.HWND) Window

type WindowBase

type WindowBase struct {
	// contains filtered or unexported fields
}

WindowBase

func (*WindowBase) AsWindowBase

func (w *WindowBase) AsWindowBase() *WindowBase

func (*WindowBase) Bounds

func (w *WindowBase) Bounds() Rect

func (*WindowBase) Close

func (w *WindowBase) Close()

func (*WindowBase) GetWindowText

func (w *WindowBase) GetWindowText() string

func (*WindowBase) Handle

func (w *WindowBase) Handle() win.HWND

func (*WindowBase) Hide

func (w *WindowBase) Hide()

func (*WindowBase) InitWindow

func (w *WindowBase) InitWindow(window MainWindow, id uintptr)

Set window resource Idd

func (*WindowBase) IsEnabled

func (w *WindowBase) IsEnabled() bool

func (*WindowBase) IsVisible

func (w *WindowBase) IsVisible() bool

func (*WindowBase) SetBounds

func (w *WindowBase) SetBounds(value Rect)

func (*WindowBase) SetDisabled

func (w *WindowBase) SetDisabled(disable bool)

func (*WindowBase) SetEnabled

func (w *WindowBase) SetEnabled(b bool)

func (*WindowBase) SetFocus

func (w *WindowBase) SetFocus()

func (*WindowBase) SetIcon

func (w *WindowBase) SetIcon(iconType int, icon *Icon)

IconType: 1 - ICON_BIG; 0 - ICON_SMALL

func (*WindowBase) SetVisible

func (w *WindowBase) SetVisible(value bool)

func (*WindowBase) SetWindowText

func (w *WindowBase) SetWindowText(title string)

func (*WindowBase) Show

func (w *WindowBase) Show()

func (*WindowBase) ShowFullScreen

func (w *WindowBase) ShowFullScreen()

func (*WindowBase) ShowMaximized

func (w *WindowBase) ShowMaximized()

func (*WindowBase) ShowMinimized

func (w *WindowBase) ShowMinimized()

func (*WindowBase) ShowNormal

func (w *WindowBase) ShowNormal()

func (*WindowBase) WndProc

func (w *WindowBase) WndProc(msg uint32, wparam, lparam uintptr) uintptr

Directories

Path Synopsis
examples
tab

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL