EvButton::EvButton(QWidget *parent) : QPushButton(parent),m_hover(false) { setFont(evApparenceSettings->buttonsFont()); setMouseTracking(true); setPressedColor(evApparenceSettings->primaryColor()); setBackgroundColor(evApparenceSettings->darkColor()); setHoverColor(evApparenceSettings->ligthColor()); m_hoverColor.setAlpha(50); setTextColor(evApparenceSettings->ligthColor()); setPaintMode(IconAndText); setRounded(true); }
void CollectionView::addTile(std::string imgPath, sf::Vector2f textureOffset, sf::Vector2f textureSize) { auto tile = std::make_shared<GUI::Button>(); tile->setText(""); tile->drawRect(true); tile->drawSprite(true); sf::Texture* texture = new sf::Texture(); if (textureSize.x != -1){ texture->loadFromFile(imgPath,sf::IntRect((int) textureOffset.x, (int) textureOffset.y,(int)textureSize.x, (int)textureSize.y)); } else texture->loadFromFile(imgPath); tile->setNormalTexture(texture); tile->setPressedColor(sf::Color(75,131,204)); tile->setToggle(true); mTiles.push_back(tile); updateGraphics(); }
// constructor MGuiSlide::MGuiSlide(MVector2 position, MVector2 scale, MVector4 color, void (* pointerEvent)(MGuiSlide * slide, MGuiEvent * guiEvent)): m_value(0), m_minValue(0), m_maxValue(1) { m_button.setPosition(position); m_button.setScale(scale); setDirection(MVector2(10, 0)); setParentWindow(NULL); setPosition(position); setScale(getDirection() + scale); setNormalColor(color); setHighLightColor(color); setPressedColor(color); setPointerEvent(pointerEvent); }
//constructor MGuiEditText::MGuiEditText(const char * text, const MVector2 & position, float size, const MVector4 & color, void (* pointerEvent)(MGuiEditText * editText, MGuiEvent * guiEvent)): m_charId(0), m_startSelectionId(0), m_endSelectionId(0), m_limitLength(false), m_maxLength(0), m_isSingleLine(false) { setParentWindow(NULL); setText(text); setPosition(position); setTextSize(size); setNormalColor(color); setHighLightColor(color); setPressedColor(color); setPointerEvent(pointerEvent); autoScaleFromText(); }
Button::Button (uint8_t id, uint16_t x, uint16_t y, uint16_t w, uint16_t h, const String &label) : Label(id, x, y, w, h, label), _pressed(false), _active(false) { setColor(BLACK, DARK_GRAY); setPressedColor(BLACK, GRAY); setActiveColor(BLACK, LIGHT_GRAY); }