Beispiel #1
0
void ScrollBar::OnHorzTrack(suic::Element* pSender, suic::MouseEventArg& e)
{
    if (!_rcTrack.Empty())
    {
        int iMin = 0;

        suic::Point ptWindow = e.MousePoint();
        suic::Point ptSelf = PointToScreen(suic::Point());

        suic::Rect rect(ptSelf.x, ptSelf.y, RenderSize().cx, RenderSize().cy);
 
        suic::Size szClamp(0, 0);
		int nThumbLength = 0;

        szClamp.cx = rect.left + (_decreaseBtn.IsVisible() ? (int)_decreaseBtn.GetWidth() : 0);
        szClamp.cy = rect.right - (_increaseBtn.IsVisible() ? (int)_increaseBtn.GetWidth() : 0);

        nThumbLength = _rcTrackStart.Width();

        szClamp.cy -= nThumbLength;

        suic::Point ptOffset(ptWindow.x - _ptTrackStart.x, ptWindow.y - _ptTrackStart.y);
        suic::Rect rectNew(_rcTrackStart);

        if (abs(ptOffset.y) < 150)
        {
            rectNew.Offset(ptOffset.x, 0);

            if (rectNew.left < szClamp.cx)
            {
                rectNew.left  = szClamp.cx;
                rectNew.right = rectNew.left + nThumbLength;
            }
            else if (szClamp.cy < rectNew.left)
            {
                rectNew.left  = szClamp.cy;
                rectNew.right = rectNew.left + nThumbLength;
            }
        }

        if (!rectNew.Equal(&_rcTrack))
		{
			_rcTrack = rectNew;
            int nPosNew = PosFromThumb(_rcTrack.left - szClamp.cx, szClamp);

			if (_scroInfo.iVisualPos != nPosNew)
            {
                _scroInfo.iVisualPos = nPosNew;

                DoScroll(true);
            }
        }
    }
}
Beispiel #2
0
void ScrollBar::OnBeginTrack(suic::Element* pSender, suic::MouseEventArg& e)
{
    suic::Point pt = PointToScreen(suic::Point());

    _rcTrackStart = GetScrollThumbRect(RenderSize(), false);

    _rcTrackStart.Offset(pt.x, pt.y);

    _rcTrack = _rcTrackStart;
    _scroInfo._iTrackPos = _scroInfo.iVisualPos;
    _ptTrackStart = e.MousePoint();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pRender - 
//-----------------------------------------------------------------------------
void Marker3D::RenderTool2D(CRender2D *pRender)
{
	if (!IsActiveTool())
	{
		return;
	}

	Vector vecPos;
	CRect rect;
	CPoint pt;

	if (IsTranslating())
	{
		vecPos = m_vecTranslatePos;
	}
	else
	{
		if (IsEmpty())
		{
			return;
		}

		vecPos = m_vecPos;
	}

	pt.x = vecPos[axHorz];
	pt.y = vecPos[axVert];
	PointToScreen(pt);

	pRender->SetLineType(CRender2D::LINE_SOLID, CRender2D::LINE_THIN, 35, 255, 75);

	//
	// Draw center rect.
	//
	rect.SetRect(pt, pt);
	rect.InflateRect(6, 6);
	pRender->Rectangle(rect, false);

	//
	// Draw crosshairs.
	//
	pRender->MoveTo(g_MIN_MAP_COORD, pt.y);
	pRender->LineTo(g_MAX_MAP_COORD, pt.y);
	pRender->MoveTo(pt.x, g_MIN_MAP_COORD);
	pRender->LineTo(pt.x, g_MAX_MAP_COORD);
}
Beispiel #4
0
//============================================================
//
suic::Size WebBrowser::ArrangeOverride(const suic::Size& size)
{
    suic::Size finalRect = __super::ArrangeOverride(size);

    suic::Point point = PointToScreen(suic::Point());
    suic::Rect rect(point.x, point.y, size.cx, size.cy);

    WebWrapper* pWeb = (WebWrapper*)_webHost;

    if (_webHost)
    {
        pWeb->SetWebRect(&rect);
        pWeb->OpenWebBrowser();
    }

    return finalRect;
}
Beispiel #5
0
void WebBrowser::OnVisibilityChanged(bool visible)
{
    suic::Point point = PointToScreen(suic::Point());
    suic::Rect rect(point.x, point.y, RenderSize().cx, RenderSize().cy);

    WebWrapper* pWeb = (WebWrapper*)_webHost;

    if (visible)
    {
        pWeb->SetWebRect(&rect);
    }
    else
    {
        suic::Rect rc;

        pWeb->SetWebRect(&rc);
    }
}
Beispiel #6
0
    void OnMouseLeftButtonDown(suic::MouseEventArg& e)
    {
        __super::OnMouseLeftButtonDown(e);

        _prev = e.MousePoint();

        suic::Point ptSelf = PointToScreen(suic::Point());

        if (CoreFlags::Horizontal == _slider->GetOrientation())
        {
            _trackStart = GetVisualOffset().x;
        }
        else
        {
            _trackStart = GetVisualOffset().y;
        }

        _trackPos = _trackStart;
    }
Beispiel #7
0
void Slider::OnMouseLeftButtonDown(suic::MouseEventArg& e)
{
    __super::OnMouseLeftButtonDown(e);

    const suic::Size& thumbSize = _thumbBtn->GetDesiredSize();
    suic::Point ptSelf = PointToScreen(suic::Point());

    if (GetOrientation() == CoreFlags::Horizontal) 
    {
        double pos = e.MousePoint().x - ptSelf.x - thumbSize.cx / 2;

        HandleHorizontal(pos);
    }
    else
    {
        double pos = e.MousePoint().y - ptSelf.y - thumbSize.cy / 2;

        HandleVertical(pos);
    }
}
Beispiel #8
0
suic::Size ScrollBar::ArrangeOverride(const suic::Size& size)
{
    ClearVisualChildren();

    bool bChanged = false;
    suic::Rect finalRect;
    suic::Rect downRect;

    if (GetOrientation() == CoreFlags::Horizontal)
    {
        UpdateScrollVisual(size.cx, false);

        finalRect.bottom = _decreaseBtn.GetDesiredSize().cy;
    }
    else
    {
        UpdateScrollVisual(size.cy, false);

        finalRect.right = _decreaseBtn.GetDesiredSize().cx;
    }

    suic::Rect rcThumb;
    
    if (!_rcTrack.Empty())
    {
        suic::Point ptSelf = PointToScreen(suic::Point());

        rcThumb = _rcTrack;
        rcThumb.Offset(-ptSelf.x, -ptSelf.y);
    }
    else
    {
        rcThumb = GetScrollThumbRect(size);
    }

    if (GetOrientation() == CoreFlags::Horizontal)
    {
        if (_increaseBtn.IsVisible())
        {
            downRect.bottom = _increaseBtn.GetDesiredSize().cy;
            downRect.right = size.cx;
            downRect.left = size.cx - _increaseBtn.GetDesiredSize().cx;
        }

        /*if (size.cx < downRect.Width() + finalRect.Width())
        {
            return size;
        }*/
    }
    else
    {
        if (_increaseBtn.IsVisible())
        {
            downRect.right = _increaseBtn.GetDesiredSize().cx;
            downRect.bottom = size.cy;
            downRect.top = size.cy - _increaseBtn.GetDesiredSize().cy;
        }

        /*if (size.cy < downRect.Height() + finalRect.Height())
        {
            return size;
        }*/
    }

    if (_decreaseBtn.IsVisible())
    {
        finalRect.right = _decreaseBtn.GetDesiredSize().cx;
        finalRect.bottom = _decreaseBtn.GetDesiredSize().cy;

        AddVisualChild(&_decreaseBtn);
        _decreaseBtn.Arrange(finalRect);
    }

    if (!rcThumb.Empty())
    {
        if (GetOrientation() == CoreFlags::Horizontal)
        {
            finalRect.left = finalRect.right;
            finalRect.right = rcThumb.left;

            if (!finalRect.Empty())
            {
                AddVisualChild(&_decreasePage);
                _decreasePage.Arrange(finalRect);
            }

            finalRect.left = rcThumb.left;
            finalRect.right = rcThumb.right;
            AddVisualChild(&_thumb);
            _thumb.Arrange(finalRect);

            finalRect.left = rcThumb.right;
            finalRect.right = size.cx - downRect.Width();
            AddVisualChild(&_increasePage);
            _increasePage.Arrange(finalRect);
        }
        else
        {
            finalRect.top = finalRect.bottom;
            finalRect.bottom = rcThumb.top;

            if (!finalRect.Empty())
            {
                AddVisualChild(&_decreasePage);
                _decreasePage.Arrange(finalRect);
            }

            finalRect.top = rcThumb.top;
            finalRect.bottom = rcThumb.bottom;
            AddVisualChild(&_thumb);
            _thumb.Arrange(finalRect);

            finalRect.top = rcThumb.bottom;
            finalRect.bottom = size.cy - downRect.Height();
            AddVisualChild(&_increasePage);
            _increasePage.Arrange(finalRect);
        }
    }

    if (!downRect.Empty())
    {
        AddVisualChild(&_increaseBtn);
        _increaseBtn.Arrange(downRect);
    }    

    return size;
}
Beispiel #9
0
}

