diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-17 12:53:42 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-18 09:58:02 +0000 |
commit | b6d579993a68cdf59c4d0759ad5e848005678d4b (patch) | |
tree | 3a0f83621280526332106d0770e63fb800011e8d /src/gui/widgets | |
parent | 77846cfb61a3e4793d3fae5c1cc23fb68851c9ac (diff) | |
download | mana-b6d579993a68cdf59c4d0759ad5e848005678d4b.tar.gz mana-b6d579993a68cdf59c4d0759ad5e848005678d4b.tar.bz2 mana-b6d579993a68cdf59c4d0759ad5e848005678d4b.tar.xz mana-b6d579993a68cdf59c4d0759ad5e848005678d4b.zip |
Added small grabbable margin to Shortcuts window
The Shortcuts window could no longer be moved since adding support for
resizing windows at the top edge. Now there is again a bit of space
where the window can be grabbed.
Included some related cleanups.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/shortcutcontainer.h | 17 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 44 |
3 files changed, 19 insertions, 43 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index e153ba65..8e16b5b3 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -50,7 +50,6 @@ ScrollArea::ScrollArea(gcn::Widget *widget): ScrollArea::~ScrollArea() { - // Garbage collection delete getContent(); instances--; diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 449a06f3..cab20f27 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -40,8 +40,6 @@ class ShortcutContainer : public gcn::Widget, public: ShortcutContainer(); - ~ShortcutContainer() override {} - /** * Draws the shortcuts */ @@ -53,21 +51,6 @@ class ShortcutContainer : public gcn::Widget, */ void widgetResized(const gcn::Event &event) override; - /** - * Handles mouse when dragged. - */ - void mouseDragged(gcn::MouseEvent &event) override = 0; - - /** - * Handles mouse when pressed. - */ - void mousePressed(gcn::MouseEvent &event) override = 0; - - /** - * Handles mouse release. - */ - void mouseReleased(gcn::MouseEvent &event) override = 0; - int getMaxItems() const { return mMaxItems; } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 6231bcbf..7e5c9ad9 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -604,44 +604,38 @@ void Window::setDefaultSize(int defaultWidth, int defaultHeight, int x = 0; int y = 0; - if (position == ImageRect::UPPER_LEFT) - { - } - else if (position == ImageRect::UPPER_CENTER) + switch (position) { + case ImageRect::UPPER_LEFT: + break; + case ImageRect::UPPER_CENTER: x = (graphics->getWidth() - defaultWidth) / 2; - } - else if (position == ImageRect::UPPER_RIGHT) - { + break; + case ImageRect::UPPER_RIGHT: x = graphics->getWidth() - defaultWidth; - } - else if (position == ImageRect::LEFT) - { + break; + case ImageRect::LEFT: y = (graphics->getHeight() - defaultHeight) / 2; - } - else if (position == ImageRect::CENTER) - { + break; + case ImageRect::CENTER: x = (graphics->getWidth() - defaultWidth) / 2; y = (graphics->getHeight() - defaultHeight) / 2; - } - else if (position == ImageRect::RIGHT) - { + break; + case ImageRect::RIGHT: x = graphics->getWidth() - defaultWidth; y = (graphics->getHeight() - defaultHeight) / 2; - } - else if (position == ImageRect::LOWER_LEFT) - { + break; + case ImageRect::LOWER_LEFT: y = graphics->getHeight() - defaultHeight; - } - else if (position == ImageRect::LOWER_CENTER) - { + break; + case ImageRect::LOWER_CENTER: x = (graphics->getWidth() - defaultWidth) / 2; y = graphics->getHeight() - defaultHeight; - } - else if (position == ImageRect::LOWER_RIGHT) - { + break; + case ImageRect::LOWER_RIGHT: x = graphics->getWidth() - defaultWidth; y = graphics->getHeight() - defaultHeight; + break; } mDefaultX = x - offsetX; |