本文整理汇总了C++中PaintEvent::getGraphics方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintEvent::getGraphics方法的具体用法?C++ PaintEvent::getGraphics怎么用?C++ PaintEvent::getGraphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintEvent
的用法示例。
在下文中一共展示了PaintEvent::getGraphics方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: 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);
}
示例3: 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));
}
}
}
示例4: onPaint
void StyledButton::onPaint(PaintEvent& ev) {
Graphics* g = ev.getGraphics();
skin::Style::State state;
if (hasMouse()) state += skin::Style::hover();
if (isSelected()) state += skin::Style::clicked();
m_style->paint(g, getClientBounds(), NULL, state);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: onPaint
void ImageView::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
gfx::Rect bounds = getClientBounds();
gfx::Rect icon;
getTextIconInfo(NULL, NULL, &icon, getAlign(),
m_sur->width(), m_sur->height());
g->fillRect(getBgColor(), bounds);
g->drawRgbaSurface(m_sur, icon.x, icon.y);
}
示例9: onPaint
virtual void onPaint(PaintEvent& ev)
{
Graphics& g = ev.getGraphics();
int y=0, h = g.measureString(L" ").h;
if (hasFocus()) { g.drawString(L"hasFocus", Color::Black, 0, y); y += h; }
if (hasMouse()) { g.drawString(L"hasMouse", Color::Black, 0, y); y += h; }
// if (hasMouseAbove()) { g.drawString(L"hasMouseAbove", Color::Black, 0, y); y += h; }
if (hasCapture()) { g.drawString(L"hasCapture", Color::Black, 0, y); y += h; }
//m_console->println(L"onPaint()");
}
示例10: onPaint
virtual void onPaint(PaintEvent& ev) override {
Graphics* g = ev.getGraphics();
g->fillRect(gfx::rgba(0, 0, 0), getClientBounds());
Graphics subG(g->getInternalSurface(),
m_editor->getBounds().x + g->getInternalDeltaY(),
m_editor->getBounds().y + g->getInternalDeltaY());
m_editor->drawSpriteUnclippedRect(&subG,
gfx::Rect(0, 0,
m_editor->sprite()->width(),
m_editor->sprite()->height()));
}
示例11: onPaint
void onPaint(PaintEvent& ev) override {
ListItem::onPaint(ev);
if (m_image) {
Graphics* g = ev.getGraphics();
she::Surface* sur = she::instance()->createRgbaSurface(m_image->width(),
m_image->height());
convert_image_to_surface(
m_image.get(), nullptr, sur,
0, 0, 0, 0, m_image->width(), m_image->height());
g->drawRgbaSurface(sur, getTextWidth()+4, 0);
sur->dispose();
}
}
示例12: onPaint
void ColorButton::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
gfx::Rect rc = getClientBounds();
gfx::Rect text;
jwidget_get_texticon_info(this, NULL, &text, NULL, 0, 0, 0);
ui::Color bg = getBgColor();
if (is_transparent(bg))
bg = theme->getColor(ThemeColor::Face);
g->fillRect(bg, rc);
app::Color color;
// When the button is pushed, show the negative
if (isSelected()) {
color = app::Color::fromRgb(255-m_color.getRed(),
255-m_color.getGreen(),
255-m_color.getBlue());
}
// When the button is not pressed, show the real color
else
color = m_color;
draw_color_button(g, rc,
true, true, true, true,
true, true, true, true,
m_pixelFormat,
color,
hasMouseOver(), false);
// Draw text
std::string str = m_color.toHumanReadableString(m_pixelFormat,
app::Color::ShortHumanReadableString);
setTextQuiet(str.c_str());
jwidget_get_texticon_info(this, NULL, &text, NULL, 0, 0, 0);
ui::Color textcolor = ui::rgba(255, 255, 255);
if (color.isValid())
textcolor = color_utils::blackandwhite_neg(ui::rgba(color.getRed(), color.getGreen(), color.getBlue()));
g->drawString(getText(), textcolor, ColorNone, false,
text.getOrigin() - getBounds().getOrigin());
}
示例13: onPaint
void onPaint(PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
Graphics* g = ev.getGraphics();
gfx::Rect bounds = getClientBounds();
Style* style = theme->styles.newsItem();
Style* styleDetail = theme->styles.newsItemDetail();
Style::State state;
if (hasMouse() && !getManager()->getCapture()) state += Style::hover();
if (isSelected()) state += Style::active();
if (getParent()->hasCapture()) state += Style::clicked();
gfx::Size textSize = style->preferredSize(getText().c_str(), state);
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);
style->paint(g, textBounds, getText().c_str(), state);
styleDetail->paint(g, detailsBounds, m_desc.c_str(), state);
}
示例14: getToolBounds
void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
ToolBox* toolbox = App::instance()->getToolBox();
Rect toolrc;
int index = 0;
for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
Tool* tool = *it;
if (tool->getGroup() == m_group) {
gfx::Color face;
int nw;
if (UIContext::instance()->settings()->getCurrentTool() == tool ||
m_hotTool == tool) {
nw = PART_TOOLBUTTON_HOT_NW;
face = theme->getColor(ThemeColor::ButtonHotFace);
}
else {
nw = PART_TOOLBUTTON_LAST_NW;
face = theme->getColor(ThemeColor::ButtonNormalFace);
}
toolrc = getToolBounds(index++);
toolrc.offset(-getBounds().x, -getBounds().y);
theme->draw_bounds_nw(g, toolrc, nw, face);
// Draw the tool icon
she::Surface* icon = theme->get_toolicon(tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
}
}
}
示例15: onPaint
void Workspace::onPaint(PaintEvent& ev)
{
ev.getGraphics()->fillRect(getBgColor(), getClientBounds());
}