MythTV  master
mythuitextedit.h
Go to the documentation of this file.
1 #ifndef MYTHUI_TEXTEDIT_H_
2 #define MYTHUI_TEXTEDIT_H_
3 
4 #include <QString>
5 #include <QClipboard>
6 
7 #include "mythtimer.h"
8 #include "mythuitype.h"
9 #include "mythvirtualkeyboard.h"
10 #include "mythstorage.h"
11 
12 class MythFontProperties;
13 class MythUIStateType;
14 class MythUIImage;
15 class MythUIText;
16 
18 {
19  FilterNone = 0x0,
20  FilterAlpha = 0x01,
21  FilterNumeric = 0x02,
23  FilterSymbols = 0x04,
24  FilterPunct = 0x08
25 };
26 
33 {
34  Q_OBJECT
35 
36  public:
37  MythUITextEdit(MythUIType *parent, const QString &name);
38  ~MythUITextEdit() override = default;
39 
40  void Pulse(void) override; // MythUIType
41  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
42  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
43  void Reset(void) override; // MythUIType
44 
45  void SetText(const QString &text, bool moveCursor = true);
46  void InsertText(const QString &text);
47  QString GetText(void) const { return m_message; }
48 
49  void SetFilter(InputFilter filter) { m_filter = filter; }
50  void SetPassword(bool isPassword) { m_isPassword = isPassword; }
51  void SetMaxLength(int length);
52 
53  enum MoveDirection { MoveLeft, MoveRight, MoveUp, MoveDown, MovePageUp, MovePageDown, MoveEnd };
54  bool MoveCursor(MoveDirection moveDir);
55 
56  void SetKeyboardPosition(PopupPosition pos) { m_keyboardPosition = pos; }
57  PopupPosition GetKeyboardPosition(void) { return m_keyboardPosition; }
58 
59  // StorageUser
60  void SetDBValue(const QString &text) override { SetText(text); } // StorageUser
61  QString GetDBValue(void) const override { return GetText(); } // StorageUser
62 
63  signals:
64  void valueChanged();
65 
66  public slots:
67  void Select();
68  void Deselect();
69 
70  protected:
71  bool ParseElement(const QString &filename, QDomElement &element,
72  bool showWarnings) override; // MythUIType
73  void CopyFrom(MythUIType *base) override; // MythUIType
74  void CreateCopy(MythUIType *parent) override; // MythUIType
75  void Finalize(void) override; // MythUIType
76 
77  void Init(void);
78  void SetInitialStates(void);
79 
80  bool InsertCharacter(const QString &character);
81  void RemoveCharacter(int position);
82 
83  void CutTextToClipboard(void);
84  void CopyTextToClipboard(void);
85  void PasteTextFromClipboard(QClipboard::Mode mode = QClipboard::Clipboard);
86 
88 
92 
94 
95  QString m_message;
98 
100 
102 
106 
108 };
109 
110 #endif
FilterAlpha
@ FilterAlpha
Definition: mythuitextedit.h:20
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:977
MythUITextEdit::m_position
int m_position
Definition: mythuitextedit.h:97
MythUITextEdit::m_keyboardPosition
PopupPosition m_keyboardPosition
Definition: mythuitextedit.h:101
MythUITextEdit::m_text
MythUIText * m_text
Definition: mythuitextedit.h:105
MythUITextEdit::m_initialized
bool m_initialized
Definition: mythuitextedit.h:87
FilterNone
@ FilterNone
Definition: mythuitextedit.h:19
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythUITextEdit::m_lastKeyPress
MythTimer m_lastKeyPress
Definition: mythuitextedit.h:91
MythUITextEdit::m_backgroundState
MythUIStateType * m_backgroundState
Definition: mythuitextedit.h:103
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:14
MythUITextEdit::m_maxLength
int m_maxLength
Definition: mythuitextedit.h:93
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:33
slots
unsigned int slots[4]
Definition: element.cpp:38
InputFilter
InputFilter
Definition: mythuitextedit.h:18
MythUITextEdit::GetText
QString GetText(void) const
Definition: mythuitextedit.h:47
MythUITextEdit::SetDBValue
void SetDBValue(const QString &text) override
Definition: mythuitextedit.h:60
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:440
MythUIType::CreateCopy
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
Definition: mythuitype.cpp:1209
MythUITextEdit::m_isPassword
bool m_isPassword
Definition: mythuitextedit.h:99
MythUITextEdit::~MythUITextEdit
~MythUITextEdit() override=default
mythvirtualkeyboard.h
FilterNumeric
@ FilterNumeric
Definition: mythuitextedit.h:21
MythUITextEdit::m_blinkInterval
int m_blinkInterval
Definition: mythuitextedit.h:89
MythUITextEdit::Init
void Init(void)
MythFontProperties
Definition: mythfontproperties.h:14
FilterPunct
@ FilterPunct
Definition: mythuitextedit.h:24
FilterSymbols
@ FilterSymbols
Definition: mythuitextedit.h:23
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
MythUITextEdit::m_composeKey
int m_composeKey
Definition: mythuitextedit.h:107
MythUITextEdit::SetPassword
void SetPassword(bool isPassword)
Definition: mythuitextedit.h:50
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1152
MythUITextEdit::SetFilter
void SetFilter(InputFilter filter)
Definition: mythuitextedit.h:49
MythUIType::Reset
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:69
MythUITextEdit::m_filter
InputFilter m_filter
Definition: mythuitextedit.h:96
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:64
MythUITextEdit::GetKeyboardPosition
PopupPosition GetKeyboardPosition(void)
Definition: mythuitextedit.h:57
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
MythUITextEdit::SetKeyboardPosition
void SetKeyboardPosition(PopupPosition pos)
Definition: mythuitextedit.h:56
MythUITextEdit::m_cursorImage
MythUIImage * m_cursorImage
Definition: mythuitextedit.h:104
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:993
MythUITextEdit::MoveDirection
MoveDirection
Definition: mythuitextedit.h:53
mythtimer.h
MythUITextEdit::valueChanged
void valueChanged()
MythUITextEdit::MoveUp
@ MoveUp
Definition: mythuitextedit.h:53
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
MythUITextEdit::m_cursorBlinkRate
int m_cursorBlinkRate
Definition: mythuitextedit.h:90
PopupPosition
PopupPosition
Preferred position to place virtual keyboard popup.
Definition: mythvirtualkeyboard.h:10
MythUIType::ParseElement
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
Definition: mythuitype.cpp:1218
mythstorage.h
MythUITextEdit::GetDBValue
QString GetDBValue(void) const override
Definition: mythuitextedit.h:61
MythUITextEdit::m_message
QString m_message
Definition: mythuitextedit.h:95
FilterAlphaNumeric
@ FilterAlphaNumeric
Definition: mythuitextedit.h:22
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:23
MythUIType::Finalize
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Definition: mythuitype.cpp:1294
mythuitype.h
StorageUser
Definition: mythstorage.h:16