Make flags for suppress resize.

This commit is contained in:
Michael Drake 2013-07-02 17:30:52 +01:00
parent 6014a35ed3
commit 4313d4c4ec
3 changed files with 17 additions and 10 deletions

View File

@ -185,7 +185,8 @@ static nserror global_history_create_dir(enum global_history_folders f)
relation, rel,
&gh_ctx.folders[f].data,
&gh_ctx.folders[f],
!gh_ctx.built);
gh_ctx.built ? TREE_CREATE_NONE :
TREE_CREATE_SUPPRESS_RESIZE);
return err;
}
@ -311,7 +312,8 @@ static nserror global_history_entry_insert(struct global_history_entry *e,
err = treeview_create_node_entry(gh_ctx.tree, &(e->entry),
parent, TREE_REL_FIRST_CHILD, e->data, e,
!gh_ctx.built);
gh_ctx.built ? TREE_CREATE_NONE :
TREE_CREATE_SUPPRESS_RESIZE);
if (err != NSERROR_OK) {
return err;
}

View File

@ -285,7 +285,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
void *data, bool quiet)
void *data, treeview_node_create_flags flags)
{
struct treeview_node *n;
@ -324,7 +324,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
*folder = n;
/* Inform front end of change in dimensions */
if (!quiet)
if (!(flags & TREE_CREATE_SUPPRESS_RESIZE))
tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;
@ -398,7 +398,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
void *data, bool quiet)
void *data, treeview_node_create_flags flags)
{
bool match;
struct treeview_node_entry *e;
@ -460,7 +460,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
*entry = n;
/* Inform front end of change in dimensions */
if (!quiet)
if (!(flags & TREE_CREATE_SUPPRESS_RESIZE))
tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;

View File

@ -38,6 +38,11 @@ enum treeview_relationship {
TREE_REL_NEXT_SIBLING
}; /**< Relationship between nodes */
typedef enum {
TREE_CREATE_NONE = (0), /* No flags set */
TREE_CREATE_SUPPRESS_RESIZE = (1 << 0) /* Suppress callback */
} treeview_node_create_flags;
enum treeview_msg {
TREE_MSG_NODE_DELETE, /**< Node to be deleted */
TREE_MSG_NODE_EDIT, /**< Node to be edited */
@ -138,7 +143,7 @@ nserror treeview_destroy(struct treeview *tree);
* \param rel Folder's relationship to relation
* \param field Field data
* \param data Client data for node event callbacks
* \param quiet True to suppress corewindow height update callback
* \param flags Node creation flags
* \return NSERROR_OK on success, appropriate error otherwise
*
* Field name must match name past in treeview_create fields[N-1].
@ -150,7 +155,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
void *data, bool quiet);
void *data, treeview_node_create_flags flags);
/**
* Create an entry node in given treeview
@ -161,7 +166,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
* \param rel Folder's relationship to relation
* \param fields Array of field data
* \param data Client data for node event callbacks
* \param quiet True to suppress corewindow height update callback
* \param flags Node creation flags
* \return NSERROR_OK on success, appropriate error otherwise
*
* Fields array names must match names past in treeview_create fields[0...N-2].
@ -173,7 +178,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
void *data, bool quiet);
void *data, treeview_node_create_flags flags);
/**
* Update an entry node in given treeview