LeechCraft Monocle 0.6.70-16373-g319c272718
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
15class QRectF;
16
17namespace LC::Monocle
18{
23 enum class FormType
24 {
32
40
48 };
49
65 {
66 public:
69 virtual ~IFormField () {}
70
75 virtual FormType GetType () const = 0;
76
83 virtual int GetID () const = 0;
84
89 virtual QString GetName () const = 0;
90
105 virtual QRectF GetRect () const = 0;
106
114 virtual Qt::Alignment GetAlignment () const = 0;
115 };
116
119 typedef std::shared_ptr<IFormField> IFormField_ptr;
120
129 {
130 public:
135 enum class Type
136 {
140
144
148 };
149
152 virtual ~IFormFieldText () {}
153
160 virtual QString GetText () const = 0;
161
168 virtual void SetText (const QString& text) = 0;
169
174 virtual Type GetTextType () const = 0;
175
184 virtual int GetMaximumLength () const = 0;
185
193 virtual bool IsPassword () const = 0;
194
201 virtual bool IsRichText () const = 0;
202 };
203
212 {
213 public:
218 enum class Type
219 {
227
235 };
236
239 virtual ~IFormFieldChoice () {}
240
245 virtual Type GetChoiceType () const = 0;
246
259 virtual QStringList GetAllChoices () const = 0;
260
274 virtual QList<int> GetCurrentChoices () const = 0;
275
287 virtual void SetCurrentChoices (const QList<int>& choices) = 0;
288
304 virtual QString GetEditChoice () const = 0;
305
321 virtual void SetEditChoice (const QString& choice) = 0;
322
334 virtual bool IsEditable () const = 0;
335 };
336
345 {
346 public:
349 virtual ~IFormFieldButton () {}
350
355 enum class Type
356 {
362
369
376 };
377
382 virtual Type GetButtonType () const = 0;
383
391 virtual QString GetCaption () const = 0;
392
401 virtual bool IsChecked () const = 0;
402
419 virtual void SetChecked (bool state) = 0;
420
438 virtual QList<int> GetButtonGroup () const = 0;
439
447 virtual LinkAction GetActivationAction () const = 0;
448 };
449}
450
451Q_DECLARE_INTERFACE (LC::Monocle::IFormField,
452 "org.LeechCraft.Monocle.IFormField/1.0")
453Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldText,
454 "org.LeechCraft.Monocle.IFormFieldText/1.0")
455Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldChoice,
456 "org.LeechCraft.Monocle.IFormFieldChoice/1.0")
457Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldButton,
458 "org.LeechCraft.Monocle.IFormFieldButton/1.0")
Interface to be implemented by button fields.
Definition iformfield.h:345
virtual LinkAction GetActivationAction() const =0
Returns the action associated with this button.
virtual ~IFormFieldButton()
Virtual destructor.
Definition iformfield.h:349
virtual QString GetCaption() const =0
Returns the caption of this button.
Type
Describes various types of button fields.
Definition iformfield.h:356
@ Checkbox
A field that can be checked independently of others.
Definition iformfield.h:368
@ Pushbutton
A button that can be pushed.
Definition iformfield.h:361
@ Radiobutton
A field that can be checked with respect to the check state of others.
Definition iformfield.h:375
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:212
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 void SetEditChoice(const QString &choice)=0
Sets the current choice for a combobox.
virtual ~IFormFieldChoice()
Virtual destructor.
Definition iformfield.h:239
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:219
@ Combobox
Combobox with choices.
Definition iformfield.h:226
@ ListBox
List widget with choices.
Definition iformfield.h:234
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:65
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 ~IFormField()
Virtual destructor.
Definition iformfield.h:69
virtual FormType GetType() const =0
Returns the type of this field.
virtual QRectF GetRect() const =0
Returns the rectangle this field occupies.
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:129
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 ~IFormFieldText()
Virtual destructor.
Definition iformfield.h:152
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:136
@ SingleLine
Single line text edit.
Definition iformfield.h:139
@ Multiline
Multiline text edit.
Definition iformfield.h:143
std::variant< NoAction, NavigationAction, ExternalNavigationAction, UrlAction, CustomAction > LinkAction
Definition ilink.h:110
std::shared_ptr< IFormField > IFormField_ptr
A shared pointer to a IFormField.
Definition iformfield.h:119
FormType
Describes the possible types of a form field.
Definition iformfield.h:24
@ Choice
A single- and multiple choice field.
Definition iformfield.h:39
@ Button
A push button, radio button or check box.
Definition iformfield.h:47
@ Text
A simple text annotation.
Definition iannotation.h:32