X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fdecorator.c;h=6600408a502095c20e2dcdceb280295fd376746c;hb=be5123fe1f4aa66b76ce8ef589362ad21b6bbf72;hp=937fb18be856d8ffefb3b3c3c2d247b9a0e393b5;hpb=f0c407e7d468bc5acfd8d436be7f79f6e6248421;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/decorator.c b/Usermode/Applications/axwin3_src/WM/decorator.c index 937fb18b..6600408a 100644 --- a/Usermode/Applications/axwin3_src/WM/decorator.c +++ b/Usermode/Applications/axwin3_src/WM/decorator.c @@ -48,7 +48,7 @@ void Decorator_UpdateBorderSize(tWindow *Window) void Decorator_Redraw(tWindow *Window) { - int bActive; + int bActive = 0; int text_width, text_height; // TODO: This could possibly be expensive, but is there a better way? @@ -64,14 +64,17 @@ void Decorator_Redraw(tWindow *Window) } // Draw title bar + // - Body WM_Render_FillRect(Window, 0, -ciTitlebarHeight, Window->W, ciTitlebarHeight, (bActive ? cColourActive_Titlebar : cColourInactive_Titlebar) ); + // - Top Border WM_Render_FillRect(Window, 0, -ciTitlebarHeight, Window->W, 1, cColour_TitleTopBorder ); + // - Sides WM_Render_FillRect(Window, 0, -ciTitlebarHeight, 1, ciTitlebarHeight, cColour_SideBorder @@ -81,11 +84,13 @@ void Decorator_Redraw(tWindow *Window) cColour_SideBorder ); + // Get the font height WM_Render_GetTextDims( NULL, // TODO: Select font Window->Title ? Window->Title : "jI", -1, &text_width, &text_height ); + // - Use that to draw the window title on the left of the window WM_Render_DrawText(Window, ciTitlebarHeight + 4, -(ciTitlebarHeight - (ciTitlebarHeight/2 - text_height/2)), Window->W - ciTitlebarHeight - 4, text_height, @@ -93,29 +98,32 @@ void Decorator_Redraw(tWindow *Window) (bActive ? cColourActive_TitleText : cColourInactive_TitleText), Window->Title ? Window->Title : "--", -1 ); - + + // TODO: Minimise, Maximise and Close + // Maximized windows don't have any other borders if( Window->Flags & WINFLAG_MAXIMIZED ) return ; - // Left + // Left Border WM_Render_FillRect(Window, -ciSideBorderWidth, -ciTitlebarHeight, ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth, cColour_SideBorder ); - // Right + // Right Border WM_Render_FillRect(Window, Window->W, -ciTitlebarHeight, ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth, cColour_SideBorder ); - // Bottom + // Bottom Border (hard line) WM_Render_FillRect(Window, -ciSideBorderWidth, Window->H, ciSideBorderWidth*2+Window->W, 1, 0x000000 ); + // Bottom Border WM_Render_FillRect(Window, -ciSideBorderWidth, Window->H+1, ciSideBorderWidth*2+Window->W, ciBottomBorderWidth-1, @@ -125,18 +133,31 @@ void Decorator_Redraw(tWindow *Window) int Decorator_HandleMessage(tWindow *Window, int Message, int Length, const void *Data) { + static tWindow *btn1_down; switch(Message) { case WNDMSG_MOUSEMOVE: { const struct sWndMsg_MouseMove *msg = Data; + + if( btn1_down == Window ) { + WM_MoveWindow(Window, Window->X + msg->dX, Window->Y + msg->dY); + return 0; + } + if(msg->Y >= 0) return 1; // Pass - + // TODO: Handle return 0; } case WNDMSG_MOUSEBTN: { const struct sWndMsg_MouseButton *msg = Data; + if( msg->Button == 0 && !msg->bPressed ) + btn1_down = 0; + if(msg->Y >= 0) return 1; // Pass - + + if( msg->Button == 0 && msg->bPressed ) + btn1_down = Window; + // TODO: Handle return 0; } default: // Anything unhandled is passed on