
GUI_WINDOW_CLASS db GUI_WINDOW_CLASS_NAME, 0
GUI_WINDOW_PROC equ GUI.Window.Proc

;; GUI.Window widget procedure
; @param e is one of CORE.Event family objects
; @returns 0 or error code
;;
proc GUI.Window.Proc obj:DWORD, e:DWORD
	xor	eax, eax
	ret
endp

proc GUI.Window.Create width:DWORD, height:DWORD, title:DWORD
	invoke	mem_alloc, sizeof.GUI.Window
	stdcall GUI.Window.Init, eax, [width], [height], [title]
	ret
endp

proc GUI.Window.Init obj:DWORD, width:DWORD, height:DWORD, title:DWORD
	push	ebx
	mov	ebx, [obj]
	stdcall CORE.Container.Init, ebx
	push	[width]
	pop	[ebx + CORE.Widget.rect.width]
	push	[height]
	pop	[ebx + CORE.Widget.rect.height]
	stdcall CORE.String.Create, [title]
	mov	[ebx + GUI.Window.title], eax
	mov	eax, ebx
	pop	ebx
	ret
endp

proc GUI.Window.Destroy obj:DWORD
	mov	eax, [obj]
	stdcall CORE.String.Destroy, [eax + GUI.Window.title]
	invoke	mem_free, [obj]
	ret
endp

proc GUI.Window.GetTitle obj:DWORD, text:DWORD
	ret
endp

proc GUI.Window.SetTitle obj:DWORD, text:DWORD
	ret
endp

proc GUI.Window.AddWidget obj:DWORD, wdgt:DWORD, x:DWORD, y:DWORD
	stdcall CORE.Container.AddItem, [obj], [wdgt]
	push	[x]
	pop	[eax + CORE.Widget.rect.left]
	push	[y]
	pop	[eax + CORE.Widget.rect.top]
	ret
endp

proc GUI.Window.RemoveWidget obj:DWORD, wdgt:DWORD
	stdcall CORE.Container.RemoveItem, [obj], [wdgt]
	ret
endp
