Exemplo n.º 1
0
void
TBarMenuTitle::Draw()
{
	BMenu* menu = Menu();
	if (menu == NULL)
		return;

	BRect frame(Frame());
	rgb_color base = menu->LowColor();

	menu->PushState();

	BRect windowBounds = menu->Window()->Bounds();
	if (frame.right > windowBounds.right)
		frame.right = windowBounds.right;

	// fill in background
	if (IsSelected()) {
		be_control_look->DrawMenuItemBackground(menu, frame, frame, base,
			BControlLook::B_ACTIVATED);
	} else
		be_control_look->DrawButtonBackground(menu, frame, frame, base);

	menu->MovePenTo(ContentLocation());
	DrawContent();

	menu->PopState();
}
Exemplo n.º 2
0
        void NFrameBase::Draw(NRender* render, Base::NPoint& ptOffset, HRGN clipRgn)
        {
            if(!IsVisible())
                return;

            Base::NRect rect(frameRect_);
            rect.Offset(ptOffset.X, ptOffset.Y);

            if(!::RectInRegion(clipRgn, rect))
                return;

            NRenderClip clip(render, clipRgn, rect);
            if(clip.IsEmpty())
                return;

            PreDrawEvent.Invoke(this, NULL);

            DrawBkg(render, rect);

            rect.Left += padding_.Left;
            rect.Top += padding_.Top;
            rect.Right -= padding_.Right;
            rect.Bottom -= padding_.Bottom;

            DrawContent(render, rect);
            DrawFore(render, rect);

            DrawChilds(render, ptOffset, clipRgn);
        }
Exemplo n.º 3
0
void InformationState::DrawText()
{

	DrawTitle();
	DrawContent();

}
Exemplo n.º 4
0
/**
 *  zeichnet das Fenster.
 * 
 *  @author OLiver
 */
bool ctrlButton::Draw_(void)
{
	if(width == 0 || height == 0)
		return true;

	// Prüfen, ob bei gehighlighteten Button die Maus auch noch über dem Button ist
	TestMouseOver();

	Rect buttonrect = { 
		GetX(), 
		GetY(), 
		GetX() + width, 
		GetY() + height 
	};

	if(tc != TC_INVISIBLE)
	{
		if(border)
			Draw3D(buttonrect.left, buttonrect.top, width, height, tc, (unsigned short)((check) ? 2 : state), illuminated);
		else
		{
			if(state == BUTTON_UP || state == BUTTON_PRESSED)
				LOADER.GetImageN("io", tc*2 + 1)->Draw(buttonrect.left, buttonrect.top, 0, 0, 0, 0, width, height);
			else
				LOADER.GetImageN("io", tc*2)->Draw(buttonrect.left, buttonrect.top,  0, 0, 0, 0, width, height);
		}
	}

	/// Inhalt malen (Text, Bilder usw.)
	DrawContent();

	return true;
}
Exemplo n.º 5
0
void
TBarMenuTitle::Draw()
{
	if (be_control_look == NULL) {
		BMenuItem::Draw();
		return;
	}

	// fill background if selected
	rgb_color base = Menu()->LowColor();
	BRect rect = Frame();

	BRect windowBounds = Menu()->Window()->Bounds();
	if (rect.right > windowBounds.right)
		rect.right = windowBounds.right;

	if (IsSelected()) {
		be_control_look->DrawMenuItemBackground(Menu(), rect, rect, base,
			BControlLook::B_ACTIVATED);
	} else {
		be_control_look->DrawButtonBackground(Menu(), rect, rect, base);
	}

	// draw content
	DrawContent();

	// make sure we restore state
	Menu()->SetLowColor(base);
}
Exemplo n.º 6
0
/**
 *  zeichnet das Fenster.
 */
bool ctrlDeepening::Draw_()
{
    Draw3D(GetDrawPos(), width_, height_, tc, 2);

    font->Draw(GetDrawPos() + DrawPoint(width_, height_) / 2, text, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER, color_);

    DrawContent();

    return true;
}
Exemplo n.º 7
0
/**
 *  zeichnet das Fenster.
 *
 *  @author OLiver
 */
