Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef HAVE_CONFIG_H
00011 # include <config.h>
00012 #endif
00013
00014 #define DISABLE_DEBUGLOG
00015
00016
00017 #include "o_image_p.h"
00018
00019
00020
00021 GWEN_INHERIT(HTML_OBJECT, OBJECT_IMAGE);
00022
00023
00024 static int HtmlObject_Image_Layout(HTML_OBJECT *o) {
00025 OBJECT_IMAGE *xo;
00026
00027 assert(o);
00028 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00029 assert(xo);
00030
00031 HtmlObject_SetWidth(o, xo->scaledWidth);
00032 HtmlObject_SetHeight(o, xo->scaledHeight);
00033 return 0;
00034 }
00035
00036
00037
00038
00039 HTML_OBJECT *HtmlObject_Image_new(GWEN_XML_CONTEXT *ctx) {
00040 HTML_OBJECT *o;
00041 OBJECT_IMAGE *xo;
00042
00043 o=HtmlObject_new(ctx, HtmlObjectType_Image);
00044 GWEN_NEW_OBJECT(OBJECT_IMAGE, xo);
00045 GWEN_INHERIT_SETDATA(HTML_OBJECT, OBJECT_IMAGE, o, xo, HtmlObject_Image_FreeData);
00046 HtmlObject_SetLayoutFn(o, HtmlObject_Image_Layout);
00047
00048 return o;
00049 }
00050
00051
00052
00053 void GWENHYWFAR_CB HtmlObject_Image_FreeData(void *bp, void *p) {
00054 OBJECT_IMAGE *xo;
00055
00056 xo=(OBJECT_IMAGE*) p;
00057 HtmlImage_free(xo->image);
00058
00059 GWEN_FREE_OBJECT(xo);
00060 }
00061
00062
00063
00064 int HtmlObject_Image_GetScaledWidth(const HTML_OBJECT *o) {
00065 OBJECT_IMAGE *xo;
00066
00067 assert(o);
00068 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00069 assert(xo);
00070
00071 return xo->scaledWidth;
00072 }
00073
00074
00075
00076 void HtmlObject_Image_SetScaledWidth(HTML_OBJECT *o, int i) {
00077 OBJECT_IMAGE *xo;
00078
00079 assert(o);
00080 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00081 assert(xo);
00082
00083 xo->scaledWidth=i;
00084 }
00085
00086
00087
00088 int HtmlObject_Image_GetScaledHeight(const HTML_OBJECT *o) {
00089 OBJECT_IMAGE *xo;
00090
00091 assert(o);
00092 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00093 assert(xo);
00094
00095 return xo->scaledHeight;
00096 }
00097
00098
00099
00100 void HtmlObject_Image_SetScaledHeight(HTML_OBJECT *o, int i) {
00101 OBJECT_IMAGE *xo;
00102
00103 assert(o);
00104 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00105 assert(xo);
00106
00107 xo->scaledHeight=i;
00108 }
00109
00110
00111
00112 HTML_IMAGE *HtmlObject_Image_GetImage(const HTML_OBJECT *o) {
00113 OBJECT_IMAGE *xo;
00114
00115 assert(o);
00116 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00117 assert(xo);
00118
00119 return xo->image;
00120 }
00121
00122
00123
00124 void HtmlObject_Image_SetImage(HTML_OBJECT *o, HTML_IMAGE *img) {
00125 OBJECT_IMAGE *xo;
00126
00127 assert(o);
00128 xo=GWEN_INHERIT_GETDATA(HTML_OBJECT, OBJECT_IMAGE, o);
00129 assert(xo);
00130
00131 if (img)
00132 HtmlImage_Attach(img);
00133 HtmlImage_free(xo->image);
00134 xo->image=img;
00135 }
00136
00137
00138
00139
00140
00141
00142
00143