src/liqcell.c File Reference

liqcell App level helper functions More...

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include "liqbase.h"
#include "liqcell.h"
#include "liqcell_prop.h"

Functions

char * liqcell_local_lookup_getname (liqcell *self, char *name)
char * liqcell_local_lookup_getcaption (liqcell *self, char *name)
liqcell * liqcell_new ()
liqcell * liqcell_hold (liqcell *self)
void liqcell_release (liqcell *self)
void liqcell_free (liqcell *self)
void liqcell_setpos (liqcell *self, int x, int y)
void liqcell_setsize (liqcell *self, int w, int h)
void liqcell_setsize_from_inner (liqcell *self)
void liqcell_setinnersize (liqcell *self, int w, int h)
void liqcell_setinnersize_from_outer (liqcell *self)
void liqcell_setrect (liqcell *self, int x, int y, int w, int h)
int liqcell_movetowardsrect (liqcell *self, int x, int y, int w, int h, float fraction)
void liqcell_setrect_autoscale (liqcell *self, int x, int y, int w, int h, float sx, float sy)
void liqcell_adjustpos (liqcell *self, int dx, int dy)
void liqcell_adjustsize (liqcell *self, int dw, int dh)
void liqcell_adjustinnersize (liqcell *self, int dw, int dh)
void liqcell_setdirtyhold (liqcell *self, int dirtyhold)
int liqcell_getdirtyhold (liqcell *self)
void liqcell_setdirty (liqcell *self, int dirty)
int liqcell_getdirty (liqcell *self)
void liqcell_setname (liqcell *self, char *name)
void liqcell_setcaption (liqcell *self, char *caption)
void liqcell_setclassname (liqcell *self, char *classname)
void liqcell_setcontext (liqcell *self, char *context)
void liqcell_setdata (liqcell *self, void *data)
void liqcell_setsketch (liqcell *self, liqsketch *sketch)
void liqcell_sketch_autoload (liqcell *self)
void liqcell_setimage (liqcell *self, liqimage *image)
void liqcell_setfont (liqcell *self, liqfont *font)
void liqcell_setcontent (liqcell *self, liqcell *content)
void liqcell_setselected (liqcell *self, int arg)
int liqcell_getselected (liqcell *self)
void liqcell_settag (liqcell *self, void *tag)
void * liqcell_gettag (liqcell *self)
void liqcell_setenabled (liqcell *self, int arg)
int liqcell_getenabled (liqcell *self)
void liqcell_setkinetic (liqcell *self, int kx, int ky)
void liqcell_setshown (liqcell *self, int arg)
int liqcell_getshown (liqcell *self)
liqcell * liqcell_getlinkparent (liqcell *self)
liqcell * liqcell_getlinkprev (liqcell *self)
liqcell * liqcell_getlinknext (liqcell *self)
liqcell * liqcell_getlinkprev_visual (liqcell *self)
liqcell * liqcell_getlinknext_visual (liqcell *self)
liqcell * liqcell_getlinkchild_visual (liqcell *self)
liqcell * liqcell_getlinkchild (liqcell *self)
void * liqcell_getdata (liqcell *self)
int liqcell_getflagwidget (liqcell *self)
int liqcell_getflagvisual (liqcell *self)
int liqcell_getvisible (liqcell *self)
void liqcell_setvisible (liqcell *self, int arg)
char * liqcell_getname (liqcell *self)
int liqcell_getqualifiedname (liqcell *self, char *buff, int buffmax)
char * liqcell_getclassname (liqcell *self)
char * liqcell_getcaption (liqcell *self)
liqsketch * liqcell_getsketch (liqcell *self)
liqimage * liqcell_getimage (liqcell *self)
liqfont * liqcell_getfont (liqcell *self)
liqcell * liqcell_getcontent (liqcell *self)
int liqcell_getx (liqcell *self)
int liqcell_gety (liqcell *self)
int liqcell_getw (liqcell *self)
int liqcell_geth (liqcell *self)
int liqcell_getinnerw (liqcell *self)
int liqcell_getinnerh (liqcell *self)
liqcell * liqcell_lastchild (liqcell *self)
 snprintf (cap, 30,"%s",(self->caption?self->caption:""))
 free (indent)
 while (xx)
void liqcell_print2 (liqcell *self)
int strcmpx (const char *s1, const char *s2)
void * liqcell_handlerfind (liqcell *self, char *handlername)
liqcell * liqcell_handleradd (liqcell *self, char *handlername, void *handler)
liqcell * liqcell_handleradd_withcontext (liqcell *self, char *handlername, void *handler, void *context)
int liqcell_handlerrun (liqcell *self, char *handlername, void *args)
liqcell * liqcell_getbasewidget (liqcell *self)
int liqcell_isclass (liqcell *self, char *classname)
int liqcell_ensurevisible (liqcell *self)
int liqcell_ensurevisible_centred (liqcell *self)
void liqcell_test ()

