LeechCraft Monocle 0.6.70-14794-g33744ae6ce
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
14class QRectF;
15
16namespace LC
17{
18namespace Monocle
19{
24 enum class FormType
25 {
32 Text,
33
40 Choice,
41
48 Button
49 };
50
66 {
67 public:
70 virtual ~IFormField () {}
71
76 virtual FormType GetType () const = 0;
77
84 virtual int GetID () const = 0;
85
90 virtual QString GetName () const = 0;
91
106 virtual QRectF GetRect () const = 0;
107
115 virtual Qt::Alignment GetAlignment () const = 0;
116 };
117
120 typedef std::shared_ptr<IFormField> IFormField_ptr;
121
130 {
131 public:
136 enum class Type
137 {
141
144 Multiline,
145
148 File
149 };
150
153 virtual ~IFormFieldText () {}
154
161 virtual QString GetText () const = 0;
162
169 virtual void SetText (const QString& text) = 0;
170
175 virtual Type GetTextType () const = 0;
176
185 virtual int GetMaximumLength () const = 0;
186
194 virtual bool IsPassword () const = 0;
195
202 virtual bool IsRichText () const = 0;
203 };
204
213 {
214 public:
219 enum class Type
220 {
227 Combobox,
228
235 ListBox
236 };
237
240 virtual ~IFormFieldChoice () {}
241
246 virtual Type GetChoiceType () const = 0;
247
260 virtual QStringList GetAllChoices () const = 0;
261
275 virtual QList<int> GetCurrentChoices () const = 0;
276
288 virtual void SetCurrentChoices (const QList<int>& choices) = 0;
289
305 virtual QString GetEditChoice () const = 0;
306
322 virtual void SetEditChoice (const QString& choice) = 0;
323
335 virtual bool IsEditable () const = 0;
336 };
337
346 {
347 public:
350 virtual ~IFormFieldButton () {}
351
356 enum class Type
357 {
363
369 Checkbox,
370
377 };
378
383 virtual Type GetButtonType () const = 0;
384
392 virtual QString GetCaption () const = 0;
393
402 virtual bool IsChecked () const = 0;
403
420 virtual void SetChecked (bool state) = 0;
421
439 virtual QList<int> GetButtonGroup () const = 0;
440
448 virtual void HandleActivated () = 0;
449 };
450}
451}
452
453Q_DECLARE_INTERFACE (LC::Monocle::IFormField,
454 "org.LeechCraft.Monocle.IFormField/1.0")
455Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldText,
456 "org.LeechCraft.Monocle.IFormFieldText/1.0")
457Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldChoice,
458 "org.LeechCraft.Monocle.IFormFieldChoice/1.0")
459Q_DECLARE_INTERFACE (LC::Monocle::IFormFieldButton,
460 "org.LeechCraft.Monocle.IFormFieldButton/1.0")
Interface to be implemented by button fields.
Definition: iformfield.h:346
virtual ~IFormFieldButton()
Virtual destructor.
Definition: iformfield.h:350
virtual void HandleActivated()=0
Notifies the field that it has been triggered.
virtual QString GetCaption() const =0
Returns the caption of this button.
Type
Describes various types of button fields.
Definition: iformfield.h:357
@ Checkbox
A field that can be checked independently of others.
@ Pushbutton
A button that can be pushed.
@ Radiobutton
A field that can be checked with respect to the check state of others.
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:213
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:240
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:220
@ Combobox
Combobox with choices.
@ ListBox
List widget with choices.
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:66
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:70
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:130
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:153
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:137
@ SingleLine
Single line text edit.
@ Multiline
Multiline text edit.
std::shared_ptr< IFormField > IFormField_ptr
A shared pointer to a IFormField.
Definition: iformfield.h:120
FormType
Describes the possible types of a form field.
Definition: iformfield.h:25
@ Choice
A single- and multiple choice field.
@ Button
A push button, radio button or check box.
@ Text
A simple text annotation.
Definition: iannotation.h:21