Usermode/AxWin3 - Fiddliing with things
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / renderer_widget.c
1 /*
2  * Acess2 Window Manager v3
3  * - By John Hodge (thePowersGang)
4  *
5  * render_widget.c
6  * - AxWin2 Widget port
7  */
8 #include <common.h>
9 #include <wm_renderer.h>
10 #include <renderer_widget.h>
11
12 // === TYPES ===
13 typedef struct sWidgetWin       tWidgetWin;
14 typedef struct sAxWin_Element   tElement;
15
16 // === STRUCTURES ===
17 struct sAxWin_Element
18 {
19         enum eElementTypes      Type;
20         
21         // Element Tree
22         tElement        *Parent;
23         tElement        *FirstChild;
24         tElement        *LastChild;
25         tElement        *NextSibling;
26         
27         // Application
28         tApplication    *Owner; //!< Owning application
29         uint16_t        ApplicationID;  //!< Index into sApplication::EleIndex
30
31         // User modifiable attributes   
32         short   PaddingL, PaddingR;
33         short   PaddingT, PaddingB;
34         short   GapSize;
35         
36         uint32_t        Flags;
37         
38         short   FixedWith;      //!< Fixed lengthways Size attribute (height)
39         short   FixedCross;     //!< Fixed Cross Size attribute (width)
40         
41         char    *Text;
42         
43         // -- Attributes maitained by the element code
44         // Not touched by the user
45         short   MinWith;        //!< Minimum long size
46         short   MinCross;       //!< Minimum cross size
47         void    *Data;  //!< Per-type data
48         
49         // -- Render Cache
50         short   CachedX, CachedY;
51         short   CachedW, CachedH;
52         
53         char    DebugName[];
54 };
55 struct sWidgetWin
56 {
57         tElement        RootElement;
58 };
59
60 // === PROTOTYPES ===
61 tWindow *Renderer_Widget_Create(int Width, int Height, int Flags);
62 void    Renderer_Widget_Redraw(tWindow *Window);
63 int     Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data);
64
65 // === GLOBALS ===
66 tWMRenderer     gRenderer_Widget = {
67         .Name = "Classful",
68         .CreateWindow = Renderer_Widget_Create,
69         .Redraw = Renderer_Widget_Redraw,
70         .HandleMessage = Renderer_Widget_HandleMessage
71 };
72
73 // === CODE ===
74 int Renderer_Widget_Init(void)
75 {
76         WM_RegisterRenderer(&gRenderer_Widget); 
77
78         return 0;
79 }
80
81 tWindow *Renderer_Widget_Create(int Width, int Height, int Flags)
82 {
83         // TODO: Add info
84         return WM_CreateWindowStruct( sizeof(tWidgetWin) );
85 }
86
87 void Renderer_Widget_Redraw(tWindow *Window)
88 {
89 }
90
91 int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
92 {
93         tWidgetWin      *info = Target->RendererInfo;
94         switch(Msg)
95         {
96         default:
97                 return 1;       // Unhandled
98         }
99 }
100

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