Example #1
0
	void CControlUI::DoPaint(HDC hDC, const RECT& rcPaint)
	{
		if( !::IntersectRect(&m_rcPaint, &rcPaint, &m_rcItem) ) return;

		// »æÖÆÑ­Ðò£º±³¾°ÑÕÉ«->±³¾°Í¼->״̬ͼ->Îı¾->±ß¿ò
		SIZE cxyBorderRound = GetManager()->GetDPIObj()->Scale(m_cxyBorderRound);
		RECT rcBorderSize = GetManager()->GetDPIObj()->Scale(m_rcBorderSize);

		if( cxyBorderRound.cx > 0 || cxyBorderRound.cy > 0 ) {
			CRenderClip roundClip;
			CRenderClip::GenerateRoundClip(hDC, m_rcPaint,  m_rcItem, cxyBorderRound.cx, cxyBorderRound.cy, roundClip);
			PaintBkColor(hDC);
			PaintBkImage(hDC);
			PaintStatusImage(hDC);
			PaintForeColor(hDC);
			PaintForeImage(hDC);
			PaintText(hDC);
			PaintBorder(hDC);
		}
		else {
			PaintBkColor(hDC);
			PaintBkImage(hDC);
			PaintStatusImage(hDC);
			PaintForeColor(hDC);
			PaintForeImage(hDC);
			PaintText(hDC);
			PaintBorder(hDC);
		}
	}
	void CControlUI::DoPaint(HDC hDC, const RECT& rcPaint)
	{
		if( !::IntersectRect(&m_rcPaint, &rcPaint, &m_rcItem) ) return;

		// »æÖÆÑ­Ðò£º±³¾°ÑÕÉ«->±³¾°Í¼->״̬ͼ->Îı¾->±ß¿ò
		if( m_cxyBorderRound.cx > 0 || m_cxyBorderRound.cy > 0 ) {
			CRenderClip roundClip;
			CRenderClip::GenerateRoundClip(hDC, m_rcPaint,  m_rcItem, m_cxyBorderRound.cx, m_cxyBorderRound.cy, roundClip);
			PaintBkColor(hDC);
			PaintBkImage(hDC);
			PaintStatusImage(hDC);
			PaintForeColor(hDC);
			PaintForeImage(hDC);
			PaintText(hDC);
			PaintBorder(hDC);
		}
		else {
			PaintBkColor(hDC);
			PaintBkImage(hDC);
			PaintStatusImage(hDC);
			PaintForeColor(hDC);
			PaintForeImage(hDC);
			PaintText(hDC);
			PaintBorder(hDC);
		}
	}
Example #3
0
static void
MoveAndClearText(Widget w, int old_y, int height, int new_y)
{
  ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  int from_left = sblw->scroll.indent + sblw->scroll.offset - 1;
  int y_clear;

  old_y *= sblw->scroll.font_height;
  new_y *= sblw->scroll.font_height;
  height *= sblw->scroll.font_height;

/*
 * If we are already at the right location then do nothing.
 * (height == 0).
 *
 * If we have scrolled more than a screen height then just clear
 * the window.
 */

  if (height <= sblw->scroll.font_height) { /* avoid rounding errors. */
    XClearArea( XtDisplay(w), XtWindow(w), from_left, 0, 
	       (unsigned int) 0, (unsigned int) 0, FALSE);    
    PaintText(w, 0, (int) sblw->core.height);
    return;
  }

  if ((int)height + (int)old_y > (int)w->core.height)
    height = w->core.height - old_y;

  XCopyArea(XtDisplay(w), XtWindow(w), XtWindow(w), sblw->scroll.move_gc,
	    from_left, old_y, 
	    (unsigned int) w->core.width - from_left, (unsigned int) height,
	    from_left, new_y);

  if (old_y > new_y)
    height -= sblw->scroll.font_height/2;  /* clear 1/2 font of extra space,
					      to make sure we don't lose or
					      gain decenders. */
  else
    height -= sblw->scroll.font_height;  /* clear 1 font of extra space,
					    to make sure we don't overwrite
					    with a last line in buffer. */

  if (old_y > new_y)
    y_clear = height;
  else
    y_clear = 0;
  
/*
 * We cannot use generate exposures, since that may allow another move and
 * clear before the area get repainted, this would be bad.
 */

  XClearArea( XtDisplay(w), XtWindow(w), from_left, y_clear,
	     (unsigned int) 0, (unsigned int) (w->core.height - height),
	     FALSE);
  PaintText(w, (int) y_clear, (int) (w->core.height - height));
}
Example #4
0
int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
	int ii = q;
	if(ii < 0 || ii >= item.GetCount())
		return 0;
	const NavItem& m = *item[ii];
	bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);

	int x = r.left;
	int ry = r.top + r.GetHeight() / 2;
	int y = ry - Draw::GetStdFontCy() / 2;

	if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) {
		w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
		                                    : SColorFace);
		if(m.kind == KIND_FILE)
			return PaintFileName(w, r, m.type, ink);
		String h = FormatNest(m.type);
		w.DrawText(x, y, h, StdFont().Bold(), ink);
		return GetTextSize(h, StdFont().Bold()).cx;
	}
	
	w.DrawRect(r, paper);
	if(m.kind == KIND_LINE) {
		w.DrawText(x, y, m.type, StdFont().Bold(), ink);
		return GetTextSize(m.type, StdFont().Bold()).cx;
	}

	PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);

	x += Zx(15);
	Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type,
	                                          m.tname, m.ctname, ~m.natural + m.at);
	int starti = 0;
	for(int i = 0; i < n.GetCount(); i++)
		if(n[i].type == ITEM_NAME) {
			starti = i;
			break;
		}
	PaintText(w, x, y, m.natural, n, starti, n.GetCount(), focuscursor, ink, false);
	if(starti) {
		const char *h = " : ";
		w.DrawText(x, y, h, BrowserFont(), SColorText);
		x += GetTextSize(h, BrowserFont()).cx;
	}
	PaintText(w, x, y, m.natural, n, 0, starti, focuscursor, ink, false);
	return x;
}
Example #5
0
void CGTextArea::Paint (CG32bitImage &Dest, const RECT &rcRect)

//	Paint
//
//	Handle paint

	{
	RECT rcText = CalcTextRect(rcRect);

	//	Paint the background

	if (m_iBorderRadius > 0)
		CGDraw::RoundedRect(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_iBorderRadius, m_rgbBackColor);
	else
		Dest.Fill(rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_rgbBackColor);

	//	Paint the editable box

	if (m_bEditable)
		{
		CG32bitPixel rgbBorderColor = CG32bitPixel::Blend(CG32bitPixel(0, 0, 0), m_rgbColor, (BYTE)128);
		CGDraw::RectOutlineDotted(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), rgbBorderColor);
		}

	//	Paint the content

	if (!m_sText.IsBlank())
		PaintText(Dest, rcText);
	else
		PaintRTF(Dest, rcText);
	}
