2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fradiobutton.cpp - Widget FRadioButton *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
|
|
|
* Copyright 2014-2017 Markus Gans *
|
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fapplication.h"
|
|
|
|
#include "final/fradiobutton.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FRadioButton
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// constructor and destructor
|
|
|
|
//----------------------------------------------------------------------
|
2015-10-10 04:01:22 +02:00
|
|
|
FRadioButton::FRadioButton(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
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2017-03-17 22:59:06 +01:00
|
|
|
FRadioButton::FRadioButton (const FString& txt, FWidget* parent)
|
2015-09-22 04:18:20 +02:00
|
|
|
: 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()
|
|
|
|
{
|
|
|
|
drawRadioButton();
|
|
|
|
drawLabel();
|
|
|
|
FToggleButton::draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FRadioButton::drawRadioButton()
|
|
|
|
{
|
|
|
|
if ( ! isVisible() )
|
|
|
|
return;
|
2016-01-08 01:00:05 +01:00
|
|
|
|
2016-10-11 04:57:36 +02:00
|
|
|
setPrintPos (1,1);
|
2016-09-25 23:53:48 +02:00
|
|
|
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 (CHECKED_RADIO_BUTTON);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print ('(');
|
2017-04-05 00:30:52 +02:00
|
|
|
print (fc::Bullet); // Bullet ●
|
2015-05-23 13:35:12 +02:00
|
|
|
print (')');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( isNewFont() )
|
|
|
|
print (RADIO_BUTTON);
|
|
|
|
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
|
|
|
}
|