bool ctrlDeepening::Draw_(void)
{
    Draw3D(GetX(), GetY(), width_, height_, tc, 2);

    font->Draw(GetX() + width_ / 2, GetY() + height_ / 2, text.c_str(), glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER, color_);

    DrawContent();

    return true;
}
Exemplo n.º 8
0
void Game::Draw()
{
	this->m_graphics->Clear();
	
	if (this->m_player != NULL)
		this->m_player->Draw(this->m_graphics,this->camera.x,this->camera.y);

	DrawContent(&this->m_content, this->m_graphics, &camera);
	
	this->m_uimanager.Draw(this->m_graphics);

	this->m_graphics->RenderPresent();
}
Exemplo n.º 9
0
void
TWindowMenuItem::Draw()
{
	if (!fExpanded) {
		BMenuItem::Draw();
		return;
	}

	// TODO: Tint this smartly based on the low color, this does
	// nothing to black.
	rgb_color menuColor = tint_color(Menu()->LowColor(), 1.07);
	BRect frame(Frame());
	BMenu* menu = Menu();

	menu->PushState();

	// if not selected or being tracked on, fill with gray
	TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
	if ((!IsSelected() && !menu->IsRedrawAfterSticky())
		|| barview->Dragging() || !IsEnabled()) {

		rgb_color shadow = tint_color(menuColor, 1.09);
		menu->SetHighColor(shadow);
		frame.right = frame.left + kHPad / 2;
		menu->FillRect(frame);

		menu->SetHighColor(menuColor);
		frame.left = frame.right + 1;
		frame.right = Frame().right;
		menu->FillRect(frame);
	}

	if (IsEnabled() && IsSelected() && !menu->IsRedrawAfterSticky()) {
		// fill
		rgb_color backColor = tint_color(menuColor,
			B_HIGHLIGHT_BACKGROUND_TINT);
		menu->SetLowColor(backColor);
		menu->SetHighColor(backColor);
		menu->FillRect(frame);
	} else {
		menu->SetLowColor(menuColor);
		menu->SetHighColor(menuColor);
	}

	DrawContent();

	menu->PopState();
}
Exemplo n.º 10
0
        void NFrameBase::Draw(NRender* render, Base::NPoint& ptOffset, HRGN clipRgn)
        {
            if(!IsVisible() || !IsValid())
                return;

            Base::NRect rect(frameRect_);
            rect.Offset(ptOffset.X, ptOffset.Y);

            if(!::RectInRegion(clipRgn, rect))
                return;

            NRenderClip clip(render, clipRgn, rect);

            DrawBkg(render, rect);
            DrawContent(render, rect);
            DrawFore(render, rect);

            DrawChilds(render, ptOffset, clipRgn);
        }
	void CDrawSimpleMarkerElementTool::LButtonDownEvent (UINT nFlags, CPoint point)
	{
		IDrawElementTool::LButtonDownEvent (nFlags, point);


		//获取活动地区
		Display::IDisplayPtr pDisplay = m_pMap->GetDisplay();
		if(!pDisplay)
			return;

		//displaytoGeo
		GEOMETRY::geom::Geometry* pGeo;
		GEOMETRY::geom::Coordinate coord;
		pDisplay->GetDisplayTransformation().ConvertDisplayToGeo(point.x, point.y, coord);
		pGeo = GEOMETRY::geom::GeometryFactory::getDefaultInstance()->createPoint(coord);

		m_pMarker.reset(new Element::CSimpleMarkerElement(*pGeo));
		GEOMETRY::geom::GeometryFactory::getDefaultInstance()->destroyGeometry(pGeo);

		Display::IMarkerSymbol* pMarkerSymbol = dynamic_cast<Display::IMarkerSymbol*>(m_pMarker->GetSymbol().get());
		double markerSizeMM = SYSTEM::UnitConverter::ConvertUnits(pMarkerSymbol->GetMarkerSize(), SYSTEM::SYS_UNIT_POINT, SYSTEM::SYS_UNIT_MILLIMETER);
		long markerSizePixel = markerSizeMM*Display::CDC::GetCreateDCsRateOfPixelAndMillimeter();
		double markerSizeGeo;
		pDisplay->GetDisplayTransformation().ConvertDisplayToGeo(markerSizePixel, markerSizeGeo);


		GEOMETRY::geom::Envelope env(coord.x - markerSizePixel/2, coord.x + markerSizePixel/2,coord.y - markerSizePixel/2,coord.y + markerSizePixel/2);
		GEOMETRY::geom::Geometry* pTmpGeo = GEOMETRY::geom::GeometryFactory::getDefaultInstance()->toGeometry(&env);
		m_pMarker->GetSelectionTracker()->SetGeometry(*pTmpGeo);
		GEOMETRY::geom::GeometryFactory::getDefaultInstance()->destroyGeometry(pTmpGeo);


		m_pMap->GetGraphicLayer()->UnselectAllElements();
		m_pMap->GetGraphicLayer()->AddElement(m_pMarker);
		m_pMap->GetGraphicLayer()->SelectElement(m_pMarker);	

		//加入回退堆栈
		//m_pMap->GetElementOperationStack()->AddOperation(Element::OPT_ADD, m_pMarker);

		//更新绘制
		m_pMapCtrl->UpdateControl(DrawContent(drawElement|drawEdit));
	}
