当前位置: 首页>>代码示例>>C++>>正文


C++ PaintEvent::graphics方法代码示例

本文整理汇总了C++中PaintEvent::graphics方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintEvent::graphics方法的具体用法?C++ PaintEvent::graphics怎么用?C++ PaintEvent::graphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaintEvent的用法示例。


在下文中一共展示了PaintEvent::graphics方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paintBackground

  void TabbedPane::paintBackground( const PaintEvent &paintEvent )
  {
    int szMinusH = getSize().getHeight() - tabContainer->getSize().getHeight()
      + getMargin(SIDE_TOP);

    paintEvent.graphics()->drawFilledRectangle(Rectangle(0,tabContainer->getSize().getHeight(),
      getSize().getWidth(),szMinusH),
      getBackColor());


    Color  Top = Color(133,133,133);
    Color  Left = Color(133,133,133);
    Color  Bottom = Color(133,133,133);
    Color  Right = Color(133,133,133);


    //top
    paintEvent.graphics()->drawLine(Point(0,tabContainer->getSize().getHeight() + 
      getMargin(SIDE_TOP)),
      Point(getSize().getWidth(),
      tabContainer->getSize().getHeight() + getMargin(SIDE_TOP)),Top);
    //left
    paintEvent.graphics()->drawLine(Point(1,tabContainer->getSize().getHeight() + 
      getMargin(SIDE_TOP)),
      Point(1,getSize().getHeight()),Left);

    //right
    paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,
      tabContainer->getSize().getHeight() + getMargin(SIDE_TOP)),
      Point(getSize().getWidth() ,getSize().getHeight()),Right);

    //bottom
    paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
      Point(getSize().getWidth(),getSize().getHeight()),Bottom);
  }
开发者ID:jmasterx,项目名称:Agui,代码行数:35,代码来源:TabbedPane.cpp

示例2: paintBackground

	void ScrollPane::paintBackground( const PaintEvent &paintEvent )
	{
		//draw background
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),getBackColor());

		Color  Top = Color(110,110,110);
		Color  Left = Color(110,110,110);
		Color  Bottom = Color(110,110,110);
		Color  Right = Color(110,110,110);


		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),Top);
		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),Left);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),Right);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
			Point(getSize().getWidth(),getSize().getHeight()),Bottom);
	}
开发者ID:jmasterx,项目名称:Agui,代码行数:26,代码来源:ScrollPane.cpp

示例3: onPaint

void EditorView::onPaint(PaintEvent& ev)
{
  Graphics* g = ev.graphics();
  SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
  bool selected = false;

  switch (m_type) {

    // Only show the view selected if it is the current editor
    case CurrentEditorMode:
      selected = (editor()->isActive());
      break;

      // Always show selected
    case AlwaysSelected:
      selected = true;
      break;

  }

  theme->drawRect(
    g, clientBounds(),
    (selected ?
     theme->parts.editorSelected().get():
     theme->parts.editorNormal().get()),
    bgColor());
}
开发者ID:Fojar,项目名称:aseprite,代码行数:27,代码来源:editor_view.cpp

示例4: onPaint

void StyledButton::onPaint(PaintEvent& ev) {
  Graphics* g = ev.graphics();
  skin::Style::State state;
  if (hasMouse()) state += skin::Style::hover();
  if (isSelected()) state += skin::Style::clicked();
  m_style->paint(g, clientBounds(), NULL, state);
}
开发者ID:4144,项目名称:aseprite,代码行数:7,代码来源:styled_button.cpp

示例5: paintComponent

	void RadioButton::paintComponent( const PaintEvent &paintEvent )
	{
		//draw the radio button
		Color checkFillColor = Color(255,255,255);
		if(getRadioButtonState() == CLICKED)
		{
			checkFillColor = Color(50,95,128);
		}
		else if(getRadioButtonState() == HOVERED)
		{
			checkFillColor = Color(200,220,230);
		}

		paintEvent.graphics()->drawFilledCircle(getRadioButtonPosition(),
			(float)getRadioButtonRadius(),checkFillColor);

		//draw the check mark if needed

		switch(getCheckedState())
		{
		case CHECKED:
			for(int i = 2; i < 8; ++i)
			paintEvent.graphics()->drawFilledCircle(getRadioButtonPosition(),
				(float)(getRadioButtonRadius() / i),Color(20,40 * i,200 * i));
		

			break;
		default:
			break;
		}

		if(isFocused())
		{
			paintEvent.graphics()->drawCircle(getRadioButtonPosition(),(float)getRadioButtonRadius(),
				Color(170,170,170));
		}
		else
		{
			paintEvent.graphics()->drawCircle(getRadioButtonPosition(),(float)getRadioButtonRadius(),
				Color(100,100,100));
		}


		//draw text
		textAreaMan.drawTextArea(paintEvent.graphics(),getFont(),getWordWrapRect(),getFontColor(),
			getTextLines(),getTextAlignment());
	}
