2015-09-25 21:37:19 +02:00
|
|
|
// File: fradiobutton.cpp
|
|
|
|
// Provides: class FRadioButton
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#include "fapp.h"
|
|
|
|
#include "fradiobutton.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FRadioButton
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// constructor and destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FRadioButton::FRadioButton(FWidget* parent) : FToggleButton(parent)
|
|
|
|
{
|
2015-07-04 22:51:47 +02:00
|
|
|
init();
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
FRadioButton::FRadioButton ( 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
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FRadioButton::~FRadioButton() // destructor
|
2015-09-22 04:18:20 +02:00
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
// private methods of FRadioButton
|
2015-07-04 22:51:47 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FRadioButton::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 FRadioButton::draw()
|
|
|
|
{
|
|
|
|
setUpdateVTerm(false);
|
|
|
|
drawRadioButton();
|
|
|
|
drawLabel();
|
|
|
|
setUpdateVTerm(true);
|
|
|
|
|
|
|
|
FToggleButton::draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FRadioButton::drawRadioButton()
|
|
|
|
{
|
|
|
|
if ( ! isVisible() )
|
|
|
|
return;
|
|
|
|
gotoxy (xpos+xmin-1, ypos+ymin-1);
|
|
|
|
setColor (foregroundColor, backgroundColor);
|
|
|
|
if ( checked )
|
|
|
|
{
|
|
|
|
if ( isNewFont() )
|
|
|
|
print (CHECKED_RADIO_BUTTON);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print ('(');
|
|
|
|
print (fc::Bullet); // Bullet •
|
|
|
|
print (')');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( isNewFont() )
|
|
|
|
print (RADIO_BUTTON);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print ('(');
|
|
|
|
print (' ');
|
|
|
|
print (')');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|