C-KIT-GUI-GTK 0.60
gtk_tree_it.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "../ut/ut_cast.h"
#include "../ut/ut_umem.h"
#include "../gui/gui_types.h"
#include "../gui/gui_base.h"
#include "../gui_gtk2/gtk_tree_it.h"

Functions

MemObj GUI_tree1__ (MemObj *o_par, void *selCB, char *opts)
 
int GUI_tree1_row_set (MemObj *mo, TreeNode *row, int ico, char *txt, int mode)
 
int GUI_tree1_decode (MemObj *mo)
 
int GUI_tree1_row_add (TreeNode *nodeChd, MemObj *mo, TreeNode *nodePar, int icoNr, char *txt, int mode)
 
int GUI_tree1_clear (MemObj *mo)
 
int GUI_tree1_iter_string (TreeNode *it, char *txt, TreeNode *itPar, MemObj *mo)
 
int GUI_tree1_childNr (MemObj *mo, TreeNode *it)
 
int GUI_tree1_remove__ (MemObj *mo, TreeNode *it)
 
int GUI_tree1_childs_remove (MemObj *mo, TreeNode *it)
 
int GUI_tree1_unselect_all (MemObj *mo)
 
int GUI_tree1_expand__ (MemObj *mo, TreeNode *it)
 
int GUI_tree1_ck_expanded (MemObj *mo, TreeNode *it)
 
int GUI_tree1_par (TreeNode *itPar, MemObj *mo, TreeNode *itChild)
 
int GUI_tree1_ndPos (char *ndPos, MemObj *mo, TreeNode *it)
 
int GUI_tree1_lev (MemObj *mo, TreeNode *it)
 
int GUI_tree1_cmp_row (MemObj *mo, TreeNode *it1, TreeNode *it2)
 
int GUI_tree1_set_selMode (MemObj *mo, int mode)
 
int GUI_tree1_childs_set (MemObj *mo, TreeNode *it, int mode)
 
int GUI_tree1_cbSel (void *selection, MemObj mo)
 
int GUI_tree1_cbMouse (void *parent, void *ev, MemObj mo)
 
int GUI_tree1_analyz1 (char *sOut, int mode, int iCol, MemObj *mo)
 

Variables

int UI_fontsizX
 
int UI_fontsizY
 
GdkPixbuf ** IcoTab
 
static GtkWidget * GUI_tree1_tree
 
static GtkTreeView * GUI_tree1_view
 
static GtkTreeModel * GUI_tree1_model
 
static GtkTreeStore * GUI_tree1_store
 
static int GUI_tree1_msbt
 
static Obj_gui2 * GUI_tree1_ActObj
 

Detailed Description

=====================================================
List_functions_start:
GUI_tree1__ create Tree with icon + text
GUI_tree1_row_add create row & set rowMode
GUI_tree1_remove__ remove row and its childs
GUI_tree1_clear clear whole tree
GUI_tree1_expand__ expand row or complete tree
GUI_tree1_ck_expanded test if row is expanded
GUI_tree1_row_set change rowMode to active,normal,passive,selected ..
GUI_tree1_unselect_all unselect all objects of tree
GUI_tree1_iter_string find row that starts with <txt>
GUI_tree1_childNr get nr of childs of row
GUI_tree1_par get parentNode of node.
GUI_tree1_lev get level of a node
GUI_tree1_cmp_row compare 2 rows if identical
GUI_tree1_ndPos get position of a node; returns string (eg "0:2")
GUI_tree1_analyz1 Resolv List.
GUI_tree1_set_selMode deactivate / reactivate selection
GUI_tree1_childs_set modify mode (active|passive) of all childs of a row
GUI_tree1_childs_remove INTERNAL remove all childs of row
GUI_tree1_cbSel INTERNAL callback list selection
List_functions_end:
=====================================================

Function Documentation

