Index: uspace/app/uidemo/uidemo.c
===================================================================
--- uspace/app/uidemo/uidemo.c	(revision ef4d684195b9c9d5b45e99bd90a859bf7db2b97b)
+++ uspace/app/uidemo/uidemo.c	(revision db3895d936f17c9389f3e8e2689bf28645fc3697)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2023 Jiri Svoboda
+ * Copyright (c) 2021 Jiri Svoboda
  * All rights reserved.
  *
@@ -40,20 +40,13 @@
 #include <str.h>
 #include <ui/entry.h>
-#include <ui/filedialog.h>
 #include <ui/fixed.h>
 #include <ui/image.h>
 #include <ui/label.h>
-#include <ui/list.h>
+#include <ui/menubar.h>
+#include <ui/menuentry.h>
 #include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
 #include <ui/msgdialog.h>
 #include <ui/pbutton.h>
-#include <ui/promptdialog.h>
 #include <ui/resource.h>
-#include <ui/selectdialog.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
 #include <ui/ui.h>
 #include <ui/window.h>
@@ -92,53 +85,6 @@
 };
 
-static void scrollbar_up(ui_scrollbar_t *, void *);
-static void scrollbar_down(ui_scrollbar_t *, void *);
-static void scrollbar_page_up(ui_scrollbar_t *, void *);
-static void scrollbar_page_down(ui_scrollbar_t *, void *);
-static void scrollbar_moved(ui_scrollbar_t *, void *, gfx_coord_t);
-
-static ui_scrollbar_cb_t scrollbar_cb = {
-	.up = scrollbar_up,
-	.down = scrollbar_down,
-	.page_up = scrollbar_page_up,
-	.page_down = scrollbar_page_down,
-	.moved = scrollbar_moved
-};
-
-static void uidemo_file_load(ui_menu_entry_t *, void *);
 static void uidemo_file_message(ui_menu_entry_t *, void *);
 static void uidemo_file_exit(ui_menu_entry_t *, void *);
-static void uidemo_edit_modify(ui_menu_entry_t *, void *);
-static void uidemo_edit_insert_character(ui_menu_entry_t *, void *);
-
-static void file_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void file_dialog_bcancel(ui_file_dialog_t *, void *);
-static void file_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t file_dialog_cb = {
-	.bok = file_dialog_bok,
-	.bcancel = file_dialog_bcancel,
-	.close = file_dialog_close
-};
-
-static void prompt_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void prompt_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void prompt_dialog_close(ui_prompt_dialog_t *, void *);
-
-static ui_prompt_dialog_cb_t prompt_dialog_cb = {
-	.bok = prompt_dialog_bok,
-	.bcancel = prompt_dialog_bcancel,
-	.close = prompt_dialog_close
-};
-
-static void select_dialog_bok(ui_select_dialog_t *, void *, void *);
-static void select_dialog_bcancel(ui_select_dialog_t *, void *);
-static void select_dialog_close(ui_select_dialog_t *, void *);
-
-static ui_select_dialog_cb_t select_dialog_cb = {
-	.bok = select_dialog_bok,
-	.bcancel = select_dialog_bcancel,
-	.close = select_dialog_close
-};
 
 static void msg_dialog_button(ui_msg_dialog_t *, void *, unsigned);
@@ -150,11 +96,4 @@
 };
 
