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

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

#include "iformfield.h"

Public Types

enum  Type { Type::Pushbutton, Type::Checkbox, Type::Radiobutton }
 Describes various types of button fields. More...
 

Public Member Functions

virtual ~IFormFieldButton ()
 Virtual destructor. More...
 
virtual Type GetButtonType () const =0
 Returns the exact type of this button field. More...
 
virtual QString GetCaption () const =0
 Returns the caption of this button. More...
 
virtual bool IsChecked () const =0
 Returns whether the button is checked. More...
 
virtual void SetChecked (bool state)=0
 Updates the check state of this button. More...
 
virtual QList< int > GetButtonGroup () const =0
 Returns the button group this button belongs to. More...
 
virtual void HandleActivated ()=0
 Notifies the field that it has been triggered. More...
 

Detailed Description

Interface to be implemented by button fields.

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

See also
IFormField.

Definition at line 366 of file iformfield.h.

Member Enumeration Documentation

Describes various types of button fields.

See also
GetButtonType()
Enumerator
Pushbutton 

A button that can be pushed.

See also
HandleActivated()
Checkbox 

A field that can be checked independently of others.

See also
IsChecked(), SetChecked()
Radiobutton 

A field that can be checked with respect to the check state of others.

See also
IsChecked(), SetChecked(), GetButtonGroup()

Definition at line 377 of file iformfield.h.

Constructor & Destructor Documentation

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

Virtual destructor.

Definition at line 371 of file iformfield.h.

Member Function Documentation

virtual QList<int> LeechCraft::Monocle::IFormFieldButton::GetButtonGroup ( ) const
pure virtual

Returns the button group this button belongs to.

This method returns the list of IDs (returned by the IFormField::GetID() method) that form the same button group, where only one button at a time can be checked.

If an empty list is returned, it is interpreted as if the button doesn't belong to any button groups.

The returned list should be sorted and contain the self ID (the ID of the field that returns the list).

This method only makes sense for buttons of Type::Radiobutton.

Returns
The list of IDs of buttons that form the same group, or an empty list of the button doesn't belong to any groups.
virtual Type LeechCraft::Monocle::IFormFieldButton::GetButtonType ( ) const
pure virtual

Returns the exact type of this button field.

Returns
The exact type of this button field.
virtual QString LeechCraft::Monocle::IFormFieldButton::GetCaption ( ) const
pure virtual

Returns the caption of this button.

This method should return the user-visible text on the button which may be way different form IFormField::GetName().

Returns
The human-readable caption of the button.
virtual void LeechCraft::Monocle::IFormFieldButton::HandleActivated ( )
pure virtual

Notifies the field that it has been triggered.

This method is invoked by Monocle when the corresponding field is triggered. Currently it only means that a field of Type::Pushbutton is activated by the user, and this method is never invoked for other types of fields.

virtual bool LeechCraft::Monocle::IFormFieldButton::IsChecked ( ) const
pure virtual

Returns whether the button is checked.

This method doesn't make sense for Type::Pushbutton buttons.

Returns
Whether this button is checked.
See also
SetChecked()
virtual void LeechCraft::Monocle::IFormFieldButton::SetChecked ( bool  state)
pure virtual

Updates the check state of this button.

If the type of this button is Type::Radiobutton and this radio button belongs to a group (GetButtonGroup() returns a non-empty list), setting the check state to code true leads to setting the check state of the previously checked radio button to false.

This method doesn't make sense for Type::Pushbutton and thus does nothing for push buttons.

Parameters
[in]stateThe new check state of this radio button or check box.
See also
IsChecked()

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