File indexing completed on 2024-05-19 16:35:29

0001 /*
0002     SPDX-FileCopyrightText: 2020 Bhushan Shah <bshah@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 #pragma once
0007 
0008 #include "kwin_export.h"
0009 
0010 #include <QVariant>
0011 #include <QtGlobal>
0012 #include <qobjectdefs.h>
0013 
0014 #include <inttypes.h>
0015 
0016 namespace KWaylandServer
0017 {
0018 Q_NAMESPACE_EXPORT(KWIN_EXPORT)
0019 /**
0020  * ContentHint allows to modify the behavior of the text input.
0021  */
0022 enum class TextInputContentHint {
0023     /**
0024      * no special behaviour
0025      */
0026     None = 0,
0027     /**
0028      * suggest word completions
0029      */
0030     AutoCompletion = 1 << 0,
0031     /**
0032      * suggest word corrections
0033      */
0034     AutoCorrection = 1 << 1,
0035     /**
0036      * switch to uppercase letters at the start of a sentence
0037      */
0038     AutoCapitalization = 1 << 2,
0039     /**
0040      * prefer lowercase letters
0041      */
0042     LowerCase = 1 << 3,
0043     /**
0044      * prefer uppercase letters
0045      */
0046     UpperCase = 1 << 4,
0047     /**
0048      * prefer casing for titles and headings (can be language dependent)
0049      */
0050     TitleCase = 1 << 5,
0051     /**
0052      * characters should be hidden
0053      */
0054     HiddenText = 1 << 6,
0055     /**
0056      * typed text should not be stored
0057      */
0058     SensitiveData = 1 << 7,
0059     /**
0060      * just latin characters should be entered
0061      */
0062     Latin = 1 << 8,
0063     /**
0064      * the text input is multi line
0065      */
0066     MultiLine = 1 << 9,
0067 };
0068 
0069 Q_DECLARE_FLAGS(TextInputContentHints, TextInputContentHint)
0070 Q_ENUM_NS(TextInputContentHint)
0071 
0072 /**
0073  * The ContentPurpose allows to specify the primary purpose of a text input.
0074  *
0075  * This allows an input method to show special purpose input panels with
0076  * extra characters or to disallow some characters.
0077  */
0078 enum class TextInputContentPurpose {
0079     /**
0080      * default input, allowing all characters
0081      */
0082     Normal,
0083     /**
0084      * allow only alphabetic characters
0085      */
0086     Alpha,
0087     /**
0088      * allow only digits
0089      */
0090     Digits,
0091     /**
0092      * input a number (including decimal separator and sign)
0093      */
0094     Number,
0095     /**
0096      * input a phone number
0097      */
0098     Phone,
0099     /**
0100      * input an URL
0101      */
0102     Url,
0103     /**
0104      * input an email address
0105      */
0106     Email,
0107     /**
0108      * input a name of a person
0109      */
0110     Name,
0111     /**
0112      * input a password
0113      */
0114     Password,
0115     /**
0116      * input a date
0117      */
0118     Date,
0119     /**
0120      * input a time
0121      */
0122     Time,
0123     /**
0124      * input a date and time
0125      */
0126     DateTime,
0127     /**
0128      * input for a terminal
0129      */
0130     Terminal,
0131     /**
0132      * input is numeric password
0133      */
0134     Pin,
0135 };
0136 Q_ENUM_NS(TextInputContentPurpose)
0137 
0138 enum class TextInputChangeCause {
0139     /**
0140      * Change caused by input method
0141      */
0142     InputMethod,
0143 
0144     /**
0145      * Something else other than input method caused change
0146      */
0147     Other,
0148 };
0149 Q_ENUM_NS(TextInputChangeCause)
0150 
0151 }
0152 
0153 Q_DECLARE_METATYPE(KWaylandServer::TextInputContentHint)
0154 Q_DECLARE_METATYPE(KWaylandServer::TextInputContentHints)
0155 Q_DECLARE_OPERATORS_FOR_FLAGS(KWaylandServer::TextInputContentHints)
0156 Q_DECLARE_METATYPE(KWaylandServer::TextInputContentPurpose)
0157 Q_DECLARE_METATYPE(KWaylandServer::TextInputChangeCause)