Minesweeper: Fix UI layout and focus behavior

Click-to-focus was visually annoying. Switch to tab-to-focus.
This commit is contained in:
Andreas Kling 2021-04-06 17:30:49 +02:00
parent ec1a72b759
commit a7ad0f14bf
2 changed files with 6 additions and 3 deletions

View file

@ -33,7 +33,6 @@
#include <LibGUI/Painter.h>
#include <LibGfx/Palette.h>
#include <time.h>
#include <unistd.h>
class SquareButton final : public GUI::Button {
C_OBJECT(SquareButton);
@ -56,7 +55,10 @@ public:
}
private:
SquareButton() { }
SquareButton()
{
set_focus_policy(GUI::FocusPolicy::TabFocus);
}
};
class SquareLabel final : public GUI::Label {

View file

@ -91,8 +91,9 @@ int main(int argc, char** argv)
auto& flag_label = container.add<GUI::Label>();
auto& face_button = container.add<GUI::Button>();
face_button.set_focus_policy(GUI::FocusPolicy::TabFocus);
face_button.set_button_style(Gfx::ButtonStyle::CoolBar);
face_button.set_fixed_width(36);
face_button.set_fixed_size(36, 36);
auto& time_image = container.add<GUI::ImageWidget>();
time_image.load_from_file("/res/icons/minesweeper/timer.png");