Usermode/AxWin3 - Clean up unneeded (and silly) log message
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / renderers / widget / image.c
1 /*
2  * Acess2 Window Manager v3
3  * - By John Hodge (thePowersGang)
4  * 
5  * renderer/widget/image.c
6  * - Image Widget Type
7  */
8 #include <common.h>
9 #include "./common.h"
10 #include "./colours.h"
11 #include "../../include/image.h"
12
13 void Widget_Image_Render(tWindow *Window, tElement *Element)
14 {
15         WM_Render_DrawImage(
16                 Window,
17                 Element->CachedX, Element->CachedY,
18                 Element->CachedW, Element->CachedH,
19                 Element->Data
20                 );
21 }
22
23 void Widget_Image_UpdateText(tElement *Element, const char *Text)
24 {
25         if(Element->Data)       free(Element->Data);
26         Element->Data = Image_Load( Text );
27         if(!Element->Data) {
28                 _SysDebug("Widget::Image - Load failed '%s'", Text);
29 //              Element->Flags &= ~ELEFLAG_FIXEDSIZE;
30                 return ;
31         }
32         
33         Element->CachedW = ((tImage*)Element->Data)->Width;
34         Element->CachedH = ((tImage*)Element->Data)->Height;
35
36         Element->MinW = ((tImage*)Element->Data)->Width;
37         Element->MinH = ((tImage*)Element->Data)->Width;
38         
39         Widget_UpdateMinDims(Element->Parent);
40         
41         // NOTE: Doesn't update Element->Text because it's not really needed here
42 }
43
44 DEFWIDGETTYPE(ELETYPE_IMAGE, "Image",
45         WIDGETTYPE_FLAG_NOCHILDREN,
46         .Render = Widget_Image_Render,
47         .UpdateText = Widget_Image_UpdateText
48         );
49

UCC git Repository :: git.ucc.asn.au