Variables

 indent [recdep] = ' '0
char cap [32] = 0
char * cc = cap
liqcell * xx = self->linkchild


Detailed Description

liqcell App level helper functions

Author:
Gary Birkett Copyright (C) 2008 Gary Birkett

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Function Documentation

void liqcell_adjustinnersize ( liqcell *  self,
int  dw,
int  dh 
)

Increase or decrease the liqcell inner width and inner height

Parameters:
self The liqcell to modify
dw Change in the width
dh Change in the height

void liqcell_adjustpos ( liqcell *  self,
int  dx,
int  dy 
)

Increase or decrease the liqcell x, y-coordinates

Parameters:
self The liqcell to modify
dx Change in the x-coordinate
dy Change in the y-coordinate

References liqcell_handlerrun().

Referenced by liqcell_ensurevisible(), and liqcell_ensurevisible_centred().

void liqcell_adjustsize ( liqcell *  self,
int  dw,
int  dh 
)

Increase or decrease the liqcell width and height

Parameters:
self The liqcell to modify
dw Change in the width
dh Change in the height

References liqcell_handlerrun().

int liqcell_ensurevisible ( liqcell *  self  ) 

Adjust a position of a liqcell to ensure it is visible

Parameters:
self The liqcell to adjusts
Returns:
Success or Failure

References liqapp_log(), liqcell_adjustpos(), and liqcell_getlinkparent().

int liqcell_ensurevisible_centred ( liqcell *  self  ) 

Adjust a position of a liqcell to ensure it is visible and centered

Parameters:
self The liqcell to adjusts
Returns:
int Success or Failure

References liqapp_log(), liqcell_adjustpos(), and liqcell_getlinkparent().

void liqcell_free ( liqcell *  self  ) 

Recursively free all liqcells of the parent liqcell provided and their items (font, image, etc..)

Parameters:
self The parent will have all children freed

References liqapp_log(), liqcell_release(), liqcell_setcaption(), liqcell_setclassname(), liqcell_setcontent(), liqcell_setcontext(), liqcell_setdata(), liqcell_setfont(), liqcell_setimage(), liqcell_setname(), and liqcell_setsketch().

Referenced by liqcell_release().

liqcell* liqcell_getbasewidget ( liqcell *  self  ) 

Get the base (top parent) of the provided liqcell

Parameters:
self The provided liqcell
Returns:
liqcell* The base liqcell

References liqcell_getlinkparent().

char* liqcell_getcaption ( liqcell *  self  ) 

Return a liqcell caption

Parameters:
self The liqcell to lookup
Returns:
char* The caption

Referenced by liqcell_easyrun().

char* liqcell_getclassname ( liqcell *  self  ) 

Return the classname

Parameters:
self The liqcell to lookup
Returns:
char* The class name

liqcell* liqcell_getcontent ( liqcell *  self  ) 

Return the liqcell's content

Parameters:
self The liqcell to lookup
Returns:
liqsketch* The content

void* liqcell_getdata ( liqcell *  self  ) 

Get the data of the liqcell

Parameters:
self The liqcell to lookup
Returns:
lvoid* The data

int liqcell_getdirty ( liqcell *  self  ) 

Get the dirty value of the liqcell

Parameters:
self The liqcell to lookup

int liqcell_getdirtyhold ( liqcell *  self  ) 

Get the dirtyhold value of the liqcell

Parameters:
self The liqcell to lookup

int liqcell_getenabled ( liqcell *  self  ) 

Return the enabled value

Parameters:
self The liqcell to lookup
Returns:
int The enabled value

liqfont* liqcell_getfont ( liqcell *  self  ) 

Return the liqcell's font

Parameters:
self The liqcell to lookup
Returns:
liqsketch* The font

int liqcell_geth ( liqcell *  self  ) 

Return the liqcell's height

Parameters:
self The liqcell to lookup
Returns:
int The height

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), and liqcell_child_arrange_makegrid_internal().

liqimage* liqcell_getimage ( liqcell *  self  ) 

Return the liqcell's image

Parameters:
self The liqcell to lookup
Returns:
liqsketch* The image

int liqcell_getinnerh ( liqcell *  self  ) 

Return the liqcell's inner height

Parameters:
self The liqcell to lookup
Returns:
int The inner height

int liqcell_getinnerw ( liqcell *  self  ) 

