示例#1
0
文件: disptext.c 项目: berkus/acess2
void Widget_DispText_Render(tWindow *Window, tElement *Element)
{
	WM_Render_DrawText(
		Window,
		Element->CachedX+1, Element->CachedY+1,
		Element->CachedW-2, Element->CachedH-2,
		NULL, TEXT_COLOUR,
		Element->Text, -1
		);
}
示例#2
0
void Decorator_Redraw(tWindow *Window)
{
	 int	bActive = 0;
	 int	text_width, text_height;
	
	// TODO: This could possibly be expensive, but is there a better way?
	{
		tWindow	*win;
		for(win = gpWM_FocusedWindow; win; win = win->Owner)
		{
			if(win == Window) {
				bActive = 1;
				break;
			}
		}
	}

	// 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
		);
	WM_Render_FillRect(Window,
		Window->W, -ciTitlebarHeight, 1, ciTitlebarHeight,
		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,
		NULL,	// TODO: Select font
		(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 Border
	WM_Render_FillRect(Window,
		-ciSideBorderWidth, -ciTitlebarHeight,
		ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth,
		cColour_SideBorder
		);
	// Right Border
	WM_Render_FillRect(Window,
		Window->W, -ciTitlebarHeight,
		ciSideBorderWidth, Window->H + ciTitlebarHeight + ciBottomBorderWidth,
		cColour_SideBorder
		);
	// 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,
		cColour_BottomBorder
		);
	
	// Buttons
	WM_Render_FillRect(Window, BTN_CLOSE(Window), cColour_CloseBtn);
	// TODO: Conditional for each
}