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 EDIT_TEXT_WIDGET_HXX |
19 | #define EDIT_TEXT_WIDGET_HXX |
20 | |
21 | #include "Rect.hxx" |
22 | #include "EditableWidget.hxx" |
23 | |
24 | |
25 | /* EditTextWidget */ |
26 | class EditTextWidget : public EditableWidget |
27 | { |
28 | public: |
29 | EditTextWidget(GuiObject* boss, const GUI::Font& font, |
30 | int x, int y, int w, int h, const string& text = "" ); |
31 | virtual ~EditTextWidget() = default; |
32 | |
33 | void setText(const string& str, bool changed = false) override; |
34 | |
35 | protected: |
36 | void drawWidget(bool hilite) override; |
37 | void lostFocusWidget() override; |
38 | |
39 | void startEditMode() override; |
40 | void endEditMode() override; |
41 | void abortEditMode() override; |
42 | |
43 | Common::Rect getEditRect() const override; |
44 | |
45 | void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; |
46 | void handleMouseEntered() override; |
47 | void handleMouseLeft() override; |
48 | |
49 | protected: |
50 | string _backupString; |
51 | bool _changed; |
52 | |
53 | private: |
54 | // Following constructors and assignment operators not supported |
55 | EditTextWidget() = delete; |
56 | EditTextWidget(const EditTextWidget&) = delete; |
57 | EditTextWidget(EditTextWidget&&) = delete; |
58 | EditTextWidget& operator=(const EditTextWidget&) = delete; |
59 | EditTextWidget& operator=(EditTextWidget&&) = delete; |
60 | }; |
61 | |
62 | #endif |
63 | |