Return the liqcell's inner width

Parameters:
self The liqcell to lookup
Returns:
int The inner width

liqcell* liqcell_getlinkchild ( liqcell *  self  ) 

Return the linked child of the parent provided.

Parameters:
self The parent liqcell
Returns:
liqcell* The linked child

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), liqcell_child_arrange_easytile(), and liqcell_child_arrange_makegrid_internal().

liqcell* liqcell_getlinkchild_visual ( liqcell *  self  ) 

Get the linked child of the liqcell, the child link in the linked list that is VISIBLE

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the first child that is visible

liqcell* liqcell_getlinknext ( liqcell *  self  ) 

Get the linked next of the liqcell, the next link in the linked list

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the next

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), liqcell_child_arrange_easytile(), liqcell_child_arrange_makegrid_internal(), liqcell_easyrun(), liqcell_handlerfind(), and liqcell_handlerrun().

liqcell* liqcell_getlinknext_visual ( liqcell *  self  ) 

Get the linked previous of the liqcell, the previous link in the linked list that is VISIBLE

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the first previous that is visible

liqcell* liqcell_getlinkparent ( liqcell *  self  ) 

Get the linked parent of the liqcell

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the parent

Referenced by liqcell_easyrun(), liqcell_ensurevisible(), liqcell_ensurevisible_centred(), liqcell_getbasewidget(), and liqcell_getqualifiedname().

liqcell* liqcell_getlinkprev ( liqcell *  self  ) 

Get the linked previous of the liqcell, the previous link in the linked list

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the previous

Referenced by liqcell_easyrun().

liqcell* liqcell_getlinkprev_visual ( liqcell *  self  ) 

Get the linked previous of the liqcell, the previous link in the linked list that is VISIBLE

Parameters:
self The liqcell to lookup
Returns:
liqcell* Liqcell pointer to the first previous that is visible

char* liqcell_getname ( liqcell *  self  ) 

Return the name of the provided liqcell.

Parameters:
self The liqcell
Returns:
string The name of the liqcell

Referenced by liqcell_easyrun().

int liqcell_getqualifiedname ( liqcell *  self,
char *  buff,
int  buffmax 
)

Get the name of a liqcell that includes all of the parent names

Parameters:
self The liqcell to get the qualified name of
buff Copy the qualified name into this buffer
buffmax Maximum length of the buffer
Returns:
int The numbers of bytes used

References liqcell_getlinkparent().

Referenced by liqcell_easyrun().

int liqcell_getselected ( liqcell *  self  ) 

Return the selected value

Parameters:
self The liqcell to lookup
Returns:
int The selected value

int liqcell_getshown ( liqcell *  self  ) 

Get the shown value of the liqcell

Parameters:
self The liqcell to lookup
Returns:
int The shown value

liqsketch* liqcell_getsketch ( liqcell *  self  ) 

Return the liqcell's sketch

Parameters:
self The liqcell to lookup
Returns:
liqsketch* The sketch

void* liqcell_gettag ( liqcell *  self  ) 

Get the tag value of the liqcell

Parameters:
self The liqcell to lookup
Returns:
void* The generic pointer to the tag

Referenced by liqcell_handlerrun().

int liqcell_getw ( liqcell *  self  ) 

Return the liqcell's width

Parameters:
self The liqcell to lookup
Returns:
int The width

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), and liqcell_child_arrange_makegrid_internal().

int liqcell_getx ( liqcell *  self  ) 

Return the liqcell's x-coordinate

Parameters:
self The liqcell to lookup
Returns:
int The x-coordinate

int liqcell_gety ( liqcell *  self  ) 

Return the liqcell's y-coordinate

Parameters:
self The liqcell to lookup
Returns:
int The y-coordinate

liqcell* liqcell_handleradd ( liqcell *  self,
char *  handlername,
void *  handler 
)

Add a handler by creating a child liqcell for the provided parent. The nameclass must be called "handler" to be identified as a handler liqcell.

Parameters:
self The liqcell to add a handler to
handlername The name of the handler
handler Function pointer to actual handler
Returns:
liqcell Newly created child liqcell

Referenced by textbox_create(), uiinfobar_create(), and uitextbox_create().

liqcell* liqcell_handleradd_withcontext ( liqcell *  self,
char *  handlername,
void *  handler,
void *  context 
)

Add a handler by creating a child liqcell for the provided parent. The nameclass must be called "handler" to be identified as a handler liqcell.

Parameters:
self The liqcell to add a handler to
handlername The name of the handler
handler Function pointer to actual handler
Returns:
liqcell Newly created child liqcell

References liqcell_settag().