-/** Horizontal alignment selected by each radio button */
-static const gfx_halign_t uidemo_halign[3] = {
-	gfx_halign_left,
-	gfx_halign_center,
-	gfx_halign_right
-};
-
 /** Window close button was clicked.
  *
@@ -183,8 +122,10 @@
 		if (rc != EOK)
 			printf("Error changing entry text.\n");
+		(void) ui_entry_paint(demo->entry);
 	} else {
 		rc = ui_entry_set_text(demo->entry, "Cancel pressed");
 		if (rc != EOK)
 			printf("Error changing entry text.\n");
+		(void) ui_entry_paint(demo->entry);
 	}
 }
@@ -198,6 +139,17 @@
 {
 	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_entry_set_read_only(demo->entry, enable);
+	errno_t rc;
+
+	if (enable) {
+		rc = ui_entry_set_text(demo->entry, "Checked");
+		if (rc != EOK)
+			printf("Error changing entry text.\n");
+		(void) ui_entry_paint(demo->entry);
+	} else {
+		rc = ui_entry_set_text(demo->entry, "Unchecked");
+		if (rc != EOK)
+			printf("Error changing entry text.\n");
+		(void) ui_entry_paint(demo->entry);
+	}
 }
 
@@ -211,7 +163,10 @@
 {
 	ui_demo_t *demo = (ui_demo_t *) garg;
-	gfx_halign_t halign = *(gfx_halign_t *) barg;
-
-	ui_entry_set_halign(demo->entry, halign);
+	const char *text = (const char *) barg;
+	errno_t rc;
+
+	rc = ui_entry_set_text(demo->entry, text);
+	if (rc != EOK)
+		printf("Error changing entry text.\n");
 	(void) ui_entry_paint(demo->entry);
 }
@@ -245,150 +200,5 @@
 }
 
-/** Scrollbar up button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos - 1);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar down button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos + 1);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar page up event.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_page_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos -
-	    ui_scrollbar_trough_length(scrollbar) / 4);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar page down event.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_page_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos +
-	    ui_scrollbar_trough_length(scrollbar) / 4);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar was moved.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- * @param pos Position
- */
-static void scrollbar_moved(ui_scrollbar_t *scrollbar, void *arg,
-    gfx_coord_t pos)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char *str;
-	errno_t rc;
-	int rv;
-
-	rv = asprintf(&str, "Scrollbar: %d of %d", (int) pos,
-	    ui_scrollbar_move_length(scrollbar));
-	if (rv < 0) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = ui_entry_set_text(demo->entry, str);
-	if (rc != EOK)
-		printf("Error changing entry text.\n");
-	(void) ui_entry_paint(demo->entry);
-
-	free(str);
-}
-
-/** Display a message window.
- *
- * @param demo UI demo
- * @param caption Window caption
- * @param text Message text
- */
-static void uidemo_show_message(ui_demo_t *demo, const char *caption,
-    const char *text)
-{
-	ui_msg_dialog_params_t mdparams;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&mdparams);
-	mdparams.caption = caption;
-	mdparams.text = text;
-
-	rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-}
-
-/** File / Load menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_load(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_file_dialog_params_t fdparams;
-	ui_file_dialog_t *dialog;
-	errno_t rc;
-
-	ui_file_dialog_params_init(&fdparams);
-	fdparams.caption = "Load File";
-
-	rc = ui_file_dialog_create(demo->ui, &fdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_file_dialog_set_cb(dialog, &file_dialog_cb, demo);
-}
-
-/** File / Message menu entry selected.
+/** File/message menu entry selected.
  *
  * @param mentry Menu entry
@@ -413,7 +223,8 @@
 
 	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-}
-
-/** File / Exit menu entry selected.
+
+}
+
+/** File/exit menu entry selected.
  *
  * @param mentry Menu entry
@@ -425,238 +236,4 @@
 
 	ui_quit(demo->ui);
-}
-
-/** Edit / Modify menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_edit_modify(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_prompt_dialog_params_t pdparams;
-	ui_prompt_dialog_t *dialog;
-	errno_t rc;
-
-	ui_prompt_dialog_params_init(&pdparams);
-	pdparams.caption = "Modify Entry Text";
-	pdparams.prompt = "Enter New Text";
-
-	rc = ui_prompt_dialog_create(demo->ui, &pdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating prompt dialog.\n");
-		return;
-	}
-
-	ui_prompt_dialog_set_cb(dialog, &prompt_dialog_cb, demo);
-}
-
-/** Edit / Insert Character menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_edit_insert_character(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_select_dialog_params_t sdparams;
-	ui_select_dialog_t *dialog;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	ui_select_dialog_params_init(&sdparams);
-	sdparams.caption = "Insert Character";
-	sdparams.prompt = "Select character to insert";
-
-	rc = ui_select_dialog_create(demo->ui, &sdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating select dialog.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Dollar sign ($)";
-	attr.arg = (void *)'$';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Hash sign (#)";
-	attr.arg = (void *)'#';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Question mark (?)";
-	attr.arg = (void *)'?';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_select_dialog_set_cb(dialog, &select_dialog_cb, demo);
-
-	(void) ui_select_dialog_paint(dialog);
-}
-
-/** File dialog OK button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- * @param fname File name
- */
-static void file_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char buf[128];
-	char *p;
-	FILE *f;
-
-	ui_file_dialog_destroy(dialog);
-
-	f = fopen(fname, "rt");
-	if (f == NULL) {
-		uidemo_show_message(demo, "Error", "Error opening file.");
-		return;
-	}
-
-	p = fgets(buf, sizeof(buf), f);
-	if (p == NULL) {
-		uidemo_show_message(demo, "Error", "Error reading file.");
-		fclose(f);
-		return;
-	}
-
-	/* Cut string off at the first non-printable character */
-	p = buf;
-	while (*p != '\0') {
-		if (*p < ' ') {
-			*p = '\0';
-			break;
-		}
-		++p;
-	}
-
-	ui_entry_set_text(demo->entry, buf);
-	fclose(f);
-}
-
-/** File dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void file_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** File dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void file_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Prompt dialog OK button press.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void prompt_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *text)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_prompt_dialog_destroy(dialog);
-	ui_entry_set_text(demo->entry, text);
-}
-
-/** Prompt dialog cancel button press.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void prompt_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Prompt dialog close request.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void prompt_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Select dialog OK button press.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void select_dialog_bok(ui_select_dialog_t *dialog, void *arg,
-    void *earg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char str[2];
-
-	ui_select_dialog_destroy(dialog);
-	str[0] = (char)(intptr_t)earg;
-	str[1] = '\0';
-	(void) ui_entry_insert_str(demo->entry, str);
-}
-
-/** Select dialog cancel button press.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void select_dialog_bcancel(ui_select_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_select_dialog_destroy(dialog);
-}
-
-/** Select dialog close request.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void select_dialog_close(ui_select_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_select_dialog_destroy(dialog);
 }
 
@@ -703,14 +280,9 @@
 	gfx_coord2_t off;
 	ui_menu_entry_t *mmsg;
-	ui_menu_entry_t *mload;
 	ui_menu_entry_t *mfoo;
 	ui_menu_entry_t *mbar;
 	ui_menu_entry_t *mfoobar;
-	ui_menu_entry_t *msep;
 	ui_menu_entry_t *mexit;
-	ui_menu_entry_t *mmodify;
-	ui_menu_entry_t *minsert_char;
 	ui_menu_entry_t *mabout;
-	ui_list_entry_attr_t eattr;
 	errno_t rc;
 
@@ -726,5 +298,5 @@
 	ui_wnd_params_init(&params);
 	params.caption = "UI Demo";
-	params.style |= ui_wds_maximize_btn | ui_wds_resizable;
+	params.style |= ui_wds_resizable;
 
 	/* FIXME: Auto layout */
