Mentally ill people should have more power to decide whether or not they want to receive treatment, one of Britain's most senior judges has said.