LeechCraft Monocle 0.6.70-17335-ge406ffdcaf
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 <QtPlugin>
13#include "ilink.h"
14
15namespace LC::Monocle
16{
21 enum class FormType
22 {
30
38
46 };
47
63 {
64 public:
67 virtual ~IFormField () = default;
68
73 virtual FormType GetType () const = 0;
74
81 virtual int GetID () const = 0;
82
87 virtual QString GetName () const = 0;
88
98 virtual PageRelativeRectBase GetRect () const = 0;
99
107 virtual Qt::Alignment GetAlignment () const = 0;
108 };
109
112 typedef std::shared_ptr<IFormField> IFormField_ptr;
113
122 {
123 public:
128 enum class Type
129 {
133
137
141 };
142
145 virtual ~IFormFieldText () = default;
146
153 virtual QString GetText () const = 0;
154
161 virtual void SetText (const QString& text) = 0;
162
167 virtual Type GetTextType () const = 0;
168
177 virtual int GetMaximumLength () const = 0;
178
186 virtual bool IsPassword () const = 0;
187
194 virtual bool IsRichText () const = 0;
195 };
196
205 {
206 public:
211 enum class Type
212 {
220
228 };
229
232 virtual ~IFormFieldChoice () = default;
233
238 virtual Type GetChoiceType () const = 0;
239
252 virtual QStringList GetAllChoices () const = 0;
253
267 virtual QList<int> GetCurrentChoices () const = 0;
268
280 virtual void SetCurrentChoices (const QList<int>& choices) = 0;
281
297 virtual QString GetEditChoice () const = 0;
298
314 virtual void SetEditChoice (const QString& choice) = 0;
315
327 virtual bool IsEditable () const = 0;
328 };
329
338 {
339 public:
342 virtual ~IFormFieldButton () = default;
343
348 enum class Type
349 {
355
362
369 };
370
375 virtual Type GetButtonType () const = 0;
376
384 virtual QString GetCaption () const = 0;
385
394 virtual bool IsChecked () const = 0;
395
412 virtual void SetChecked (bool state) = 0;
413
431 virtual QList<int> GetButtonGroup () const = 0;
432
440 virtual LinkAction GetActivationAction () const = 0;
441 };
442}
Interface to be implemented by button fields.
Definition iformfield.h:338
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:349
@ Checkbox
A field that can be checked independently of others.
Definition iformfield.h:361
@ Pushbutton
A button that can be pushed.
Definition iformfield.h:354
@ Radiobutton
A field that can be checked with respect to the check state of others.
Definition iformfield.h:368
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:205
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:212
@ Combobox
Combobox with choices.
Definition iformfield.h:219
@ ListBox
List widget with choices.
Definition iformfield.h:227
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:63
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:122
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:129
@ SingleLine
Single line text edit.
Definition iformfield.h:132
@ Multiline
Multiline text edit.
Definition iformfield.h:136
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:112
FormType
Describes the possible types of a form field.
Definition iformfield.h:22
@ Choice
A single- and multiple choice field.
Definition iformfield.h:37
@ Button
A push button, radio button or check box.
Definition iformfield.h:45
@ Text
A simple text annotation.
Definition iannotation.h:31