@@ -732,11 +304,11 @@
 		params.rect.p0.x = 0;
 		params.rect.p0.y = 0;
-		params.rect.p1.x = 46;
+		params.rect.p1.x = 80;
 		params.rect.p1.y = 25;
 	} else {
 		params.rect.p0.x = 0;
 		params.rect.p0.y = 0;
-		params.rect.p1.x = 255;
-		params.rect.p1.y = 410;
+		params.rect.p1.x = 220;
+		params.rect.p1.y = 350;
 	}
 
@@ -765,11 +337,11 @@
 	}
 
-	rc = ui_menu_dd_create(demo.mbar, "~F~ile", NULL, &demo.mfile);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "~M~essage", "", &mmsg);
+	rc = ui_menu_create(demo.mbar, "File", &demo.mfile);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_create(demo.mfile, "Message", "", &mmsg);
 	if (rc != EOK) {
 		printf("Error creating menu.\n");
@@ -779,39 +351,29 @@
 	ui_menu_entry_set_cb(mmsg, uidemo_file_message, (void *) &demo);
 
-	rc = ui_menu_entry_create(demo.mfile, "~L~oad", "", &mload);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mload, uidemo_file_load, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.mfile, "~F~oo", "Ctrl-Alt-Del", &mfoo);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "~B~ar", "", &mbar);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "F~o~obar", "", &mfoobar);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_disabled(mfoobar, true);
-
-	rc = ui_menu_entry_sep_create(demo.mfile, &msep);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "E~x~it", "Alt-F4", &mexit);
+	rc = ui_menu_entry_create(demo.mfile, "Foo", "Ctrl-Alt-Del", &mfoo);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_create(demo.mfile, "Bar", "", &mbar);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_create(demo.mfile, "Foobar", "", &mfoobar);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_sep_create(demo.mfile, &mexit);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_create(demo.mfile, "Exit", "Alt-F4", &mexit);
 	if (rc != EOK) {
 		printf("Error creating menu.\n");
@@ -821,42 +383,23 @@
 	ui_menu_entry_set_cb(mexit, uidemo_file_exit, (void *) &demo);
 
-	rc = ui_menu_dd_create(demo.mbar, "~E~dit", NULL, &demo.medit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.medit, "~M~odify", "", &mmodify);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mmodify, uidemo_edit_modify, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.medit, "~I~nsert Character",
-	    "", &minsert_char);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(minsert_char, uidemo_edit_insert_character,
-	    (void *) &demo);
-
-	rc = ui_menu_dd_create(demo.mbar, "~P~references", NULL,
-	    &demo.mpreferences);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_dd_create(demo.mbar, "~H~elp", NULL, &demo.mhelp);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mhelp, "~A~bout", "Ctrl-H, F1", &mabout);
+	rc = ui_menu_create(demo.mbar, "Edit", &demo.medit);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_create(demo.mbar, "Preferences", &demo.mpreferences);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_create(demo.mbar, "Help", &demo.mhelp);
+	if (rc != EOK) {
+		printf("Error creating menu.\n");
+		return rc;
+	}
+
+	rc = ui_menu_entry_create(demo.mhelp, "About", "Ctrl-H, F1", &mabout);
 	if (rc != EOK) {
 		printf("Error creating menu.\n");
@@ -867,14 +410,13 @@
 	if (ui_is_textmode(ui)) {
 		rect.p0.x = 1;
-		rect.p0.y = 1;
-		rect.p1.x = 43;
-		rect.p1.y = 2;
+		rect.p0.y = 2;
+		rect.p1.x = 79;
+		rect.p1.y = 3;
 	} else {
 		rect.p0.x = 4;
 		rect.p0.y = 30;
-		rect.p1.x = 251;
+		rect.p1.x = 216;
 		rect.p1.y = 52;
 	}
-
 	ui_menu_bar_set_rect(demo.mbar, &rect);
 
@@ -885,49 +427,4 @@
 	}
 
