Set the default control font on Windows to the expected standard font instead of to the default System font.
This commit is contained in:
parent
a9325fbfbc
commit
58f6bed7e4
|
@ -24,6 +24,7 @@ type classData struct {
|
||||||
xstyle uint32
|
xstyle uint32
|
||||||
mkid bool
|
mkid bool
|
||||||
altStyle uint32
|
altStyle uint32
|
||||||
|
font *_HANDLE
|
||||||
appendMsg uintptr
|
appendMsg uintptr
|
||||||
insertBeforeMsg uintptr
|
insertBeforeMsg uintptr
|
||||||
deleteMsg uintptr
|
deleteMsg uintptr
|
||||||
|
@ -44,17 +45,20 @@ var classTypes = [nctypes]*classData{
|
||||||
name: "BUTTON",
|
name: "BUTTON",
|
||||||
style: _BS_PUSHBUTTON | controlstyle,
|
style: _BS_PUSHBUTTON | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
|
font: &controlFont,
|
||||||
},
|
},
|
||||||
c_checkbox: &classData{
|
c_checkbox: &classData{
|
||||||
name: "BUTTON",
|
name: "BUTTON",
|
||||||
style: _BS_AUTOCHECKBOX | controlstyle,
|
style: _BS_AUTOCHECKBOX | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
|
font: &controlFont,
|
||||||
},
|
},
|
||||||
c_combobox: &classData{
|
c_combobox: &classData{
|
||||||
name: "COMBOBOX",
|
name: "COMBOBOX",
|
||||||
style: _CBS_DROPDOWNLIST | _WS_VSCROLL | controlstyle,
|
style: _CBS_DROPDOWNLIST | _WS_VSCROLL | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
altStyle: _CBS_DROPDOWN | _CBS_AUTOHSCROLL | _WS_VSCROLL | controlstyle,
|
altStyle: _CBS_DROPDOWN | _CBS_AUTOHSCROLL | _WS_VSCROLL | controlstyle,
|
||||||
|
font: &controlFont,
|
||||||
appendMsg: _CB_ADDSTRING,
|
appendMsg: _CB_ADDSTRING,
|
||||||
insertBeforeMsg: _CB_INSERTSTRING,
|
insertBeforeMsg: _CB_INSERTSTRING,
|
||||||
deleteMsg: _CB_DELETESTRING,
|
deleteMsg: _CB_DELETESTRING,
|
||||||
|
@ -66,11 +70,13 @@ var classTypes = [nctypes]*classData{
|
||||||
name: "EDIT",
|
name: "EDIT",
|
||||||
style: _ES_AUTOHSCROLL | _WS_BORDER | controlstyle,
|
style: _ES_AUTOHSCROLL | _WS_BORDER | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
|
font: &controlFont,
|
||||||
},
|
},
|
||||||
c_label: &classData{
|
c_label: &classData{
|
||||||
name: "STATIC",
|
name: "STATIC",
|
||||||
style: _SS_NOPREFIX | controlstyle,
|
style: _SS_NOPREFIX | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
|
font: &controlFont,
|
||||||
},
|
},
|
||||||
c_listbox: &classData{
|
c_listbox: &classData{
|
||||||
name: "LISTBOX",
|
name: "LISTBOX",
|
||||||
|
@ -78,6 +84,7 @@ var classTypes = [nctypes]*classData{
|
||||||
style: _WS_VSCROLL | controlstyle,
|
style: _WS_VSCROLL | controlstyle,
|
||||||
xstyle: 0 | controlxstyle,
|
xstyle: 0 | controlxstyle,
|
||||||
altStyle: _LBS_EXTENDEDSEL | _WS_VSCROLL | controlstyle,
|
altStyle: _LBS_EXTENDEDSEL | _WS_VSCROLL | controlstyle,
|
||||||
|
font: &controlFont,
|
||||||
appendMsg: _LB_ADDSTRING,
|
appendMsg: _LB_ADDSTRING,
|
||||||
insertBeforeMsg: _LB_INSERTSTRING,
|
insertBeforeMsg: _LB_INSERTSTRING,
|
||||||
deleteMsg: _LB_DELETESTRING,
|
deleteMsg: _LB_DELETESTRING,
|
||||||
|
@ -151,6 +158,19 @@ func (s *sysData) make(initText string, window *sysData) (err error) {
|
||||||
return fmt.Errorf("error actually creating window/control: %v", r.err)
|
return fmt.Errorf("error actually creating window/control: %v", r.err)
|
||||||
}
|
}
|
||||||
s.hwnd = _HWND(r.ret)
|
s.hwnd = _HWND(r.ret)
|
||||||
|
if ct.font != nil {
|
||||||
|
uitask <- &uimsg{
|
||||||
|
call: _sendMessage,
|
||||||
|
p: []uintptr{
|
||||||
|
uintptr(s.hwnd),
|
||||||
|
uintptr(_WM_SETFONT),
|
||||||
|
uintptr(_WPARAM(*ct.font)),
|
||||||
|
uintptr(_LPARAM(_TRUE)),
|
||||||
|
},
|
||||||
|
ret: ret,
|
||||||
|
}
|
||||||
|
<-ret
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue