LeechCraft Monocle  0.6.70-6645-gcd10d7e
Modular document viewer for LeechCraft
LeechCraft::Monocle::IFormFieldChoice Class Referenceabstract

Interface to be implemented by choice fields. More...

#include "iformfield.h"

Public Types

enum  Type { Type::Combobox, Type::ListBox }
 Describes various types of choice fields. More...
 

Public Member Functions

virtual ~IFormFieldChoice ()
 Virtual destructor. More...
 
virtual Type GetChoiceType () const =0
 Returns the exact type of this choice field. More...
 
virtual QStringList GetAllChoices () const =0
 Returns all available choices. More...
 
virtual QList< int > GetCurrentChoices () const =0
 Returns the list of current choices for a listbox. More...
 
virtual void SetCurrentChoices (const QList< int > &choices)=0
 Sets the currently selected choices for a listbox. More...
 
virtual QString GetEditChoice () const =0
 Returns the current choice for a combobox. More...
 
virtual void SetEditChoice (const QString &choice)=0
 Sets the current choice for a combobox. More...
 
virtual bool IsEditable () const =0
 Returns whether this combobox is editable. More...
 

Detailed Description

Interface to be implemented by choice fields.

If a field is of type FormType::Choice, it should also implement this interface.

See also
IFormField

Definition at line 233 of file iformfield.h.

Member Enumeration Documentation

Describes various types of choice fields.

See also
GetChoiceType()
Enumerator
Combobox 

Combobox with choices.

Only single choice is allowed.

See also
GetEditChoice(), SetEditChoice(), IsEditable()
ListBox 

List widget with choices.

Multiple choices are possibly allowed.

See also
GetCurrentChoices(), SetCurrentChoices()

Definition at line 240 of file iformfield.h.

Constructor & Destructor Documentation

virtual LeechCraft::Monocle::IFormFieldChoice::~IFormFieldChoice ( )
inlinevirtual

Virtual destructor.

Definition at line 261 of file iformfield.h.

Member Function Documentation

virtual QStringList LeechCraft::Monocle::IFormFieldChoice::GetAllChoices ( ) const
pure virtual

Returns all available choices.

This method returns the list of all available choices for both Type::Combobox and Type::ListBox choice fields.

Please note that user can enter his own choice variant for Type::Combobox fields that are editable.

Returns
All available choices.
See also
GetCurrentChoices(), GetEditChoice()
virtual Type LeechCraft::Monocle::IFormFieldChoice::GetChoiceType ( ) const
pure virtual

Returns the exact type of this choice field.

Returns
The exact type of this choice field.
virtual QList<int> LeechCraft::Monocle::IFormFieldChoice::GetCurrentChoices ( ) const
pure virtual

Returns the list of current choices for a listbox.

This method returns the currently selected variants in a Type::ListBox choice field. It does nothing for other types of fields.

The numbers in the returned list are the indexes of the choices in the array returned by GetAllChoices().

Returns
The indexes of the currently selected variants.
See also
SetCurrentChoices(), GetAllChoices()
virtual QString LeechCraft::Monocle::IFormFieldChoice::GetEditChoice ( ) const
pure virtual

Returns the current choice for a combobox.

This method returns the current choice in a Type::Combobox choice field. The returned value can be either one of the variants in the list returned by GetAllChoices() or it can be a custom text if this combobox is editable (that is, IsEditable() returns true).

For other types of choice fields this method does nothing.

Returns
The current choice, either predefined one or a custom one.
See also
SetEditChoice(), IsEditable()
virtual bool LeechCraft::Monocle::IFormFieldChoice::IsEditable ( ) const
pure virtual

Returns whether this combobox is editable.

This method returns whether this Type::Combobox choice field is editable — that is, whether custom user text can be passed to the SetEditChoice() method.

For other types of fields this method doesn't make sense and always returns false.

Returns
Whether this combobox is editable.
virtual void LeechCraft::Monocle::IFormFieldChoice::SetCurrentChoices ( const QList< int > &  choices)
pure virtual

Sets the currently selected choices for a listbox.

This method sets the currently selected variants in a Type::ListBox choice field. It does nothing for other types of fields.

The numbers in the choices list are the indexes of the choices in the array returned by GetAllChoices().

See also
GetCurrentChoices(), GetAllChoices()
virtual void LeechCraft::Monocle::IFormFieldChoice::SetEditChoice ( const QString &  choice)
pure virtual

Sets the current choice for a combobox.

This method updates the current choice in a Type::Combobox choice field. The choice can be either one of the variants in the list returned by GetAllChoices() or it can be a custom text if this combobox is editable (that is, IsEditable() returns true).

For other types of choice fields this method does nothing.

Parameters
[in]choiceThe new choice, either predefined one or a custom one for an editable combobox.
See also
GetEditChoice(), IsEditable()

The documentation for this class was generated from the following file: