void DeleteSection::paint(Graphics& g) { static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0)); g.setColour(Colour(0xbb212121)); g.fillAll(); Rectangle<int> delete_rect = getDeleteRect(); shadow.drawForRectangle(g, delete_rect); g.setColour(Colour(0xff303030)); g.fillRect(delete_rect); g.saveState(); g.setOrigin(delete_rect.getX() + PADDING_X, delete_rect.getY() + PADDING_Y); g.setFont(Fonts::instance()->proportional_light().withPointHeight(14.0f)); g.setColour(Colour(0xffaaaaaa)); String text; if (file_.isDirectory()) text = TRANS("Are you sure you want to delte this folder?"); else text = TRANS("Are you sure you want to delte this patch?"); g.drawText(text, 0, 0.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f, Justification::centred, false); g.setFont(Fonts::instance()->monospace().withPointHeight(16.0f)); g.setColour(Colour(0xff03a9f4)); g.drawText(file_.getFileNameWithoutExtension(), 0, 20.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f, Justification::centred, false); g.restoreState(); }
void DeleteSection::resized() { Rectangle<int> delete_rect = getDeleteRect(); float button_width = (delete_rect.getWidth() - 3 * PADDING_X) / 2.0f; delete_button_->setBounds(delete_rect.getX() + PADDING_X, delete_rect.getBottom() - PADDING_Y - BUTTON_HEIGHT, button_width, BUTTON_HEIGHT); cancel_button_->setBounds(delete_rect.getX() + button_width + 2 * PADDING_X, delete_rect.getBottom() - PADDING_Y - BUTTON_HEIGHT, button_width, BUTTON_HEIGHT); }
void DeleteSection::paint(Graphics& g) { static Font patch_font(Typeface::createSystemTypefaceFor(BinaryData::DroidSansMono_ttf, BinaryData::DroidSansMono_ttfSize)); static Font roboto_light(Typeface::createSystemTypefaceFor(BinaryData::RobotoLight_ttf, BinaryData::RobotoLight_ttfSize)); static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0)); g.setColour(Colour(0xbb212121)); g.fillAll(); Rectangle<int> delete_rect = getDeleteRect(); shadow.drawForRectangle(g, delete_rect); g.setColour(Colour(0xff303030)); g.fillRect(delete_rect); g.saveState(); g.setOrigin(delete_rect.getX() + PADDING_X, delete_rect.getY() + PADDING_Y); g.setFont(roboto_light.withPointHeight(14.0f)); g.setColour(Colour(0xffaaaaaa)); String text; if (file_.isDirectory()) text = TRANS("Are you sure you want to delte this folder?"); else text = TRANS("Are you sure you want to delte this patch?"); g.drawText(text, 0, 0.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f, Justification::centred, false); g.setFont(patch_font.withPointHeight(16.0f)); g.setColour(Colour(0xff03a9f4)); g.drawText(file_.getFileNameWithoutExtension(), 0, 20.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f, Justification::centred, false); g.restoreState(); }
void DeleteSection::mouseUp(const MouseEvent &e) { if (!getDeleteRect().contains(e.getPosition())) setVisible(false); }