示例#1
0
void CWBProcess::OnMouseLButtonUp( MouseFlag flag, PtPos& point )
{
    if (m_bLeftDown && GetInterfacePtr())
    {
        switch (m_CurIdent)
        {
        case ID_WB_POS:
            GetInterfacePtr()->EdtDrawArea(m_MouseIni, point);
            break;
        case ID_WB_PTR:
            _DrawIndicator(point);
            break;
        case ID_WB_IMG:
            _DrawImage(m_CtrlAttr.ctImage.idName, point, point);
            // Para selecionar o controle POS apos desenhar a imagem
            GetInterfacePtr()->ToolBoxItemSel(ID_WB_POS);
            break;
        case ID_WB_TXT:
            m_CtrlAttr.Clear();
            m_CtrlAttr.ctName = WB_TXT;
            m_bCtrlTxt = true;
            GetInterfacePtr()->CtlEditTxt(m_MouseIni, point, m_CurFont, m_CurColor);
            break;
        case ID_WB_LIN:
            _DrawLine(m_MouseIni, point, m_CurLine, m_CurColor);
            break;
        case ID_WB_SQR:
            _DrawRect(m_MouseIni, point, m_CurLine, m_CurColor, false);
            break;
        case ID_WB_SQF:
            _DrawRect(m_MouseIni, point, m_CurLine, m_CurColor, true);
            break;
        case ID_WB_CRC:
            _DrawEllipse(m_MouseIni, point, m_CurLine, m_CurColor, false);
            break;
        case ID_WB_CRF:
            _DrawEllipse(m_MouseIni, point, m_CurLine, m_CurColor, true);
            break;
        case ID_WB_DEL:
            _DrawPoint(NULL, m_CurLine, m_DelColor, false);
            break;
        case ID_WB_PEN:
            _DrawPoint(NULL, m_CurLine, m_CurColor, false);
            break;
        case ID_WB_MRK:
            _DrawPoint(NULL, m_CurLine, m_MrkColor, true);
            break;
        }

        m_MousePos.SetAttr(point.X, point.Y);
    }

    m_bLeftDown = false;
}
示例#2
0
void
KeyboardLayoutView::Draw(BRect updateRect)
{
	if (fOldSize != BSize(Bounds().Width(), Bounds().Height())) {
		_InitOffscreen();
		_LayoutKeyboard();
	}

	BView* view;
	if (fOffscreenBitmap != NULL) {
		view = fOffscreenView;
		view->LockLooper();
	} else
		view = this;

	// Draw background

	if (Parent())
		view->SetLowColor(Parent()->ViewColor());
	else
		view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	view->FillRect(updateRect, B_SOLID_LOW);

	// Draw keys

	for (int32 i = 0; i < fLayout->CountKeys(); i++) {
		Key* key = fLayout->KeyAt(i);

		_DrawKey(view, updateRect, key, _FrameFor(key),
			_IsKeyPressed(key->code));
	}

	// Draw LED indicators

	for (int32 i = 0; i < fLayout->CountIndicators(); i++) {
		Indicator* indicator = fLayout->IndicatorAt(i);

		_DrawIndicator(view, updateRect, indicator, _FrameFor(indicator->frame),
			(fModifiers & indicator->modifier) != 0);
	}

	if (fOffscreenBitmap != NULL) {
		view->Sync();
		view->UnlockLooper();

		DrawBitmapAsync(fOffscreenBitmap, BPoint(0, 0));
	}
}