// Include utility routines that create simple dialog boxes:
#include <cwidget/dialogs.h>
// Include the routines to control the cwidget system:
#include <cwidget/toplevel.h>

// Create a short alias for the "cwidget" namespace, so we can use
// cw::foo instead of cwidget::foo.
namespace cw = cwidget;

int main(int argc, char **argv)
{
  // Initialize ncurses and the cwidget system.
  cw::toplevel::init();

  // Create a simple dialog box that says "Hello, world!" and
  // shuts the program down when it is.  "text" will be deleted
  // when the dialog is closed.
  cw::widgets::widget_ref dialog =
    cw::dialogs::ok(L"Hello, world!",
		    cw::util::arg(sigc::ptr_fun(cw::toplevel::exitmain)));

  // Tell cwidget that this dialog should be the widget displayed in
  // the terminal.
  cw::toplevel::settoplevel(dialog);

  // Run the main loop.
  cw::toplevel::mainloop();

  // Shut down cwidget and restore the terminal state.
  cw::toplevel::shutdown();

  return 0;
}