-	rc = ui_tab_set_create(ui_res, &demo.tabset);
-	if (rc != EOK) {
-		printf("Error creating tab set.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 2;
-		rect.p0.y = 2;
-		rect.p1.x = 44;
-		rect.p1.y = 24;
-	} else {
-		rect.p0.x = 8;
-		rect.p0.y = 53;
-		rect.p1.x = 250;
-		rect.p1.y = 405;
-	}
-
-	ui_tab_set_set_rect(demo.tabset, &rect);
-
-	rc = ui_tab_create(demo.tabset, "Basic", &demo.tbasic);
-	if (rc != EOK) {
-		printf("Error creating tab.\n");
-		return rc;
-	}
-
-	rc = ui_tab_create(demo.tabset, "Lists", &demo.tlists);
-	if (rc != EOK) {
-		printf("Error creating tab.\n");
-		return rc;
-	}
-
-	rc = ui_fixed_add(demo.fixed, ui_tab_set_ctl(demo.tabset));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_fixed_create(&demo.bfixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
 	rc = ui_entry_create(window, "", &demo.entry);
 	if (rc != EOK) {
@@ -936,21 +433,12 @@
 	}
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 41;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 88;
-		rect.p1.x = 205;
-		rect.p1.y = 113;
-	}
-
+	rect.p0.x = 15;
+	rect.p0.y = 53;
+	rect.p1.x = 205;
+	rect.p1.y = 78;
 	ui_entry_set_rect(demo.entry, &rect);
 	ui_entry_set_halign(demo.entry, gfx_halign_center);
 
-	rc = ui_fixed_add(demo.bfixed, ui_entry_ctl(demo.entry));
+	rc = ui_fixed_add(demo.fixed, ui_entry_ctl(demo.entry));
 	if (rc != EOK) {
 		printf("Error adding control to layout.\n");
@@ -964,21 +452,12 @@
 	}
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 7;
-		rect.p1.x = 41;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 60;
-		rect.p0.y = 123;
-		rect.p1.x = 160;
-		rect.p1.y = 136;
-	}
-
+	rect.p0.x = 60;
+	rect.p0.y = 88;
+	rect.p1.x = 160;
+	rect.p1.y = 101;
 	ui_label_set_rect(demo.label, &rect);
 	ui_label_set_halign(demo.label, gfx_halign_center);
 
