The Walker_Page class was implemented in WordPress 2.1 to help create HTML list of pages. It extends the Walker class. You can also extend this class to add your own logic.
<?php
$walker_page = new Walker_Page();
$walker_page->walk($pages_array, $max_depth);
This example shows how to print a list of pages and display all levels:
<?php $walker_page = new Walker_Page(); echo '<ul>'.$walker_page->walk(get_pages(), 0).'</ul>'; // 0 means display all levels.
The first parameter of method walk accepts an array of pages, in this case, we get the array of pages using the method get_pages.
The second parameter is the max depth option.
Print list of all root pages:
<?php $walker_page = new Walker_Page(); echo '<ul>'.$walker_page->walk(get_pages(), 1).'</ul>';
Print list of all root pages including child pages:
<?php $walker_page = new Walker_Page(); echo '<ul>'.$walker_page->walk(get_pages(), 2).'</ul>';
Print list of all level but display it flatly. No inner <ul> element:
<?php $walker_page = new Walker_Page(); echo '<ul>'.$walker_page->walk(get_pages(), -1).'</ul>';
Walker_Page is located in wp-includes/class-walker-page.php