File indexing completed on 2024-05-12 05:32:30

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