Example #1
0
void ro_gui_iconbar_initialise(void)
{
	os_error *error;

	/* Build the iconbar menu */

	static const struct ns_menu iconbar_definition = {
		"NetSurf", {
			{ "Info", NO_ACTION, &dialog_info },
			{ "AppHelp", HELP_OPEN_CONTENTS, 0 },
			{ "Open", BROWSER_NAVIGATE_URL, 0 },
			{ "Open.OpenURL", BROWSER_NAVIGATE_URL, &dialog_openurl },
			{ "Open.HotlistShow", HOTLIST_SHOW, 0 },
			{ "Open.HistGlobal", HISTORY_SHOW_GLOBAL, 0 },
			{ "Open.ShowCookies", COOKIES_SHOW, 0 },
			{ "Choices", CHOICES_SHOW, 0 },
			{ "Quit", APPLICATION_QUIT, 0 },
			{NULL, 0, 0}
		}
	};
	ro_gui_iconbar_menu = ro_gui_menu_define_menu(&iconbar_definition);

	/* Create an iconbar icon. */

	wimp_icon_create icon = {
		wimp_ICON_BAR_RIGHT,
		{ { 0, 0, 68, 68 },
		wimp_ICON_SPRITE | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED |
				(wimp_BUTTON_CLICK << wimp_ICON_BUTTON_TYPE_SHIFT),
		{ "!netsurf" } } };
	error = xwimp_create_icon(&icon, 0);
	if (error) {
		LOG(("xwimp_create_icon: 0x%x: %s",
				error->errnum, error->errmess));
		die(error->errmess);
	}

	/* Register handlers to look after clicks and menu actions. */

	ro_gui_wimp_event_register_mouse_click(wimp_ICON_BAR,
			ro_gui_iconbar_click);

	ro_gui_wimp_event_register_menu(wimp_ICON_BAR, ro_gui_iconbar_menu,
			true, true);
	ro_gui_wimp_event_register_menu_selection(wimp_ICON_BAR,
			ro_gui_iconbar_menu_select);
	ro_gui_wimp_event_register_menu_warning(wimp_ICON_BAR,
			ro_gui_iconbar_menu_warning);
}
Example #2
0
void ro_gui_global_history_postinitialise(void)
{
	/* Create our toolbar. */

	global_history_window.toolbar = ro_toolbar_create(NULL,
			global_history_window.window,
			THEME_STYLE_GLOBAL_HISTORY_TOOLBAR, TOOLBAR_FLAGS_NONE,
			ro_treeview_get_toolbar_callbacks(), NULL,
			"HelpGHistoryToolbar");
	if (global_history_window.toolbar != NULL) {
		ro_toolbar_add_buttons(global_history_window.toolbar,
				global_history_toolbar_buttons,
				       nsoption_charp(toolbar_history));
		ro_toolbar_rebuild(global_history_window.toolbar);
	}

	/* Create the treeview with the window and toolbar. */

	global_history_window.tv =
			ro_treeview_create(global_history_window.window,
			global_history_window.toolbar,
			&ro_global_history_treeview_callbacks,
			history_global_get_tree_flags());
	if (global_history_window.tv == NULL) {
		LOG(("Failed to allocate treeview"));
		return;
	}

	ro_toolbar_update_client_data(global_history_window.toolbar,
			global_history_window.tv);

	/* Initialise the global history into the tree. */

	history_global_initialise(
		ro_treeview_get_tree(global_history_window.tv),
		tree_directory_icon_name);

	/* Build the global history window menu. */

	static const struct ns_menu global_history_definition = {
		"History", {
			{ "History", NO_ACTION, 0 },
			{ "_History.Export", HISTORY_EXPORT, &dialog_saveas },
			{ "History.Expand", TREE_EXPAND_ALL, 0 },
			{ "History.Expand.All", TREE_EXPAND_ALL, 0 },
			{ "History.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
			{ "History.Expand.Links", TREE_EXPAND_LINKS, 0 },
			{ "History.Collapse", TREE_COLLAPSE_ALL, 0 },
			{ "History.Collapse.All", TREE_COLLAPSE_ALL, 0 },
			{ "History.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
			{ "History.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
			{ "History.Toolbars", NO_ACTION, 0 },
			{ "_History.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
			{ "History.Toolbars.EditToolbar",TOOLBAR_EDIT, 0 },
			{ "Selection", TREE_SELECTION, 0 },
			{ "Selection.Launch", TREE_SELECTION_LAUNCH, 0 },
			{ "Selection.Delete", TREE_SELECTION_DELETE, 0 },
			{ "SelectAll", TREE_SELECT_ALL, 0 },
			{ "Clear", TREE_CLEAR_SELECTION, 0 },
			{NULL, 0, 0}
		}
	};
	global_history_window.menu = ro_gui_menu_define_menu(
			&global_history_definition);

	ro_gui_wimp_event_register_menu(global_history_window.window,
			global_history_window.menu, false, false);
	ro_gui_wimp_event_register_menu_prepare(global_history_window.window,
			ro_gui_global_history_menu_prepare);
	ro_gui_wimp_event_register_menu_selection(global_history_window.window,
			ro_gui_global_history_menu_select);
	ro_gui_wimp_event_register_menu_warning(global_history_window.window,
			ro_gui_global_history_menu_warning);
}
Example #3
0
void ro_gui_cookies_postinitialise(void)
{
	/* Create our toolbar. */

	cookies_window.toolbar = ro_toolbar_create(NULL, cookies_window.window,
			THEME_STYLE_COOKIES_TOOLBAR, TOOLBAR_FLAGS_NONE,
			ro_treeview_get_toolbar_callbacks(), NULL,
			"HelpCookiesToolbar");
	if (cookies_window.toolbar != NULL) {
		ro_toolbar_add_buttons(cookies_window.toolbar,
				cookies_toolbar_buttons,
				       nsoption_charp(toolbar_cookies));
		ro_toolbar_rebuild(cookies_window.toolbar);
	}

	/* Create the treeview with the window and toolbar. */

	cookies_window.tv = ro_treeview_create(cookies_window.window,
			cookies_window.toolbar, &ro_cookies_treeview_callbacks,
			cookies_get_tree_flags());
	if (cookies_window.tv == NULL) {
		LOG(("Failed to allocate treeview"));
		return;
	}

	ro_toolbar_update_client_data(cookies_window.toolbar,
			cookies_window.tv);

	/* Initialise the cookies into the tree. */

	cookies_initialise(ro_treeview_get_tree(cookies_window.tv),
			   tree_directory_icon_name,
			   tree_content_icon_name);


	/* Build the cookies window menu. */

	static const struct ns_menu cookies_definition = {
		"Cookies", {
			{ "Cookies", NO_ACTION, 0 },
			{ "Cookies.Expand", TREE_EXPAND_ALL, 0 },
			{ "Cookies.Expand.All", TREE_EXPAND_ALL, 0 },
			{ "Cookies.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
			{ "Cookies.Expand.Links", TREE_EXPAND_LINKS, 0 },
			{ "Cookies.Collapse", TREE_COLLAPSE_ALL, 0 },
			{ "Cookies.Collapse.All", TREE_COLLAPSE_ALL, 0 },
			{ "Cookies.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
			{ "Cookies.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
			{ "Cookies.Toolbars", NO_ACTION, 0 },
			{ "_Cookies.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
			{ "Cookies.Toolbars.EditToolbar",TOOLBAR_EDIT, 0 },
			{ "Selection", TREE_SELECTION, 0 },
			{ "Selection.Delete", TREE_SELECTION_DELETE, 0 },
			{ "SelectAll", TREE_SELECT_ALL, 0 },
			{ "Clear", TREE_CLEAR_SELECTION, 0 },
			{NULL, 0, 0}
		}
	};
	cookies_window.menu = ro_gui_menu_define_menu(&cookies_definition);

	ro_gui_wimp_event_register_menu(cookies_window.window,
			cookies_window.menu, false, false);
	ro_gui_wimp_event_register_menu_prepare(cookies_window.window,
			ro_gui_cookies_menu_prepare);
	ro_gui_wimp_event_register_menu_selection(cookies_window.window,
			ro_gui_cookies_menu_select);
	ro_gui_wimp_event_register_menu_warning(cookies_window.window,
			ro_gui_cookies_menu_warning);
}
Example #4
0
void ro_gui_menu_init(void)
{
	/* image quality menu */
	static const struct ns_menu images_definition = {
		"Display", {
			{ "ImgStyle0", NO_ACTION, 0 },
			{ "ImgStyle1", NO_ACTION, 0 },
			{ "ImgStyle2", NO_ACTION, 0 },
			{ "ImgStyle3", NO_ACTION, 0 },
			{NULL, 0, 0}
		}
	};
	image_quality_menu = ro_gui_menu_define_menu(&images_definition);

	/* proxy menu */
	static const struct ns_menu proxy_type_definition = {
		"ProxyType", {
			{ "ProxyNone", NO_ACTION, 0 },
			{ "ProxyNoAuth", NO_ACTION, 0 },
			{ "ProxyBasic", NO_ACTION, 0 },
			{ "ProxyNTLM", NO_ACTION, 0 },
			{NULL, 0, 0}
		}
	};
	proxy_type_menu = ro_gui_menu_define_menu(&proxy_type_definition);

	/* special case menus */
	ro_gui_url_suggest_init();

	/* Note: This table *must* be kept in sync with the LangNames file */
	static const struct ns_menu lang_definition = {
		"Languages", {
			{ "lang_af", NO_ACTION, 0 },
			{ "lang_bm", NO_ACTION, 0 },
			{ "lang_ca", NO_ACTION, 0 },
			{ "lang_cs", NO_ACTION, 0 },
			{ "lang_cy", NO_ACTION, 0 },
			{ "lang_da", NO_ACTION, 0 },
			{ "lang_de", NO_ACTION, 0 },
			{ "lang_en", NO_ACTION, 0 },
			{ "lang_es", NO_ACTION, 0 },
			{ "lang_et", NO_ACTION, 0 },
			{ "lang_eu", NO_ACTION, 0 },
			{ "lang_ff", NO_ACTION, 0 },
			{ "lang_fi", NO_ACTION, 0 },
			{ "lang_fr", NO_ACTION, 0 },
			{ "lang_ga", NO_ACTION, 0 },
			{ "lang_gl", NO_ACTION, 0 },
			{ "lang_ha", NO_ACTION, 0 },
			{ "lang_hr", NO_ACTION, 0 },
			{ "lang_hu", NO_ACTION, 0 },
			{ "lang_id", NO_ACTION, 0 },
			{ "lang_is", NO_ACTION, 0 },
			{ "lang_it", NO_ACTION, 0 },
			{ "lang_lt", NO_ACTION, 0 },
			{ "lang_lv", NO_ACTION, 0 },
			{ "lang_ms", NO_ACTION, 0 },
			{ "lang_mt", NO_ACTION, 0 },
			{ "lang_nl", NO_ACTION, 0 },
			{ "lang_no", NO_ACTION, 0 },
			{ "lang_pl", NO_ACTION, 0 },
			{ "lang_pt", NO_ACTION, 0 },
			{ "lang_rn", NO_ACTION, 0 },
			{ "lang_ro", NO_ACTION, 0 },
			{ "lang_rw", NO_ACTION, 0 },
			{ "lang_sk", NO_ACTION, 0 },
			{ "lang_sl", NO_ACTION, 0 },
			{ "lang_so", NO_ACTION, 0 },
			{ "lang_sq", NO_ACTION, 0 },
			{ "lang_sr", NO_ACTION, 0 },
			{ "lang_sv", NO_ACTION, 0 },
			{ "lang_sw", NO_ACTION, 0 },
			{ "lang_tr", NO_ACTION, 0 },
			{ "lang_uz", NO_ACTION, 0 },
			{ "lang_vi", NO_ACTION, 0 },
			{ "lang_wo", NO_ACTION, 0 },
			{ "lang_xs", NO_ACTION, 0 },
			{ "lang_yo", NO_ACTION, 0 },
			{ "lang_zu", NO_ACTION, 0 },
			{ NULL, 0, 0 }
		}
	};
	languages_menu = ro_gui_menu_define_menu(&lang_definition);
}