Beispiel #1
0
void ro_gui_options_theme_free(void)
{
	struct toolbar_display *toolbar;
	struct toolbar_display *next_toolbar;

	/* free all our toolbars */
	next_toolbar = toolbars;
	while ((toolbar = next_toolbar) != NULL) {
		next_toolbar = toolbar->next;
		xwimp_delete_icon(theme_pane, toolbar->icon_number);
		xwimp_delete_icon(theme_pane, toolbar->icon_number + 1);
		if (next_toolbar)
			xwimp_delete_icon(theme_pane,
					toolbar->icon_number + 2);
		ro_gui_theme_destroy_toolbar(toolbar->toolbar);
		free(toolbar);
	}
	toolbars = NULL;

	/* close all our themes */
	if (theme_list)
		ro_gui_theme_close(theme_list, true);
	theme_list = NULL;
}
Beispiel #2
0
bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
{
	wimp_icon_create	icon;
	os_error		*error;
	bool			resize;

	if (url_bar == NULL || url_bar->window == NULL)
		return false;

	icon.w = url_bar->window;
	icon.icon.extent.x0 = 0;
	icon.icon.extent.y0 = 0;
	icon.icon.extent.x1 = 0;
	icon.icon.extent.y1 = 0;

	resize = false;

	/* Create or delete the container icon. */

	if (!url_bar->hidden && url_bar->container_icon == -1) {
		icon.icon.flags = wimp_ICON_BORDER |
				(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT);
		error = xwimp_create_icon(&icon, &url_bar->container_icon);
		if (error != NULL) {
			LOG(("xwimp_create_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			url_bar->container_icon = -1;
			return false;
		}

		resize = true;
	} else  if (url_bar->hidden && url_bar->container_icon != -1){
		error = xwimp_delete_icon(url_bar->window,
				url_bar->container_icon);
		if (error != NULL) {
			LOG(("xwimp_delete_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			return false;
		}

		url_bar->container_icon = -1;
	}

	/* Create or delete the text icon. */

	if (!url_bar->hidden && url_bar->text_icon == -1) {
		icon.icon.data.indirected_text.text = url_bar->text_buffer;
		icon.icon.data.indirected_text.validation = text_validation;
		icon.icon.data.indirected_text.size = url_bar->text_size;
		icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
				wimp_ICON_VCENTRED | wimp_ICON_FILLED |
				(wimp_COLOUR_BLACK <<
					wimp_ICON_FG_COLOUR_SHIFT);
		if (url_bar->display)
			icon.icon.flags |= (wimp_BUTTON_NEVER <<
					wimp_ICON_BUTTON_TYPE_SHIFT);
		else
			icon.icon.flags |= (wimp_BUTTON_WRITE_CLICK_DRAG <<
					wimp_ICON_BUTTON_TYPE_SHIFT);
		error = xwimp_create_icon(&icon, &url_bar->text_icon);
		if (error) {
			LOG(("xwimp_create_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			url_bar->text_icon = -1;
			return false;
		}

		resize = true;
	} else if (url_bar->hidden && url_bar->text_icon != -1) {
		error = xwimp_delete_icon(url_bar->window,
				url_bar->text_icon);
		if (error != NULL) {
			LOG(("xwimp_delete_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			return false;
		}

		url_bar->text_icon = -1;
	}

	/* Create or delete the suggest icon. */

	if (!url_bar->hidden && url_bar->suggest_icon == -1) {
		icon.icon.data.indirected_text.text = null_text_string;
		icon.icon.data.indirected_text.size = 1;
		icon.icon.data.indirected_text.validation = suggest_validation;
		icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
				wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED |
				wimp_ICON_VCENTRED | (wimp_BUTTON_CLICK <<
				wimp_ICON_BUTTON_TYPE_SHIFT);
		error = xwimp_create_icon(&icon, &url_bar->suggest_icon);
		if (error) {
			LOG(("xwimp_create_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			return false;
		}

		if (!url_bar->display)
			ro_gui_wimp_event_register_menu_gright(url_bar->window,
					wimp_ICON_WINDOW, url_bar->suggest_icon,
					ro_gui_url_suggest_menu);

		if (!ro_gui_url_bar_update_urlsuggest(url_bar))
			return false;

		resize = true;
	} else if (url_bar->hidden && url_bar->suggest_icon != -1) {
		ro_gui_wimp_event_deregister(url_bar->window,
				url_bar->suggest_icon);
		error = xwimp_delete_icon(url_bar->window,
				url_bar->suggest_icon);
		if (error != NULL) {
			LOG(("xwimp_delete_icon: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("WimpError", error->errmess);
			return false;
		}

		url_bar->suggest_icon = -1;
	}

	/* If any icons were created, resize the bar. */

	if (resize && !ro_gui_url_bar_icon_resize(url_bar, true))
		return false;

	/* If there are any icons, apply shading as necessary. */

	if (url_bar->container_icon != -1)
		ro_gui_set_icon_shaded_state(url_bar->window,
				url_bar->container_icon, url_bar->shaded);

	if (url_bar->text_icon != -1)
		ro_gui_set_icon_shaded_state(url_bar->window,
				url_bar->text_icon, url_bar->shaded);

	if (url_bar->suggest_icon != -1)
		ro_gui_set_icon_shaded_state(url_bar->window,
				url_bar->suggest_icon, url_bar->shaded);

	return true;
}