コード例 #1
0
BOOL on_create(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
	UNREFERENCED_PARAMETER(lpCreateStruct);

	BOOL is_ok = TRUE;
	int wid = 0,
		hi = 0,
		x = 0,
		y = 0;
	RECT rect = {0};
	RECT desktop_rect = {0};

	GetClientRect(hwnd, &rect);

	is_ok = editctrl_create(__theApp.instance_, &rect, hwnd);
	if(!is_ok) return is_ok;

	is_ok = treeview_create(__theApp.instance_, &rect, hwnd);
	if(!is_ok) return is_ok;

	is_ok = listview_create(__theApp.instance_, &rect, hwnd);
	if(!is_ok) return is_ok;

	GetWindowRect(hwnd, &rect);
	GetWindowRect(GetDesktopWindow(), &desktop_rect);

	wid = rect.right - rect.left;
	hi = rect.bottom - rect.top;
	y = (desktop_rect.bottom - desktop_rect.top)/2 - hi/2;
	x = (desktop_rect.right - desktop_rect.left)/2 - wid/2;

	MoveWindow(hwnd, x, y, wid, hi, TRUE);

	return is_ok;
}
コード例 #2
0
/* Exported interface, documented in cookie_manager.h */
nserror cookie_manager_init(struct core_window_callback_table *cw_t,
		void *core_window_handle)
{
	nserror err;

	LOG(("Generating cookie manager data"));

	/* Init. cookie manager treeview entry fields */
	err = cookie_manager_init_entry_fields();
	if (err != NSERROR_OK) {
		cm_ctx.tree = NULL;
		return err;
	}

	/* Init. common treeview field values */
	err = cookie_manager_init_common_values();
	if (err != NSERROR_OK) {
		cm_ctx.tree = NULL;
		return err;
	}

	/* Create the cookie manager treeview */
	err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
			COOKIE_M_N_FIELDS, cm_ctx.fields,
			cw_t, core_window_handle,
			TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
	if (err != NSERROR_OK) {
		cm_ctx.tree = NULL;
		return err;
	}

	/* Load the cookies */
	urldb_iterate_cookies(cookie_manager_add);

	/* Cookie manager is built
	 * We suppress the treeview height callback on entry insertion before
	 * the treeview is built. */
	cm_ctx.built = true;

	/* Inform client of window height */
	treeview_get_height(cm_ctx.tree);

	LOG(("Generated cookie manager data"));

	return NSERROR_OK;
}
コード例 #3
0
ファイル: global_history.c プロジェクト: arczi84/NetSurf-68k
/* Exported interface, documented in global_history.h */
nserror global_history_init(struct core_window_callback_table *cw_t,
		void *core_window_handle)
{
	nserror err;

	LOG("Loading global history");

	/* Init. global history treeview time */
	err = global_history_initialise_time();
	if (err != NSERROR_OK) {
		gh_ctx.tree = NULL;
		return err;
	}

	/* Init. global history treeview entry fields */
	err = global_history_initialise_entry_fields();
	if (err != NSERROR_OK) {
		gh_ctx.tree = NULL;
		return err;
	}

	/* Load the entries */
	urldb_iterate_entries(global_history_add_entry);

	/* Create the global history treeview */
	err = treeview_create(&gh_ctx.tree, &gh_tree_cb_t,
			N_FIELDS, gh_ctx.fields,
			cw_t, core_window_handle,
			TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
	if (err != NSERROR_OK) {
		gh_ctx.tree = NULL;
		return err;
	}

	/* Ensure there is a folder for today */
	err = global_history_create_dir(GH_TODAY);
	if (err != NSERROR_OK) {
		return err;
	}

	/* Add the history to the treeview */
	err = global_history_init_entries();
	if (err != NSERROR_OK) {
		return err;
	}

	/* Expand the "Today" folder node */
	err = treeview_node_expand(gh_ctx.tree,
			gh_ctx.folders[GH_TODAY].folder);
	if (err != NSERROR_OK) {
		return err;
	}

	/* History tree is built
	 * We suppress the treeview height callback on entry insertion before
	 * the treeview is built. */
	gh_ctx.built = true;

	/* Inform client of window height */
	treeview_get_height(gh_ctx.tree);

	LOG("Loaded global history");

	return NSERROR_OK;
}