GUI: Add DropdownButtonWidget and use it in the launcher for mass add

DropdownButtonWidget is a button split in two parts vertically. Clicking
the left part triggers a default action. Clicking the right part shows a
list of other actions the user can choose from.

Using this widget on the launcher lets 'Mass add' be a secondary action
of the 'Add' button, removing the necessity of pressing the shift key to
access the feature.
This commit is contained in:
Bastien Bouclet 2019-11-13 21:09:21 +01:00
parent 3db6aed4e4
commit 2c812a6b7a
27 changed files with 1785 additions and 240 deletions

View file

@ -52,13 +52,48 @@ void VectorRenderer::drawStep(const Common::Rect &area, const Common::Rect &clip
setGradientFactor(step.factor);
setStrokeWidth(step.stroke);
setFillMode((FillMode)step.fillMode);
setClippingRect(clip);
setClippingRect(applyStepClippingRect(area, clip, step));
_dynamicData = extra;
(this->*(step.drawingCall))(area, step);
}
Common::Rect VectorRenderer::applyStepClippingRect(const Common::Rect &area, const Common::Rect &clip, const DrawStep &step) {
if (step.clip == Common::Rect()) {
return clip;
}
Common::Rect finalClip = clip;
if (step.clip.left > 0) {
finalClip.left = area.left + step.clip.left;
} else if (step.clip.left < 0) {
finalClip.left = area.right + step.clip.left;
}
if (step.clip.top > 0) {
finalClip.top = area.top + step.clip.top;
} else if (step.clip.top < 0) {
finalClip.top = area.bottom + step.clip.top;
}
if (step.clip.right > 0) {
finalClip.right = area.left + step.clip.right;
} else if (step.clip.right < 0) {
finalClip.right = area.right + step.clip.right;
}
if (step.clip.bottom > 0) {
finalClip.bottom = area.top + step.clip.bottom;
} else if (step.clip.bottom < 0) {
finalClip.bottom = area.bottom + step.clip.bottom;
}
finalClip.clip(clip);
return finalClip;
}
int VectorRenderer::stepGetRadius(const DrawStep &step, const Common::Rect &area) {
int radius = 0;
@ -102,7 +137,7 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &
}
} else {
in_x = area.left + step.padding.left;
in_w = area.width();
in_w = area.width() - step.padding.left - step.padding.right;
}
if (!step.autoHeight) {
@ -133,7 +168,7 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &
}
} else {
in_y = area.top + step.padding.top;
in_h = area.height();
in_h = area.height() - step.padding.top - step.padding.bottom;
}
if (step.scale != (1 << 16) && step.scale != 0) {