-	rc = ui_fixed_add(demo.bfixed, ui_label_ctl(demo.label));
+	rc = ui_fixed_add(demo.fixed, ui_label_ctl(demo.label));
 	if (rc != EOK) {
 		printf("Error adding control to layout.\n");
@@ -994,22 +473,13 @@
 	ui_pbutton_set_cb(demo.pb1, &pbutton_cb, (void *) &demo);
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 9;
-		rect.p1.x = 15;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 146;
-		rect.p1.x = 105;
-		rect.p1.y = 174;
-	}
-
+	rect.p0.x = 15;
+	rect.p0.y = 111;
+	rect.p1.x = 105;
+	rect.p1.y = 139;
 	ui_pbutton_set_rect(demo.pb1, &rect);
 
 	ui_pbutton_set_default(demo.pb1, true);
 
-	rc = ui_fixed_add(demo.bfixed, ui_pbutton_ctl(demo.pb1));
+	rc = ui_fixed_add(demo.fixed, ui_pbutton_ctl(demo.pb1));
 	if (rc != EOK) {
 		printf("Error adding control to layout.\n");
@@ -1025,19 +495,11 @@
 	ui_pbutton_set_cb(demo.pb2, &pbutton_cb, (void *) &demo);
 
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 30;
-		rect.p0.y = 9;
-		rect.p1.x = 41;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 115;
-		rect.p0.y = 146;
-		rect.p1.x = 205;
-		rect.p1.y = 174;
-	}
-
+	rect.p0.x = 115;
+	rect.p0.y = 111;
+	rect.p1.x = 205;
+	rect.p1.y = 139;
 	ui_pbutton_set_rect(demo.pb2, &rect);
 
-	rc = ui_fixed_add(demo.bfixed, ui_pbutton_ctl(demo.pb2));
+	rc = ui_fixed_add(demo.fixed, ui_pbutton_ctl(demo.pb2));
 	if (rc != EOK) {
 		printf("Error adding control to layout.\n");
@@ -1046,15 +508,8 @@
 
 	gfx_bitmap_params_init(&bparams);
-	if (ui_is_textmode(ui)) {
-		bparams.rect.p0.x = 0;
-		bparams.rect.p0.y = 0;
-		bparams.rect.p1.x = 37;
-		bparams.rect.p1.y = 2;
-	} else {
-		bparams.rect.p0.x = 0;
-		bparams.rect.p0.y = 0;
-		bparams.rect.p1.x = 188;
-		bparams.rect.p1.y = 24;
-	}
+	bparams.rect.p0.x = 0;
+	bparams.rect.p0.y = 0;
+	bparams.rect.p1.x = 188;
+	bparams.rect.p1.y = 24;
 
 	rc = gfx_bitmap_create(gc, &bparams, NULL, &bitmap);
@@ -1072,30 +527,21 @@
 	}
 
-	if (ui_is_textmode(ui)) {
-		off.x = 4;
-		off.y = 11;
-	} else {
-		off.x = 15;
-		off.y = 190;
-	}
-
+	off.x = 15;
+	off.y = 155;
 	gfx_rect_translate(&off, &bparams.rect, &rect);
 
 	/* Adjust for frame width (2 x 1 pixel) */