/*--------------------------------------------------------------+
| fnText - window proc for static text window
|                               |
+--------------------------------------------------------------*/
LRESULT CALLBACK fnText(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch(msg)
    {
        case WM_SETTEXT:
            DefWindowProc(hwnd, msg, wParam, lParam);
            InvalidateRect(hwnd,NULL,FALSE);
            UpdateWindow(hwnd);
            return 0L;

        case WM_ERASEBKGND:
            return 0L;

        case WM_PAINT:
        {
            PAINTSTRUCT ps;

            BeginPaint(hwnd, &ps);
            PaintText(hwnd, ps.hdc);
            EndPaint(hwnd, &ps);
            return 0L;
        }
    }

    return DefWindowProc(hwnd, msg, wParam, lParam);
}
Example #7
0
void CDisplayWindow::PatchBackground(HDC hdc,RECT *rc,RECT *UpdateRect)
{
	HDC hdcMem	= CreateCompatibleDC(hdc);
	HBITMAP hBitmap	= CreateCompatibleBitmap(hdc,rc->right-rc->left,rc->bottom-rc->top);
	HGDIOBJ hOriginalObject = SelectObject(hdcMem,hBitmap);

	/* Draw the stored background on top of the patched area. */
	BitBlt(hdcMem,UpdateRect->left,UpdateRect->top,rc->right,rc->bottom,m_hdcBackground,
	UpdateRect->left,UpdateRect->top,SRCCOPY);

	PaintText(hdcMem,m_LeftIndent);
	DrawIconEx(hdcMem,MAIN_ICON_LEFT,MAIN_ICON_TOP,m_hMainIcon,
		MAIN_ICON_WIDTH,MAIN_ICON_HEIGHT,NULL,NULL,DI_NORMAL);

	if(m_bShowThumbnail)
	{
		DrawThumbnail(hdcMem);
	}

	BitBlt(hdc,UpdateRect->left,UpdateRect->top,rc->right,rc->bottom,hdcMem,
	UpdateRect->left,UpdateRect->top,SRCCOPY);

	SelectObject(hdcMem,hOriginalObject);
	DeleteObject(hBitmap);
	DeleteDC(hdcMem);
}
Example #8
0
    void Label::OnPaint(gfx::Canvas* canvas)
    {
        OnPaintBackground(canvas);

        std::wstring paint_text;
        gfx::Rect text_bounds;
        int flags = 0;
        CalculateDrawStringParams(&paint_text, &text_bounds, &flags);
        PaintText(canvas, paint_text, text_bounds, flags);
    }
Example #9
0
//
/// Calls TGadget::PaintBorder to perform the actual painting of the border of the
/// control. Get Inner rectangle of control, layout Text and Bitmap and call
/// PaintText() and PaintFace().
//
void
TButtonTextGadget::Paint(TDC& dc)
{
  PRECONDITION(Window);

  PaintBorder(dc);

  TRect  faceRect, textRect, btnRect;
  GetInnerRect(faceRect);

  Layout(faceRect, textRect, btnRect);

  if(Style&sText)
    PaintText(dc, textRect, Text);
  if(Style&sBitmap)
    PaintFace(dc, btnRect);
}
void ParallelCoordinate::paintGL(){
    glViewport(0, 0, this->width(), this->height());
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 1, 0, 1, 0, 2);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0, 0, -1.0);

    glClear(GL_COLOR_BUFFER_BIT);
    glShadeModel(GL_SMOOTH);

    if ( dataset_ == NULL ) return;

    PaintSubsetIdentifyItems();
    PaintLines();
    PaintText();
    PaintCoordinate();
}
Example #11
0
/* ARGSUSED */
static void
Redisplay(Widget w, XEvent *event, Region region)
{
  int top, height;		/* the locations of the top and height
				   of the region that needs to be repainted. */
  
/*
 * This routine tells the client which sections of the window to 
 * repaint in his callback function which does the actual repainting.
 */

  if (event->type == Expose) {
    top = event->xexpose.y;
    height = event->xexpose.height;
  }
  else {
    top = event->xgraphicsexpose.y;
    height  = event->xgraphicsexpose.height;
  }
  
  PaintText(w, top, height);
} /* redisplay (expose) */
Example #12
0
	void CGroupBoxUI::PaintBorder(HDC hDC)
	{
		if( m_nBorderSize > 0 )
		{
			CDuiRect rcItem = m_rcItem;
			rcItem.Deflate(5,5);
			if( m_cxyBorderRound.cx > 0 || m_cxyBorderRound.cy > 0 )//»­Ô²½Ç±ß¿ò
			{
				if (IsFocused() && m_dwFocusBorderColor != 0)
					CRenderEngine::DrawRoundRect(hDC, rcItem, m_nBorderSize, m_cxyBorderRound.cx, m_cxyBorderRound.cy, GetAdjustColor(m_dwFocusBorderColor));
				else
					CRenderEngine::DrawRoundRect(hDC, rcItem, m_nBorderSize, m_cxyBorderRound.cx, m_cxyBorderRound.cy, GetAdjustColor(m_dwBorderColor));
			}
			else
			{
				if (IsFocused() && m_dwFocusBorderColor != 0)
					CRenderEngine::DrawRect(hDC, rcItem, m_nBorderSize, GetAdjustColor(m_dwFocusBorderColor));
				else
					CRenderEngine::DrawRect(hDC, rcItem, m_nBorderSize, GetAdjustColor(m_dwBorderColor));
			}
		}

		PaintText(hDC);
	}
/*
 * The following procedure manages the "insert" cursor
 */
