diff options
author | Valtteri Koskivuori <vkoskiv@gmail.com> | 2021-05-10 00:15:35 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-11 10:18:29 +0100 |
commit | 4d01183f5c6df152b5c68def74da4d4189c0dbc8 (patch) | |
tree | ef071300d96ec8770853c90bdccbd66548c76187 /Userland/Applications/Magnifier/MagnifierWidget.h | |
parent | 4864ef944005bb16648467d2e84e29b9bcb3c8d7 (diff) | |
download | serenity-4d01183f5c6df152b5c68def74da4d4189c0dbc8.zip |
Userland: Implement a magnifier app
This utility is useful for making sure those UI elements are pixel
perfect. A simple 2x/4x magnification around the mouse cursor, shown in
a window.
Diffstat (limited to 'Userland/Applications/Magnifier/MagnifierWidget.h')
-rw-r--r-- | Userland/Applications/Magnifier/MagnifierWidget.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Userland/Applications/Magnifier/MagnifierWidget.h b/Userland/Applications/Magnifier/MagnifierWidget.h new file mode 100644 index 0000000000..f58d7d54d5 --- /dev/null +++ b/Userland/Applications/Magnifier/MagnifierWidget.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021, Valtteri Koskivuori <vkoskiv@gmail.com> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <LibGUI/Widget.h> +#include <LibGfx/Point.h> + +class MagnifierWidget final : public GUI::Widget { + C_OBJECT(MagnifierWidget) + +public: + MagnifierWidget(); + virtual ~MagnifierWidget(); + void set_scale_factor(int scale_factor); + void track_cursor_globally(); + +private: + virtual void timer_event(Core::TimerEvent&) override; + virtual void paint_event(GUI::PaintEvent&) override; + + Gfx::IntPoint m_mouse_position; + int m_scale_factor { 2 }; +}; |