1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef TIA_ZOOM_WIDGET_HXX
19#define TIA_ZOOM_WIDGET_HXX
20
21class GuiObject;
22class ContextMenu;
23
24#include "Widget.hxx"
25#include "Command.hxx"
26
27class TiaZoomWidget : public Widget, public CommandSender
28{
29 public:
30 TiaZoomWidget(GuiObject *boss, const GUI::Font& font,
31 int x, int y, int w, int h);
32 virtual ~TiaZoomWidget() = default;
33
34 void loadConfig() override;
35 void setPos(int x, int y);
36
37 protected:
38 void handleMouseEntered() override;
39
40 private:
41 void zoom(int level);
42 void recalc();
43
44 void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
45 void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
46 void handleMouseWheel(int x, int y, int direction) override;
47 void handleMouseMoved(int x, int y) override;
48 void handleMouseLeft() override;
49 bool handleEvent(Event::Type event) override;
50 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
51
52 void drawWidget(bool hilite) override;
53 bool wantsFocus() const override { return true; }
54
55 private:
56 unique_ptr<ContextMenu> myMenu;
57
58 int myZoomLevel;
59 int myNumCols, myNumRows;
60 int myOffX, myOffY;
61 int myOffXLo, myOffYLo;
62
63 bool myMouseMoving;
64 int myClickX, myClickY;
65
66 private:
67 // Following constructors and assignment operators not supported
68 TiaZoomWidget() = delete;
69 TiaZoomWidget(const TiaZoomWidget&) = delete;
70 TiaZoomWidget(TiaZoomWidget&&) = delete;
71 TiaZoomWidget& operator=(const TiaZoomWidget&) = delete;
72 TiaZoomWidget& operator=(TiaZoomWidget&&) = delete;
73};
74
75#endif
76