开发者ID:jmasterx,项目名称:Agui,代码行数:47,代码来源:RadioButton.cpp

示例6: paintComponent

	void TextField::paintComponent( const PaintEvent &paintEvent )
	{
		int caretLoc = getCaretLocation();
		int textLoc = getTextOffset();

		Rectangle sideclip = getInnerRectangle();
		sideclip = Rectangle(sideclip.getX() + getLeftPadding() ,
			sideclip.getY() + 2,sideclip.getSize().getWidth() - getLeftPadding()
			- getRightPadding() + 1, sideclip.getHeight() - 4);

		

		if(isReadOnly())
		{
			paintEvent.graphics()->drawFilledRectangle(
				getSizeRectangle(),frameColor);
		}
		else
		{
			paintEvent.graphics()->drawFilledRectangle(
				getSizeRectangle(),getBackColor());
		}
		

		paintEvent.graphics()->pushClippingRect(sideclip);

		if(getSelectionStart() != getSelectionEnd() && (isFocused() || !isHidingSelection()) )
		{
			Rectangle selRect = Rectangle(
				getSelectionLocation(),
				(getInnerHeight() / 2) - 
				(getFont()->getLineHeight() / 2),
				getSelectionWidth(),
				getFont()->getLineHeight());

			paintEvent.graphics()->drawFilledRectangle(
				selRect,getSelectionBackColor());
		}


			paintEvent.graphics()->drawText(Point(textLoc, +
				((getInnerSize().getHeight() - getFont()->getLineHeight()) / 2)),getText().c_str(),
				getFontColor(),getFont());
		

			if(isFocused())
			{
				if(isBlinking())
					paintEvent.graphics()->drawLine(Point(caretLoc + 1,
					((getInnerSize().getHeight() / 2) + (getFont()->getLineHeight() / 2))),
					Point(caretLoc + 1, ((getInnerSize().getHeight() / 2) - 
					(getFont()->getLineHeight() / 2))),
					Color(0,0,0));
			}


		paintEvent.graphics()->popClippingRect();

		
	}
开发者ID:arvidsson,项目名称:Agui,代码行数:60,代码来源:TextField.cpp

示例7: onPaint

void Notifications::onPaint(PaintEvent& ev)
{
  Graphics* g = ev.graphics();

  skin::Style::State state;
  if (hasMouseOver()) state += skin::Style::hover();
  if (m_withNotifications) state += skin::Style::active();
  if (isSelected()) state += skin::Style::clicked();
  m_flagStyle->paint(g, clientBounds(), NULL, state);
}
开发者ID:4144,项目名称:aseprite,代码行数:10,代码来源:notifications.cpp

示例8: onPaint

    void onPaint(PaintEvent& ev) override {
      Graphics* g = ev.graphics();
      skin::SkinTheme* theme = skin::SkinTheme::instance();
      gfx::Rect rc = clientBounds();

      Button::onPaint(ev);

      rc.shrink(theme->calcBorder(this, style()));
      draw_color(g, rc, m_color, doc::ColorMode::RGB);
    }
开发者ID:webbie1887,项目名称:aseprite,代码行数:10,代码来源:color_popup.cpp

示例9: paintBackground

	void Button::paintBackground( const PaintEvent &paintEvent )
	{
		Color color = getBackColor();

		switch (getButtonState())
		{
		case HOVERED:
			color = Color((float)(color.getR() + 0.075f), 
				(float)(color.getG() + 0.075f),
				(float)(color.getB() + 0.075f), 
				(float)(color.getA() ));
			break;
		case CLICKED:
			color = Color((float)(color.getR() - 0.075f), 
				(float)(color.getG() - 0.075f),
				(float)(color.getB() - 0.075f), (float)(color.getA() ));
			break;
		default:
			break;
		}

		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),color);

		Color shadow = Color(
			color.getR() - 0.2f,
			color.getG() - 0.2f,
			color.getB() - 0.2f);

		Color highlight = Color(
			color.getR() + 0.2f,
			color.getG() + 0.2f,
			color.getB() + 0.2f);

		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),highlight);
		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),highlight);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight() ),
			Point(getSize().getWidth(),getSize().getHeight() ),shadow);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),shadow);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight() - 1 ),
			Point(getSize().getWidth(),getSize().getHeight() - 1 ),shadow);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth()  - 1,0),
			Point(getSize().getWidth() - 1 ,getSize().getHeight()),shadow);

	}
