gwenhywfar 4.0.3
|
00001 /*************************************************************************** 00002 begin : Fri Jul 16 2010 00003 copyright : (C) 2010 by Martin Preuss 00004 email : martin@libchipcard.de 00005 00006 *************************************************************************** 00007 * Please see toplevel file COPYING for license details * 00008 ***************************************************************************/ 00009 00010 #ifdef HAVE_CONFIG_H 00011 # include <config.h> 00012 #endif 00013 00014 #define DISABLE_DEBUGLOG 00015 00016 00017 #include "htmlimage_p.h" 00018 00019 00020 00021 GWEN_INHERIT_FUNCTIONS(HTML_IMAGE) 00022 GWEN_LIST_FUNCTIONS(HTML_IMAGE, HtmlImage) 00023 00024 00025 HTML_IMAGE *HtmlImage_new() { 00026 HTML_IMAGE *img; 00027 00028 GWEN_NEW_OBJECT(HTML_IMAGE, img); 00029 img->refCount=1; 00030 GWEN_INHERIT_INIT(HTML_IMAGE, img); 00031 GWEN_LIST_INIT(HTML_IMAGE, img); 00032 00033 return img; 00034 } 00035 00036 00037 00038 void HtmlImage_free(HTML_IMAGE *img) { 00039 if (img) { 00040 assert(img->refCount); 00041 if (img->refCount>1) 00042 img->refCount--; 00043 else { 00044 GWEN_LIST_FINI(HTML_IMAGE, img); 00045 GWEN_INHERIT_FINI(HTML_IMAGE, img); 00046 free(img->imageName); 00047 00048 img->refCount=0; 00049 GWEN_FREE_OBJECT(img); 00050 } 00051 } 00052 } 00053 00054 00055 00056 void HtmlImage_Attach(HTML_IMAGE *img) { 00057 assert(img); 00058 assert(img->refCount); 00059 img->refCount++; 00060 } 00061 00062 00063 00064 const char *HtmlImage_GetImageName(const HTML_IMAGE *img) { 00065 assert(img); 00066 assert(img->refCount); 00067 return img->imageName; 00068 } 00069 00070 00071 00072 void HtmlImage_SetImageName(HTML_IMAGE *img, const char *s) { 00073 assert(img); 00074 assert(img->refCount); 00075 free(img->imageName); 00076 if (s) img->imageName=strdup(s); 00077 else img->imageName=NULL; 00078 } 00079 00080 00081 00082 int HtmlImage_GetWidth(const HTML_IMAGE *img) { 00083 assert(img); 00084 assert(img->refCount); 00085 return img->width; 00086 } 00087 00088 00089 00090 void HtmlImage_SetWidth(HTML_IMAGE *img, int i) { 00091 assert(img); 00092 assert(img->refCount); 00093 img->width=i; 00094 } 00095 00096 00097 00098 int HtmlImage_GetHeight(const HTML_IMAGE *img) { 00099 assert(img); 00100 assert(img->refCount); 00101 return img->height; 00102 } 00103 00104 00105 00106 void HtmlImage_SetHeight(HTML_IMAGE *img, int i) { 00107 assert(img); 00108 assert(img->refCount); 00109 img->height=i; 00110 } 00111 00112 00113