-	if (!ui_is_textmode(ui)) {
-		ui_image_set_flags(demo.image, ui_imgf_frame);
-		rect.p1.x += 2;
-		rect.p1.y += 2;
-	}
-
+	rect.p1.x += 2;
+	rect.p1.y += 2;
 	ui_image_set_rect(demo.image, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_image_ctl(demo.image));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_checkbox_create(ui_res, "Read only", &demo.checkbox);
+	ui_image_set_flags(demo.image, ui_imgf_frame);
+
+	rc = ui_fixed_add(demo.fixed, ui_image_ctl(demo.image));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		return rc;
+	}
+
+	rc = ui_checkbox_create(ui_res, "Check me", &demo.checkbox);
 	if (rc != EOK) {
 		printf("Error creating check box.\n");
@@ -1105,20 +551,11 @@
 	ui_checkbox_set_cb(demo.checkbox, &checkbox_cb, (void *) &demo);
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 14;
-		rect.p1.x = 14;
-		rect.p1.y = 15;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 225;
-		rect.p1.x = 140;
-		rect.p1.y = 245;
-	}
-
+	rect.p0.x = 15;
+	rect.p0.y = 190;
+	rect.p1.x = 140;
+	rect.p1.y = 210;
 	ui_checkbox_set_rect(demo.checkbox, &rect);
 
-	rc = ui_fixed_add(demo.bfixed, ui_checkbox_ctl(demo.checkbox));
+	rc = ui_fixed_add(demo.fixed, ui_checkbox_ctl(demo.checkbox));
 	if (rc != EOK) {
 		printf("Error adding control to layout.\n");
@@ -1132,6 +569,6 @@
 	}
 
-	rc = ui_rbutton_create(demo.rbgroup, "Left", (void *) &uidemo_halign[0],
-	    &demo.rbleft);
+	rc = ui_rbutton_create(demo.rbgroup, "Option 1", (void *) "First",
+	    &demo.rb1);
 	if (rc != EOK) {
 		printf("Error creating radio button.\n");
@@ -1142,26 +579,18 @@
 	    (void *) &demo);
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 16;
-		rect.p1.x = 14;
-		rect.p1.y = 17;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 255;
-		rect.p1.x = 140;
-		rect.p1.y = 275;
-	}
-	ui_rbutton_set_rect(demo.rbleft, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbleft));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_create(demo.rbgroup, "Center", (void *) &uidemo_halign[1],
-	    &demo.rbcenter);
+	rect.p0.x = 15;
+	rect.p0.y = 220;
+	rect.p1.x = 140;
+	rect.p1.y = 240;
+	ui_rbutton_set_rect(demo.rb1, &rect);
+
+	rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb1));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		return rc;
+	}
+
+	rc = ui_rbutton_create(demo.rbgroup, "Option 2", (void *) "Second",
+	    &demo.rb2);
 	if (rc != EOK) {
 		printf("Error creating radio button.\n");
@@ -1169,27 +598,18 @@
 	}
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 17;
-		rect.p1.x = 14;
-		rect.p1.y = 18;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 285;
-		rect.p1.x = 140;
-		rect.p1.y = 305;
-	}
-	ui_rbutton_set_rect(demo.rbcenter, &rect);
-	ui_rbutton_select(demo.rbcenter);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbcenter));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_create(demo.rbgroup, "Right", (void *) &uidemo_halign[2],
-	    &demo.rbright);
+	rect.p0.x = 15;
+	rect.p0.y = 250;
+	rect.p1.x = 140;
+	rect.p1.y = 270;
+	ui_rbutton_set_rect(demo.rb2, &rect);
+
+	rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb2));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		return rc;
+	}
+
+	rc = ui_rbutton_create(demo.rbgroup, "Option 3", (void *) "Third",
+	    &demo.rb3);
 	if (rc != EOK) {
 		printf("Error creating radio button.\n");
@@ -1197,25 +617,17 @@
 	}
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 18;
-		rect.p1.x = 14;
-		rect.p1.y = 19;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 315;
-		rect.p1.x = 140;
-		rect.p1.y = 335;
-	}
-	ui_rbutton_set_rect(demo.rbright, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbright));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_slider_create(ui_res, &demo.slider);
+	rect.p0.x = 15;
+	rect.p0.y = 280;
+	rect.p1.x = 140;
+	rect.p1.y = 300;
+	ui_rbutton_set_rect(demo.rb3, &rect);
+
+	rc = ui_fixed_add(demo.fixed, ui_rbutton_ctl(demo.rb3));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		return rc;
+	}
+
+	rc = ui_slider_create(ui_res, "Slide!", &demo.slider);
 	if (rc != EOK) {
 		printf("Error creating button.\n");
@@ -1225,169 +637,15 @@
 	ui_slider_set_cb(demo.slider, &slider_cb, (void *) &demo);
 
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 20;
-		rect.p1.x = 32;
-		rect.p1.y = 21;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 345;
-		rect.p1.x = 130;
-		rect.p1.y = 365;
-	}
-
+	rect.p0.x = 15;
+	rect.p0.y = 310;
+	rect.p1.x = 130;
+	rect.p1.y = 330;
 	ui_slider_set_rect(demo.slider, &rect);
 
