Added most of the Windows implementation of ProgressBar. Now to grab the comctl32.dll stuff.

This commit is contained in:
Pietro Gagliardi 2014-02-25 01:02:16 -05:00
parent d8c0df7993
commit 668de3bccb
2 changed files with 32 additions and 7 deletions

View File

@ -53,6 +53,10 @@ var stdDlgSizes = [nctypes]dlgunits{
// height is not clearly defined here ("an integral number of items (3 items minimum)") so just use a three-line edit control
height: 14 + 10 + 10,
},
c_progressbar: dlgunits{
width: 237, // the first reference says 107 also works; TODO decide which to use
height: 8,
},
}
var (

View File

@ -37,23 +37,23 @@ const controlstyle = _WS_CHILD | _WS_VISIBLE | _WS_TABSTOP
const controlxstyle = 0
var classTypes = [nctypes]*classData{
c_window: &classData{
c_window: &classData{
style: _WS_OVERLAPPEDWINDOW,
xstyle: 0,
},
c_button: &classData{
c_button: &classData{
name: "BUTTON",
style: _BS_PUSHBUTTON | controlstyle,
xstyle: 0 | controlxstyle,
font: &controlFont,
},
c_checkbox: &classData{
c_checkbox: &classData{
name: "BUTTON",
style: _BS_AUTOCHECKBOX | controlstyle,
xstyle: 0 | controlxstyle,
font: &controlFont,
},
c_combobox: &classData{
c_combobox: &classData{
name: "COMBOBOX",
style: _CBS_DROPDOWNLIST | _WS_VSCROLL | controlstyle,
xstyle: 0 | controlxstyle,
@ -66,19 +66,19 @@ var classTypes = [nctypes]*classData{
selectedIndexErr: _CB_ERR,
addSpaceErr: _CB_ERRSPACE,
},
c_lineedit: &classData{
c_lineedit: &classData{
name: "EDIT",
style: _ES_AUTOHSCROLL | _WS_BORDER | controlstyle,
xstyle: 0 | controlxstyle,
font: &controlFont,
},
c_label: &classData{
c_label: &classData{
name: "STATIC",
style: _SS_NOPREFIX | controlstyle,
xstyle: 0 | controlxstyle,
font: &controlFont,
},
c_listbox: &classData{
c_listbox: &classData{
name: "LISTBOX",
// TODO also _WS_HSCROLL?
style: _WS_VSCROLL | controlstyle,
@ -92,6 +92,11 @@ var classTypes = [nctypes]*classData{
selectedIndexErr: _LB_ERR,
addSpaceErr: _LB_ERRSPACE,
},
c_progressbar: &classData{
name: XXXXX,
style: _PBS_SMOOTH | controlstyle,
xstyle: 0 | controlxstyle,
},
}
func (s *sysData) addChild(child *sysData) _HMENU {
@ -501,3 +506,19 @@ func (s *sysData) delete(index int) (err error) {
}
return nil
}
func (s *sysData) setProgress(percent int) {
ret := make(chan uiret)
defer close(ret)
uitask <- &uimsg{
call: _sendMessage,
p: []uintptr{
uintptr(s.hwnd),
uintptr(_PBM_SETPOS),
uintptr(_WPARAM(percent)),
uintptr(0),
},
ret: ret,
}
<-ret
}