tree_model.h File Reference

Tree_Model Abstract Widget. More...

#include "ntw.h"

Go to the source code of this file.

Data Structures

struct  ntw_tree_model_node
struct  ntw_tree_model

Functions

int ntw_tree_model_data_send (struct ntw_tree_model *tm, FILE *file)
int ntw_tree_model_get_column_type (ntwWidget *widget, int32 column)
 Get the type of a particular column in a tree model.
ntw_tree_model_node * ntw_tree_model_get_node_from_path (ntwWidget *widget, char *path_string)
 Find a node in a tree_model.
int ntw_tree_model_insert_node (struct ntw_tree_model *tm, struct ntw_tree_model_node *parent_node, struct ntw_tree_model_node *node, int32 row)
int ntw_tree_model_clear (ntwWidget *widget)
 Delete all data nodes from a tree model.
int ntw_tree_model_delete_row (ntwWidget *widget, struct ntw_tree_model_node *tmn)
 Delete a row from a tree model.
ntw_tree_model_node * ntw_tree_model_insert_row (ntwWidget *widget, struct ntw_tree_model_node *parent_node, int32 row,...)
 Add row to tree_model.
ntwWidget * ntw_tree_model_new (int32 columns,...)
 Create a tree model.
void ntw_tree_model_initialize_callback ()


Detailed Description

Tree_Model Abstract Widget.

A tree_model is an abstract widget that's used with various viewer widgets that display the tree_model's data. The tree_model data is stored in rows that have a specified number of columns. Each column contains the same type of data. The tree_model stores data in a hierarchy. There may be any number of nodes on the same level, and any node may have children on a lower level.


Function Documentation

int ntw_tree_model_clear ntwWidget *  widget  ) 
 

Delete all data nodes from a tree model.

Parameters:
widget tree_model to clear
Returns:
-1 on failure

int ntw_tree_model_delete_row ntwWidget *  widget,
struct ntw_tree_model_node *  tmn
 

Delete a row from a tree model.

Parameters:
widget tree_model to delete row from
node The node referring to the row to be deleted
Returns:
-1 on failure

int ntw_tree_model_get_column_type ntwWidget *  widget,
int32  column
 

Get the type of a particular column in a tree model.

Parameters:
widget tree_model widget
column number of column
Returns:
column_type

struct ntw_tree_model_node* ntw_tree_model_get_node_from_path ntwWidget *  widget,
char *  path_string
 

Find a node in a tree_model.

Parameters:
widget tree_model
path_string The path to the node. This is a colon separated list of integers, i.e. "1:2:0". The tree will be traversed according to the path, so that "1:2:0" will start at the root of the tree, skip one node ahead, go to the child of that node, skip two nodes ahead, go to the child of THAT node, and return the result.
Returns:
The found node, or NULL on failure

struct ntw_tree_model_node* ntw_tree_model_insert_row ntwWidget *  widget,
struct ntw_tree_model_node *  parent_node,
int32  row,
  ...
 

Add row to tree_model.

Example
ntw_tree_model_insert_row(my_list_model, my_parent_node, 0, "Data for first column", 1, "Data for second column", -1);

Parameters:
widget tree_model to add row to
parent_node The parent node to append to. NULL for a top level node.
... -1 terminated list of data to be inserted. Format is column_number, data.
Returns:
The ntw_tree_model_node that was created to store data.

ntwWidget* ntw_tree_model_new int32  columns,
  ...
 

Create a tree model.

Parameters:
columns number of columns each row will contain
... Data type for each column. May be any of:
  • DT_BOOLEAN - Boolean data
  • DT_INT - 32 bit signed integer
  • DT_UINT - 32 bit unsigned integer
  • DT_FLOAT - Floating point number (double)
  • DT_IMAGE - Image buffer
  • DT_STRING - UTF-8 text string
Returns:
Newly created tree_model


Generated on Wed Jun 28 17:00:07 2006 for NTW Server C Library by  doxygen 1.4.6