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 POPUP_WIDGET_HXX |
19 | #define |
20 | |
21 | class GUIObject; |
22 | class ; |
23 | |
24 | #include "bspf.hxx" |
25 | #include "Variant.hxx" |
26 | #include "Command.hxx" |
27 | #include "Widget.hxx" |
28 | |
29 | /** |
30 | * Popup or dropdown widget which, when clicked, "pop up" a list of items and |
31 | * lets the user pick on of them. |
32 | * |
33 | * Implementation wise, when the user selects an item, then a kPopUpItemSelectedCmd |
34 | * is broadcast, with data being equal to the tag value of the selected entry. |
35 | */ |
36 | class : public Widget, public CommandSender |
37 | { |
38 | public: |
39 | (GuiObject* boss, const GUI::Font& font, |
40 | int x, int y, int w, int h, const VariantList& items, |
41 | const string& label, int labelWidth = 0, int cmd = 0); |
42 | virtual () = default; |
43 | |
44 | int () const override { return _y + 1; } |
45 | int () const override { return _y + 1 + getHeight(); } |
46 | |
47 | /** Add the given items to the widget. */ |
48 | void (const VariantList& items); |
49 | |
50 | /** Various selection methods passed directly to the underlying menu |
51 | See ContextMenu.hxx for more information. */ |
52 | void (const Variant& tag, |
53 | const Variant& def = EmptyVariant); |
54 | void (int idx, bool changed = false); |
55 | void (bool changed = false); |
56 | void (); |
57 | |
58 | int () const; |
59 | const string& () const; |
60 | const Variant& () const; |
61 | |
62 | bool () const override { return true; } |
63 | |
64 | protected: |
65 | void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; |
66 | void handleMouseWheel(int x, int y, int direction) override; |
67 | void handleMouseEntered() override; |
68 | void handleMouseLeft() override; |
69 | bool handleEvent(Event::Type e) override; |
70 | void handleCommand(CommandSender* sender, int cmd, int data, int id) override; |
71 | void (bool hilite) override; |
72 | |
73 | private: |
74 | unique_ptr<ContextMenu> ; |
75 | int ; |
76 | int ; |
77 | |
78 | string ; |
79 | int ; |
80 | bool ; |
81 | |
82 | private: |
83 | // Following constructors and assignment operators not supported |
84 | () = delete; |
85 | (const PopUpWidget&) = delete; |
86 | (PopUpWidget&&) = delete; |
87 | PopUpWidget& (const PopUpWidget&) = delete; |
88 | PopUpWidget& (PopUpWidget&&) = delete; |
89 | }; |
90 | |
91 | #endif |
92 | |