MemObj GUI_tree1__ ( MemObj *  o_par,
void *  selCB,
char *  opts 
)
create Tree with icon + text.
Icons must be loaded with GUI_Ico_init < iSizYIco_init
Input:
o_par parentBox
selCB callbackfunktion for the selection-event
opts options; (HorSiz,VertSiz)
HorSiz,VertSiz: size in characters; default is automatic size.
'e' = expand widget; default is fixed size.
Examples: "" or "10" or "10e,e"
"10e,e" horiz. size 10 chars, hor. and vert. expandable.
Output:
returns tree
prototyp selCB:
int selCB (void *parent, void **data);
// data=table of 6 pointers;
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
GUI_DATA_I1 =*(int*)data[1]=GUI_MouseL| left mousebutton
GUI_MouseM| mid mousebutton
GUI_MouseR| right mousebutton
(TreeNode*)data[2] =TreeNode of selected row
GUI_DATA_S3 =(char*)data[3]=text (col.1) of selected row
GUI_DATA_I4 =*(int*)data[4]=icon-nr of selected row
GUI_DATA_I5 =*(int*)data[5]=state of selected row 1=active, 0=passive
see also UI_mcl__ GUI_mList__
int GUI_tree1_row_set ( MemObj *  mo,
TreeNode *  row,
int  ico,
char *  txt,
int  mode 
)
GUI_tree1_row_set change rowMode to active, normal, passive
Input:
ico index of icon; -1 = do not modify.
txt text for row; NULL = do not modify.
mode -2 unselected
-1 passive (icon & text dimmed)
0 do not modify
1 active (normal)
2 selected see GUI_tree1_set_selMode().
int GUI_tree1_decode ( MemObj *  mo)
int GUI_tree1_row_add ( TreeNode *  nodeChd,
MemObj *  mo,
TreeNode *  nodePar,
int  icoNr,
char *  txt,
int  mode 
)
add (one more) childnode to parentNode <rowPar>
Input:
mo tree-obj
nodePar parent-row-node; NULL for primary obj
icoNr index of icon; -1 = do not modify. see eg ICO_Var
txt text for row; NULL = do not modify.
mode -1 passive (icon & text dimmed)
0 normal (text colored)
1 active (text normal)
Output:
nodeChd child-row-node
int GUI_tree1_clear ( MemObj *  mo)

clear whole tree

int GUI_tree1_iter_string ( TreeNode *  it,
char *  txt,
TreeNode *  itPar,
MemObj *  mo 
)
get iter of row that starts with <txt> among childs of itPar.
Check only childs of one level.
Input:
txt objId + " " eg "M21 "
itPar parentNode; check only its childs; NULL for topLevel
Output:
it node found
RetCode: 0 = ok, found; row <it> starts with <txt>
-1 = not found
int GUI_tree1_childNr ( MemObj *  mo,
TreeNode *  it 
)

GUI_tree1_childNr get nr of childs of it

int GUI_tree1_remove__ ( MemObj *  mo,
TreeNode *  it 
)

remove node it and its childs

int GUI_tree1_childs_remove ( MemObj *  mo,
TreeNode *  it 
)
remove all childs of node; but not node.
recursiv
int GUI_tree1_unselect_all ( MemObj *  mo)

unselect all objects of tree

int GUI_tree1_expand__ ( MemObj *  mo,
TreeNode *  it 
)

expand row or all (if it == NULL)

int GUI_tree1_ck_expanded ( MemObj *  mo,
TreeNode *  it 
)
test if row is expanded
RetCod: 0 row is not expanded
1 row is expanded
int GUI_tree1_par ( TreeNode *  itPar,
MemObj *  mo,
TreeNode *  itChild 
)
get parentNode of node.
Retcode:
0 NO PARENT EXIST
else OK
int GUI_tree1_ndPos ( char *  ndPos,
MemObj *  mo,
TreeNode *  it 
)
get position of a node; returns string.
Output:
ndPos char[40]
returns string; eg "0" or "0:2" or "0:2:1" ..
nodeName: "0" first group
"0:0" first subObj of first group
int GUI_tree1_lev ( MemObj *  mo,
TreeNode *  it 
)
get level of a node;
level=0=topNode; level=1 is a child of the topNode;
level=2 is a child of a child of the topNode.
level is the nr of ':'-chars in the treePosString;
"0"=0; "0:2"=1; "0:2:1"=2;
int GUI_tree1_cmp_row ( MemObj *  mo,
TreeNode *  it1,
TreeNode *  it2 
)

compare 2 rows if identical;

int GUI_tree1_set_selMode ( MemObj *  mo,
int  mode 
)
deactivate / reactivate selection
use if select rows with GUI_tree1_childs_set(,,2)
GUI_tree1_set_selMode (tree, 1); // do not report following selections
GUI_tree1_set_selMode (tree, 0); // report all following selections
int GUI_tree1_childs_set ( MemObj *  mo,
TreeNode *  it,
int  mode 
)
modify mode (active|passive) of all childs of a row, but not of row.
mode -1=passive; 1=active
recursive.
int GUI_tree1_cbSel ( void *  selection,
MemObj  mo 
)

INTERNAL

int GUI_tree1_cbMouse ( void *  parent,
void *  ev,
MemObj  mo 
)

INTERNAL

int GUI_tree1_analyz1 ( char *  sOut,
int  mode,
int  iCol,
MemObj *  mo 
)
GUI_tree1_analyz1 Resolv List.
Input:
mode 0=init-resolv; 1=get-next-listObj 2=get-active-listObj
Retcod:
>=0 OK, nr_of_columns;
-1 no more listObjs

Variable Documentation

int UI_fontsizX
int UI_fontsizY
GdkPixbuf** IcoTab
GtkWidget* GUI_tree1_tree
static
GtkTreeView* GUI_tree1_view
static
GtkTreeModel* GUI_tree1_model
static
GtkTreeStore* GUI_tree1_store
static
int GUI_tree1_msbt
static
Obj_gui2* GUI_tree1_ActObj
static