static void
InsertCursor(Widget w, int x, int y, XawTextInsertState state)
{
    MultiSinkObject sink = (MultiSinkObject)w;
    XFontSet fontset = sink->multi_sink.fontset;
    Widget ctx = XtParent(w);
    XawTextPosition position = XawTextGetInsertionPoint(ctx);

    if (XtIsRealized(ctx)) {
	int fheight, fdiff;
	XawTextBlock block;
	wchar_t c;
	XawTextPosition selection_start, selection_end;
	Boolean has_selection;
	XFontSetExtents *ext = XExtentsOfFontSet(fontset);

	XawTextGetSelectionPos((Widget)ctx, &selection_start, &selection_end);
	has_selection = selection_start != selection_end;

	fheight = ext->max_logical_extent.height;
	fdiff = fheight - abs(ext->max_logical_extent.y);

	if ((sink->multi_sink.cursor_position != position || state == XawisOff)
	    && !has_selection && sink->multi_sink.laststate != XawisOff) {
	    wchar_t *ochar;

	    (void)XawTextSourceRead(XawTextGetSource(ctx),
				    sink->multi_sink.cursor_position,
				    &block, 1);
	    if (!block.length)
		ochar = NULL;
	    else {
		c = ((wchar_t *)block.ptr)[0];
		if (c == _Xaw_atowc(XawLF))
		    ochar = NULL;
		else if (c == _Xaw_atowc(XawTAB))
		    ochar = wspace;
		else
		    ochar = (wchar_t *)block.ptr;
	    }

	    if (!ochar)
		_XawTextSinkClearToBackground(w, sink->multi_sink.cursor_x,
					      (sink->multi_sink.cursor_y - 1 -
					      fheight), CharWidth(sink, fontset,
								  0, wspace[0]),
					      fheight);
	    else {
		if (XwcTextEscapement(sink->multi_sink.fontset, ochar, 1) != 0)
		    DisplayText(w, sink->multi_sink.cursor_x,
				sink->multi_sink.cursor_y - 1 - fheight,
				sink->multi_sink.cursor_position,
				sink->multi_sink.cursor_position + 1,
				False);
		else
		    PaintText(w, sink->multi_sink.normgc,
			      sink->multi_sink.cursor_x,
			      sink->multi_sink.cursor_y - 1 - fdiff,
			      ochar, 1,
			      ctx->core.background_pixmap != XtUnspecifiedPixmap);
	    }
	}

	if (!has_selection && state != XawisOff) {
	    wchar_t *nchar;
	    Boolean focus = ((TextWidget)ctx)->text.hasfocus;

	    (void)XawTextSourceRead(XawTextGetSource(ctx),
				    position, &block, 1);
	    c = ((wchar_t *)block.ptr)[0];
	    if (!block.length || c == _Xaw_atowc(XawLF)
		|| c == _Xaw_atowc(XawTAB))
		nchar = wspace;
	    else
		nchar = (wchar_t *)block.ptr;

	    if (focus) {
		if (XwcTextEscapement(sink->multi_sink.fontset, nchar, 1) != 0)
		    XwcDrawImageString(XtDisplay(ctx), XtWindow(ctx),
				       fontset, sink->multi_sink.invgc,
				       x, (y - 1 - fdiff), nchar, 1);
		else
		    DisplayText(w, x, y - 1 - fheight,
				position, position + 1, True);
	    }
	    else
		XDrawRectangle(XtDisplay(ctx), XtWindow(ctx),
			       sink->multi_sink.xorgc ?
			       sink->multi_sink.xorgc : sink->multi_sink.normgc,
			       x, y - 1 - fheight,
			       CharWidth(sink, fontset, 0, *nchar) - 1,
			       fheight - 1);
	  }
      }

    sink->multi_sink.cursor_x = x;
    sink->multi_sink.cursor_y = y;
    sink->multi_sink.laststate = state;
    sink->multi_sink.cursor_position = position;
}
Example #14
0
// Paint the button
void QPictureButton::paintEvent(QPaintEvent*)
{
    PaintButton();
    PaintIcon();
    PaintText();
}
Example #15
0
void COptionMonitor::Paint(IMonitorPainter * pPainter)
{
	PaintText(pPainter, m_Value() ? L("Yes") : L("No"));
}
Example #16
0
void CAzimuthMonitor::Paint(IMonitorPainter * pPainter)
{
	PaintText(pPainter, m_fSet ? IntToText(m_iValue) + L"°" : L"-");
}
void UIPicButton::Paint (HDC hdc)
{
	if (m_bVisible == false) {
		return;
	}

	// Paint the title to the screen
	BITMAP bm;
	HDC hdcMem = CreateCompatibleDC (hdc);
	HBITMAP hbmOld;

	int i = 0;
	int a = 0;

	if (g_bMouseover == true) {
		if (g_mouseDown == true) {
			hbmOld = (HBITMAP) SelectObject (hdcMem, g_hbmDown);
			GetObject (g_hbmDown, sizeof (bm), &bm);
		} else {
			hbmOld = (HBITMAP) SelectObject (hdcMem, g_hbmHighlight);
			GetObject (g_hbmHighlight, sizeof (bm), &bm);
		}
		
	} else {
		hbmOld = (HBITMAP) SelectObject (hdcMem, g_hbmBase);	
		GetObject (g_hbmBase, sizeof (bm), &bm);
	}
	
	if (g_bMouseover == true) {
		if (g_bUsehighlight == true) {
			if (g_bUsefade == true) {
				g_bHighlighted = true;
				if (g_mouseDown == true) {
					g_bDepressed = true;
					DrawButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
				} else {
					if (g_bDepressed == true) {
						DrawButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
						g_bDepressed = false;
					} else {
						DrawButton (hdc, hdcMem, BLITMETHOD_ALPHABLEND, g_blendop);	
					}
					
				}
			} else {
				g_bHighlighted = true;
				if (m_bUseRectHighlight == true) {
					DrawRect (hdc);
					DrawClippedButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
				} else {
					DrawButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
				}
			}
		}
	} else {
		if (g_bHighlighted==false) {
			DrawButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
		} else {
			if (g_bUsefade == true) {
				DrawButton (hdc, hdcMem, BLITMETHOD_ALPHABLEND, g_blendop);
			} else {
				DrawButton (hdc, hdcMem, BLITMETHOD_STANDARD, g_blendop);
			}
		}		
	}

	if (g_bUsingtext == true) {
		PaintText (hdc);
	}

	SelectObject (hdcMem, hbmOld);
	DeleteObject (hbmOld);
	DeleteDC (hdcMem);
}
Example #18
0
INT_PTR CALLBACK
ColorsProc(HWND hwndDlg,
           UINT uMsg,
           WPARAM wParam,
           LPARAM lParam)
{
    PCONSOLE_PROPS pConInfo;
    DWORD colorIndex;
    COLORREF color;

    pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam;
            SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);

            /* Set the valid range of the colour indicators */
            SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_RED  , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
            SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_GREEN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
            SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_BLUE , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));

            /* Select by default the screen background option */
            CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND);
            SendMessage(hwndDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);

            return TRUE;
        }

        case WM_DRAWITEM:
        {
            LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;

            if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16)
                return PaintStaticControls(hwndDlg, pConInfo, drawItem);
            else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
                return PaintText(drawItem, pConInfo, Screen);
            else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
                return PaintText(drawItem, pConInfo, Popup);

            break;
        }

        case WM_NOTIFY:
        {
            switch (((LPNMHDR)lParam)->code)
            {
                case PSN_APPLY:
                {
                    if (!pConInfo->AppliedConfig)
                    {
                        return ApplyConsoleInfo(hwndDlg, pConInfo);
                    }
                    else
                    {
                        /* Options have already been applied */
                        SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
                        return TRUE;
                    }
                    break;
                }

                case UDN_DELTAPOS:
                {
                    LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;

                    /* Get the current color */
                    colorIndex = pConInfo->ActiveStaticControl;
                    color = pConInfo->ci.Colors[colorIndex];

                    if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color));
                    }
                    else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color));
                    }
                    else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos);
                    }
                    else
                    {
                        break;
                    }

                    pConInfo->ci.Colors[colorIndex] = color;
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                    PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
                    break;
                }
            }

            break;
        }

        case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
                case IDC_RADIO_SCREEN_TEXT:
                {
                    /* Get the color of the screen foreground */
                    colorIndex = TextAttribFromAttrib(pConInfo->ci.ScreenAttrib);
                    color = pConInfo->ci.Colors[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    pConInfo->ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
                    break;
                }

                case IDC_RADIO_SCREEN_BACKGROUND:
                {
                    /* Get the color of the screen background */
                    colorIndex = BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib);
                    color = pConInfo->ci.Colors[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    pConInfo->ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
                    break;
                }

                case IDC_RADIO_POPUP_TEXT:
                {
                    /* Get the color of the popup foreground */
                    colorIndex = TextAttribFromAttrib(pConInfo->ci.PopupAttrib);
                    color = pConInfo->ci.Colors[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    pConInfo->ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
                    break;
                }

                case IDC_RADIO_POPUP_BACKGROUND:
                {
                    /* Get the color of the popup background */
                    colorIndex = BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib);
                    color = pConInfo->ci.Colors[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    pConInfo->ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
                    break;
                }

                case IDC_EDIT_COLOR_RED:
                {
                    if (HIWORD(wParam) == EN_KILLFOCUS)
                    {
                        DWORD red;

                        /* Get the current color */
                        colorIndex = pConInfo->ActiveStaticControl;
                        color = pConInfo->ci.Colors[colorIndex];

                        red = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
                        red = min(max(red, 0), 255);

                        color = RGB(red, GetGValue(color), GetBValue(color));

                        pConInfo->ci.Colors[colorIndex] = color;
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                        PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
                    }
                    break;
                }

                case IDC_EDIT_COLOR_GREEN:
                {
                    if (HIWORD(wParam) == EN_KILLFOCUS)
                    {
                        DWORD green;

                        /* Get the current color */
                        colorIndex = pConInfo->ActiveStaticControl;
                        color = pConInfo->ci.Colors[colorIndex];

                        green = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
                        green = min(max(green, 0), 255);

                        color = RGB(GetRValue(color), green, GetBValue(color));

                        pConInfo->ci.Colors[colorIndex] = color;
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                        PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
                    }
                    break;
                }

                case IDC_EDIT_COLOR_BLUE:
                {
                    if (HIWORD(wParam) == EN_KILLFOCUS)
                    {
                        DWORD blue;

                        /* Get the current color */
                        colorIndex = pConInfo->ActiveStaticControl;
                        color = pConInfo->ci.Colors[colorIndex];

                        blue = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
                        blue = min(max(blue, 0), 255);

                        color = RGB(GetRValue(color), GetGValue(color), blue);

                        pConInfo->ci.Colors[colorIndex] = color;
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                        InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                        PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
                    }
                    break;
                }

            }

            if ( HIWORD(wParam) == STN_CLICKED &&
                 IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16 )
            {
                colorIndex = LOWORD(wParam) - IDC_STATIC_COLOR1;

                if (colorIndex == pConInfo->ActiveStaticControl)
                {
                    /* Same static control was re-clicked */
                    break;
                }

                color = pConInfo->ci.Colors[colorIndex];

                SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                /* Update global struct */
                if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT))
                {
                    pConInfo->ci.ScreenAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib));
                }
                else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND))
                {
                    pConInfo->ci.ScreenAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.ScreenAttrib), colorIndex);
                }
                else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_TEXT))
                {
                    pConInfo->ci.PopupAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib));
                }
                else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_BACKGROUND))
                {
                    pConInfo->ci.PopupAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.PopupAttrib), colorIndex);
                }

                InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                pConInfo->ActiveStaticControl = colorIndex;
                InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
                InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
                break;
            }
        }

        default:
            break;
    }

    return FALSE;
}
Example #19
0
void duSpin::DrawObject(HDC hDC)
{
	duRect rcEdit;
	rcEdit.SetRectEmpty();
	GetRect(&rcEdit);
	rcEdit.OffsetRect(-rcEdit.left, -rcEdit.top);

	duStyleGroup *pStyleGroup = (duStyleGroup *)GetResObj(GetStyle(), DU_RES_STYLEGROUP);
	if (pStyleGroup)
		pStyleGroup->Draw(hDC, &rcEdit, GetState(), NULL, GetAlpha());
	
	duRect rcSpinUpButton, rcSpinDownButton;
	rcSpinUpButton.left = rcEdit.right - m_nSpinLeft;
	rcSpinUpButton.top = rcEdit.top + m_nSpinTop;
	rcSpinUpButton.right =  rcSpinUpButton.left + n_nSpinWidth;
	rcSpinUpButton.bottom = rcSpinUpButton.top + (rcEdit.Height() - m_nSpinTop - m_nSpinBottom) / 2;
		
	rcSpinDownButton = rcSpinUpButton;
	rcSpinDownButton.top = rcSpinUpButton.bottom;
	rcSpinDownButton.bottom = rcEdit.bottom - m_nSpinBottom;
	
	duStyleGroup *pUpStyle = (duStyleGroup *)GetResObj(m_szUpStyle, DU_RES_STYLEGROUP);
	if (pUpStyle)
		pUpStyle->Draw(hDC, &rcSpinUpButton, m_uUpState, NULL, GetAlpha());
	
	duStyleGroup *pDownStyle = (duStyleGroup *)GetResObj(m_szDownStyle, DU_RES_STYLEGROUP);
	if (pDownStyle)
		pDownStyle->Draw(hDC, &rcSpinDownButton, m_uDownState, NULL, GetAlpha());
	
	HRGN hRgnClip = ::CreateRectRgn(m_rcFormat.left, m_rcFormat.top, m_rcFormat.right, m_rcFormat.bottom);
	::SelectClipRgn(hDC, hRgnClip);
	
	int s = m_nSelectionStart;
	int e = m_nSelectionEnd;
	int ll;
	int x;
	int y;
	LRESULT pos;

	pos = EMPosFromChar(0);
	x = (short)LOWORD(pos);
	y = (short)HIWORD(pos);
	ll = GetEditTextLength();
	s = min(m_nSelectionStart, m_nSelectionEnd);
	e = max(m_nSelectionStart, m_nSelectionEnd);
	s = min(ll, s);
	e = min(ll, e);
	if ((s != e) && IsFocus())
	{
		x += PaintText(hDC, x, y, 0, 0, s, FALSE);
		x += PaintText(hDC, x, y, 0, s, e - s, TRUE);
		x += PaintText(hDC, x, y, 0, e, ll - e, FALSE);
	}
	else
	{
		x += PaintText(hDC, x, y, 0, 0, ll, FALSE);
	}

	::SelectClipRgn(hDC, NULL);
	::DeleteObject(hRgnClip);
}
void CLibraryAlbumTrack::Paint(CLibraryAlbumView* pView, CDC* pDC, const CRect& rcTrack, int nCount)
{
	COLORREF crBack = m_bSelected ? Colors.m_crHighlight : CLibraryAlbumView::m_crRows[ nCount & 1 ];

	pDC->SetBkColor( crBack );
	pDC->SetTextColor( m_bSelected ? Colors.m_crHiText : Colors.m_crText );

	CRect rcLine( &rcTrack );
	rcLine.DeflateRect( 2, 1 );

	// Icon Box

	CRect rcTemp( rcLine.left, rcLine.top, rcLine.left + ICON_WIDTH, rcLine.bottom );
	rcLine.left += ICON_WIDTH;

	if ( nCount >= 0 )
		PaintText( pDC, rcTemp, 0, 100, NULL );

	ShellIcons.Draw( pDC, m_nShell, 16, rcTemp.left + 4,
		( rcTemp.top + rcTemp.bottom ) / 2 - 8, CLR_NONE, m_bSelected );

	// Rating Stars Box

	rcTemp.SetRect( rcLine.right - RATING_WIDTH, rcLine.top, rcLine.right, rcLine.bottom );
	rcLine.right -= RATING_WIDTH;

	CPoint ptStar( rcTemp.left + 4, ( rcTemp.top + rcTemp.bottom ) / 2 - 6 );
	PaintText( pDC, rcTemp, 0, 100, NULL, TRUE );

	if ( pView->m_pRating == this && m_nSetRating < 7 )
	{
		for ( int nRating = 2 ; nRating <= 6 ; nRating++ )
		{
			ImageList_DrawEx( pView->m_pStars, m_nSetRating >= nRating ? 2 : 1,
				*pDC, ptStar.x, ptStar.y, 12, 12,
				m_bSelected ? CLR_NONE : crBack, crBack,
				m_nSetRating >= nRating ? ILD_NORMAL : ILD_BLEND50 );
			ptStar.x += 12;
		}
	}
	else
	{
		for ( int nRating = 2 ; nRating <= 6 ; nRating++ )
		{
			ImageList_DrawEx( pView->m_pStars, m_nRating >= nRating ? 0 : 1,
				*pDC, ptStar.x, ptStar.y, 12, 12,
				m_bSelected ? CLR_NONE : crBack, crBack,
				m_nRating >= nRating ? ILD_NORMAL : ILD_BLEND50 );
			ptStar.x += 12;
		}
	}

	ptStar.x++;	// Comment icon gap

	if ( pView->m_pRating == this && m_nSetRating == 7 )
	{
		ImageList_DrawEx( pView->m_pStars, 5,
			*pDC, ptStar.x, ptStar.y, 12, 12, CLR_NONE, crBack, ILD_NORMAL );
	}
	else
	{
		ImageList_DrawEx( pView->m_pStars, m_bComments ? 3 : 4,
			*pDC, ptStar.x, ptStar.y, 12, 12,
			m_bSelected ? CLR_NONE : crBack, crBack,
			m_bComments ? ILD_NORMAL : ILD_BLEND50 );
	}

	// Metadata Boxes  (Available space %)

	if ( pView->m_pStyle == CSchema::uriMusicAlbum )
	{
		// Track, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 5, &m_sTrack, TRUE );
		PaintText( pDC, rcLine, 5, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
	else if ( pView->m_pStyle == CSchema::uriMusicArtist )
	{
		// Album, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 30, &m_sAlbum );
		PaintText( pDC, rcLine, 30, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
	else if ( pView->m_pStyle == CSchema::uriMusicAll ) // Genre
	{
		// Artist, Album, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 25, &m_sArtist );
		PaintText( pDC, rcLine, 25, 50, &m_sAlbum );
		PaintText( pDC, rcLine, 50, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
	else // Non-music
	{
		// Title, Artist, Length
		PaintText( pDC, rcLine,  0, 66, &m_sTitle );
		PaintText( pDC, rcLine, 66, 88, &m_sArtist );
		PaintText( pDC, rcLine, 88, 100, &m_sLength, TRUE );
	}
}
Example #21
0
void CLibraryAlbumTrack::Paint(CLibraryAlbumView* pView, CDC* pDC, const CRect& rcTrack, int nCount)
{
	COLORREF crBack1 = CLibraryAlbumView::m_crRows[ nCount & 1 ];
	COLORREF crBack2 = m_bSelected ? CoolInterface.m_crHighlight : crBack1;
	
	CRect rcLine( &rcTrack );
	rcLine.DeflateRect( 1, 1 );
	rcLine.left ++; rcLine.right --;
	
	CRect rcTemp( rcLine.left, rcLine.top, rcLine.left + 22, rcLine.bottom );
	rcLine.left += 22;
	
	pDC->SetBkColor( m_bSelected ? crBack2 : crBack1 );
	
	ShellIcons.Draw( pDC, m_nShell, 16, rcTemp.left + 3,
		( rcTemp.top + rcTemp.bottom ) / 2 - 8, CLR_NONE, m_bSelected );
	
	pDC->SetTextColor( m_bSelected ? CoolInterface.m_crHiText : CoolInterface.m_crText );
	
	rcTemp.SetRect( rcLine.right - 78, rcLine.top, rcLine.right, rcLine.bottom );
	rcLine.right -= 78;
	
	CPoint ptStar( rcTemp.left + 3, ( rcTemp.top + rcTemp.bottom ) / 2 - 6 );
	PaintText( pDC, rcTemp, 0, 100, NULL );
	
	if ( pView->m_pRating == this && m_nSetRating < 7 )
	{
		for ( int nRating = 2 ; nRating <= 6 ; nRating++ )
		{
			ImageList_DrawEx( pView->m_pStars, m_nSetRating >= nRating ? 2 : 1,
				*pDC, ptStar.x, ptStar.y, 12, 12, crBack2, crBack2,
				m_nSetRating >= nRating ? ILD_NORMAL : ILD_BLEND50 );
			ptStar.x += 12;
		}
	}
	else
	{
		for ( int nRating = 2 ; nRating <= 6 ; nRating++ )
		{
			ImageList_DrawEx( pView->m_pStars, m_nRating >= nRating ? 0 : 1,
				*pDC, ptStar.x, ptStar.y, 12, 12, crBack2, crBack2,
				m_nRating >= nRating ? ILD_NORMAL : ILD_BLEND50 );
			ptStar.x += 12;
		}
	}
	
	if ( pView->m_pRating == this && m_nSetRating == 7 )
	{
		ImageList_DrawEx( pView->m_pStars, 5,
			*pDC, ptStar.x, ptStar.y, 12, 12, crBack2, crBack2, ILD_NORMAL );
	}
	else
	{
		ImageList_DrawEx( pView->m_pStars, m_bComments ? 3 : 4,
			*pDC, ptStar.x, ptStar.y, 12, 12, crBack2, crBack2,
			m_bComments ? ILD_NORMAL : ILD_BLEND50 );
	}
	
	if ( pView->m_pStyle == CSchema::uriMusicAlbum )
	{
		// Track, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 5, &m_sTrack, TRUE );
		PaintText( pDC, rcLine, 5, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
	else if ( pView->m_pStyle == CSchema::uriMusicArtist )
	{
		// Album, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 30, &m_sAlbum );
		PaintText( pDC, rcLine, 30, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
	else
	{
		// Artist, Album, Title, Length, Bitrate
		PaintText( pDC, rcLine, 0, 25, &m_sArtist );
		PaintText( pDC, rcLine, 25, 50, &m_sAlbum );
		PaintText( pDC, rcLine, 50, 84, &m_sTitle );
		PaintText( pDC, rcLine, 84, 92, &m_sLength, TRUE );
		PaintText( pDC, rcLine, 92, 100, &m_sBitrate, TRUE );
	}
}
Example #22
0
int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
	                            Color _ink, Color paper, dword style) const
{
	const CppItemInfo& m = ValueTo<CppItemInfo>(q);
	w.DrawRect(r, paper);
	bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
	if(IsNull(q)) return 0;
	int x = r.left;
	int ry = r.top + r.GetHeight() / 2;
	Image img;
	if(m.access == PROTECTED)
		img = BrowserImg::mprotected();
	else
	if(m.access == PRIVATE)
		img = BrowserImg::mprivate();
	else
	if(m.access == WITHBODY)
		img = BrowserImg::impl();
	if(!IsNull(img))
		w.DrawImage(x, ry - img.GetHeight() / 2, img);
	x += 4;
	img = BrowserImg::unknown();
	Image bk;
	switch(m.kind) {
	case FUNCTIONTEMPLATE:
		bk = BrowserImg::template_function();
	case FUNCTION:
		img = BrowserImg::function();
		break;
	case INSTANCEFUNCTIONTEMPLATE:
		bk = BrowserImg::template_function();
	case INSTANCEFUNCTION:
		img = BrowserImg::instance_function();
		break;
	case CLASSFUNCTIONTEMPLATE:
		bk = BrowserImg::template_function();
	case CLASSFUNCTION:
		img = BrowserImg::class_function();
		break;
	case STRUCTTEMPLATE:
		bk = BrowserImg::template_struct();
	case STRUCT:
		img = BrowserImg::type_struct();
		break;
	case INSTANCEVARIABLE:
		img = BrowserImg::instance_data();
		break;
	case CLASSVARIABLE:
		img = BrowserImg::class_data();
		break;
	case VARIABLE:
		img = BrowserImg::data();
		break;
	case ENUM:
		img = BrowserImg::type_enum();
		break;
	case INLINEFRIEND:
		img = BrowserImg::inline_friend();
		break;
	case TYPEDEF:
		img = BrowserImg::type_def();
		break;
	case CONSTRUCTOR:
		img = BrowserImg::constructor();
		break;
	case DESTRUCTOR:
		img = BrowserImg::destructor();
		break;
	case MACRO:
		img = BrowserImg::macro();
		break;
	case FRIENDCLASS:
		img = BrowserImg::friend_class();
		break;
	case KIND_INCLUDEFILE:
		img = IdeCommonImg::Header();
		break;
	case KIND_INCLUDEFILE_ANY:
		img = CtrlImg::File();
		break;
	case KIND_INCLUDEFOLDER:
		img = CtrlImg::Dir();
		break;
	}

	int by = ry - bk.GetSize().cy / 2;
	int iy = ry - img.GetSize().cy / 2;

	if(focuscursor) {
		DrawHighlightImage(w, x, by, bk);
		w.DrawImage(x, iy, img);
	}
	else {
		w.DrawImage(x, by, bk);
		w.DrawImage(x, iy, img);
	}
	if(m.inherited) {
		w.DrawImage(x + 10, r.top, BrowserImg::inherited());
		for(int i = 1; i < min(m.inherited, 5); i++)
			w.DrawRect(x + 10, r.top + 7 + 2 * i, 7, 1, SColorText);
	}
	x += 20;
	int y = ry - Draw::GetStdFontCy() / 2;
	int x0 = x;
	Vector<ItemTextPart> n = ParseItemNatural(m);
	int starti = 0;
	if(namestart)
		for(int i = 0; i < n.GetCount(); i++)
			if(n[i].type == ITEM_NAME) {
				starti = i;
				break;
			}
	PaintText(w, x, y, m, n, starti, n.GetCount(), focuscursor, _ink);
	if(starti) {
		const char *h = " : ";
		w.DrawText(x, y, h, BrowserFont(), SColorText);
		x += GetTextSize(h, BrowserFont()).cx;
	}
	PaintText(w, x, y, m, n, 0, starti, focuscursor, _ink);
	if(m.virt || m.over)
		w.DrawRect(x0, r.bottom - 2, x - x0, 1, m.over ? m.virt ? LtRed : LtBlue : SColorText);
	if(m.inherited && m.IsType())
		w.DrawRect(r.left, r.top, r.Width(), 1, SColorDisabled);

	if(showtopic) {
		String k = MakeCodeRef(m.scope, m.qitem);
		int cnt = GetRefLinks(k).GetCount();
		if(cnt) {
			Size sz = BrowserImg::Ref().GetSize();
			int xx = r.right - sz.cx - 1;
			int yy = r.top + (r.Height() - sz.cy) / 2;
			DrawHighlightImage(w, xx, yy, BrowserImg::Ref());
			if(cnt > 1) {
				String txt = AsString(cnt);
				Font fnt = Arial(Ctrl::VertLayoutZoom(10)).Bold();
				Size tsz = GetTextSize(txt, fnt);
				Point p(xx + (sz.cx - tsz.cx) / 2, yy + (sz.cy - tsz.cy) / 2);
				for(int ax = -1; ax <= 1; ax++)
					for(int ay = -1; ay <= 1; ay++)
						w.DrawText(p.x + ax, p.y + ay, txt, fnt, White);
				w.DrawText(p.x, p.y, txt, fnt, Blue);
			}
			x += sz.cx + 3;
		}
	}

	return x;
}
Example #23
0
INT_PTR CALLBACK
ColorsProc(HWND hDlg,
           UINT uMsg,
           WPARAM wParam,
           LPARAM lParam)
{
    DWORD colorIndex;
    COLORREF color;

    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            /* Set the valid range of the colour indicators */
            SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_RED  , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
            SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_GREEN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
            SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_BLUE , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));

            /* Select by default the screen background option */
            CheckRadioButton(hDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND);
            SendMessageW(hDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);

            return TRUE;
        }

        case WM_DRAWITEM:
        {
            LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;

            if (IDC_STATIC_COLOR1 <= drawItem->CtlID && drawItem->CtlID <= IDC_STATIC_COLOR16)
                PaintStaticControls(drawItem, ConInfo);
            else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
                PaintText(drawItem, ConInfo, Screen);
            else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
                PaintText(drawItem, ConInfo, Popup);

            return TRUE;
        }

        case WM_NOTIFY:
        {
            switch (((LPNMHDR)lParam)->code)
            {
                case PSN_APPLY:
                {
                    ApplyConsoleInfo(hDlg);
                    return TRUE;
                }

                case UDN_DELTAPOS:
                {
                    LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;

                    /* Get the current color */
                    colorIndex = ActiveStaticControl;
                    color = ConInfo->ColorTable[colorIndex];

                    if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color));
                    }
                    else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color));
                    }
                    else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
                    {
                        lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
                        color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos);
                    }
                    else
                    {
                        break;
                    }

                    ConInfo->ColorTable[colorIndex] = color;
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                    PropSheet_Changed(GetParent(hDlg), hDlg);
                    break;
                }
            }

            break;
        }

        case WM_COMMAND:
        {
            /* NOTE: both BN_CLICKED and STN_CLICKED == 0 */
            if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == STN_CLICKED)
            {
                if (LOWORD(wParam) == IDC_RADIO_SCREEN_TEXT       ||
                    LOWORD(wParam) == IDC_RADIO_SCREEN_BACKGROUND ||
                    LOWORD(wParam) == IDC_RADIO_POPUP_TEXT        ||
                    LOWORD(wParam) == IDC_RADIO_POPUP_BACKGROUND)
                {
                    switch (LOWORD(wParam))
                    {
                    case IDC_RADIO_SCREEN_TEXT:
                        /* Get the colour of the screen foreground */
                        colorIndex = TextAttribFromAttrib(ConInfo->ScreenAttributes);
                        break;

                    case IDC_RADIO_SCREEN_BACKGROUND:
                        /* Get the colour of the screen background */
                        colorIndex = BkgdAttribFromAttrib(ConInfo->ScreenAttributes);
                        break;

                    case IDC_RADIO_POPUP_TEXT:
                        /* Get the colour of the popup foreground */
                        colorIndex = TextAttribFromAttrib(ConInfo->PopupAttributes);
                        break;

                    case IDC_RADIO_POPUP_BACKGROUND:
                        /* Get the colour of the popup background */
                        colorIndex = BkgdAttribFromAttrib(ConInfo->PopupAttributes);
                        break;
                    }

                    color = ConInfo->ColorTable[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
                    ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
                    break;
                }
                else
                if (IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16)
                {
                    colorIndex = LOWORD(wParam) - IDC_STATIC_COLOR1;

                    /* If the same static control was re-clicked, don't take it into account */
                    if (colorIndex == ActiveStaticControl)
                        break;

                    color = ConInfo->ColorTable[colorIndex];

                    /* Set the values of the colour indicators */
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED  , GetRValue(color), FALSE);
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
                    SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);

                    if (IsDlgButtonChecked(hDlg, IDC_RADIO_SCREEN_TEXT))
                    {
                        ConInfo->ScreenAttributes = MakeAttrib(colorIndex, BkgdAttribFromAttrib(ConInfo->ScreenAttributes));
                    }
                    else if (IsDlgButtonChecked(hDlg, IDC_RADIO_SCREEN_BACKGROUND))
                    {
                        ConInfo->ScreenAttributes = MakeAttrib(TextAttribFromAttrib(ConInfo->ScreenAttributes), colorIndex);
                    }
                    else if (IsDlgButtonChecked(hDlg, IDC_RADIO_POPUP_TEXT))
                    {
                        ConInfo->PopupAttributes = MakeAttrib(colorIndex, BkgdAttribFromAttrib(ConInfo->PopupAttributes));
                    }
                    else if (IsDlgButtonChecked(hDlg, IDC_RADIO_POPUP_BACKGROUND))
                    {
                        ConInfo->PopupAttributes = MakeAttrib(TextAttribFromAttrib(ConInfo->PopupAttributes), colorIndex);
                    }

                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
                    ActiveStaticControl = colorIndex;
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                    PropSheet_Changed(GetParent(hDlg), hDlg);
                    break;
                }
            }
            else if (HIWORD(wParam) == EN_KILLFOCUS)
            {
                if (LOWORD(wParam) == IDC_EDIT_COLOR_RED   ||
                    LOWORD(wParam) == IDC_EDIT_COLOR_GREEN ||
                    LOWORD(wParam) == IDC_EDIT_COLOR_BLUE)
                {
                    DWORD value;

                    /* Get the current colour */
                    colorIndex = ActiveStaticControl;
                    color = ConInfo->ColorTable[colorIndex];

                    /* Modify the colour component */
                    switch (LOWORD(wParam))
                    {
                    case IDC_EDIT_COLOR_RED:
                        value = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
                        value = min(max(value, 0), 255);
                        color = RGB(value, GetGValue(color), GetBValue(color));
                        break;

                    case IDC_EDIT_COLOR_GREEN:
                        value = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
                        value = min(max(value, 0), 255);
                        color = RGB(GetRValue(color), value, GetBValue(color));
                        break;

                    case IDC_EDIT_COLOR_BLUE:
                        value = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
                        value = min(max(value, 0), 255);
                        color = RGB(GetRValue(color), GetGValue(color), value);
                        break;
                    }

                    ConInfo->ColorTable[colorIndex] = color;
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
                    InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);

                    PropSheet_Changed(GetParent(hDlg), hDlg);
                    break;
                }
            }

            break;
        }

        default:
            break;
    }

    return FALSE;
}
Example #24
0
//
/// Paint the item entirely.
//
void
TCheckList::PaintItem(DRAWITEMSTRUCT & drawInfo)
{
  TCheckListItem* item = GetItem(drawInfo.itemID);
  if (item == 0)
    return;

  const bool disabled = !item->IsEnabled() || (drawInfo.itemState & ODS_DISABLED);

  // Prepare DC
  //
  TDC dc(drawInfo.hDC);

  // Erase entire line
  //
  TRect rect(drawInfo.rcItem);
  TBrush bkgnd(TColor::SysWindow);
  dc.FillRect(rect, bkgnd);

  // Draw checkbox
  //
  TRect checkboxRect(rect.left+1,rect.top+1,
                     rect.left+CheckList_BoxWidth,rect.bottom-1);

  // Draw checkbox in 3D Windows Style
  //
  uint state;
  if (item->IsIndeterminate())
    state = TUIPart::Button3State|TUIPart::Checked;//TUIPart::Pushed;
  else
    state = TUIPart::ButtonCheck;

  if(item->IsChecked())
    state |= TUIPart::Checked;

  if (disabled)
    state |= TUIPart::Inactive;

  TUIPart().Paint(dc, checkboxRect, TUIPart::uiButton, (TUIPart::TState)state);

  // Draw select state with hightlight color
  //
  TRect textRect = rect;
  textRect.left = checkboxRect.right + 2;

  if (disabled)
  {
    dc.SetTextColor(TColor::SysGrayText);
    dc.SetBkColor(TColor::SysWindow);
  }
  else if (drawInfo.itemState & ODS_SELECTED)
  {
    TBrush fillBrush(TColor::SysHighlight);
    dc.FillRect(textRect, fillBrush);
    dc.SetTextColor(TColor::SysHighlightText);
    dc.SetBkColor(TColor::SysHighlight);
  }
  else
  {
    dc.SetTextColor(TColor::SysWindowText);
    dc.SetBkColor(TColor::SysWindow);
  }

  // Draw Text
  //
  textRect.left++;
  PaintText(dc, textRect, item->Text);
  textRect.left--;

  // Draw focus and selected states
  //
  if (drawInfo.itemState & ODS_FOCUS)
    dc.DrawFocusRect(textRect);
}
Example #25
0
/*
 * This function does not know about drawing more than one line of text.
 */
