2015-09-25 21:37:19 +02:00
|
|
|
|
// File: fcheckbox.cpp
|
|
|
|
|
// Provides: class FCheckBox
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
#include "fcheckbox.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// class FCheckBox
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// constructor and destructor
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-10-10 04:01:22 +02:00
|
|
|
|
FCheckBox::FCheckBox(FWidget* parent)
|
|
|
|
|
: FToggleButton(parent)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-07-04 22:51:47 +02:00
|
|
|
|
init();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-10-10 04:01:22 +02:00
|
|
|
|
FCheckBox::FCheckBox (const FString& txt, FWidget* parent)
|
|
|
|
|
: FToggleButton(txt, parent)
|
2015-05-23 13:35:12 +02:00
|
|
|
|
{
|
2015-07-04 22:51:47 +02:00
|
|
|
|
init();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
FCheckBox::~FCheckBox() // destructor
|
2015-09-22 04:18:20 +02:00
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private methods of FCheckBox
|
2015-07-04 22:51:47 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void FCheckBox::init()
|
|
|
|
|
{
|
|
|
|
|
label_offset_pos = 4;
|
|
|
|
|
button_width = 4;
|
2015-08-11 00:11:07 +02:00
|
|
|
|
setVisibleCursor();
|
2015-07-04 22:51:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void FCheckBox::draw()
|
|
|
|
|
{
|
2016-08-06 21:43:39 +02:00
|
|
|
|
updateVTerm(false);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
drawCheckButton();
|
|
|
|
|
drawLabel();
|
2016-08-06 21:43:39 +02:00
|
|
|
|
updateVTerm(true);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
FToggleButton::draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
void FCheckBox::drawCheckButton()
|
|
|
|
|
{
|
|
|
|
|
if ( ! isVisible() )
|
|
|
|
|
return;
|
2016-01-08 01:00:05 +01:00
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
|
printPos (1,1);
|
|
|
|
|
setColor();
|
2016-01-08 01:00:05 +01:00
|
|
|
|
|
2015-10-11 21:56:16 +02:00
|
|
|
|
if ( isMonochron() )
|
|
|
|
|
{
|
|
|
|
|
if ( hasFocus() )
|
|
|
|
|
setReverse(false);
|
|
|
|
|
else
|
|
|
|
|
setReverse(true);
|
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
if ( checked )
|
|
|
|
|
{
|
|
|
|
|
if ( isNewFont() )
|
|
|
|
|
print (CHECKBOX_ON);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print ('[');
|
2016-01-08 01:00:05 +01:00
|
|
|
|
print (fc::Times); // Times ×
|
2015-05-23 13:35:12 +02:00
|
|
|
|
print (']');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ( isNewFont() )
|
|
|
|
|
print (CHECKBOX);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print ('[');
|
|
|
|
|
print (' ');
|
|
|
|
|
print (']');
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-07-09 00:01:59 +02:00
|
|
|
|
|
2015-10-11 21:56:16 +02:00
|
|
|
|
if ( isMonochron() )
|
|
|
|
|
setReverse(false);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
}
|