Class FSwitch: disable cursor on focus
This commit is contained in:
parent
91497fbb4c
commit
cef8ec0916
|
@ -34,11 +34,13 @@ FSwitch::~FSwitch() // destructor
|
||||||
void FSwitch::draw()
|
void FSwitch::draw()
|
||||||
{
|
{
|
||||||
setUpdateVTerm(false);
|
setUpdateVTerm(false);
|
||||||
drawCheckButton();
|
|
||||||
drawLabel();
|
drawLabel();
|
||||||
|
drawCheckButton();
|
||||||
setUpdateVTerm(true);
|
setUpdateVTerm(true);
|
||||||
|
|
||||||
FToggleButton::draw();
|
FToggleButton::draw();
|
||||||
|
updateTerminal();
|
||||||
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -58,6 +60,7 @@ void FSwitch::drawCheckButton()
|
||||||
print (" On ");
|
print (" On ");
|
||||||
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
||||||
print (" Off ");
|
print (" Off ");
|
||||||
|
gotoxy (xpos+xmin+2+switch_offset_pos, ypos+ymin-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -68,6 +71,7 @@ void FSwitch::drawCheckButton()
|
||||||
else
|
else
|
||||||
setColor (wc.button_hotkey_fg, wc.button_active_bg);
|
setColor (wc.button_hotkey_fg, wc.button_active_bg);
|
||||||
print (" Off ");
|
print (" Off ");
|
||||||
|
gotoxy (xpos+xmin+6+switch_offset_pos, ypos+ymin-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,10 +102,7 @@ void FSwitch::onKeyPress (FKeyEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event->isAccepted() )
|
if ( event->isAccepted() )
|
||||||
{
|
|
||||||
draw();
|
draw();
|
||||||
updateTerminal();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
FToggleButton::onKeyPress(event);
|
FToggleButton::onKeyPress(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,8 @@ void FToggleButton::draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isRadioButton() || isCheckboxButton() )
|
||||||
|
{
|
||||||
// set the cursor to the button
|
// set the cursor to the button
|
||||||
setCursorPos (xpos+xmin, ypos+ymin-1);
|
setCursorPos (xpos+xmin, ypos+ymin-1);
|
||||||
|
|
||||||
|
@ -161,6 +163,7 @@ void FToggleButton::draw()
|
||||||
}
|
}
|
||||||
else if ( ! isHiddenCursor() )
|
else if ( ! isHiddenCursor() )
|
||||||
hideCursor();
|
hideCursor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -254,6 +257,13 @@ bool FToggleButton::isRadioButton() const
|
||||||
const_cast<char*>("FRadioButton") ) == 0 );
|
const_cast<char*>("FRadioButton") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FToggleButton::isCheckboxButton() const
|
||||||
|
{
|
||||||
|
return ( strcmp (getClassName(),
|
||||||
|
const_cast<char*>("FCheckBox") ) == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onKeyPress (FKeyEvent* event)
|
void FToggleButton::onKeyPress (FKeyEvent* event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,7 @@ class FToggleButton : public FWidget
|
||||||
void processToggle();
|
void processToggle();
|
||||||
FButtonGroup* group() const;
|
FButtonGroup* group() const;
|
||||||
bool isRadioButton() const;
|
bool isRadioButton() const;
|
||||||
|
bool isCheckboxButton() const;
|
||||||
virtual void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -286,7 +286,7 @@ MyDialog::MyDialog (FWidget* parent) : FDialog(parent)
|
||||||
tagged_count->setGeometry(28, 4, 5, 1);
|
tagged_count->setGeometry(28, 4, 5, 1);
|
||||||
tagged_count->setNumber(0);
|
tagged_count->setNumber(0);
|
||||||
|
|
||||||
FLabel* sum = new FLabel(L"Sum:", this);
|
FLabel* sum = new FLabel(L"Sum:\n123\n456", this);
|
||||||
sum->setGeometry(20, 5, 7, 1);
|
sum->setGeometry(20, 5, 7, 1);
|
||||||
sum->setAlignment(fc::alignRight);
|
sum->setAlignment(fc::alignRight);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ watch::watch (FWidget* parent) : FDialog(parent)
|
||||||
setText ("Watch");
|
setText ("Watch");
|
||||||
setShadow();
|
setShadow();
|
||||||
int pw = parentWidget()->getWidth();
|
int pw = parentWidget()->getWidth();
|
||||||
setGeometry (1+(pw-22)/2, 3, 22, 12);
|
setGeometry (1+(pw-22)/2, 3, 22, 13);
|
||||||
|
|
||||||
// Create labels
|
// Create labels
|
||||||
time_label = new FLabel(L"Time", this);
|
time_label = new FLabel(L"Time", this);
|
||||||
|
@ -67,7 +67,7 @@ watch::watch (FWidget* parent) : FDialog(parent)
|
||||||
|
|
||||||
// Create button
|
// Create button
|
||||||
FButton* quit = new FButton(L"&Quit", this);
|
FButton* quit = new FButton(L"&Quit", this);
|
||||||
quit->setGeometry(6, 8, 9, 1);
|
quit->setGeometry(6, 9, 9, 1);
|
||||||
quit->setShadow();
|
quit->setShadow();
|
||||||
quit->setFocus();
|
quit->setFocus();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue