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


C++ PaintEvent类代码示例

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


在下文中一共展示了PaintEvent类的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 EditorView::onPaint(PaintEvent& ev)
{
  Graphics* g = ev.getGraphics();
  Widget* viewport = getViewport();
  Widget* child = UI_FIRST_WIDGET(viewport->getChildren());
  SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
  bool selected = false;

  switch (m_type) {

    // Only show the view selected if it is the current editor
    case CurrentEditorMode:
      selected = (child == current_editor);
      break;

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

  }

  theme->draw_bounds_nw(g, getClientBounds(),
    selected ? PART_EDITOR_SELECTED_NW:
    PART_EDITOR_NORMAL_NW,
    ColorNone);
}
开发者ID:rajeshpillai,项目名称:aseprite,代码行数:27,代码来源:editor_view.cpp

示例5: onPaint

void SplitBar::onPaint(PaintEvent& ev)
{
  Graphics& g = ev.getGraphics();

  if (m_gripperVisible) {
    Rect rcBar(getBarRect());

    for (int c=0; c<8; ++c) {
      Rect rc(0, 0, 3, 3);

      if (m_orientation == Orientation::Vertical) {
	rc.x = rcBar.x+rcBar.w/2-rc.w/2;
	rc.y = rcBar.y+rcBar.h/2-8*(rc.h+1)/2+c*(rc.h+1);
      }
      else {
	rc.x = rcBar.x+rcBar.w/2-8*(rc.w+1)/2+c*(rc.w+1);
	rc.y = rcBar.y+rcBar.h/2-rc.h/2;
      }

      g.draw3dRect(rc,
		   System::getColor(COLOR_3DSHADOW),
		   System::getColor(COLOR_3DHIGHLIGHT));
    }
  }
}
开发者ID:Jmos,项目名称:vaca,代码行数:25,代码来源:SplitBar.cpp

示例6: 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

示例7: HandlePaintEvent

 void XWindow::HandlePaintEvent(const PaintEvent & e)
 {
   // Set up Graphics
   this->graphics->SetTransform(AffineTransform::MakeIdentity());
   this->graphics->SetClipRect(e.GetDamagedArea());
   this->Paint(this->graphics); // Calls Component's implementation
 }
开发者ID:BingchengIT,项目名称:Stop_Watch,代码行数:7,代码来源:XWindow.cpp

示例8: onPaint

void IconButton::onPaint(PaintEvent& ev)
{
  SkinTheme* theme = SkinTheme::instance();
  Graphics* g = ev.getGraphics();
  gfx::Color fg, bg;

  if (isSelected()) {
    fg = theme->colors.menuitemHighlightText();
    bg = theme->colors.menuitemHighlightFace();
  }
  else if (isEnabled() && hasMouseOver()) {
    fg = theme->colors.menuitemHotText();
    bg = theme->colors.menuitemHotFace();
  }
  else {
    fg = theme->colors.menuitemNormalText();
    bg = getBgColor();
  }

  g->fillRect(bg, g->getClipBounds());

  gfx::Rect bounds = getClientBounds();
  g->drawColoredRgbaSurface(
    m_icon, fg,
    bounds.x+bounds.w/2-m_icon->width()/2,
    bounds.y+bounds.h/2-m_icon->height()/2);
}
开发者ID:whizzter,项目名称:aseprite,代码行数:27,代码来源:icon_button.cpp

示例9: onPaint

void BandedDockArea::onPaint(PaintEvent& ev)
{
#if 0
  Graphics& g = ev.getGraphics();
  Color topLeft = System::getColor(COLOR_3DSHADOW);
  Color bottomRight = System::getColor(COLOR_3DHIGHLIGHT);
  int c, count = m_bandInfo.size();

  // for each band
  for (c=0; c<count; ++c) {
    // get the bounds of this band
    Rect bounds = getBandBounds(c);

    if (isHorizontal()) {
      g.setColor(topLeft);
      g.drawLine(bounds.x, bounds.y-2, bounds.x+bounds.w, bounds.y-2);

      g.setColor(bottomRight);
      g.drawLine(bounds.x, bounds.y-1, bounds.x+bounds.w, bounds.y-1);
    }
    else {
      g.setColor(topLeft);
      g.drawLine(bounds.x-2, bounds.y, bounds.x-2, bounds.y+bounds.h);
      
      g.setColor(bottomRight);
      g.drawLine(bounds.x-1, bounds.y, bounds.x-1, bounds.y+bounds.h);
    }
  }
#endif
}
开发者ID:Jmos,项目名称:vaca,代码行数:30,代码来源:BandedDockArea.cpp

示例10: 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

示例11: 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

示例12: 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

示例13: onPaint

void ImageView::onPaint(PaintEvent& ev)
{
  Graphics* g = ev.getGraphics();
  gfx::Rect bounds = getClientBounds();
  gfx::Rect icon;
  getTextIconInfo(NULL, NULL, &icon, getAlign(), m_bmp->w, m_bmp->h);

  g->fillRect(getBgColor(), bounds);
  g->blit(m_bmp, 0, 0, icon.x, icon.y, icon.w, icon.h);
}
开发者ID:CalinLeafshade,项目名称:aseprite,代码行数:10,代码来源:image_view.cpp

示例14: onPaint

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

  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, getClientBounds(), NULL, state);
}
开发者ID:ololo1982,项目名称:aseprite,代码行数:10,代码来源:notifications.cpp

示例15: 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


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