void ro_gui_options_update_shading(wimp_w w) { bool shaded; shaded = ro_gui_get_icon_selected_state(w, IMAGE_DISABLE_ANIMATION); ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_TEXT, shaded); ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_FIELD, shaded); ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_DEC, shaded); ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_INC, shaded); ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_CS, shaded); }
bool ro_gui_options_interface_initialise(wimp_w w) { /* set the current values */ ro_gui_set_icon_selected_state(w, INTERFACE_STRIP_EXTNS_OPTION, nsoption_bool(strip_extensions)); ro_gui_set_icon_selected_state(w, INTERFACE_CONFIRM_OVWR_OPTION, nsoption_bool(confirm_overwrite)); ro_gui_set_icon_selected_state(w, INTERFACE_URL_COMPLETE_OPTION, nsoption_bool(url_suggestion)); ro_gui_set_icon_selected_state(w, INTERFACE_HISTORY_TOOLTIP_OPTION, nsoption_bool(history_tooltip)); ro_gui_set_icon_selected_state(w, INTERFACE_THUMBNAIL_ICONISE_OPTION, nsoption_bool(thumbnail_iconise)); ro_gui_set_icon_selected_state(w, INTERFACE_USE_EXTERNAL_HOTLIST, nsoption_bool(external_hotlists)); ro_gui_set_icon_string(w, INTERFACE_EXTERNAL_HOTLIST_APP, (nsoption_charp(external_hotlist_app)) ? nsoption_charp(external_hotlist_app) : "", false); ro_gui_set_icon_shaded_state(w, INTERFACE_EXTERNAL_HOTLIST_APP, !nsoption_bool(external_hotlists)); /* initialise all functions for a newly created window */ ro_gui_wimp_event_register_mouse_click(w, ro_gui_options_interface_click); ro_gui_wimp_event_register_button(w, INTERFACE_DEFAULT_BUTTON, ro_gui_options_interface_default); ro_gui_wimp_event_register_cancel(w, INTERFACE_CANCEL_BUTTON); ro_gui_wimp_event_register_ok(w, INTERFACE_OK_BUTTON, ro_gui_options_interface_ok); ro_gui_wimp_event_set_help_prefix(w, "HelpInterfaceConfig"); ro_gui_wimp_event_memorise(w); return true; }
bool ro_gui_options_home_initialise(wimp_w w) { /* set the current values */ ro_gui_set_icon_string(w, HOME_URL_FIELD, nsoption_charp(homepage_url) ? nsoption_charp(homepage_url) : "", true); ro_gui_set_icon_selected_state(w, HOME_OPEN_STARTUP, nsoption_bool(open_browser_at_startup)); ro_gui_set_icon_shaded_state(w, HOME_URL_GRIGHT, !ro_gui_url_suggest_prepare_menu()); /* initialise all functions for a newly created window */ ro_gui_wimp_event_register_menu_gright(w, HOME_URL_FIELD, HOME_URL_GRIGHT, ro_gui_url_suggest_menu); ro_gui_wimp_event_register_checkbox(w, HOME_OPEN_STARTUP); ro_gui_wimp_event_register_button(w, HOME_DEFAULT_BUTTON, ro_gui_options_home_default); ro_gui_wimp_event_register_cancel(w, HOME_CANCEL_BUTTON); ro_gui_wimp_event_register_ok(w, HOME_OK_BUTTON, ro_gui_options_home_ok); ro_gui_wimp_event_register_menu_prepare(w, ro_gui_options_home_menu_prepare); ro_gui_wimp_event_set_help_prefix(w, "HelpHomeConfig"); ro_gui_wimp_event_memorise(w); return true; }
bool ro_gui_url_bar_update_urlsuggest(struct url_bar *url_bar) { if (url_bar == NULL || url_bar->hidden) return (url_bar == NULL) ? false : true; if (url_bar->window != NULL && url_bar->suggest_icon != -1) ro_gui_set_icon_shaded_state(url_bar->window, url_bar->suggest_icon, !ro_gui_url_suggest_get_menu_available()); return true; }
nserror theme_install_callback(hlcache_handle *handle, const hlcache_event *event, void *pw) { char buffer[256]; int author_indent = 0; switch (event->type) { case CONTENT_MSG_DONE: { const char *source_data; unsigned long source_size; theme_install_content = handle; source_data = content_get_source_data(handle, &source_size); if (!theme_install_read(source_data, source_size)) { warn_user("ThemeInvalid", 0); theme_install_close(dialog_theme_install); break; } /* remove '© ' from the start of the data */ if (theme_install_descriptor.author[0] == '©') author_indent++; while (theme_install_descriptor.author[author_indent] == ' ') author_indent++; snprintf(buffer, sizeof buffer, messages_get("ThemeInstall"), theme_install_descriptor.name, &theme_install_descriptor.author[author_indent]); buffer[sizeof buffer - 1] = '\0'; ro_gui_set_icon_string(dialog_theme_install, ICON_THEME_INSTALL_MESSAGE, buffer, true); ro_gui_set_icon_shaded_state(dialog_theme_install, ICON_THEME_INSTALL_INSTALL, false); } break; case CONTENT_MSG_ERROR: theme_install_close(dialog_theme_install); warn_user(event->data.error, 0); break; default: break; } return NSERROR_OK; }
bool ro_gui_options_interface_click(wimp_pointer *pointer) { bool shaded; switch (pointer->i) { case INTERFACE_USE_EXTERNAL_HOTLIST: shaded = !ro_gui_get_icon_selected_state(pointer->w, INTERFACE_USE_EXTERNAL_HOTLIST); ro_gui_set_icon_shaded_state(pointer->w, INTERFACE_EXTERNAL_HOTLIST_APP, shaded); return false; break; } return false; }
bool ro_gui_options_connection_update(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a) { int proxy_type; bool host, user; /* update the shaded state */ proxy_type = ro_gui_options_connection_proxy_type(w); host = (proxy_type > 0); user = (proxy_type > 1); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_HOST_LABEL, !host); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_HOST, !host); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PORT_LABEL, !host); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PORT, !host); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_USERNAME_LABEL, !user); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_USERNAME, !user); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD_LABEL, !user); ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD, !user); return true; }
void theme_install_start(hlcache_handle *c) { assert(c != NULL); assert(content_get_type(c) == CONTENT_THEME); if (ro_gui_dialog_open_top(dialog_theme_install, NULL, 0, 0)) { warn_user("ThemeInstActive", 0); return; } /* stop theme sitting in memory cache */ content_invalidate_reuse_data(c); hlcache_handle_replace_callback(c, theme_install_callback, NULL); ro_gui_set_icon_string(dialog_theme_install, ICON_THEME_INSTALL_MESSAGE, messages_get("ThemeInstDown"), true); ro_gui_set_icon_shaded_state(dialog_theme_install, ICON_THEME_INSTALL_INSTALL, true); ro_gui_wimp_event_register_close_window(dialog_theme_install, theme_install_close); }
void ro_gui_dialog_prepare_main(void) { ro_gui_set_icon_shaded_state(dialog_main, ICON_MAIN_REMOVE, (theme_sprites == NULL)); }
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; }