LeechCraft Monocle 0.6.70-19424-g027e980fd1
Modular document viewer for LeechCraft
Loading...
Searching...
No Matches
iformfield.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <memory>
12#include "ilink.h"
13
14namespace LC::Monocle
15{
20 enum class FormType
21 {
29
37
45 };
46
62 {
63 public:
66 virtual ~IFormField () = default;
67
72 virtual FormType GetType () const = 0;
73
80 virtual int GetID () const = 0;
81
86 virtual QString GetName () const = 0;
87
97 virtual PageRelativeRectBase GetRect () const = 0;
98
106 virtual Qt::Alignment GetAlignment () const = 0;
107 };
108
111 typedef std::shared_ptr<IFormField> IFormField_ptr;
112
121 {
122 public:
127 enum class Type
128 {
131 SingleLine,
132
135 Multiline,
136
139 File
140 };
141
144 virtual ~IFormFieldText () = default;
145
152 virtual QString GetText () const = 0;
153
160 virtual void SetText (const QString& text) = 0;
161
166 virtual Type GetTextType () const = 0;
167
176 virtual int GetMaximumLength () const = 0;
177
185 virtual bool IsPassword () const = 0;
186
193 virtual bool IsRichText () const = 0;
194 };
195
204 {
205 public:
210 enum class Type
211 {
218 Combobox,
219
226 ListBox
227 };
228
231 virtual ~IFormFieldChoice () = default;
232
237 virtual Type GetChoiceType () const = 0;
238
251 virtual QStringList GetAllChoices () const = 0;
252
266 virtual QList<int> GetCurrentChoices () const = 0;
267
279 virtual void SetCurrentChoices (const QList<int>& choices) = 0;
280
296 virtual QString GetEditChoice () const = 0;
297
313 virtual void SetEditChoice (const QString& choice) = 0;
314
326 virtual bool IsEditable () const = 0;
327 };
328
337 {
338 public:
341 virtual ~IFormFieldButton () = default;
342
347 enum class Type
348 {
353 Pushbutton,
354
360 Checkbox,
361
367 Radiobutton
368 };
369
374 virtual Type GetButtonType () const = 0;
375
383 virtual QString GetCaption () const = 0;
384
393 virtual bool IsChecked () const = 0;
394
411 virtual void SetChecked (bool state) = 0;
412
430 virtual QList<int> GetButtonGroup () const = 0;
431
439 virtual LinkAction GetActivationAction () const = 0;
440 };
441}
Interface to be implemented by button fields.
Definition iformfield.h:337
virtual LinkAction GetActivationAction() const =0
Returns the action associated with this button.
virtual ~IFormFieldButton()=default
Virtual destructor.
virtual QString GetCaption() const =0
Returns the caption of this button.
Type
Describes various types of button fields.
Definition iformfield.h:348
virtual QList< int > GetButtonGroup() const =0
Returns the button group this button belongs to.
virtual Type GetButtonType() const =0
Returns the exact type of this button field.
virtual void SetChecked(bool state)=0
Updates the check state of this button.
virtual bool IsChecked() const =0
Returns whether the button is checked.
Interface to be implemented by choice fields.
Definition iformfield.h:204
virtual bool IsEditable() const =0
Returns whether this combobox is editable.
virtual void SetCurrentChoices(const QList< int > &choices)=0
Sets the currently selected choices for a listbox.
virtual Type GetChoiceType() const =0
Returns the exact type of this choice field.
virtual ~IFormFieldChoice()=default
Virtual destructor.
virtual void SetEditChoice(const QString &choice)=0
Sets the current choice for a combobox.
virtual QStringList GetAllChoices() const =0
Returns all available choices.
virtual QString GetEditChoice() const =0
Returns the current choice for a combobox.
Type
Describes various types of choice fields.
Definition iformfield.h:211
virtual QList< int > GetCurrentChoices() const =0
Returns the list of current choices for a listbox.
Base interface to be implemented by form fields.
Definition iformfield.h:62
virtual PageRelativeRectBase GetRect() const =0
Returns the rectangle this field occupies.
virtual ~IFormField()=default
Virtual destructor.
virtual int GetID() const =0
Returns the unique ID of this field.
virtual QString GetName() const =0
Returns the user-visible name of this field.
virtual FormType GetType() const =0
Returns the type of this field.
virtual Qt::Alignment GetAlignment() const =0
Returns the alignment of the contents of this field.
Interface to be implemented by text fields.
Definition iformfield.h:121
virtual ~IFormFieldText()=default
Virtual destructor.
virtual void SetText(const QString &text)=0
Sets the current text value of this field to text.
virtual bool IsPassword() const =0
Returns whether this is a password entry field.
virtual Type GetTextType() const =0
Returns the exact type of this text entry field.
virtual bool IsRichText() const =0
Returns whether rich text should be accepted.
virtual int GetMaximumLength() const =0
Returns the maximum length of the text.
virtual QString GetText() const =0
Returns the current text value of this field.
Type
Describes various types of text entry fields.
Definition iformfield.h:128
std::variant< NoAction, NavigationAction, ExternalNavigationAction, UrlAction, CustomAction > LinkAction
Definition ilink.h:107
std::shared_ptr< IFormField > IFormField_ptr
A shared pointer to a IFormField.
Definition iformfield.h:111
FormType
Describes the possible types of a form field.
Definition iformfield.h:21
@ Choice
A single- and multiple choice field.
Definition iformfield.h:36
@ Button
A push button, radio button or check box.
Definition iformfield.h:44
@ Text
A simple text annotation.
Definition iannotation.h:30