static void
DisplayText(
	       Widget w,
	       Position x,
	       Position y,
	       XawTextPosition pos1,
	       XawTextPosition pos2,
	       Boolean highlight)
{
    MultiSinkObject sink = (MultiSinkObject) w;
    Widget source = XawTextGetSource(XtParent(w));
    wchar_t buf[BUFSIZ];
    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);

    int j, k;
    XawTextBlock blk;
    GC gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc;
    GC invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc;

    if (!sink->multi_sink.echo)
	return;

    y = (Position) (y + abs(ext->max_logical_extent.y));
    for (j = 0; pos1 < pos2;) {
	pos1 = (int) XawTextSourceRead(source, pos1, &blk, (int) (pos2 - pos1));
	for (k = 0; k < blk.length; k++) {
	    if (j >= BUFSIZ) {	/* buffer full, dump the text. */
		x = (Position) (x + PaintText(w, gc, x, y, buf, j));
		j = 0;
	    }
	    buf[j] = ((wchar_t *) blk.ptr)[k];
	    if (buf[j] == _Xaw_atowc(XawLF))
		continue;

	    else if (buf[j] == _Xaw_atowc(XawTAB)) {
		Position temp = 0;
		Dimension width;

		if ((j != 0)
		    && ((temp = (Position) PaintText(w, gc, x, y, buf, j)
			) == 0))
		    return;

		x = (Position) (x + temp);
		width = (Dimension) CharWidth(w, x, _Xaw_atowc(XawTAB));
		XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
			       invgc, (int) x,
			       (int) y - abs(ext->max_logical_extent.y),
			       (unsigned int) width,
			       (unsigned int) ext->max_logical_extent.height);
		x = (Position) (x + width);
		j = -1;
	    } else if (XwcTextEscapement(sink->multi_sink.fontset,
					 &buf[j], 1) == 0) {
		if (sink->multi_sink.display_nonprinting)
		    buf[j] = _Xaw_atowc('@');
		else
		    buf[j] = _Xaw_atowc(' ');
	    }
	    j++;
	}
    }
    if (j > 0)
	(void) PaintText(w, gc, x, y, buf, j);
}
void CLibraryAlbumTrack::PaintText(CDC* pDC, const CRect& rcTrack, int nFrom, int nTo, int nID, BOOL bCenter)
{
	CString str;
	LoadString( str, nID );
	PaintText( pDC, rcTrack, nFrom, nTo, &str, bCenter );
}
/*
 * This function does not know about drawing more than one line of text
 */