void ColorDialog::AllowScrollbars::set(bool value) {
    pAllowScrollbars = value;
    if (!value && !bSwatchesVisible) SwitchToPredefined();
    butSwitch->Visible = value;
}
void ColorDialog::AllowAlpha::set(bool value) {
    pAllowAlpha = value;
    if (!value) scrA->Value = 255;
    scrA->Visible = value;
}

void ColorDialog::OnPaint(GTA::GraphicsEventArgs^ e) {
    Form::OnPaint(e);
    Drawing::Point pos = PointToScreen(Drawing::Point(0,0));
    Drawing::Rectangle rect;
    if (bSwatchesVisible) {
        for (int i = 0; i < GTA::ColorIndex::colary->Length; i++) {
            rect = GetColorRect(i);
            rect.Offset(pos);
            e->Graphics->DrawRectangle(rect, Drawing::Color::FromArgb(GTA::ColorIndex::colary[i] | 0xFF000000));
        }
    } else {
        e->Graphics->DrawText("R", tosX(pos.X + 8), tosY(pos.Y + 8), ForeColor, Font);
        e->Graphics->DrawText("G", tosX(pos.X + 8), tosY(pos.Y + 8+32), ForeColor, Font);
        e->Graphics->DrawText("B", tosX(pos.X + 8), tosY(pos.Y + 8+32*2), ForeColor, Font);
        if (pAllowAlpha) e->Graphics->DrawText("A", tosX(pos.X + 8), tosY(pos.Y + 8+32*3), ForeColor, Font);
    }
    int x = ColCols * ColSize + 8*2;
    e->Graphics->DrawText("Color:", tosX(pos.X + x), tosY(pos.Y + 4), ForeColor, Font);