Exemplo n.º 12
0
	void CDrawFreehandLineTool::LButtonUpEvent(UINT nFlags, CPoint point)
	{
		if(!m_pFreehanline)
			return;

		m_pFreehanline->RemoveVertix(m_nLastVertixId);
		m_nLastVertixId--;

		if (m_nLastVertixId >= 2  )
		{
			m_pMap->GetGraphicLayer()->AddElement(m_pFreehanline);
			m_pMap->GetGraphicLayer()->SelectElement(m_pFreehanline);	

			//加入回退堆栈
			//m_pMap->GetElementOperationStack()->AddOperation(Element::OPT_ADD, m_pFreehanline);
		}

		m_pFreehanline.reset();

		//更新绘制
		m_pMapCtrl->UpdateControl(DrawContent(drawElement|drawEdit));

		IDrawElementTool::LButtonDblClkEvent(nFlags, point);

		//工具设为选择
		Framework::ITool* pTool = NULL;
		m_pMapCtrl->SetCurTool("SelectElementTool");

		pTool=Framework::ITool::FindTool("SelectElementTool");
		if(pTool)
		{
			pTool->Initialize(dynamic_cast<Framework::IUIObject*>(m_pMapCtrl));
		}


	}
Exemplo n.º 13
0
void
TTeamMenuItem::Draw()
{
	BRect frame(Frame());
	BMenu* menu = Menu();
	menu->PushState();
	rgb_color menuColor = menu->LowColor();
	TBarView* barView = (static_cast<TBarApp*>(be_app))->BarView();

	bool canHandle = !barView->Dragging()
		|| barView->AppCanHandleTypes(Signature());

	if (be_control_look != NULL) {
		uint32 flags = 0;
		if (_IsSelected() && canHandle)
			flags |= BControlLook::B_ACTIVATED;

		uint32 borders = BControlLook::B_TOP_BORDER;
		if (fVertical) {
			menu->SetHighColor(tint_color(menuColor, B_DARKEN_1_TINT));
			borders |= BControlLook::B_LEFT_BORDER
				| BControlLook::B_RIGHT_BORDER;
			menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
			frame.bottom--;

			be_control_look->DrawMenuBarBackground(menu, frame, frame,
				menuColor, flags, borders);
		} else {
			if (flags & BControlLook::B_ACTIVATED)
				menu->SetHighColor(tint_color(menuColor, B_DARKEN_3_TINT));
			else
				menu->SetHighColor(tint_color(menuColor, 1.22));
			borders |= BControlLook::B_BOTTOM_BORDER;
			menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
			frame.left++;

			be_control_look->DrawButtonBackground(menu, frame, frame,
				menuColor, flags, borders);
		}

		menu->MovePenTo(ContentLocation());
		DrawContent();
		menu->PopState();
		return;
	}

	// if not selected or being tracked on, fill with gray
	if ((!_IsSelected() && !menu->IsRedrawAfterSticky()) || !canHandle
		|| !IsEnabled()) {
		frame.InsetBy(1, 1);
		menu->SetHighColor(menuColor);
		menu->FillRect(frame);
	}

	// draw the gray, unselected item, border
	if (!_IsSelected() || !IsEnabled()) {
		rgb_color shadow = tint_color(menuColor, B_DARKEN_1_TINT);
		rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);

		frame = Frame();

		menu->SetHighColor(shadow);
		if (fVertical)
			menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
		else
			menu->StrokeLine(frame.LeftBottom() + BPoint(1, 0),
				frame.RightBottom());

		menu->StrokeLine(frame.RightBottom(), frame.RightTop());

		menu->SetHighColor(light);
		menu->StrokeLine(frame.RightTop() + BPoint(-1, 0), frame.LeftTop());
		if (fVertical)
			menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()
				+ BPoint(0, -1));
		else
			menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
	}

	// if selected or being tracked on, fill with the hilite gray color
	if (IsEnabled() && _IsSelected() && !menu->IsRedrawAfterSticky()
		&& canHandle) {
		// fill
		menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT));
		menu->FillRect(frame);

		// these continue the dark grey border on the left or top edge
		menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT));
		if (fVertical) {
			// dark line at top
			menu->StrokeLine(frame.LeftTop(), frame.RightTop());
		} else {
			// dark line on the left
			menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
		}
	} else
		menu->SetLowColor(menuColor);

	menu->MovePenTo(ContentLocation());
	DrawContent();
	menu->PopState();
}
Exemplo n.º 14
0
// Draw the client area
void CBalloonHelp::DrawClientArea(CDC* pDC)
{
	CSize sizeHeader = DrawHeader(pDC);
	DrawContent(pDC, sizeHeader.cy+nTIP_MARGIN);
}
Exemplo n.º 15
0
void C_Door::Draw()
{
    if(firstTime) /// It wasnt properly initialized
        return;

    if(!minimalize)
    {
        glPushMatrix();
        glDisable(GL_TEXTURE_2D);
        glTranslatef(x, y, 0.0);

        if(isTitle)
        {
            //title//
            if(layer == topLayer)
                glColor3ub(255, 0, 0);
            else
                glColor3ub(50, 50, 255);

            glBegin(GL_QUADS);
                glTexCoord2f(0.0f, 0.0f);	glVertex2i(0, 0);
                glTexCoord2f(1.0f, 0.0f);	glVertex2i(width, 0);
                glTexCoord2f(1.0f, 1.0f);	glVertex2i(width, TITLE_HEIGHT);
                glTexCoord2f(0.0f, 1.0f);	glVertex2i(0, TITLE_HEIGHT);
            glEnd();

            if(layer == topLayer)
                glColor3ub(244, 244, 244);
            else
                glColor3ub(44, 44, 44);

            glScissor(x, App::Inst()->GetScreenHeight() - (y + TITLE_HEIGHT), width - 2, TITLE_HEIGHT);// Definování oøezávací oblasti
            glEnable(GL_SCISSOR_TEST);
                FontMan::Inst()->Print("impact12", 5, TITLE_HEIGHT - 3, "%s", title.c_str());
            glDisable(GL_SCISSOR_TEST);

            // minimalize area
            if(minimalizeable)
            {
                if(layer == topLayer)
                    glColor3ub(170, 0, 0);
                else
                    glColor3ub(0, 0, 170);
                glBegin(GL_QUADS);
                    glTexCoord2f(0.0f, 0.0f);	glVertex2i(width - (2 * TITLE_HEIGHT) - 2, 1);
                    glTexCoord2f(1.0f, 0.0f);	glVertex2i(width - (1 * TITLE_HEIGHT) - 2, 1);
                    glTexCoord2f(1.0f, 1.0f);	glVertex2i(width - (1 * TITLE_HEIGHT) - 2, TITLE_HEIGHT - 1);
                    glTexCoord2f(0.0f, 1.0f);	glVertex2i(width - (2 * TITLE_HEIGHT) - 2, TITLE_HEIGHT - 1);
                glEnd();
            }

            // close area
            if(closeable)
            {
                if(layer == topLayer)
                    glColor3ub(120, 0, 0);
                else
                    glColor3ub(0, 0, 120);
                glBegin(GL_QUADS);
                    glTexCoord2f(0.0f, 0.0f);	glVertex2i(width - (1 * TITLE_HEIGHT) - 1, 1);
                    glTexCoord2f(1.0f, 0.0f);	glVertex2i(width - (0 * TITLE_HEIGHT) - 1, 1);
                    glTexCoord2f(1.0f, 1.0f);	glVertex2i(width - (0 * TITLE_HEIGHT) - 1, TITLE_HEIGHT - 1);
                    glTexCoord2f(0.0f, 1.0f);	glVertex2i(width - (1 * TITLE_HEIGHT) - 1, TITLE_HEIGHT - 1);
                glEnd();
            }

            glTranslatef(0.0, TITLE_HEIGHT, 0.0);

            glScissor(x, App::Inst()->GetScreenHeight()-(y + height + TITLE_HEIGHT), width, height);// Definování oøezávací oblasti
        } else  // if isTitle
            glScissor(x, App::Inst()->GetScreenHeight()-(y + height), width, height);// Definování oøezávací oblasti

        //////////
        // DOOR //
        //////////

        glColor3ub(180, 180, 180);

        glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 0.0f);	glVertex2i(0, 0);
            glTexCoord2f(1.0f, 0.0f);	glVertex2i(width, 0);
            glTexCoord2f(1.0f, 1.0f);	glVertex2i(width, height);
            glTexCoord2f(0.0f, 1.0f);	glVertex2i(0, height);
        glEnd();

        glEnable(GL_TEXTURE_2D);

        if(scrollable && maxScrollY != 0 &&
           scrollY > maxScrollY)
        {
            scrollY = maxScrollY;
        }
        glTranslated(0, -scrollY, 0);

        glEnable(GL_SCISSOR_TEST);
        glPushMatrix();
            DrawContent();
        glPopMatrix();
        glDisable(GL_SCISSOR_TEST);

        glTranslated(0, scrollY, 0);

        glDisable(GL_TEXTURE_2D);

        ///////////
        // OBRYS //
        ///////////

        if(layer == topLayer)
            glColor3ub(255, 0, 0);
        else
            glColor3ub(50, 50, 255);

        glBegin(GL_LINE_STRIP);
            glVertex2d(0,0);
            glVertex2d(width, 0);
            glVertex2d(width, height);
            glVertex2d(0, height);
            glVertex2d(0,0);
        glEnd();

        // resize area
        if(IsMouseInDoor())
            if(resizeableHorizontal || resizeableVertical)
            {
                glColor3ub(0, 180, 0);
                glBegin(GL_QUADS);
                    glTexCoord2f(0.0f, 0.0f);	glVertex2i(width - RESIZE_AREA, height - RESIZE_AREA);
                    glTexCoord2f(1.0f, 0.0f);	glVertex2i(width, height - RESIZE_AREA);
                    glTexCoord2f(1.0f, 1.0f);	glVertex2i(width, height);
                    glTexCoord2f(0.0f, 1.0f);	glVertex2i(width - RESIZE_AREA, height);
                glEnd();
            }

        glEnable(GL_TEXTURE_2D);
        glPopMatrix();
    }
}