vworld/vcell.h

00001 
00002 
00003 #ifndef VCELL_H
00004 #define VCELL_H
00005 
00006 #include "liqbase.h"
00007 
00008 //#include "vcell_easyrun.h"
00009 //#include "vcell_prop.h"
00010 
00011 
00012 //#########################################################################
00013 //#########################################################################
00014 //######################################################################### cell type definition
00015 //#########################################################################
00016 //#########################################################################
00017 
00018 typedef
00019 struct vcell
00020 {
00021         unsigned int usagecount;
00022         //struct vcell *linkcontent;                    // this gives me a shiver..
00023         struct vcell *linkparent;
00024         struct vcell *linkprev;
00025         struct vcell *linknext;
00026         struct vcell *linkchild;
00027         //int childcount;
00028 
00029         int    kind;                                            // see cellkind_ enumeration
00030 
00031 
00032                                                                                 // 1=prop               - a none visual property
00033                                                                                 // 2=visual             - a user interface element
00034                                                                                 // 4=widget         - a core widget component, the "base"
00035 
00036         char * name;
00037         char * classname;
00038         char * context;
00039         void * data;                                            // YOU are in charge of allocation, perhaps I Should enforce rigidity
00040 
00041         // todo: VVV maybe fold these up into a single uint bitmask VVV
00042 
00043         int deleted;                                            // marked as deleted (recoverable), will decide on this later
00044         int visible;
00045         int enabled;
00046         int selected;
00047 
00048 
00049         int x;                                                          // these are our dimensions according to the parent
00050         int y;
00051         int w;
00052         int h;
00053 
00054         int kineticx;                                           // this is how fast we are travelling relative to our parent
00055         int kineticy;                                           // this will be moved shortly
00056 
00057         int overlapx;                                           // amount of overlap (just to keep the algo in place)
00058         int overlapy;
00059 
00060 
00061         int innerw;                                                     // these are our total required dimensions according to our contents
00062         int innerh;                                                     // all children are expected to exist within this area
00063 
00064         // another
00065         struct vcell *content;                          // contained cell :)
00066 
00067         liqsketch *sketch;                                      // one of each of the media types are required.  i need to be able to write paint or draw directly :)
00068         liqimage  *image;
00069         liqfont   *font;
00070         int dirty;                                                      // the dirty flag is important, and should really be automatic
00071         int tag;
00072         int dirtyhold;
00073         char *caption;
00074 
00075         unsigned int unused[8];
00076 
00077 }       vcell;
00078 
00079 #define cellkind_prop      1
00080 #define cellkind_visual    2
00081 #define cellkind_widget    4
00082 #define cellkind_shown     8
00083 
00084 
00085 int vcell_iskind(vcell *self,int cellkind);
00086 /*
00087         // old style iter code
00088         vcell *c=self->linkchild;
00089         while(c)
00090         {
00091                 // do action
00092                 c=c->linknext;
00093         }
00094 
00095         // newer OO method, aim to not touch the ->members directly
00096         vcell *c=vcell_getlinkchild(self);
00097         while(c)
00098         {
00099                 // do action
00100                 c=vcell_getlinknext(c);
00101         }
00102  */
00103 
00104 //#########################################################################
00105 //#########################################################################
00106 //######################################################################### cell construction and reference counting
00107 //#########################################################################
00108 //#########################################################################
00109 vcell * vcell_new();
00110 vcell * vcell_hold(vcell *self);
00111 void    vcell_release(vcell *self);
00112 void    vcell_free(vcell *self);
00113 
00114 //######################################################################### standard constructors
00115 
00116 vcell*  vcell_quickcreatewidget(char *name,char *classname,int innerw,int innerh);
00117 vcell*  vcell_quickcreatevis(char *name,char *classname,int x,int y,int w,int h);
00118 vcell*  vcell_quickcreatedata(char *name,char *classname,void *data);
00119 vcell*  vcell_quickcreatenameclass(char *name,char *classname);
00120 //vcell * vcell_quickcreatefull(char *name,char *classname,char *context,void *data);
00121 
00122 //######################################################################### children and tree management
00123 
00124 vcell*  vcell_child_append(vcell *self,vcell *child);
00125 vcell*  vcell_child_insert(vcell *self,vcell *child);
00126 vcell*  vcell_child_insertsorted(vcell *self, vcell * ch);
00127 void    vcell_child_remove(vcell *self,vcell *child);
00128 
00129 vcell*  vcell_child_lookup(vcell *self,char *name);
00130 vcell*  vcell_child_lookup_nameclass(vcell *self,char *name,char *classname);
00131 
00132 
00133 
00134 vcell * vcell_getlinkparent(vcell *self);
00135 vcell * vcell_getlinkprev(vcell *self);
00136 vcell * vcell_getlinknext(vcell *self);
00137 vcell * vcell_getlinkchild(vcell *self);
00138 
00139 
00140 //######################################################################### searching
00141 
00142 //vcell*  vcell_findfirst(vcell *self,char *query);
00143 vcell*  vcell_findnext(vcell *self,char *query);
00144 
00145 
00146 
00147 vcell*  vcell_local_lookup(vcell *self,char *name);
00148 vcell*  vcell_local_lookup_nameclass(vcell *self,char *name,char *classname);
00149 vcell*  vcell_global_lookup(vcell *self,char *name);
00150 vcell*  vcell_global_lookup_nameclass(vcell *self,char *name,char *classname);
00151 
00152 void *  vcell_handlerfind(vcell *self,char *handlername);
00153 vcell*  vcell_handleradd( vcell *self,char *handlername, void *handler);
00154 int     vcell_handlerrun( vcell *self,char *handlername,void *args);
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 //######################################################################### standard control properties
00163 
00164 void    vcell_setname(vcell *self,char *name);                          // symbolic identifier
00165 char *  vcell_getname(vcell *self);
00166 
00167 
00168 
00169 void    vcell_setcaption(vcell *self,char *caption);            // easy translatable label
00170 char *  vcell_getcaption(vcell *self);
00171 
00172 
00173 
00174 void    vcell_setclassname(vcell *self,char *classname);        // class name used to construct
00175 char *  vcell_getclassname(vcell *self);
00176 
00177 
00178 
00179 void    vcell_setcontext(vcell *self,char *context);            // variation used (if applicable)
00180 char *  vcell_getcontext(vcell *self);
00181 
00182 
00183 
00184 
00185 
00186 void    vcell_setcontent(vcell *self,vcell *content);
00187 vcell * vcell_getcontent(vcell *content);
00188 
00189 int     vcell_getqualifiedname(vcell *self, char *buff, int buffmax);
00190 
00191 void    vcell_setdata(vcell *self,void *data);
00192 void *  vcell_getdata(vcell *self);
00193 
00194 //vcell *       vcell_getlinkcontent(vcell *self);
00195 
00196 
00197 //######################################################################### ui/interaction
00198 void    vcell_setvisible(vcell *self,int arg);                          // set the visible indicator
00199 int     vcell_getvisible(vcell *self);
00200 
00201 void    vcell_setselected(vcell *self,int arg);                         // set the selected indicator
00202 int     vcell_getselected(vcell *self);
00203 
00204 void    vcell_setdirty(vcell *self,int dirty);                          // set the dirty flag :)  this cascades through parents as well
00205 int     vcell_getdirty(vcell *self);
00206 
00207 void    vcell_setdirtyhold(vcell *self,int dirtyhold);          // hold off on telling parent (useful if there are multiple changes due)
00208 int     vcell_getdirtyhold(vcell *self);
00209 
00210 
00211 void    vcell_setshown(vcell *self,int arg);                            // set the shown indicator flag
00212 int     vcell_getshown(vcell *self);
00213 
00214 //######################################################################### style attributes
00215 
00216 void    vcell_setsketch(vcell *self,liqsketch *sketch);
00217 liqsketch*vcell_getsketch(vcell *self);
00218 
00219 
00220 void    vcell_setimage(vcell *self,liqimage *image);
00221 liqimage *vcell_getimage(vcell *self);
00222 
00223 void    vcell_setfont(vcell *self,liqfont *font);
00224 liqfont *vcell_getfont(vcell *self);
00225 
00226 //######################################################################### rectangle boundary handlers
00227 
00228 void    vcell_setpos(vcell *self,int x,int y);
00229 void    vcell_setsize(vcell *self,int w,int h);
00230 void    vcell_adjustpos(vcell *self,int dx,int dy);
00231 void    vcell_adjustsize(vcell *self,int dw,int dh);
00232 void    vcell_setkinetic(vcell *self,int kx,int ky);
00233 void    vcell_setrect(vcell *self,int x,int y,int w,int h);
00234 
00235 int     vcell_getx(vcell *self);
00236 int     vcell_gety(vcell *self);
00237 int     vcell_getw(vcell *self);
00238 int     vcell_geth(vcell *self);
00239 int     vcell_getinnerw(vcell *self);
00240 int     vcell_getinnerh(vcell *self);
00241 int     vcell_getkineticx(vcell *self);
00242 int     vcell_getkineticy(vcell *self);
00243 
00244 void    vcell_forceinboundparent(vcell *self);
00245 
00246 //######################################################################### Misc Functions
00247 
00248 void    vcell_zorder_totop(vcell *self);  // moves the cell to the top of the zorder, NULL function at present
00249 vcell * vcell_getbasewidget(vcell *self); // called from within an event steps backwards until it finds the base widget this item was created by
00250 
00251 //######################################################################### Arrangement and Layout tools
00252 
00253 
00254 int     vcell_child_arrange_easytile(vcell *self);                      // make sure all contents are bound within the area
00255 int     vcell_child_arrange_easyrow(vcell *self);                       // split into Left|Centre|Right boxes (newspaper panels)
00256 int     vcell_child_arrange_easycol(vcell *self);                       // split into Top|Middle|Bottom boxes (sections)
00257 
00258 
00259 int     vcell_child_arrange_autoflow(vcell *self);                      // flowing document: like text does;
00260 int     vcell_child_arrange_nooverlap(vcell *self,vcell *currentselection);
00261 int     vcell_child_arrange_makegrid(vcell *self,int viscolcount,int visrowcount);
00262 
00263 
00264 
00265 //######################################################################### special handlers
00266 
00267 
00268 
00269 
00270 #endif

Generated on Mon Apr 13 15:09:26 2009 for libliqbase by  doxygen 1.5.1