finalcut/src/fradiomenuitem.cpp

73 lines
1.6 KiB
C++
Raw Normal View History

// File: fradiomenuitem.cpp
// Provides: class FRadioMenuItem
#include "fradiomenuitem.h"
#include "fmenu.h"
//----------------------------------------------------------------------
// class FRadioMenuItem
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (FWidget* parent)
: FMenuItem(parent)
{
init (parent);
}
//----------------------------------------------------------------------
2017-03-17 22:59:06 +01:00
FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);
}
//----------------------------------------------------------------------
FRadioMenuItem::~FRadioMenuItem() // destructor
{ }
// private methods of FRadioMenuItem
//----------------------------------------------------------------------
void FRadioMenuItem::init (FWidget* parent)
{
checkable = true;
radio_button = true;
if ( ! parent )
return;
if ( isMenu(parent) ) // Parent is menu
{
FMenu* menu_ptr = dynamic_cast<FMenu*>(parent);
if ( menu_ptr )
menu_ptr->has_checkable_items = true;
this->addCallback
(
"toggled",
_METHOD_CALLBACK (parent, &FMenu::cb_menuitem_toggled)
);
}
}
//----------------------------------------------------------------------
void FRadioMenuItem::processToggle()
{
emitCallback("toggled");
}
//----------------------------------------------------------------------
void FRadioMenuItem::processClicked()
{
if ( ! checked )
{
checked = true;
processToggle();
}
emitCallback("clicked");
}