LeechCraft Monocle  0.6.70-6645-gcd10d7e
Modular document viewer for LeechCraft
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <memory>
33 #include <QtPlugin>
34 
35 class QRectF;
36 
37 namespace LeechCraft
38 {
39 namespace Monocle
40 {
45  enum class FormType
46  {
53  Text,
54 
61  Choice,
62 
69  Button
70  };
71 
86  class IFormField
87  {
88  public:
91  virtual ~IFormField () {}
92 
97  virtual FormType GetType () const = 0;
98 
105  virtual int GetID () const = 0;
106 
111  virtual QString GetName () const = 0;
112 
127  virtual QRectF GetRect () const = 0;
128 
136  virtual Qt::Alignment GetAlignment () const = 0;
137  };
138 
141  typedef std::shared_ptr<IFormField> IFormField_ptr;
142 
151  {
152  public:
157  enum class Type
158  {
161  SingleLine,
162 
165  Multiline,
166 
169  File
170  };
171 
174  virtual ~IFormFieldText () {}
175 
182  virtual QString GetText () const = 0;
183 
190  virtual void SetText (const QString& text) = 0;
191 
196  virtual Type GetTextType () const = 0;
197 
206  virtual int GetMaximumLength () const = 0;
207 
215  virtual bool IsPassword () const = 0;
216 
223  virtual bool IsRichText () const = 0;
224  };
225 
234  {
235  public:
240  enum class Type
241  {
248  Combobox,
249 
256  ListBox
257  };
258 
261  virtual ~IFormFieldChoice () {}
262 
267  virtual Type GetChoiceType () const = 0;
268 
281  virtual QStringList GetAllChoices () const = 0;
282 
296  virtual QList<int> GetCurrentChoices () const = 0;
297 
309  virtual void SetCurrentChoices (const QList<int>& choices) = 0;
310 
326  virtual QString GetEditChoice () const = 0;
327 
343  virtual void SetEditChoice (const QString& choice) = 0;
344 
356  virtual bool IsEditable () const = 0;
357  };
358 
367  {
368  public:
371  virtual ~IFormFieldButton () {}
372 
377  enum class Type
378  {
383  Pushbutton,
384 
390  Checkbox,
391 
397  Radiobutton
398  };
399 
404  virtual Type GetButtonType () const = 0;
405 
413  virtual QString GetCaption () const = 0;
414 
423  virtual bool IsChecked () const = 0;
424 
441  virtual void SetChecked (bool state) = 0;
442 
460  virtual QList<int> GetButtonGroup () const = 0;
461 
469  virtual void HandleActivated () = 0;
470  };
471 }
472 }
473 
475  "org.LeechCraft.Monocle.IFormField/1.0");
477  "org.LeechCraft.Monocle.IFormFieldText/1.0");
479  "org.LeechCraft.Monocle.IFormFieldChoice/1.0");
481  "org.LeechCraft.Monocle.IFormFieldButton/1.0");
Type
Describes various types of choice fields.
Definition: iformfield.h:240
Type
Describes various types of button fields.
Definition: iformfield.h:377
Q_DECLARE_INTERFACE(LeechCraft::Monocle::IFormField,"org.LeechCraft.Monocle.IFormField/1.0")
A single- and multiple choice field.
virtual ~IFormFieldChoice()
Virtual destructor.
Definition: iformfield.h:261
Interface to be implemented by button fields.
Definition: iformfield.h:366
Type
Describes various types of text entry fields.
Definition: iformfield.h:157
Base interface to be implemented by form fields.
Definition: iformfield.h:86
A push button, radio button or check box.
Interface to be implemented by choice fields.
Definition: iformfield.h:233
std::shared_ptr< IFormField > IFormField_ptr
A shared pointer to a IFormField.
Definition: iformfield.h:141
virtual ~IFormFieldText()
Virtual destructor.
Definition: iformfield.h:174
FormType
Describes the possible types of a form field.
Definition: iformfield.h:45
Interface to be implemented by text fields.
Definition: iformfield.h:150
virtual ~IFormFieldButton()
Virtual destructor.
Definition: iformfield.h:371
virtual ~IFormField()
Virtual destructor.
Definition: iformfield.h:91