Commit de62ef6b authored by claes's avatar claes

Function brow_GetPreviousSibling implemented

parent c4c79675
...@@ -481,6 +481,45 @@ int FlowArray::brow_get_next_sibling( FlowArrayElem *element, ...@@ -481,6 +481,45 @@ int FlowArray::brow_get_next_sibling( FlowArrayElem *element,
return FLOW__NONEXTSIBLING; return FLOW__NONEXTSIBLING;
} }
int FlowArray::brow_get_previous_sibling( FlowArrayElem *element,
FlowArrayElem **sibling)
{
int i;
int idx;
int found;
int level;
found = 0;
for ( i = 0; i < a_size; i++)
{
if ( *(a + i) == element)
{
idx = i;
found = 1;
break;
}
}
if ( !found)
return FLOW__NOELEM;
if ( idx == 0)
return FLOW__NONEXTSIBLING;
// Return previous element of the same level
level = ((FlowNode *)a[idx])->get_level();
for ( i = idx - 1; i <= 0; i--)
{
if (((FlowNode *)a[i])->get_level() == level)
{
*sibling = a[i];
return 1;
}
if (((FlowNode *)a[i])->get_level() < level)
return FLOW__NONEXTSIBLING;
}
return FLOW__NONEXTSIBLING;
}
void FlowArray::zoom() void FlowArray::zoom()
{ {
int i; int i;
......
...@@ -65,6 +65,8 @@ class FlowArray { ...@@ -65,6 +65,8 @@ class FlowArray {
int brow_get_child( FlowArrayElem *element, FlowArrayElem **child); int brow_get_child( FlowArrayElem *element, FlowArrayElem **child);
int brow_get_next_sibling( FlowArrayElem *element, int brow_get_next_sibling( FlowArrayElem *element,
FlowArrayElem **sibling); FlowArrayElem **sibling);
int brow_get_previous_sibling( FlowArrayElem *element,
FlowArrayElem **sibling);
void move_widgets( int x, int y); void move_widgets( int x, int y);
int get_first( FlowArrayElem **first); int get_first( FlowArrayElem **first);
int get_last( FlowArrayElem **last); int get_last( FlowArrayElem **last);
......
...@@ -668,6 +668,12 @@ int brow_GetNextSibling( brow_tCtx ctx, brow_tObject object, ...@@ -668,6 +668,12 @@ int brow_GetNextSibling( brow_tCtx ctx, brow_tObject object,
return ctx->get_next_sibling( (FlowArrayElem *)object, (FlowArrayElem **)sibling); return ctx->get_next_sibling( (FlowArrayElem *)object, (FlowArrayElem **)sibling);
} }
int brow_GetPreviousSibling( brow_tCtx ctx, brow_tObject object,
brow_tObject *sibling)
{
return ctx->get_previous_sibling( (FlowArrayElem *)object, (FlowArrayElem **)sibling);
}
int brow_IsVisible( brow_tCtx ctx, brow_tObject object) int brow_IsVisible( brow_tCtx ctx, brow_tObject object)
{ {
return ctx->is_visible( (FlowArrayElem *)object); return ctx->is_visible( (FlowArrayElem *)object);
......
...@@ -196,6 +196,8 @@ int brow_GetParent( brow_tCtx ctx, brow_tObject object, brow_tObject *parent); ...@@ -196,6 +196,8 @@ int brow_GetParent( brow_tCtx ctx, brow_tObject object, brow_tObject *parent);
int brow_GetChild( brow_tCtx ctx, brow_tObject object, brow_tObject *child); int brow_GetChild( brow_tCtx ctx, brow_tObject object, brow_tObject *child);
int brow_GetNextSibling( brow_tCtx ctx, brow_tObject object, int brow_GetNextSibling( brow_tCtx ctx, brow_tObject object,
brow_tObject *sibling); brow_tObject *sibling);
int brow_GetPreviousSibling( brow_tCtx ctx, brow_tObject object,
brow_tObject *sibling);
int brow_IsVisible( brow_tCtx ctx, brow_tObject object); int brow_IsVisible( brow_tCtx ctx, brow_tObject object);
int brow_CreateSecondaryCtx( brow_tCtx ctx, brow_tCtx *secondary_ctx, int brow_CreateSecondaryCtx( brow_tCtx ctx, brow_tCtx *secondary_ctx,
int (*init_proc)(brow_tCtx ctx, void *client_data), int (*init_proc)(brow_tCtx ctx, void *client_data),
......
...@@ -35,6 +35,8 @@ class BrowCtx : public FlowCtx { ...@@ -35,6 +35,8 @@ class BrowCtx : public FlowCtx {
{ return a.brow_get_child( element, child);}; { return a.brow_get_child( element, child);};
int get_next_sibling( FlowArrayElem *element, FlowArrayElem **sibling) int get_next_sibling( FlowArrayElem *element, FlowArrayElem **sibling)
{ return a.brow_get_next_sibling( element, sibling);}; { return a.brow_get_next_sibling( element, sibling);};
int get_previous_sibling( FlowArrayElem *element, FlowArrayElem **sibling)
{ return a.brow_get_previous_sibling( element, sibling);};
int is_visible( FlowArrayElem *element); int is_visible( FlowArrayElem *element);
void center_object( FlowArrayElem *object, double factor); void center_object( FlowArrayElem *object, double factor);
~BrowCtx() {}; ~BrowCtx() {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment