void SuperFunTime::draw(gcn::Graphics *graphics) { // Draw border? gcn::Color faceColor = getBaseColor(); gcn::Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(faceColor); graphics->fillRectangle(gcn::Rectangle(1, 1, getDimension().width-1, getHeight() - 1)); graphics->setColor(shadowColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 1); graphics->setColor(highlightColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1); graphics->setFont(getFont()); graphics->setColor(gcn::Color(0, 0, 0)); // Draw me for ( runner_list::iterator iter = _images.begin(); iter != _images.end(); iter++ ) graphics->drawImage((*iter)->image, (*iter)->x, (*iter)->y); }
void CheckBox::drawBox(Graphics *graphics) { int h = getHeight() - 1; int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(shadowColor); graphics->drawLine(0, 0, h, 0); graphics->drawLine(0, 1, 0, h); graphics->setColor(highlightColor); graphics->drawLine(h, 1, h, h); graphics->drawLine(1, h, h - 1, h); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(1, 1, h - 1, h - 1)); graphics->setColor(getForegroundColor()); if (mMarked) { graphics->drawLine(3, 5, 3, h - 3); graphics->drawLine(4, 5, 4, h - 3); graphics->drawLine(5, h - 4, h - 2, 3); graphics->drawLine(5, h - 5, h - 4, 4); } }
void ScrollArea::drawRightButton(Graphics* graphics) { Rectangle dim = getRightButtonDimension(); graphics->pushClipArea(dim); Color highlightColor; Color shadowColor; Color faceColor; int offset; int alpha = getBaseColor().a; if (mRightButtonPressed) { faceColor = getBaseColor() - 0x303030; faceColor.a = alpha; highlightColor = faceColor - 0x303030; highlightColor.a = alpha; shadowColor = getBaseColor(); shadowColor.a = alpha; offset = 1; } else { faceColor = getBaseColor(); faceColor.a = alpha; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; offset = 0; } graphics->setColor(faceColor); graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height)); graphics->setColor(highlightColor); graphics->drawLine(0, 0, dim.width - 1, 0); graphics->drawLine(0, 1, 0, dim.height - 1); graphics->setColor(shadowColor); graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1); graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1); graphics->setColor(getForegroundColor()); int i; int w = dim.width / 2; int h = w + 1; for (i = 0; i < w / 2; ++i) { graphics->drawLine(-i + h + offset, w - i + offset, -i + h + offset, w + i + offset); } graphics->popClipArea(); }
void ScrollArea::drawHMarker(Graphics* graphics) { Rectangle dim = getHorizontalMarkerDimension(); graphics->pushClipArea(dim); int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(faceColor); graphics->fillRectangle(Rectangle(1, 1, dim.width - 1, dim.height - 1)); graphics->setColor(highlightColor); graphics->drawLine(0, 0, dim.width - 1, 0); graphics->drawLine(0, 1, 0, dim.height - 1); graphics->setColor(shadowColor); graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1); graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1); graphics->popClipArea(); }
void ScrollArea::draw(Graphics *graphics) { graphics->setColor(getBackgroundColor()); graphics->fillRectangle(getContentDimension()); int alpha = getBaseColor().a; Color highlightColor = getBaseColor() + 0x303030; highlightColor.a = alpha; Color shadowColor = getBaseColor() - 0x303030; shadowColor.a = alpha; if (mVBarVisible) { drawUpButton(graphics); drawDownButton(graphics); drawVBar(graphics); drawVMarker(graphics); } if (mHBarVisible) { drawLeftButton(graphics); drawRightButton(graphics); drawHBar(graphics); drawHMarker(graphics); } if (mHBarVisible && mVBarVisible) { graphics->setColor(getBaseColor()); graphics->fillRectangle(Rectangle(getWidth() - mScrollbarWidth, getHeight() - mScrollbarWidth, mScrollbarWidth, mScrollbarWidth)); } if (mContent) { Rectangle contdim = mContent->getDimension(); graphics->pushClipArea(getContentDimension()); if (mContent->getBorderSize() > 0) { Rectangle rec = mContent->getDimension(); rec.x -= mContent->getBorderSize(); rec.y -= mContent->getBorderSize(); rec.width += 2 * mContent->getBorderSize(); rec.height += 2 * mContent->getBorderSize(); graphics->pushClipArea(rec); mContent->drawBorder(graphics); graphics->popClipArea(); } graphics->pushClipArea(contdim); mContent->draw(graphics); graphics->popClipArea(); graphics->popClipArea(); } }
void ImageCheckBox::draw(gcn::Graphics* graphics) { gcn::Color faceColor = getBaseColor(); gcn::Color highlightColor, shadowColor; int alpha = getBaseColor().a; if (isMarked()) { faceColor = faceColor - 0x303030; faceColor.a = alpha; highlightColor = faceColor - 0x303030; highlightColor.a = alpha; shadowColor = faceColor + 0x303030; shadowColor.a = alpha; } else { highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; } graphics->setColor(faceColor); graphics->fillRectangle(gcn::Rectangle(1, 1, getDimension().width-1, getHeight() - 1)); graphics->setColor(highlightColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 1); graphics->setColor(shadowColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1); graphics->setColor(getForegroundColor()); int textX = getWidth() / 2 - mImage->getWidth() / 2; int textY = getHeight() / 2 - mImage->getHeight() / 2; if (isMarked()) { graphics->drawImage(mImage, textX + 1, textY + 1); } else { graphics->drawImage(mImage, textX, textY); if (isFocused()) { graphics->drawRectangle(gcn::Rectangle(2, 2, getWidth() - 4, getHeight() - 4)); } } }
void EnergyGauge::draw(gcn::Graphics* graphics) { int highlightThickness = (getOrientation() == Orientation::VERTICAL ? getWidth() : getHeight() ) / 4; // width of the highlight stripe, typically 2 pixels const float percentageFilled = value / maximumValue; // Draw the background of the gague graphics->setColor(getBackgroundColor()); graphics->fillRectangle(0, 0, getWidth(), getHeight()); if(getOrientation() == Orientation::VERTICAL) { // Draw the highlight stripe graphics->setColor(getForegroundColor()); const int highlightStartX = (getWidth() / 2) - (highlightThickness / 2); graphics->fillRectangle(highlightStartX, 0, highlightThickness, getHeight()); graphics->setColor(getBaseColor()); // Draw horizontal ticks for(unsigned int row = 0, height = getHeight(); row < height; ++row) { if(row % 2 == 1) { graphics->drawLine(0, row, getWidth(), row); } } // Draw overlay rectangle int fillHeight = getHeight() - static_cast<int>(percentageFilled * static_cast<float>(getHeight())); graphics->fillRectangle(0, 0, getWidth(), fillHeight); // Draw border graphics->drawLine(0, 0, 0, getHeight()); graphics->drawLine(getWidth() - 1, 0, getWidth() - 1, getHeight()); } else { // Draw horizontal orientation graphics->setColor(getForegroundColor()); const int highlightStartY = (getHeight() / 2) - (highlightThickness / 2); graphics->fillRectangle(0, highlightStartY, getWidth(), highlightThickness); graphics->setColor(getBaseColor()); // Draw horizontal ticks for(unsigned int column = 0, width = getWidth(); column < width; ++column) { if(column % 2 == 1) { graphics->drawLine(column, 0, column, getHeight()); } } // Draw overlay rectangle int fillWidth = getWidth() - static_cast<int>(percentageFilled * static_cast<float>(getWidth())); graphics->fillRectangle(0, 0, fillWidth, getHeight()); // Draw border graphics->drawLine(0, 0, getWidth(), 0); graphics->drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); } }
void DropDown::draw(Graphics* graphics) { int h; if (mDroppedDown) { h = mOldH; } else { h = getHeight(); } int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), h)); graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth() - h, h)); graphics->setColor(getForegroundColor()); } if (mListBox->getListModel() && mListBox->getSelected() >= 0) { graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0); } drawButton(graphics); if (mDroppedDown) { drawChildren(graphics); // Draw two lines separating the ListBox with se selected // element view. graphics->setColor(highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); graphics->drawLine(0, h + 1,getWidth(),h + 1); } }
void TabbedArea::draw(Graphics *graphics) { const Color &faceColor = getBaseColor(); const int alpha = getBaseColor().a; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; // Draw a border. graphics->setColor(highlightColor); graphics->drawLine(0, mTabContainer->getHeight(), 0, getHeight() - 2); graphics->setColor(shadowColor); graphics->drawLine(getWidth() - 1, mTabContainer->getHeight() + 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1); if (isOpaque()) { graphics->setColor(getBaseColor()); graphics->fillRectangle(Rectangle(1, 1, getWidth() - 2, getHeight() - 2)); } // Draw a line underneath the tabs. graphics->setColor(highlightColor); graphics->drawLine(1, mTabContainer->getHeight(), getWidth() - 1, mTabContainer->getHeight()); // If a tab is selected, remove the line right underneath // the selected tab. if (mSelectedTab != NULL) { graphics->setColor(getBaseColor()); graphics->drawLine(mSelectedTab->getX() + 1, mTabContainer->getHeight(), mSelectedTab->getX() + mSelectedTab->getWidth() - 2, mTabContainer->getHeight()); } drawChildren(graphics); }
void Slider::draw(gcn::Graphics* graphics) { Color shadowColor = getBaseColor() - 0x101010; int alpha = getBaseColor().a; shadowColor.a = alpha; graphics->setColor(shadowColor); graphics->fillRectangle(gcn::Rectangle(0,0,getWidth(),getHeight())); drawMarker(graphics); }
void Decoration::draw(gcn::Graphics* graphics) { gcn::Color faceColor = getBaseColor(); gcn::Color highlightColor, shadowColor; int alpha = getBaseColor().a; int width = getWidth() + getFrameSize() * 2 - 1; int height = getHeight() + getFrameSize() * 2 - 1; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; int x_start = getFont()->getWidth("A") - 1; int x_stop = x_start + getFont()->getWidth(mText) + 1; int y_offset = getFont()->getHeight()/2; unsigned int i; for (i = 0; i < getFrameSize(); ++i) { if ( mType == DIV_TYPE_RAISED ) graphics->setColor(highlightColor); else graphics->setColor(shadowColor); // Top Line if ( mText.size() > 0 ) { graphics->drawLine(i,i + y_offset, x_start, i + y_offset ); graphics->drawLine(x_stop,i + y_offset, width - i, i + y_offset); } else { graphics->drawLine(i,i + y_offset, width - i, i + y_offset); } // Left Line graphics->drawLine(i,i + 1 + y_offset, i, height - i - 1); if ( mType == DIV_TYPE_RAISED ) graphics->setColor(shadowColor); else graphics->setColor(shadowColor); // Right Line graphics->drawLine(width - i - 2,i + 1 + y_offset, width - i - 2, height - i); //Bottom Line graphics->drawLine(i,height - i - 2, width - i - 1, height - i - 2); } graphics->drawText ( mText, x_start+1, 1 ); }
AudioOptions::AudioOptions(RootWidget * top) : gcn::Window("Audio"), m_top(top) { gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); setOpaque(true); gcn::Box * vbox = new gcn::VBox(6); m_widgets.push_back(SPtr<gcn::Widget>(vbox)); gcn::Box * hbox = new gcn::HBox(6); m_widgets.push_back(SPtr<gcn::Widget>(hbox)); gcn::Button * b = new gcn::Button("Apply"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("apply"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); b = new gcn::Button("Close"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("close"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); vbox->pack(hbox); add(vbox); resizeToContent(); }
TaskWindow::TaskWindow(Eris::Entity * e) : m_entity(e) { assert(e != 0); gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); // setTitleBarHeight(0); setMovable(false); // setOpaque(true); m_vbox = new gcn::VBox(2); m_widgets.push_back(SPtr<gcn::Widget>(m_vbox)); m_progressBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_progressBar)); m_progressBar->setWidth(100); m_progressBar->setHeight(6); m_progressBar->setValue(0.0); m_progressBar->setForegroundColor(gcn::Color(0xaaaaaa)); m_progressBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_progressBar); add(m_vbox); resizeToContent(); }
void ScrollArea::draw(Graphics *graphics) { drawBackground(graphics); if (mVBarVisible) { drawUpButton(graphics); drawDownButton(graphics); drawVBar(graphics); drawVMarker(graphics); } if (mHBarVisible) { drawLeftButton(graphics); drawRightButton(graphics); drawHBar(graphics); drawHMarker(graphics); } if (mHBarVisible && mVBarVisible) { graphics->setColor(getBaseColor()); graphics->fillRectangle(Rectangle(getWidth() - mScrollbarWidth, getHeight() - mScrollbarWidth, mScrollbarWidth, mScrollbarWidth)); } drawChildren(graphics); }
void Slider::drawMarker(gcn::Graphics* graphics) { gcn::Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(faceColor); if (getOrientation() == HORIZONTAL) { int v = getMarkerPosition(); graphics->fillRectangle(gcn::Rectangle(v + 1, 1, getMarkerLength() - 2, getHeight() - 2)); graphics->setColor(highlightColor); graphics->drawLine(v, 0, v + getMarkerLength() - 1,0); graphics->drawLine(v, 0, v, getHeight() - 1); graphics->setColor(shadowColor); graphics->drawLine(v + getMarkerLength() - 1, 1, v + getMarkerLength() - 1, getHeight() - 1); graphics->drawLine(v + 1, getHeight() - 1, v + getMarkerLength() - 1, getHeight() - 1); if (isFocused()) { graphics->setColor(getForegroundColor()); graphics->drawRectangle(Rectangle(v + 2, 2, getMarkerLength() - 4, getHeight() - 4)); } } else { int v = (getHeight() - getMarkerLength()) - getMarkerPosition(); graphics->fillRectangle(gcn::Rectangle(1, v + 1, getWidth() - 2, getMarkerLength() - 2)); graphics->setColor(highlightColor); graphics->drawLine(0, v, 0, v + getMarkerLength() - 1); graphics->drawLine(0, v, getWidth() - 1, v); graphics->setColor(shadowColor); graphics->drawLine(1, v + getMarkerLength() - 1, getWidth() - 1, v + getMarkerLength() - 1); graphics->drawLine(getWidth() - 1, v + 1, getWidth() - 1, v + getMarkerLength() - 1); if (isFocused()) { graphics->setColor(getForegroundColor()); graphics->drawRectangle(Rectangle(2, v + 2, getWidth() - 4, getMarkerLength() - 4)); } } }
void RadioBar::draw(gcn::Graphics *graphics){ if( isSelected() ){ graphics->setColor(getBackgroundColor()); } else { graphics->setColor(getBaseColor()); } graphics->fillRectangle(getDimension()); }
void World::upgradeTower(cocos2d::Vec2 tile) { auto tower = _gameplayLayer->getTower(tile); tower->upgrade(); _mapLayer->setSlotColor(tile, tower->getBaseColor()); _gameplayLayer->balanceTotalEnergy(-tower->getCost()); }
void TextField::draw(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; // Draw a border. graphics->setColor(shadowColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 2); graphics->setColor(highlightColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1); // Push a clip area so the other drawings don't need to worry // about the border. graphics->pushClipArea(Rectangle(1, 1, getWidth() - 2, getHeight() - 2)); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->drawRectangle(Rectangle(0, 0, getWidth() - 2, getHeight() - 2)); graphics->drawRectangle(Rectangle(1, 1, getWidth() - 4, getHeight() - 4)); } if (isFocused() && isEditable()) { drawCaret(graphics, mText->getCaretX(getFont()) - mXScroll); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); const Rectangle& dim = mText->getCaretDimension(getFont()); if (mText->getNumberOfRows() != 0) graphics->drawText(mText->getRow(0), 1 - mXScroll, 1); graphics->popClipArea(); }
void Container::Draw(GraphicsPtr graphics) { if (IsOpaque()) { graphics->setColor(getBaseColor()); graphics->fillRectangle(Rectangle(0, 0, GetWidth(), GetHeight())); } DrawChildren(graphics); }
void Container::draw(Graphics* graphics) { if (isOpaque()) { graphics->setColor(getBaseColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); } drawChildren(graphics); }
void TextField::draw(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; // Draw a border. graphics->setColor(shadowColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 2); graphics->setColor(highlightColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1); // Push a clip area so the other drawings don't need to worry // about the border. graphics->pushClipArea(Rectangle(1, 1, getWidth() - 2, getHeight() - 2)); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->drawRectangle(Rectangle(0, 0, getWidth() - 2, getHeight() - 2)); graphics->drawRectangle(Rectangle(1, 1, getWidth() - 4, getHeight() - 4)); } if (isFocused()) { drawCaret(graphics, getFont()->getWidth(mText.substr(0, mCaretPosition)) - mXScroll); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); graphics->drawText(mText.c_str(), 3 - mXScroll, 1); graphics->popClipArea(); }
void ScrollArea::drawVBar(Graphics* graphics) { Rectangle dim = getVerticalBarDimension(); graphics->pushClipArea(dim); int alpha = getBaseColor().a; Color trackColor = getBaseColor() - 0x101010; trackColor.a = alpha; Color shadowColor = getBaseColor() - 0x303030; shadowColor.a = alpha; graphics->setColor(trackColor); graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height)); graphics->setColor(shadowColor); graphics->drawLine(0, 0, 0, dim.height); graphics->popClipArea(); }
void SelectionRectGraphicsWidget::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget /*= 0 */ ) { QColor basecolor(getBaseColor()); QPen pen(getPenColor()); pen.setWidth(0); painter->setPen(pen); basecolor.setAlphaF(0.2); painter->setBrush(basecolor); painter->drawRect(mapRectFromParent(geometry())); }
void StatusBar::Colorize() { FXColor clr=getBaseColor(); coords->setShadowColor(clr); coords->setBackColor(clr); coords->setEditable(false); docname->setShadowColor(clr); docname->setBackColor(clr); encname->setShadowColor(clr); encname->setBackColor(clr); mode->setBackColor(ColorFuncs::HexToRGB("#FFFFCC")); mode->setTextColor(ColorFuncs::HexToRGB("#FF0000")); }
void CheckBox::drawBox(Graphics *graphics) { const int h = GetHeight() - 2; const int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(shadowColor); graphics->drawLine(1, 1, h, 1); graphics->drawLine(1, 1, 1, h); graphics->setColor(highlightColor); graphics->drawLine(h, 1, h, h); graphics->drawLine(1, h, h - 1, h); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(2, 2, h - 2, h - 2)); graphics->setColor(getForegroundColor()); if (IsFocused()) { graphics->drawRectangle(Rectangle(0, 0, h + 2, h + 2)); } if (mSelected) { graphics->drawLine(3, 5, 3, h - 2); graphics->drawLine(4, 5, 4, h - 2); graphics->drawLine(5, h - 3, h - 2, 4); graphics->drawLine(5, h - 4, h - 4, 5); } }
void CheckBox::drawBorder(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; int width = getWidth() + getBorderSize() * 2 - 1; int height = getHeight() + getBorderSize() * 2 - 1; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; unsigned int i; for (i = 0; i < getBorderSize(); ++i) { graphics->setColor(shadowColor); graphics->drawLine(i,i, width - i, i); graphics->drawLine(i,i + 1, i, height - i - 1); graphics->setColor(highlightColor); graphics->drawLine(width - i,i + 1, width - i, height - i); graphics->drawLine(i,height - i, width - i - 1, height - i); } }
void Icon2::drawFrame(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int32_t alpha = getBaseColor().a; int32_t width = getWidth() + getFrameSize() * 2 - 1; int32_t height = getHeight() + getFrameSize() * 2 - 1; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; uint32_t i; for (i = 0; i < getFrameSize(); ++i) { graphics->setColor(shadowColor); graphics->drawLine(i,i, width - i, i); graphics->drawLine(i,i + 1, i, height - i - 1); graphics->setColor(highlightColor); graphics->drawLine(width - i,i + 1, width - i, height - i); graphics->drawLine(i,height - i, width - i - 1, height - i); } }
int caClock::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtAnalogClock::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = getPV(); break; case 1: *reinterpret_cast< timeType*>(_v) = getTimeType(); break; case 2: *reinterpret_cast< QColor*>(_v) = getBaseColor(); break; case 3: *reinterpret_cast< bool*>(_v) = getScaleDefaultColor(); break; case 4: *reinterpret_cast< QColor*>(_v) = getScaleColor(); break; case 5: *reinterpret_cast< colMode*>(_v) = getColorMode(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPV(*reinterpret_cast< QString*>(_v)); break; case 1: setTimeType(*reinterpret_cast< timeType*>(_v)); break; case 2: setBaseColor(*reinterpret_cast< QColor*>(_v)); break; case 3: setScaleDefaultColor(*reinterpret_cast< bool*>(_v)); break; case 4: setScaleColor(*reinterpret_cast< QColor*>(_v)); break; case 5: setColorMode(*reinterpret_cast< colMode*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
StatusWindow::StatusWindow(Eris::Entity * e) : m_entity(e) { assert(e != 0); gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); // setTitleBarHeight(0); setMovable(false); setCaption(e->getName()); // setOpaque(true); m_vbox = new gcn::VBox(2); m_widgets.push_back(SPtr<gcn::Widget>(m_vbox)); m_healthBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_healthBar)); m_healthBar->setWidth(100); m_healthBar->setHeight(6); m_healthBar->setValue(0.3); m_healthBar->setForegroundColor(gcn::Color(0xff0000)); m_healthBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_healthBar); m_staminaBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_staminaBar)); m_staminaBar->setWidth(100); m_staminaBar->setHeight(6); m_staminaBar->setValue(0.6); m_staminaBar->setForegroundColor(gcn::Color(0xeeeeee)); m_staminaBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_staminaBar); m_manaBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_manaBar)); m_manaBar->setWidth(100); m_manaBar->setHeight(6); m_manaBar->setValue(0.9); m_manaBar->setForegroundColor(gcn::Color(0x0000ff)); m_manaBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_manaBar); add(m_vbox); resizeToContent(); }
void DropDown::draw(gcn::Graphics* graphics) { int h; if (mDroppedDown) h = mFoldedUpHeight; else h = getHeight(); updateAlpha(); const int alpha = (int) (mAlpha * 255.0f); gcn::Color faceColor = getBaseColor(); faceColor.a = alpha; const gcn::Color *highlightColor = &Theme::getThemeColor(Theme::HIGHLIGHT, alpha); gcn::Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; if (mListBox->getListModel() && mListBox->getSelected() >= 0) { graphics->setFont(getFont()); graphics->setColor(Theme::getThemeColor(Theme::TEXT)); graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0); } if (isFocused()) { graphics->setColor(*highlightColor); graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h)); } drawButton(graphics); if (mDroppedDown) { drawChildren(graphics); // Draw two lines separating the ListBox with selected // element view. graphics->setColor(*highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); graphics->drawLine(0, h + 1, getWidth(), h + 1); } }