Пример #1
0
func NewWindow(rsz, min bool) *Window {
	wnd := new(Window)
	wnd.resizable = rsz
	wnd.minimizable = min
	style := wnd.compileStyle()

	wnd.handle = w32.CreateWindowEx(
		/* exStyle */ 0,
		/* className */ wndClassName,
		/* windowName */ nil,
		/* style */ style,
		/* x */ w32.CW_USEDEFAULT,
		/* y */ w32.CW_USEDEFAULT,
		/* width */ w32.CW_USEDEFAULT,
		/* height */ w32.CW_USEDEFAULT,
		/* parent */ 0,
		/* menu */ 0,
		/* instance */ appHandle,
		/* param */ nil,
	)

	if wnd.handle == 0 {
		panic("Can't create window!")
	}

	windows = append(windows, wnd)

	return wnd
}
Пример #2
0
func (w *Window) NewListBox() *ListBox {
	lb := new(ListBox)
	lb.id = getNewControlId()
	lb.handle = w32.CreateWindowEx(
		/* exStyle */ w32.WS_EX_CLIENTEDGE,
		/* className */ listBoxClassName,
		/* windowName */ nil,
		/* style */ w32.WS_CHILD|w32.WS_VISIBLE|w32.WS_VSCROLL|w32.LBS_NOTIFY,
		/* x */ w32.CW_USEDEFAULT,
		/* y */ w32.CW_USEDEFAULT,
		/* width */ w32.CW_USEDEFAULT,
		/* height */ w32.CW_USEDEFAULT,
		/* parent */ w.handle,
		/* menu */ w32.HMENU(lb.id),
		/* instance */ appHandle,
		/* param */ nil,
	)
	controls = append(controls, lb)
	lb.Parent = w
	lb.setFont(defaultFont)
	return lb
}
Пример #3
0
func (w *Window) NewTextEdit() *TextEdit {
	te := new(TextEdit)
	te.id = getNewControlId()
	te.handle = w32.CreateWindowEx(
		/* exStyle */ w32.WS_EX_CLIENTEDGE,
		/* className */ textEditClassName,
		/* windowName */ nil,
		/* style */ w32.WS_CHILD|w32.WS_VISIBLE|w32.ES_AUTOHSCROLL,
		/* x */ w32.CW_USEDEFAULT,
		/* y */ w32.CW_USEDEFAULT,
		/* width */ w32.CW_USEDEFAULT,
		/* height */ w32.CW_USEDEFAULT,
		/* parent */ w.handle,
		/* menu */ w32.HMENU(te.id),
		/* instance */ appHandle,
		/* param */ nil,
	)
	controls = append(controls, te)
	te.Parent = w
	te.setFont(defaultFont)
	return te
}
Пример #4
0
func (w *Window) NewButton() *Button {
	b := new(Button)
	b.id = getNewControlId()
	b.handle = w32.CreateWindowEx(
		/* exStyle */ 0,
		/* className */ buttonClassName,
		/* windowName */ nil,
		/* style */ w32.WS_CHILD|w32.WS_VISIBLE|w32.BS_PUSHBUTTON,
		/* x */ w32.CW_USEDEFAULT,
		/* y */ w32.CW_USEDEFAULT,
		/* width */ w32.CW_USEDEFAULT,
		/* height */ w32.CW_USEDEFAULT,
		/* parent */ w.handle,
		/* menu */ w32.HMENU(b.id),
		/* instance */ appHandle,
		/* param */ nil,
	)
	controls = append(controls, b)
	b.Parent = w
	b.setFont(defaultFont)
	return b
}
Пример #5
0
func (w *Window) NewLabel() *Label {
	l := new(Label)
	l.id = getNewControlId()
	l.handle = w32.CreateWindowEx(
		/* exStyle */ 0,
		/* className */ labelClassName,
		/* windowName */ nil,
		/* style */ w32.WS_CHILD|w32.WS_VISIBLE,
		/* x */ w32.CW_USEDEFAULT,
		/* y */ w32.CW_USEDEFAULT,
		/* width */ w32.CW_USEDEFAULT,
		/* height */ w32.CW_USEDEFAULT,
		/* parent */ w.handle,
		/* menu */ w32.HMENU(l.id),
		/* instance */ appHandle,
		/* param */ nil,
	)
	controls = append(controls, l)
	l.Parent = w
	l.setFont(defaultFont)
	return l
}