void* liqcell_handlerfind ( liqcell *  self,
char *  handlername 
)

Search for handler

Parameters:
self The liqcell to search for a handler for
handlername The name of the handler to find
Returns:
void* The handler

References liqcell_getlinknext().

Referenced by liqcell_easyrun().

int liqcell_handlerrun ( liqcell *  self,
char *  handlername,
void *  args 
)

Run/Execute the handler of the provided liqcell. This only executes the handler provided by "handlername".

Parameters:
self The liqcell with the handler
handlername The name of the handler to run
Returns:
int 1 for Successful handler run, which means each handler must return 1 for success

References liqcell_getlinknext(), and liqcell_gettag().

Referenced by liqcell_adjustpos(), liqcell_adjustsize(), liqcell_easyrun(), liqcell_movetowardsrect(), liqcell_setcaption(), liqcell_setdirty(), liqcell_setpos(), liqcell_setrect(), liqcell_setrect_autoscale(), and liqcell_setsize().

liqcell* liqcell_hold ( liqcell *  self  ) 

Add to the usage count, hold onto an object which someone else created

Parameters:
self The liqcell to modify
Returns:
liqcell* The modified liqcell

Referenced by liqcell_setcontent().

int liqcell_isclass ( liqcell *  self,
char *  classname 
)

Check if the string provided is a classname of the liqcell provided

Parameters:
self The provided liqcell
classname The string to cechk
int True or False

liqcell* liqcell_lastchild ( liqcell *  self  ) 

Get the last child of the parent provided

Parameters:
self The parent liqcell
Returns:
liqcell*

int liqcell_movetowardsrect ( liqcell *  self,
int  x,
int  y,
int  w,
int  h,
float  fraction 
)

Move and resize a liqcell

Parameters:
self The liqcell to modify
x New x-coordinate
y New y-coordinate
w New width
h New height
fraction Ratio to increase or decreases the liqcell position and size
Returns:
int Success or Failure

References liqcell_handlerrun().

Referenced by liqcell_child_arrange_makegrid_internal().

liqcell* liqcell_new (  ) 

Low level liqcell creation which allocates memory and sets the liqcell into use.

Returns:
liqcell* The newly created liqcell

Referenced by liqcell_test().

void liqcell_print2 ( liqcell *  self  ) 

Print a tree of liqcells starting with the provided liqcell

Parameters:
self The provided liqcell

Referenced by liqcell_easyrun().

void liqcell_release ( liqcell *  self  ) 

Decrease the usage count, once this gets to 0, the liqcell is freed

Parameters:
self The liqcell to modify

References liqcell_free().

Referenced by liqcell_free(), liqcell_setcontent(), and liqcell_test().

void liqcell_setcaption ( liqcell *  self,
char *  caption 
)

Set the caption of the liqcell

Parameters:
self The liqcell to modify
caption The caption of the liqcell

References liqapp_log(), and liqcell_handlerrun().

Referenced by liqcell_free(), uiinfobar_create(), uinumberbox_create(), uipicturebox_create(), uitextbox_create(), and uititlebar_create().

void liqcell_setclassname ( liqcell *  self,
char *  classname 
)

Set the classname of the liqcell

Parameters:
self The liqcell to modify
classname The classname of the liqcell

Referenced by liqcell_free().

void liqcell_setcontent ( liqcell *  self,
liqcell *  content 
)

Set the content of one liqcell to the content of the other liqcell.

Parameters:
self The destination liqcell
Returns:
liqcell* The source liqcell

References liqcell_hold(), and liqcell_release().

Referenced by liqcell_free().

void liqcell_setcontext ( liqcell *  self,
char *  context 
)

Set the context of the liqcell

Parameters:
self The liqcell to modify
context The context of the liqcell

Referenced by liqcell_free().

void liqcell_setdata ( liqcell *  self,
void *  data 
)

Set the data of the liqcell

Parameters:
self The liqcell to modify
data The data of the liqcell

Referenced by liqcell_free().

void liqcell_setdirty ( liqcell *  self,
int  dirty 
)

Set dirty in order to indicate that the liqcell has changed, and needs to be updated

Parameters:
self The liqcell to modify
dirty Set this to 1 to indicate that the liqcell needs to be updated

References liqcell_handlerrun().

Referenced by liqcell_child_arrange_makegrid_internal(), liqcell_setdirtyhold(), and liqcell_setimage().

void liqcell_setdirtyhold ( liqcell *  self,
int  dirtyhold 
)

Set the dirty hold to indicate whether a liqcell can be updated

Parameters:
self The liqcell to modify
dirtyhold Set this to 0 to indicate no hold, can be updated.

