2 * Acess2 Window Manager v3 (axwin3)
3 * - By John Hodge (thePowersGang)
10 #include <decorator.h>
13 void Decorator_UpdateBorderSize(tWindow *Window);
14 void Decorator_Redraw(tWindow *Window);
15 int Decorator_HandleMessage(tWindow *Window, int Message, int Length, void *Data);
18 tColour cColourActive_Titlebar = 0xFF8800;
19 tColour cColourActive_TitleText = 0x000000;
20 tColour cColourInactive_Titlebar = 0xD0D0D0;
21 tColour cColourInactive_TitleText= 0x000000;
22 tColour cColour_SideBorder = 0xD0D0D0;
23 tColour cColour_BottomBorder = 0xD0D0D0;
24 int ciTitlebarHeight = 18;
25 int ciSideBorderWidth = 2;
26 int ciBottomBorderWidth = 4;
29 void Decorator_UpdateBorderSize(tWindow *Window)
36 Window->BorderT = ciTitlebarHeight;
37 if( Window->Flags & WINFLAG_MAXIMIZED )
40 Window->BorderB = ciBottomBorderWidth;
41 Window->BorderR = ciSideBorderWidth;
42 Window->BorderL = ciSideBorderWidth;
45 void Decorator_Redraw(tWindow *Window)
48 int text_width, text_height;
50 // TODO: Detect if window has focus
53 WM_Render_FillRect(Window,
54 0, -ciTitlebarHeight, Window->W, ciTitlebarHeight,
55 (bActive ? cColourActive_Titlebar : cColourInactive_Titlebar)
58 WM_Render_GetTextDims(
59 NULL, // TODO: Select font
60 Window->Title ? Window->Title : "jI",
61 &text_width, &text_height
63 WM_Render_DrawText(Window,
64 ciTitlebarHeight + 4, -(ciTitlebarHeight - (ciTitlebarHeight/2 - text_height/2)),
65 Window->W - ciTitlebarHeight - 4, text_height,
66 NULL, // TODO: Select font
67 (bActive ? cColourActive_TitleText : cColourInactive_TitleText),
68 Window->Title ? Window->Title : "--"
71 // Maximized windows don't have any other borders
72 if( Window->Flags & WINFLAG_MAXIMIZED )
76 WM_Render_FillRect(Window,
77 -ciSideBorderWidth, -ciTitlebarHeight,
78 ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth,
82 WM_Render_FillRect(Window,
83 Window->W, -ciTitlebarHeight,
84 ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth,
88 WM_Render_FillRect(Window,
89 -ciSideBorderWidth, Window->H,
90 ciSideBorderWidth*2+Window->W, ciBottomBorderWidth,
95 int Decorator_HandleMessage(tWindow *Window, int Message, int Length, void *Data)
99 default: // Anything unhandled is passed on