开发者ID:arvidsson,项目名称:Agui,代码行数:57,代码来源:Button.cpp

示例10: onPaint

void ScrollBar::onPaint(PaintEvent& ev)
{
  gfx::Rect thumbBounds = clientBounds();
  if (align() & HORIZONTAL)
    getScrollBarThemeInfo(&thumbBounds.x, &thumbBounds.w);
  else
    getScrollBarThemeInfo(&thumbBounds.y, &thumbBounds.h);

  theme()->paintScrollBar(
    ev.graphics(), this, style(), thumbStyle(),
    clientBounds(), thumbBounds);
}
开发者ID:aseprite,项目名称:aseprite,代码行数:12,代码来源:scroll_bar.cpp

示例11: paintBackground

	void TextField::paintBackground( const PaintEvent &paintEvent )
	{
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),getBackColor());

		Color  Top = Color(171,171,171);
		Color  Left = Color(227,227,227);
		Color  Bottom = Color(231,231,231);
		Color  Right = Color(222,222,222);


		if(isFocused())
		{
			Top = Color(63,123,173);
			Left = Color(181,207,231);
			Bottom = Color(183,217,237);
			Right = Color(164,201,227);
		}



		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),Top);

		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),Left);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),Right);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
			Point(getSize().getWidth(),getSize().getHeight()),Bottom);
	}
开发者ID:arvidsson,项目名称:Agui,代码行数:36,代码来源:TextField.cpp

示例12: onPaint

  void onPaint(PaintEvent& ev) override {
    SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
    Graphics* g = ev.graphics();
    gfx::Rect bounds = clientBounds();
    ui::Style* style = theme->styles.newsItem();
    ui::Style* styleDetail = theme->styles.newsItemDetail();

    setText(m_title);
    gfx::Size textSize = theme->calcSizeHint(this, style);
    gfx::Rect textBounds(bounds.x, bounds.y, bounds.w, textSize.h);
    gfx::Rect detailsBounds(
      bounds.x, bounds.y+textSize.h,
      bounds.w, bounds.h-textSize.h);

    theme->paintWidget(g, this, style, textBounds);

    setText(m_desc);
    theme->paintWidget(g, this, styleDetail, detailsBounds);
  }
开发者ID:pseudogames,项目名称:aseprite,代码行数:19,代码来源:news_listbox.cpp

示例13: onPaint

  void onPaint(PaintEvent& ev) override {
    SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
    Graphics* g = ev.graphics();
    gfx::Rect bounds = clientBounds();
    Style* style = theme->styles.recentFile();
    Style* styleDetail = theme->styles.recentFileDetail();

    Style::State state;
    if (hasMouse() && !manager()->getCapture()) state += Style::hover();
    if (isSelected()) state += Style::active();
    if (parent()->hasCapture()) state += Style::clicked();

    style->paint(g, bounds, m_name.c_str(), state);

    gfx::Size textSize = style->sizeHint(m_name.c_str(), state);
    gfx::Rect detailsBounds(
      bounds.x+textSize.w, bounds.y,
      bounds.w-textSize.w, bounds.h);
    styleDetail->paint(g, detailsBounds, m_path.c_str(), state);
  }
开发者ID:Doraenmon,项目名称:aseprite,代码行数:20,代码来源:recent_listbox.cpp

示例14: paintBackground

	void HScrollBar::paintBackground( const PaintEvent &paintEvent )
	{
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),
			getBackColor());

	}
开发者ID:jmasterx,项目名称:Agui,代码行数:6,代码来源:HScrollBar.cpp

示例15: paintComponent

	void Button::paintComponent( const PaintEvent &paintEvent )
	{

		resizableText.drawTextArea(paintEvent.graphics(),getFont(),
			getInnerRectangle(),getFontColor(),wrappedText,getTextAlignment());
	}
开发者ID:arvidsson,项目名称:Agui,代码行数:6,代码来源:Button.cpp


注:本文中的PaintEvent::graphics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。