References liqcell_setdirty().

void liqcell_setenabled ( liqcell *  self,
int  arg 
)

Set the enabled value of the liqcell

Parameters:
self The liqcell to modify
arg The value to set enabled of the liqcell

void liqcell_setfont ( liqcell *  self,
liqfont *  font 
)

Set the font of the liqcell

Parameters:
self The liqcell to modify
font The liqcell's font

Referenced by liqcell_free(), textbox_create(), uiinfobar_create(), uinumberbox_create(), uipicturebox_create(), uitextbox_create(), and uititlebar_create().

void liqcell_setimage ( liqcell *  self,
liqimage *  image 
)

Set the provided liqcell's bakground image.

Parameters:
self The liqcell
image The liqimage to set

References liqcell_setdirty().

Referenced by liqcell_free(), uipicturebox_create(), and uititlebar_create().

void liqcell_setinnersize ( liqcell *  self,
int  w,
int  h 
)

Set the inner sizes parameters of the liqcell

Parameters:
self The liqcell to modify
w Width
h Height

void liqcell_setinnersize_from_outer ( liqcell *  self  ) 

Set the inner size parameters using the width and height parameters of the liqcell

Parameters:
self The liqcell to modify

void liqcell_setkinetic ( liqcell *  self,
int  kx,
int  ky 
)

Set the liqcell's kinetic values int he x and y direction

Parameters:
self The liqcell to modify
kx The kinetic value in the x direction
ky The kinetic value in the y direction

void liqcell_setname ( liqcell *  self,
char *  name 
)

Set the liqcell name

Parameters:
self The liqcell to modify
name The name of the liqcell

References liqapp_errorandfail().

Referenced by liqcell_free().

void liqcell_setpos ( liqcell *  self,
int  x,
int  y 
)

Set the x, y coordinate position of the liqcell

Parameters:
self Liqcell to set the position of
x The x-coordinate
y The y-coordinate

References liqcell_handlerrun().

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), and liqcell_child_arrange_makegrid_internal().

void liqcell_setrect ( liqcell *  self,
int  x,
int  y,
int  w,
int  h 
)

Set the x, y-coordinates and height/width of a liqcell

Parameters:
self The liqcell to modify
x X-Coordinate
y Y-Coordinate
w Width
h Height

References liqcell_handlerrun().

void liqcell_setrect_autoscale ( liqcell *  self,
int  x,
int  y,
int  w,
int  h,
float  sx,
float  sy 
)

Set the rect, but use default original scaling to do it

Parameters:
self The liqcell to modify
x X-Coordinate
y Y-Coordinate
w Width
h Height
sx X Scaling fraction
sy Y Scaling fraction

References liqcell_handlerrun().

void liqcell_setselected ( liqcell *  self,
int  arg 
)

Set the selection of the liqcell

Parameters:
self The liqcell to
arg The argument set to selected parameter of the liqcell

void liqcell_setshown ( liqcell *  self,
int  arg 
)

Set the shown value of the liqcell

Parameters:
self The liqcell to modify
arg The value to set shown

void liqcell_setsize ( liqcell *  self,
int  w,
int  h 
)

Set the width and height of the liqcell

Parameters:
self Liqcell to set dimensions of
w The width
h The height

References liqcell_handlerrun().

Referenced by liqcell_child_arrange_easycol(), liqcell_child_arrange_easyrow(), liqcell_child_arrange_makegrid_internal(), and liqcell_setsize_from_inner().

void liqcell_setsize_from_inner ( liqcell *  self  ) 

Set the size of a liqcell by providing just the liqcell and using the inner width and inner height

Parameters:
self The liqcell to set the size of

References liqcell_setsize().

void liqcell_setsketch ( liqcell *  self,
liqsketch *  sketch 
)

Set the sketch of the liqcell

Parameters:
self The liqcell to modify
sketch The sketch of the liqcell

Referenced by liqcell_free(), and liqcell_sketch_autoload().

void liqcell_settag ( liqcell *  self,
void *  tag 
)

Set the tag of the liqcell

Parameters:
self The liqcell to modify
tag The liqcell's tag

Referenced by liqcell_handleradd_withcontext().

void liqcell_sketch_autoload ( liqcell *  self  ) 

Load the sketch of the liqcell

Parameters:
self The liqcell to load the sketch of

References liqapp_fileexists(), liqcell_propgets(), and liqcell_setsketch().

void liqcell_test (  ) 

Testing function

References liqcell_new(), and liqcell_release().


Generated on Wed Jul 22 13:20:12 2009 for libliqbase by  doxygen 1.5.9