-	rc = ui_fixed_add(demo.bfixed, ui_slider_ctl(demo.slider));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &demo.hscrollbar);
-	if (rc != EOK) {
-		printf("Error creating scrollbar.\n");
-		return rc;
-	}
-
-	ui_scrollbar_set_cb(demo.hscrollbar, &scrollbar_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 22;
-		rect.p1.x = 42;
-		rect.p1.y = 23;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 375;
-		rect.p1.x = 220;
-		rect.p1.y = 398;
-	}
-
-	ui_scrollbar_set_rect(demo.hscrollbar, &rect);
-
-	ui_scrollbar_set_thumb_length(demo.hscrollbar,
-	    ui_scrollbar_trough_length(demo.hscrollbar) / 4);
-
-	rc = ui_fixed_add(demo.bfixed, ui_scrollbar_ctl(demo.hscrollbar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_vert, &demo.vscrollbar);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_scrollbar_set_cb(demo.vscrollbar, &scrollbar_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 42;
-		rect.p0.y = 5;
-		rect.p1.x = 43;
-		rect.p1.y = 22;
-	} else {
-		rect.p0.x = 220;
-		rect.p0.y = 88;
-		rect.p1.x = 243;
-		rect.p1.y = 375;
-	}
-
-	ui_scrollbar_set_rect(demo.vscrollbar, &rect);
-
-	ui_scrollbar_set_thumb_length(demo.vscrollbar,
-	    ui_scrollbar_trough_length(demo.vscrollbar) / 4);
-
-	rc = ui_fixed_add(demo.bfixed, ui_scrollbar_ctl(demo.vscrollbar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_tab_add(demo.tbasic, ui_fixed_ctl(demo.bfixed));
-
-	rc = ui_fixed_create(&demo.lfixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_list_create(window, false, &demo.list);
-	if (rc != EOK) {
-		printf("Error creating list.\n");
-		return rc;
-	}
-
-	ui_list_entry_attr_init(&eattr);
-
-	eattr.caption = "One";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Two";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Three";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Four";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Five";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Six";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 41;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 88;
-		rect.p1.x = 245;
-		rect.p1.y = 173;
-	}
-
-	ui_list_set_rect(demo.list, &rect);
-
-	rc = ui_fixed_add(demo.lfixed, ui_list_ctl(demo.list));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_tab_add(demo.tlists, ui_fixed_ctl(demo.lfixed));
+	rc = ui_fixed_add(demo.fixed, ui_slider_ctl(demo.slider));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		return rc;
+	}
 
 	ui_window_add(window, ui_fixed_ctl(demo.fixed));
@@ -1435,5 +693,5 @@
 			k = i * i + j * j;
 			pixelmap_put_pixel(&pixelmap, i, j,
-			    PIXEL(0, k, k, 255 - k));
+			    PIXEL(255, k, k, 255 - k));
 		}
 	}
@@ -1449,5 +707,5 @@
 int main(int argc, char *argv[])
 {
-	const char *display_spec = UI_ANY_DEFAULT;
+	const char *display_spec = UI_DISPLAY_DEFAULT;
 	errno_t rc;
 	int i;