static void
DisplayText(Widget w, int x, int y,
	    XawTextPosition pos1, XawTextPosition pos2, Bool highlight)
{
    TextWidget ctx = (TextWidget)XtParent(w);
    MultiSinkObject sink = (MultiSinkObject)w;
    XFontSet fontset = sink->multi_sink.fontset;
    Widget source = XawTextGetSource(XtParent(w));
    wchar_t buf[256];
    XFontSetExtents *ext = XExtentsOfFontSet(fontset);
    int j, k;
    XawTextBlock blk;
    GC gc, invgc, tabgc;
    int max_x;
    Bool clear_bg;

    if (!sink->multi_sink.echo || !ctx->text.lt.lines)
	return;

    max_x = (int)XtWidth(ctx) - ctx->text.r_margin.right;
    clear_bg = !highlight && ctx->core.background_pixmap != XtUnspecifiedPixmap;

    gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc;
    invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc;

    if (highlight && sink->multi_sink.xorgc)
	tabgc = sink->multi_sink.xorgc;
    else
	tabgc = invgc;

    y += abs(ext->max_logical_extent.y);
    for (j = 0; pos1 < pos2;) {
	pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1);
	for (k = 0; k < blk.length; k++) {
	    if ((unsigned) j >= (sizeof(buf) / sizeof(wchar_t)) - 1) {
		/* buffer full, dump the text */
		if ((x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
		    return;
		j = 0;
	    }
	    buf[j] = ((wchar_t *)blk.ptr)[k];
	    if (buf[j] == _Xaw_atowc(XawLF))
		continue;

	    else if (buf[j] == _Xaw_atowc(XawTAB)) {
		unsigned int width;

		if (j != 0 &&
		    (x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
		    return;

		width = CharWidth(sink, fontset, x, _Xaw_atowc(XawTAB));
		if (clear_bg)
		    _XawTextSinkClearToBackground(w,
					x, y - abs(ext->max_logical_extent.y),
					width, ext->max_logical_extent.height);
		else
		    XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
				   tabgc, x,
				   y - abs(ext->max_logical_extent.y),
				   width,
				   ext->max_logical_extent.height);
		x += width;
		j = -1;
	    }
	    else if (XwcTextEscapement(sink->multi_sink.fontset, &buf[j], 1)
		     == 0) {
		if (sink->multi_sink.display_nonprinting)
		    buf[j] = _Xaw_atowc('@');
		else
		    buf[j] = _Xaw_atowc(XawSP);
	    }
	    j++;
	}
    }

    if (j > 0)
	(void)PaintText(w, gc, x, y, buf, j, clear_bg);
}
Example #28
0
BOOL ColourGallery::DoRedrawAnItem(ListItem *Item, BOOL Large, UINT32 DisplayMode)
{
	PaintText(0, 0, ((IndexedColour *)Item)->GetName());
	return(TRUE);
}
Example #29
0
// Paint the client area of the window and resize the child window controls
void Paint() {

	// Sizes used in the layout
	int margin = 16;
	int labelwidth = 70;
	int buttonwidth = 80;
	int taskheight = 122;
	int buttonheight = 25;
	int statusheight = 54;

	// Rectangular sizes in the client area
	sizeitem client;
	sizeitem label1, label2, label3;
	sizeitem border1, border2, border3;
	sizeitem tasks, status, errors;
	sizeitem clear, task, start, stop, reset;

	// Find the width and height of the client area
	RECT rectangle;
	GetClientRect(Handle.window, &rectangle);
	client.set(rectangle); // 0 when the window is minimized

	// Tasks label
	label1.set(margin, margin, labelwidth, taskheight);

	// Tasks box
	border1 = label1;
	border1.x(label1.r() + margin);
	border1.r(client.w() - margin); // Measure from right, and keep it wide enough
	if (border1.w() < buttonwidth) border1.w(buttonwidth);

	// Clear button
	clear = border1;
	clear.y(border1.b() + margin);
	clear.w(buttonwidth);
	clear.h(buttonheight);

	// Buttons in that row
	task = clear;
	task.addx(buttonwidth + margin);
	start = task;
	start.addx(buttonwidth + margin);
	stop = start;
	stop.addx(buttonwidth + margin);
	reset = stop;
	reset.addx(buttonwidth + margin);

	// Labels on the left
	label2 = label1;
	label2.y(clear.b() + margin);
	label2.h(statusheight);
	label3 = label2;
	label3.y(label2.b() + margin);
	label3.b(client.b() - margin); // Measure from bottom, and keep it tall enough
	if (label3.h() < buttonheight) label3.h(buttonheight);

	// Controls on the right
	border2 = label2;
	border2.x(border1.x());
	border2.w(border1.w());
	border3 = label3;
	border3.x(border1.x());
	border3.w(border1.w());

	// Controls in borders;
	tasks  = border1; tasks.inside();
	status = border2; status.inside();
	errors = border3; errors.inside();

	// Move labels inside to line up with controls
	label1.inside();
	label2.inside();
	label3.inside();

	// Pick colors for the background banner message
	brushitem *field, *text, *label;
	if      (Handle.display.banner == L"start")   { field = &Handle.blue;   text = &Handle.lightblue;   label = &Handle.white; }
	else if (Handle.display.banner == L"running") { field = &Handle.yellow; text = &Handle.lightyellow; label = &Handle.black; }
	else if (Handle.display.banner == L"done")    { field = &Handle.green;  text = &Handle.lightgreen;  label = &Handle.black; }
	else if (Handle.display.banner == L"errors")  { field = &Handle.red;    text = &Handle.lightred;    label = &Handle.white; }
	else                                          { field = &Handle.blue;   text = &Handle.lightblue;   label = &Handle.white; }

	// Position and size child window controls
	WindowSize(Handle.tasks, tasks);
	WindowSize(Handle.status, status);
	WindowSize(Handle.errors, errors);
	WindowSize(Handle.clear, clear);
	WindowSize(Handle.task, task);
	WindowSize(Handle.start, start);
	WindowSize(Handle.stop, stop);
	WindowSize(Handle.reset, reset);

	// Paint the window
	deviceitem device;
	device.OpenPaint(Handle.window);

	// Paint the background color
	PaintFill(&device, client, field->brush);

	// Paint the banner
	device.Font(Handle.arial);
	device.FontColor(text->color);
	device.BackgroundColor(field->color);
	PaintText(&device, Handle.display.banner, client);

	// Paint the text lables on the left
	device.Font(Handle.font);
	device.FontColor(label->color);
	device.Background(TRANSPARENT);
	PaintText(&device, L"Tasks",  label1);
	PaintText(&device, L"Status", label2);
	PaintText(&device, L"Errors", label3);

	// Paint the borders
	PaintBorder(&device, border1, Handle.middle.brush);
	PaintBorder(&device, border2, Handle.middle.brush);
	PaintBorder(&device, border3, Handle.middle.brush);
}
Example #30
0
//---------------------------------------------------------------------------
void __fastcall TAboutForm::TimerTimer(TObject *Sender)
{
	PaintText(true);
}