KWayland

textinput_interface.h
1 /*
2  SPDX-FileCopyrightText: 2016 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef KWAYLAND_SERVER_TEXTINPUT_INTERFACE_H
7 #define KWAYLAND_SERVER_TEXTINPUT_INTERFACE_H
8 
9 #include "global.h"
10 #include "resource.h"
11 
12 #include <KWayland/Server/kwaylandserver_export.h>
13 
14 namespace KWayland
15 {
16 namespace Server
17 {
18 
19 class Display;
20 class SeatInterface;
21 class SurfaceInterface;
22 class TextInputInterface;
23 
33  UnstableV0,
37  UnstableV1,
42 };
43 
54 class KWAYLANDSERVER_EXPORT TextInputManagerInterface : public Global
55 {
56  Q_OBJECT
57 public:
58  virtual ~TextInputManagerInterface();
59 
63  TextInputInterfaceVersion interfaceVersion() const;
64 
65 protected:
66  class Private;
67  explicit TextInputManagerInterface(Private *d, QObject *parent = nullptr);
68 
69 private:
70  Private *d_func() const;
71 };
72 
91 class KWAYLANDSERVER_EXPORT TextInputInterface : public Resource
92 {
93  Q_OBJECT
94 public:
95  virtual ~TextInputInterface();
96 
100  enum class ContentHint : uint32_t {
104  None = 0,
108  AutoCompletion = 1 << 0,
112  AutoCorrection = 1 << 1,
116  AutoCapitalization = 1 << 2,
120  LowerCase = 1 << 3,
124  UpperCase = 1 << 4,
128  TitleCase = 1 << 5,
132  HiddenText = 1 << 6,
136  SensitiveData = 1 << 7,
140  Latin = 1 << 8,
144  MultiLine = 1 << 9
145  };
146  Q_DECLARE_FLAGS(ContentHints, ContentHint)
147 
148 
154  enum class ContentPurpose : uint32_t {
158  Normal,
162  Alpha,
166  Digits,
170  Number,
174  Phone,
178  Url,
182  Email,
186  Name,
190  Password,
194  Date,
198  Time,
202  DateTime,
206  Terminal
207  };
208 
212  TextInputInterfaceVersion interfaceVersion() const;
213 
220  QByteArray preferredLanguage() const;
221 
225  QRect cursorRectangle() const;
226 
230  ContentPurpose contentPurpose() const;
231 
235  ContentHints contentHints() const;
236 
243  QByteArray surroundingText() const;
249  qint32 surroundingTextCursorPosition() const;
258  qint32 surroundingTextSelectionAnchor() const;
259 
265  QPointer<SurfaceInterface> surface() const;
266 
272  bool isEnabled() const;
273 
287  void preEdit(const QByteArray &text, const QByteArray &commitText);
288 
301  void commit(const QByteArray &text);
302 
311  void setPreEditCursor(qint32 index);
312 
322  void deleteSurroundingText(quint32 beforeLength, quint32 afterLength);
323 
329  void setCursorPosition(qint32 index, qint32 anchor);
330 
334  void setTextDirection(Qt::LayoutDirection direction);
335 
336  void keysymPressed(quint32 keysym, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
337  void keysymReleased(quint32 keysym, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
338 
348  void setInputPanelState(bool visible, const QRect &overlappedSurfaceArea);
349 
353  void setLanguage(const QByteArray &languageTag);
354 
355 Q_SIGNALS:
360  void requestShowInputPanel();
365  void requestHideInputPanel();
371  void requestReset();
376  void preferredLanguageChanged(const QByteArray &language);
380  void cursorRectangleChanged(const QRect &rect);
386  void contentTypeChanged();
394  void surroundingTextChanged();
400  void enabledChanged();
401 
402 protected:
403  class Private;
404  explicit TextInputInterface(Private *p, QObject *parent = nullptr);
405 
406 private:
407  friend class TextInputManagerUnstableV0Interface;
408  friend class TextInputManagerUnstableV2Interface;
409  friend class SeatInterface;
410 
411  Private *d_func() const;
412 };
413 
414 
415 }
416 }
417 
419 Q_DECLARE_METATYPE(KWayland::Server::TextInputInterface *)
422 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Server::TextInputInterface::ContentHints)
424 
425 #endif
typedef KeyboardModifiers
ContentPurpose
The ContentPurpose allows to specify the primary purpose of a text input.
ContentHint
ContentHint allows to modify the behavior of the text input.
Represents a generic Resource for a text input object.
LayoutDirection
TextInputInterfaceVersion
Enum describing the different InterfaceVersion encapsulated in this implementation.
Represents a Seat on the Wayland Display.
wl_text_input as the non-standardized version
Base class for all Globals.
Definition: global.h:46
Represent the Global for the interface.
Represents a bound Resource.
Definition: resource.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 5 2020 22:48:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.