Usermode/AxWin3 - Splitting widget types out into separate files
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / renderers / widget / button.c
1 /*
2  * Acess2 Window Manager v3
3  * - By John Hodge (thePowersGang)
4  * 
5  * renderer/widget/button.c
6  * - Button Widget Type
7  */
8 #include <common.h>
9 #include "./common.h"
10 #include "./colours.h"
11
12 void Widget_Button_Render(tWindow *Window, tElement *Element)
13 {
14         WM_Render_FillRect(
15                 Window,
16                 Element->CachedX+1, Element->CachedY+1,
17                 Element->CachedW-2, Element->CachedH-2,
18                 BUTTON_BGCOLOUR
19                 );
20         WM_Render_DrawRect(
21                 Window,
22                 Element->CachedX, Element->CachedY,
23                 Element->CachedW-1, Element->CachedH-1,
24                 BUTTON_BORDER
25                 );
26 }
27
28 int Widget_Button_MouseButton(tElement *Element, int X, int Y, int Button, int bPress)
29 {
30         _SysDebug("Ele %i - Button %i %s",
31                 Element->ID, Button,
32                 (bPress ? "pressed" : "released")
33                 );
34         if(!bPress)     Widget_Fire(Element);
35         return 0;       // Handled
36 }
37
38 DEFWIDGETTYPE(ELETYPE_BUTTON,
39         .Render = Widget_Button_Render,
40         .MouseButton = Widget_Button_MouseButton
41         )
42

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