Removing public + protected data members from classes
This commit is contained in:
parent
9a40890026
commit
69db7417ad
|
@ -1,3 +1,6 @@
|
||||||
|
2019-09-01 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Removing public + protected data members from classes
|
||||||
|
|
||||||
2019-08-25 Markus Gans <guru.mail@muenster.de>
|
2019-08-25 Markus Gans <guru.mail@muenster.de>
|
||||||
* More use of direct initializations
|
* More use of direct initializations
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ void Button::setChecked (bool enable)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
setBackgroundColor(wc.button_active_bg);
|
setBackgroundColor(wc.button_active_bg);
|
||||||
setFocusForegroundColor(wc.button_active_focus_fg);
|
setFocusForegroundColor(wc.button_active_focus_fg);
|
||||||
setFocusBackgroundColor(wc.button_active_focus_bg);
|
setFocusBackgroundColor(wc.button_active_focus_bg);
|
||||||
|
@ -335,6 +336,7 @@ void Calc::drawDispay()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
print() << FColorPair(fc::Black, fc::LightGray)
|
print() << FColorPair(fc::Black, fc::LightGray)
|
||||||
<< FPoint(3, 3) << display << ' '
|
<< FPoint(3, 3) << display << ' '
|
||||||
<< FColorPair(wc.dialog_fg, wc.dialog_bg);
|
<< FColorPair(wc.dialog_fg, wc.dialog_bg);
|
||||||
|
@ -837,7 +839,7 @@ void Calc::draw()
|
||||||
{
|
{
|
||||||
setBold();
|
setBold();
|
||||||
setColor (fc::LightBlue, fc::Cyan);
|
setColor (fc::LightBlue, fc::Cyan);
|
||||||
clearArea (vdesktop, fc::MediumShade);
|
clearArea (getVirtualDesktop(), fc::MediumShade);
|
||||||
unsetBold();
|
unsetBold();
|
||||||
finalcut::FDialog::draw();
|
finalcut::FDialog::draw();
|
||||||
drawDispay();
|
drawDispay();
|
||||||
|
|
|
@ -46,8 +46,8 @@ class Keyboard : public finalcut::FWidget
|
||||||
Keyboard::Keyboard (finalcut::FWidget* parent)
|
Keyboard::Keyboard (finalcut::FWidget* parent)
|
||||||
: finalcut::FWidget(parent)
|
: finalcut::FWidget(parent)
|
||||||
{
|
{
|
||||||
wc.term_fg = finalcut::fc::Default;
|
setFWidgetColors().term_fg = finalcut::fc::Default;
|
||||||
wc.term_bg = finalcut::fc::Default;
|
setFWidgetColors().term_bg = finalcut::fc::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -63,10 +63,10 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
<< " (id " << key_id << ")\n";
|
<< " (id " << key_id << ")\n";
|
||||||
|
|
||||||
if ( is_last_line )
|
if ( is_last_line )
|
||||||
scrollAreaForward (vdesktop);
|
scrollAreaForward (getVirtualDesktop());
|
||||||
|
|
||||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
||||||
, true, vdesktop );
|
, true, getVirtualDesktop() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -83,7 +83,7 @@ void Keyboard::draw()
|
||||||
<< "---------------\n"
|
<< "---------------\n"
|
||||||
<< "Press Q to quit\n"
|
<< "Press Q to quit\n"
|
||||||
<< "---------------\n";
|
<< "---------------\n";
|
||||||
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);
|
setAreaCursor (finalcut::FPoint(1, 4), true, getVirtualDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -497,30 +497,31 @@ void MouseDraw::drawCanvas()
|
||||||
if ( ! (hasPrintArea() && canvas) )
|
if ( ! (hasPrintArea() && canvas) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ax = 9 + getTermX() - print_area->offset_left
|
auto printarea = getCurrentPrintArea();
|
||||||
, ay = 1 + getTermY() - print_area->offset_top
|
int ax = 9 + getTermX() - printarea->offset_left
|
||||||
|
, ay = 1 + getTermY() - printarea->offset_top
|
||||||
, y_end = canvas->height
|
, y_end = canvas->height
|
||||||
, x_end = canvas->width
|
, x_end = canvas->width
|
||||||
, w_line_len = print_area->width + print_area->right_shadow;
|
, w_line_len = printarea->width + printarea->right_shadow;
|
||||||
|
|
||||||
for (int y{0}; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
finalcut::charData* canvaschar{}; // canvas character
|
finalcut::charData* canvaschar{}; // canvas character
|
||||||
finalcut::charData* winchar{}; // window character
|
finalcut::charData* winchar{}; // window character
|
||||||
canvaschar = &canvas->text[y * x_end];
|
canvaschar = &canvas->text[y * x_end];
|
||||||
winchar = &print_area->text[(ay + y) * w_line_len + ax];
|
winchar = &printarea->text[(ay + y) * w_line_len + ax];
|
||||||
std::memcpy ( winchar
|
std::memcpy ( winchar
|
||||||
, canvaschar
|
, canvaschar
|
||||||
, sizeof(finalcut::charData) * unsigned(x_end) );
|
, sizeof(finalcut::charData) * unsigned(x_end) );
|
||||||
|
|
||||||
if ( int(print_area->changes[ay + y].xmin) > ax )
|
if ( int(printarea->changes[ay + y].xmin) > ax )
|
||||||
print_area->changes[ay + y].xmin = uInt(ax);
|
printarea->changes[ay + y].xmin = uInt(ax);
|
||||||
|
|
||||||
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
|
if ( int(printarea->changes[ay + y].xmax) < ax + x_end - 1 )
|
||||||
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
|
printarea->changes[ay + y].xmax = uInt(ax + x_end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_area->has_changes = true;
|
printarea->has_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -135,6 +135,7 @@ void Scrollview::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
||||||
clearArea();
|
clearArea();
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class AttribDlg : public finalcut::FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, bgcolor(wc.label_bg)
|
, bgcolor(getFWidgetColors().label_bg)
|
||||||
{
|
{
|
||||||
setText ( "A terminal attributes test ("
|
setText ( "A terminal attributes test ("
|
||||||
+ finalcut::FString(getTermType())
|
+ finalcut::FString(getTermType())
|
||||||
|
@ -270,6 +270,7 @@ void AttribDemo::printColorLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void AttribDemo::printAltCharset()
|
void AttribDemo::printAltCharset()
|
||||||
{
|
{
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
auto parent = static_cast<AttribDlg*>(getParent());
|
auto parent = static_cast<AttribDlg*>(getParent());
|
||||||
|
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
|
@ -420,6 +421,7 @@ void AttribDemo::printProtected()
|
||||||
void AttribDemo::draw()
|
void AttribDemo::draw()
|
||||||
{
|
{
|
||||||
// test alternate character set
|
// test alternate character set
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
printAltCharset();
|
printAltCharset();
|
||||||
|
|
||||||
std::vector<std::function<void()> > effect
|
std::vector<std::function<void()> > effect
|
||||||
|
|
|
@ -54,8 +54,8 @@ Timer::Timer (finalcut::FWidget* parent)
|
||||||
delTimer (id);
|
delTimer (id);
|
||||||
addTimer (250); // 250-millisecond timer
|
addTimer (250); // 250-millisecond timer
|
||||||
|
|
||||||
wc.term_fg = fc::Default;
|
setFWidgetColors().term_fg = fc::Default;
|
||||||
wc.term_bg = fc::Default;
|
setFWidgetColors().term_bg = fc::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -65,7 +65,7 @@ void Timer::draw()
|
||||||
<< "---------------\n"
|
<< "---------------\n"
|
||||||
<< "Press Q to quit\n"
|
<< "Press Q to quit\n"
|
||||||
<< "---------------\n";
|
<< "---------------\n";
|
||||||
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);
|
setAreaCursor (finalcut::FPoint(1, 4), true, getVirtualDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -81,10 +81,10 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||||
<< "Timer event, id " << timer_id << '\n';
|
<< "Timer event, id " << timer_id << '\n';
|
||||||
|
|
||||||
if ( is_last_line )
|
if ( is_last_line )
|
||||||
scrollAreaForward (vdesktop);
|
scrollAreaForward (getVirtualDesktop());
|
||||||
|
|
||||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
||||||
, true, vdesktop );
|
, true, getVirtualDesktop() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -93,6 +93,7 @@ void Transparent::draw()
|
||||||
|
|
||||||
if ( type == shadow )
|
if ( type == shadow )
|
||||||
{
|
{
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor(wc.shadow_bg, wc.shadow_fg);
|
setColor(wc.shadow_bg, wc.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ class SmallWindow : public finalcut::FDialog
|
||||||
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
|
const finalcut::FWidgetColors& wc = getFWidgetColors();
|
||||||
wchar_t arrow_up, arrow_down;
|
wchar_t arrow_up, arrow_down;
|
||||||
arrow_up = fc::BlackUpPointingTriangle;
|
arrow_up = fc::BlackUpPointingTriangle;
|
||||||
arrow_down = fc::BlackDownPointingTriangle;
|
arrow_down = fc::BlackDownPointingTriangle;
|
||||||
|
@ -455,11 +456,11 @@ void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
if ( ! dialog_list || dialog_list->empty() )
|
if ( ! getDialogList() || getDialogList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = dialog_list->end();
|
auto iter = getDialogList()->end();
|
||||||
auto first = dialog_list->begin();
|
auto first = getDialogList()->begin();
|
||||||
activateWindow(this);
|
activateWindow(this);
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -475,12 +476,12 @@ void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
if ( ! dialog_list || dialog_list->empty() )
|
if ( ! getDialogList() || getDialogList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = dialog_list->begin();
|
auto iter = getDialogList()->begin();
|
||||||
|
|
||||||
while ( iter != dialog_list->end() )
|
while ( iter != getDialogList()->end() )
|
||||||
{
|
{
|
||||||
if ( static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
if ( static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
||||||
{
|
{
|
||||||
|
@ -491,8 +492,8 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
++next_element;
|
++next_element;
|
||||||
|
|
||||||
if ( next_element == dialog_list->end() )
|
if ( next_element == getDialogList()->end() )
|
||||||
next_element = dialog_list->begin();
|
next_element = getDialogList()->begin();
|
||||||
|
|
||||||
next = static_cast<finalcut::FDialog*>(*next_element);
|
next = static_cast<finalcut::FDialog*>(*next_element);
|
||||||
} while ( ! next->isEnabled()
|
} while ( ! next->isEnabled()
|
||||||
|
@ -511,10 +512,10 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
if ( ! dialog_list || dialog_list->empty() )
|
if ( ! getDialogList() || getDialogList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = dialog_list->end();
|
auto iter = getDialogList()->end();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -528,8 +529,8 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( prev_element == dialog_list->begin() )
|
if ( prev_element == getDialogList()->begin() )
|
||||||
prev_element = dialog_list->end();
|
prev_element = getDialogList()->end();
|
||||||
|
|
||||||
--prev_element;
|
--prev_element;
|
||||||
prev = static_cast<finalcut::FDialog*>(*prev_element);
|
prev = static_cast<finalcut::FDialog*>(*prev_element);
|
||||||
|
@ -542,7 +543,7 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( iter != dialog_list->begin() );
|
while ( iter != getDialogList()->begin() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -182,7 +182,7 @@ bool FApplication::sendEvent ( const FObject* receiver
|
||||||
const auto r_widget = static_cast<const FWidget*>(receiver);
|
const auto r_widget = static_cast<const FWidget*>(receiver);
|
||||||
auto widget = const_cast<FWidget*>(r_widget);
|
auto widget = const_cast<FWidget*>(r_widget);
|
||||||
|
|
||||||
if ( modal_dialogs > 0 )
|
if ( getModalDialogCounter() > 0 )
|
||||||
{
|
{
|
||||||
const FWidget* window;
|
const FWidget* window;
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ bool FApplication::processDialogSwitchAccelerator()
|
||||||
{
|
{
|
||||||
FKey key = keyboard->getKey();
|
FKey key = keyboard->getKey();
|
||||||
std::size_t n = key - fc::Fmkey_0;
|
std::size_t n = key - fc::Fmkey_0;
|
||||||
std::size_t s = dialog_list->size();
|
std::size_t s = getDialogList()->size();
|
||||||
|
|
||||||
if ( s > 0 && s >= n )
|
if ( s > 0 && s >= n )
|
||||||
{
|
{
|
||||||
|
@ -695,7 +695,7 @@ bool FApplication::processDialogSwitchAccelerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
FAccelEvent a_ev (fc::Accelerator_Event, getFocusWidget());
|
FAccelEvent a_ev (fc::Accelerator_Event, getFocusWidget());
|
||||||
sendEvent (dialog_list->at(n - 1), &a_ev);
|
sendEvent (getDialogList()->at(n - 1), &a_ev);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,11 +709,11 @@ bool FApplication::processAccelerator (const FWidget*& widget)
|
||||||
bool accpt{false};
|
bool accpt{false};
|
||||||
|
|
||||||
if ( widget
|
if ( widget
|
||||||
&& widget->accelerator_list
|
&& widget->getAcceleratorList()
|
||||||
&& ! widget->accelerator_list->empty() )
|
&& ! widget->getAcceleratorList()->empty() )
|
||||||
{
|
{
|
||||||
auto iter = widget->accelerator_list->begin();
|
auto iter = widget->getAcceleratorList()->begin();
|
||||||
auto last = widget->accelerator_list->end();
|
auto last = widget->getAcceleratorList()->end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -1156,17 +1156,17 @@ void FApplication::processCloseWidget()
|
||||||
{
|
{
|
||||||
updateTerminal (FVTerm::stop_refresh);
|
updateTerminal (FVTerm::stop_refresh);
|
||||||
|
|
||||||
if ( close_widget && ! close_widget->empty() )
|
if ( getWidgetCloseList() && ! getWidgetCloseList()->empty() )
|
||||||
{
|
{
|
||||||
auto iter = close_widget->begin();
|
auto iter = getWidgetCloseList()->begin();
|
||||||
|
|
||||||
while ( iter != close_widget->end() && *iter )
|
while ( iter != getWidgetCloseList()->end() && *iter )
|
||||||
{
|
{
|
||||||
delete *iter;
|
delete *iter;
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
close_widget->clear();
|
getWidgetCloseList()->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTerminal (FVTerm::start_refresh);
|
updateTerminal (FVTerm::start_refresh);
|
||||||
|
|
|
@ -130,7 +130,7 @@ void FButton::setInactiveBackgroundColor (FColor color)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FButton::setNoUnderline (bool enable)
|
bool FButton::setNoUnderline (bool enable)
|
||||||
{
|
{
|
||||||
return (flags.no_underline = enable);
|
return (setFlags().no_underline = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -179,7 +179,7 @@ bool FButton::setFocus (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FButton::setFlat (bool enable)
|
bool FButton::setFlat (bool enable)
|
||||||
{
|
{
|
||||||
return (flags.flat = enable);
|
return (setFlags().flat = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -189,16 +189,16 @@ bool FButton::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::VT100
|
&& getEncoding() != fc::VT100
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
flags.shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize(1, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags.shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags.shadow;
|
return getFlags().shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -238,6 +238,7 @@ void FButton::hide()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
fg = wc.dialog_fg;
|
fg = wc.dialog_fg;
|
||||||
bg = wc.dialog_bg;
|
bg = wc.dialog_bg;
|
||||||
}
|
}
|
||||||
|
@ -409,6 +410,7 @@ void FButton::onFocusOut (FFocusEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::init()
|
void FButton::init()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.button_active_fg);
|
setForegroundColor (wc.button_active_fg);
|
||||||
setBackgroundColor (wc.button_active_bg);
|
setBackgroundColor (wc.button_active_bg);
|
||||||
setShadow();
|
setShadow();
|
||||||
|
@ -455,7 +457,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// noshadow + indent one character to the right
|
// noshadow + indent one character to the right
|
||||||
if ( flags.flat )
|
if ( getFlags().flat )
|
||||||
clearFlatBorder();
|
clearFlatBorder();
|
||||||
else if ( hasShadow() )
|
else if ( hasShadow() )
|
||||||
clearShadow();
|
clearShadow();
|
||||||
|
@ -490,7 +492,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
||||||
|
|
||||||
print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
|
print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
|
||||||
|
|
||||||
if ( flags.active && isMonochron() )
|
if ( getFlags().active && isMonochron() )
|
||||||
setReverse(false); // Dark background
|
setReverse(false); // Dark background
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,7 +579,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
|
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
|
||||||
, 1 + int(vcenter_offset) )); // hotkey
|
, 1 + int(vcenter_offset) )); // hotkey
|
||||||
|
|
||||||
if ( ! flags.active && isMonochron() )
|
if ( ! getFlags().active && isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
|
||||||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
|
@ -587,14 +589,14 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
; pos < center_offset + txtlength && z < getWidth() - 2
|
||||||
; z++, pos++)
|
; z++, pos++)
|
||||||
{
|
{
|
||||||
if ( z == hotkeypos && flags.active )
|
if ( z == hotkeypos && getFlags().active )
|
||||||
{
|
{
|
||||||
setColor (button_hotkey_fg, button_bg);
|
setColor (button_hotkey_fg, button_bg);
|
||||||
|
|
||||||
if ( ! active_focus && getMaxColor() < 16 )
|
if ( ! active_focus && getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
|
||||||
print (button_text[z]);
|
print (button_text[z]);
|
||||||
|
@ -602,7 +604,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
if ( ! active_focus && getMaxColor() < 16 )
|
if ( ! active_focus && getMaxColor() < 16 )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (button_fg, button_bg);
|
setColor (button_fg, button_bg);
|
||||||
|
@ -633,7 +635,7 @@ void FButton::draw()
|
||||||
auto parent_widget = getParentWidget();
|
auto parent_widget = getParentWidget();
|
||||||
txtlength = text.getLength();
|
txtlength = text.getLength();
|
||||||
space_char = int(' ');
|
space_char = int(' ');
|
||||||
active_focus = flags.active && flags.focus;
|
active_focus = getFlags().active && getFlags().focus;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -654,13 +656,13 @@ void FButton::draw()
|
||||||
// Clear right margin after animation
|
// Clear right margin after animation
|
||||||
clearRightMargin (parent_widget);
|
clearRightMargin (parent_widget);
|
||||||
|
|
||||||
if ( ! flags.active && isMonochron() )
|
if ( ! getFlags().active && isMonochron() )
|
||||||
space_char = fc::MediumShade; // ▒ simulates greyed out at Monochron
|
space_char = fc::MediumShade; // ▒ simulates greyed out at Monochron
|
||||||
|
|
||||||
if ( isMonochron() && (flags.active || flags.focus) )
|
if ( isMonochron() && (getFlags().active || getFlags().focus) )
|
||||||
setReverse(false); // Dark background
|
setReverse(false); // Dark background
|
||||||
|
|
||||||
if ( flags.flat && ! button_down )
|
if ( getFlags().flat && ! button_down )
|
||||||
drawFlatBorder();
|
drawFlatBorder();
|
||||||
|
|
||||||
hotkeypos = finalcut::getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
hotkeypos = finalcut::getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
||||||
|
@ -686,7 +688,7 @@ void FButton::draw()
|
||||||
drawTopBottomBackground();
|
drawTopBottomBackground();
|
||||||
|
|
||||||
// Draw button shadow
|
// Draw button shadow
|
||||||
if ( ! flags.flat && flags.shadow && ! button_down )
|
if ( ! getFlags().flat && getFlags().shadow && ! button_down )
|
||||||
drawShadow();
|
drawShadow();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -699,7 +701,7 @@ void FButton::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::updateStatusBar()
|
void FButton::updateStatusBar()
|
||||||
{
|
{
|
||||||
if ( ! flags.focus || ! getStatusBar() )
|
if ( ! getFlags().focus || ! getStatusBar() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
|
|
|
@ -207,6 +207,7 @@ void FButtonGroup::hide()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
fg = wc.dialog_fg;
|
fg = wc.dialog_fg;
|
||||||
bg = wc.dialog_bg;
|
bg = wc.dialog_bg;
|
||||||
}
|
}
|
||||||
|
@ -324,6 +325,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
{
|
{
|
||||||
auto iter = buttonlist.begin();
|
auto iter = buttonlist.begin();
|
||||||
auto last = buttonlist.end();
|
auto last = buttonlist.end();
|
||||||
|
in_ev->ignore();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -334,7 +336,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
if ( isRadioButton(toggle_button) )
|
if ( isRadioButton(toggle_button) )
|
||||||
{
|
{
|
||||||
auto prev_element = getFocusWidget();
|
auto prev_element = getFocusWidget();
|
||||||
in_ev->ignore();
|
|
||||||
toggle_button->setFocus();
|
toggle_button->setFocus();
|
||||||
|
|
||||||
FFocusEvent cfi (fc::ChildFocusIn_Event);
|
FFocusEvent cfi (fc::ChildFocusIn_Event);
|
||||||
|
@ -343,6 +345,9 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
FFocusEvent in (fc::FocusIn_Event);
|
FFocusEvent in (fc::FocusIn_Event);
|
||||||
FApplication::sendEvent(toggle_button, &in);
|
FApplication::sendEvent(toggle_button, &in);
|
||||||
|
|
||||||
|
if ( in.isAccepted() )
|
||||||
|
in_ev->accept();
|
||||||
|
|
||||||
if ( prev_element )
|
if ( prev_element )
|
||||||
prev_element->redraw();
|
prev_element->redraw();
|
||||||
|
|
||||||
|
@ -356,9 +361,9 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_ev->isAccepted() )
|
if ( ! in_ev->isAccepted() )
|
||||||
{
|
{
|
||||||
in_ev->ignore();
|
in_ev->accept();
|
||||||
auto prev_element = getFocusWidget();
|
auto prev_element = getFocusWidget();
|
||||||
|
|
||||||
if ( in_ev->getFocusType() == fc::FocusNextWidget )
|
if ( in_ev->getFocusType() == fc::FocusNextWidget )
|
||||||
|
@ -473,6 +478,7 @@ bool FButtonGroup::isRadioButton (const FToggleButton* button) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::init()
|
void FButtonGroup::init()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.label_fg);
|
setForegroundColor (wc.label_fg);
|
||||||
setBackgroundColor (wc.label_bg);
|
setBackgroundColor (wc.label_bg);
|
||||||
setMinimumSize (FSize(7, 4));
|
setMinimumSize (FSize(7, 4));
|
||||||
|
@ -487,6 +493,8 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||||
else
|
else
|
||||||
|
@ -494,16 +502,16 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||||
|
|
||||||
for (std::size_t z{0}; z < length; z++)
|
for (std::size_t z{0}; z < length; z++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && flags.active )
|
if ( (z == hotkeypos) && getFlags().active )
|
||||||
{
|
{
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
|
||||||
print (LabelText[z]);
|
print (LabelText[z]);
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
setColor (wc.label_emphasis_fg, wc.label_bg);
|
||||||
|
|
|
@ -55,7 +55,7 @@ FCheckMenuItem::~FCheckMenuItem() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FCheckMenuItem::init (FWidget* parent)
|
void FCheckMenuItem::init (FWidget* parent)
|
||||||
{
|
{
|
||||||
checkable = true;
|
setCheckable();
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
return;
|
return;
|
||||||
|
@ -76,7 +76,11 @@ void FCheckMenuItem::processToggle()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FCheckMenuItem::processClicked()
|
void FCheckMenuItem::processClicked()
|
||||||
{
|
{
|
||||||
checked = ! checked;
|
if ( isChecked() )
|
||||||
|
unsetChecked();
|
||||||
|
else
|
||||||
|
setChecked();
|
||||||
|
|
||||||
processToggle();
|
processToggle();
|
||||||
emitCallback("clicked");
|
emitCallback("clicked");
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,6 @@ FDialog::~FDialog() // destructor
|
||||||
bool is_quit = fapp->isQuit();
|
bool is_quit = fapp->isQuit();
|
||||||
delete dialog_menu;
|
delete dialog_menu;
|
||||||
dgl_menuitem = nullptr;
|
dgl_menuitem = nullptr;
|
||||||
delete accelerator_list;
|
|
||||||
accelerator_list = nullptr;
|
|
||||||
|
|
||||||
if ( ! is_quit )
|
if ( ! is_quit )
|
||||||
switchToPrevWindow(this);
|
switchToPrevWindow(this);
|
||||||
|
@ -80,7 +78,7 @@ bool FDialog::setDialogWidget (bool enable)
|
||||||
if ( isDialogWidget() == enable )
|
if ( isDialogWidget() == enable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
flags.dialog_widget = enable;
|
setFlags().dialog_widget = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
setTermOffsetWithPadding();
|
setTermOffsetWithPadding();
|
||||||
|
@ -96,12 +94,12 @@ bool FDialog::setModal (bool enable)
|
||||||
if ( isModal() == enable )
|
if ( isModal() == enable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
flags.modal = enable;
|
setFlags().modal = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
modal_dialogs++;
|
setModalDialogCounter()++;
|
||||||
else
|
else
|
||||||
modal_dialogs--;
|
setModalDialogCounter()--;
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +108,7 @@ bool FDialog::setModal (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::setScrollable (bool enable)
|
bool FDialog::setScrollable (bool enable)
|
||||||
{
|
{
|
||||||
return (flags.scrollable = enable);
|
return (setFlags().scrollable = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -189,7 +187,7 @@ void FDialog::setPos (const FPoint& pos, bool)
|
||||||
|
|
||||||
// move to the new position
|
// move to the new position
|
||||||
FWindow::setPos(pos, false);
|
FWindow::setPos(pos, false);
|
||||||
putArea (getTermPos(), vwin);
|
putArea (getTermPos(), getVWin());
|
||||||
|
|
||||||
// restoring the non-covered terminal areas
|
// restoring the non-covered terminal areas
|
||||||
if ( getTermGeometry().overlap(old_geometry) )
|
if ( getTermGeometry().overlap(old_geometry) )
|
||||||
|
@ -686,12 +684,12 @@ void FDialog::onWindowRaised (FEvent*)
|
||||||
if ( ! isShown() )
|
if ( ! isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
putArea (getTermPos(), vwin);
|
putArea (getTermPos(), getVWin());
|
||||||
|
|
||||||
// Handle always-on-top windows
|
// Handle always-on-top windows
|
||||||
if ( always_on_top_list && ! always_on_top_list->empty() )
|
if ( getAlwaysOnTopList() && ! getAlwaysOnTopList()->empty() )
|
||||||
{
|
{
|
||||||
for (auto&& win : *always_on_top_list)
|
for (auto&& win : *getAlwaysOnTopList())
|
||||||
putArea (win->getTermPos(), win->getVWin());
|
putArea (win->getTermPos(), win->getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,13 +697,13 @@ void FDialog::onWindowRaised (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowLowered (FEvent*)
|
void FDialog::onWindowLowered (FEvent*)
|
||||||
{
|
{
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto&& win : *window_list)
|
for (auto&& win : *getWindowList())
|
||||||
putArea (win->getTermPos(), win->getVWin());
|
putArea (win->getTermPos(), win->getVWin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +736,7 @@ void FDialog::draw()
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
setCursorPos(FPoint(2, int(getHeight()) - 1));
|
setCursorPos(FPoint(2, int(getHeight()) - 1));
|
||||||
|
|
||||||
if ( flags.shadow )
|
if ( getFlags().shadow )
|
||||||
drawDialogShadow();
|
drawDialogShadow();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -748,7 +746,7 @@ void FDialog::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::drawDialogShadow()
|
void FDialog::drawDialogShadow()
|
||||||
{
|
{
|
||||||
if ( isMonochron() && ! flags.trans_shadow )
|
if ( isMonochron() && ! getFlags().trans_shadow )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawShadow();
|
drawShadow();
|
||||||
|
@ -786,6 +784,7 @@ void FDialog::init()
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
auto old_focus = FWidget::getFocusWidget();
|
auto old_focus = FWidget::getFocusWidget();
|
||||||
|
@ -796,15 +795,8 @@ void FDialog::init()
|
||||||
old_focus->redraw();
|
old_focus->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
// Create your own accelerator list for this dialog
|
||||||
{
|
createWidgetAcceleratorList();
|
||||||
accelerator_list = new Accelerators();
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the dialog menu
|
// Add the dialog menu
|
||||||
initDialogMenu();
|
initDialogMenu();
|
||||||
|
@ -915,7 +907,10 @@ void FDialog::drawBorder()
|
||||||
{
|
{
|
||||||
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
|
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
|
||||||
&& ! isZoomed() )
|
&& ! isZoomed() )
|
||||||
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
|
@ -976,6 +971,7 @@ void FDialog::drawBarButton()
|
||||||
{
|
{
|
||||||
// Print the title button
|
// Print the title button
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( dialog_menu && dialog_menu->isShown() )
|
if ( dialog_menu && dialog_menu->isShown() )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
||||||
|
@ -1028,6 +1024,8 @@ void FDialog::drawZoomButton()
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( zoom_button_pressed )
|
if ( zoom_button_pressed )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
||||||
else
|
else
|
||||||
|
@ -1095,6 +1093,7 @@ void FDialog::drawTextBar()
|
||||||
// Fill with spaces (left of the title)
|
// Fill with spaces (left of the title)
|
||||||
std::size_t center_offset{0};
|
std::size_t center_offset{0};
|
||||||
std::size_t x{1};
|
std::size_t x{1};
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
@ -1140,17 +1139,17 @@ void FDialog::restoreOverlaidWindows()
|
||||||
{
|
{
|
||||||
// Restoring overlaid windows
|
// Restoring overlaid windows
|
||||||
|
|
||||||
if ( ! window_list || window_list->empty() )
|
if ( ! getWindowList() || getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool overlaid{false};
|
bool overlaid{false};
|
||||||
|
|
||||||
for (auto&& win : *window_list)
|
for (auto&& win : *getWindowList())
|
||||||
{
|
{
|
||||||
if ( overlaid )
|
if ( overlaid )
|
||||||
putArea (win->getTermPos(), win->getVWin());
|
putArea (win->getTermPos(), win->getVWin());
|
||||||
|
|
||||||
if ( vwin == win->getVWin() )
|
if ( getVWin() == win->getVWin() )
|
||||||
overlaid = true;
|
overlaid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1167,7 @@ void FDialog::setCursorToFocusWidget()
|
||||||
{
|
{
|
||||||
FPoint cursor_pos(focus->getCursorPos());
|
FPoint cursor_pos(focus->getCursorPos());
|
||||||
focus->setCursorPos(cursor_pos);
|
focus->setCursorPos(cursor_pos);
|
||||||
updateVTermCursor(vwin);
|
updateVTermCursor(getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1597,24 +1596,24 @@ inline void FDialog::cancelMoveSize()
|
||||||
void FDialog::addDialog (FWidget* obj)
|
void FDialog::addDialog (FWidget* obj)
|
||||||
{
|
{
|
||||||
// Add the dialog object obj to the dialog list
|
// Add the dialog object obj to the dialog list
|
||||||
if ( dialog_list )
|
if ( getDialogList() )
|
||||||
dialog_list->push_back(obj);
|
getDialogList()->push_back(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::delDialog (FWidget* obj)
|
void FDialog::delDialog (FWidget* obj)
|
||||||
{
|
{
|
||||||
// Delete the dialog object obj from the dialog list
|
// Delete the dialog object obj from the dialog list
|
||||||
if ( ! dialog_list || dialog_list->empty() )
|
if ( ! getDialogList() || getDialogList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = dialog_list->begin();
|
auto iter = getDialogList()->begin();
|
||||||
|
|
||||||
while ( iter != dialog_list->end() )
|
while ( iter != getDialogList()->end() )
|
||||||
{
|
{
|
||||||
if ( (*iter) == obj )
|
if ( (*iter) == obj )
|
||||||
{
|
{
|
||||||
dialog_list->erase(iter);
|
getDialogList()->erase(iter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ void FLabel::setText (const FString& txt)
|
||||||
void FLabel::hide()
|
void FLabel::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
hideSize (getSize());
|
hideArea (getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -342,6 +342,7 @@ void FLabel::init()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
}
|
}
|
||||||
|
@ -535,16 +536,17 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( z == hotkeypos && flags.active )
|
if ( z == hotkeypos && getFlags().active )
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
|
||||||
print (line[z]);
|
print (line[z]);
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
if ( hasEmphasis() )
|
if ( hasEmphasis() )
|
||||||
|
|
|
@ -168,6 +168,7 @@ const FLineEdit& FLineEdit::operator >> (FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FLineEdit::setEnable (bool enable)
|
bool FLineEdit::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
FWidget::setEnable(enable);
|
FWidget::setEnable(enable);
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
|
@ -195,6 +196,7 @@ bool FLineEdit::setEnable (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FLineEdit::setFocus (bool enable)
|
bool FLineEdit::setFocus (bool enable)
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
FWidget::setFocus(enable);
|
FWidget::setFocus(enable);
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
|
@ -236,16 +238,16 @@ bool FLineEdit::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::VT100
|
&& getEncoding() != fc::VT100
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
flags.shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize(1, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags.shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags.shadow;
|
return getFlags().shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -318,7 +320,7 @@ void FLineEdit::hide()
|
||||||
|
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
||||||
hideSize (getSize() + shadow);
|
hideArea (getSize() + shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -658,6 +660,7 @@ void FLineEdit::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::init()
|
void FLineEdit::init()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
label->setAccelWidget(this);
|
label->setAccelWidget(this);
|
||||||
setVisibleCursor();
|
setVisibleCursor();
|
||||||
setShadow();
|
setShadow();
|
||||||
|
@ -696,7 +699,7 @@ void FLineEdit::draw()
|
||||||
{
|
{
|
||||||
drawInputField();
|
drawInputField();
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( getFlags().focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const auto& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const auto& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
@ -712,7 +715,7 @@ void FLineEdit::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::drawInputField()
|
void FLineEdit::drawInputField()
|
||||||
{
|
{
|
||||||
bool isActiveFocus = flags.active && flags.focus;
|
bool isActiveFocus = getFlags().active && getFlags().focus;
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -756,7 +759,7 @@ void FLineEdit::drawInputField()
|
||||||
setUnderline(false);
|
setUnderline(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( flags.shadow )
|
if ( getFlags().shadow )
|
||||||
drawShadow ();
|
drawShadow ();
|
||||||
|
|
||||||
// set the cursor to the first pos.
|
// set the cursor to the first pos.
|
||||||
|
|
|
@ -216,7 +216,7 @@ void FListBox::setText (const FString& txt)
|
||||||
void FListBox::hide()
|
void FListBox::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
hideSize (getSize());
|
hideArea (getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -303,6 +303,7 @@ void FListBox::clear()
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
// clear list from screen
|
// clear list from screen
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc.list_fg, wc.list_bg);
|
||||||
size = getWidth() - 2;
|
size = getWidth() - 2;
|
||||||
|
|
||||||
|
@ -757,6 +758,7 @@ void FListBox::init()
|
||||||
initScrollbar (vbar, fc::vertical, &FListBox::cb_VBarChange);
|
initScrollbar (vbar, fc::vertical, &FListBox::cb_VBarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, &FListBox::cb_HBarChange);
|
initScrollbar (hbar, fc::horizontal, &FListBox::cb_HBarChange);
|
||||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
@ -824,7 +826,7 @@ void FListBox::draw()
|
||||||
drawScrollbars();
|
drawScrollbars();
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( getFlags().focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const auto& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const auto& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
@ -874,6 +876,7 @@ void FListBox::drawHeadline()
|
||||||
FString txt(" " + text + " ");
|
FString txt(" " + text + " ");
|
||||||
std::size_t length = txt.getLength();
|
std::size_t length = txt.getLength();
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint(2, 1);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||||
|
@ -951,13 +954,14 @@ inline void FListBox::drawListLine ( int y
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
std::size_t inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
FString element (getString(iter).mid ( std::size_t(1 + xoffset)
|
FString element (getString(iter).mid ( std::size_t(1 + xoffset)
|
||||||
, getWidth() - nf_offset - 4 ));
|
, getWidth() - nf_offset - 4 ));
|
||||||
const wchar_t* const& element_str = element.wc_str();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
std::size_t len = element.getLength();
|
std::size_t len = element.getLength();
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && getFlags().focus )
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
else
|
else
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -970,14 +974,14 @@ inline void FListBox::drawListLine ( int y
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len && flags.focus )
|
if ( serach_mark && i == inc_len && getFlags().focus )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc.current_element_focus_bg );
|
||||||
|
|
||||||
print (element_str[i]);
|
print (element_str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && getFlags().focus )
|
||||||
{
|
{
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
i++;
|
i++;
|
||||||
|
@ -1011,7 +1015,7 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
, b{0};
|
, b{0};
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && getFlags().focus )
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
else
|
else
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -1032,6 +1036,7 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
std::size_t full_length = getString(iter).getLength()
|
std::size_t full_length = getString(iter).getLength()
|
||||||
, len = element.getLength()
|
, len = element.getLength()
|
||||||
, i{0};
|
, i{0};
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
for (; i < len; i++)
|
for (; i < len; i++)
|
||||||
{
|
{
|
||||||
|
@ -1057,7 +1062,7 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && getFlags().focus )
|
||||||
{
|
{
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
i++;
|
i++;
|
||||||
|
@ -1075,6 +1080,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
{
|
{
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
std::size_t inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
print() << FPoint(2, 2 + int(y));
|
print() << FPoint(2, 2 + int(y));
|
||||||
|
|
||||||
if ( isLineSelected )
|
if ( isLineSelected )
|
||||||
|
@ -1094,14 +1100,14 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
|
|
||||||
if ( isCurrentLine )
|
if ( isCurrentLine )
|
||||||
{
|
{
|
||||||
if ( flags.focus && getMaxColor() < 16 )
|
if ( getFlags().focus && getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
if ( isLineSelected )
|
if ( isLineSelected )
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setBold();
|
setBold();
|
||||||
else if ( flags.focus )
|
else if ( getFlags().focus )
|
||||||
setColor ( wc.selected_current_element_focus_fg
|
setColor ( wc.selected_current_element_focus_fg
|
||||||
, wc.selected_current_element_focus_bg );
|
, wc.selected_current_element_focus_bg );
|
||||||
else
|
else
|
||||||
|
@ -1115,7 +1121,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
if ( flags.focus )
|
if ( getFlags().focus )
|
||||||
{
|
{
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc.current_element_focus_bg );
|
||||||
|
@ -1142,7 +1148,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
else if ( flags.focus && getMaxColor() < 16 )
|
else if ( getFlags().focus && getMaxColor() < 16 )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,7 +758,7 @@ int FListView::addColumn (const FString& label, int width)
|
||||||
void FListView::hide()
|
void FListView::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
hideSize (getSize());
|
hideArea (getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1387,6 +1387,7 @@ void FListView::init()
|
||||||
root = selflist.begin();
|
root = selflist.begin();
|
||||||
null_iter = selflist.end();
|
null_iter = selflist.end();
|
||||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
@ -1492,7 +1493,7 @@ void FListView::draw()
|
||||||
drawScrollbars();
|
drawScrollbars();
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( getFlags().focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const auto& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const auto& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
@ -1601,9 +1602,9 @@ void FListView::drawList()
|
||||||
print() << FPoint(2, 2 + int(y));
|
print() << FPoint(2, 2 + int(y));
|
||||||
|
|
||||||
// Draw one FListViewItem
|
// Draw one FListViewItem
|
||||||
drawListLine (item, flags.focus, is_current_line);
|
drawListLine (item, getFlags().focus, is_current_line);
|
||||||
|
|
||||||
if ( flags.focus && is_current_line )
|
if ( getFlags().focus && is_current_line )
|
||||||
{
|
{
|
||||||
setVisibleCursor (item->isCheckable());
|
setVisibleCursor (item->isCheckable());
|
||||||
setCursorPos (FPoint ( 3 + tree_offset + checkbox_offset - xoffset
|
setCursorPos (FPoint ( 3 + tree_offset + checkbox_offset - xoffset
|
||||||
|
@ -1713,6 +1714,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
inline void FListView::setLineAttributes ( bool is_current
|
inline void FListView::setLineAttributes ( bool is_current
|
||||||
, bool is_focus )
|
, bool is_focus )
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc.list_fg, wc.list_bg);
|
||||||
|
|
||||||
if ( is_current )
|
if ( is_current )
|
||||||
|
@ -1845,6 +1847,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||||
int column = int(std::distance(first, iter)) + 1;
|
int column = int(std::distance(first, iter)) + 1;
|
||||||
bool has_sort_indicator = bool ( sort_column == column
|
bool has_sort_indicator = bool ( sort_column == column
|
||||||
&& ! hide_sort_indicator );
|
&& ! hide_sort_indicator );
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
setColor (wc.label_emphasis_fg, wc.label_bg);
|
||||||
|
@ -1885,6 +1888,7 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
||||||
// Print lable ellipsis
|
// Print lable ellipsis
|
||||||
static constexpr int ellipsis_length = 2;
|
static constexpr int ellipsis_length = 2;
|
||||||
int width = iter->width;
|
int width = iter->width;
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
headerline << ' '
|
headerline << ' '
|
||||||
<< text.left(uInt(width - ellipsis_length))
|
<< text.left(uInt(width - ellipsis_length))
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool FMenu::setMenuWidget (bool enable)
|
||||||
if ( isMenuWidget() == enable )
|
if ( isMenuWidget() == enable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return (flags.menu_widget = enable);
|
return (setFlags().menu_widget = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -218,7 +218,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
mouse_down = true;
|
mouse_down = true;
|
||||||
|
|
||||||
if ( item_list.empty() )
|
if ( getItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Mouse pointer over menu list changed focus
|
// Mouse pointer over menu list changed focus
|
||||||
|
@ -239,7 +239,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
|
|
||||||
if ( item_list.empty() )
|
if ( getItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Mouse pointer over an entry in the menu list
|
// Mouse pointer over an entry in the menu list
|
||||||
|
@ -260,7 +260,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ! isWindowActive() )
|
if ( ! isWindowActive() )
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
|
|
||||||
if ( ! mouse_down || item_list.empty() )
|
if ( ! mouse_down || getItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouseStates ms =
|
mouseStates ms =
|
||||||
|
@ -328,11 +328,13 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, FDataPtr)
|
||||||
if ( ! menuitem->isChecked() )
|
if ( ! menuitem->isChecked() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( item_list.empty() )
|
auto list = getItemList();
|
||||||
|
|
||||||
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = item_list.begin();
|
auto iter = list.begin();
|
||||||
auto last = item_list.end();
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -443,6 +445,7 @@ void FMenu::init(FWidget* parent)
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc.menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
item.setMenu(this);
|
item.setMenu(this);
|
||||||
|
@ -469,8 +472,9 @@ void FMenu::init(FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::calculateDimensions()
|
void FMenu::calculateDimensions()
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
max_item_width = 10; // minimum width
|
max_item_width = 10; // minimum width
|
||||||
|
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
|
@ -506,7 +510,7 @@ void FMenu::calculateDimensions()
|
||||||
, FSize(max_item_width + 2, getCount() + 2) );
|
, FSize(max_item_width + 2, getCount() + 2) );
|
||||||
|
|
||||||
// set geometry of all items
|
// set geometry of all items
|
||||||
iter = item_list.begin();
|
iter = list.begin();
|
||||||
int item_X = 1;
|
int item_X = 1;
|
||||||
int item_Y = 1;
|
int item_Y = 1;
|
||||||
|
|
||||||
|
@ -530,8 +534,9 @@ void FMenu::calculateDimensions()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::adjustItems()
|
void FMenu::adjustItems()
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -659,8 +664,9 @@ void FMenu::hideSuperMenus()
|
||||||
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
{
|
{
|
||||||
bool focus_changed{false};
|
bool focus_changed{false};
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -747,8 +753,9 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -806,8 +813,9 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -1028,8 +1036,9 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::selectNextItem()
|
bool FMenu::selectNextItem()
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -1041,8 +1050,8 @@ bool FMenu::selectNextItem()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
++next_element;
|
++next_element;
|
||||||
if ( next_element == item_list.end() )
|
if ( next_element == list.end() )
|
||||||
next_element = item_list.begin();
|
next_element = list.begin();
|
||||||
next = static_cast<FMenuItem*>(*next_element);
|
next = static_cast<FMenuItem*>(*next_element);
|
||||||
}
|
}
|
||||||
while ( ! next->isEnabled()
|
while ( ! next->isEnabled()
|
||||||
|
@ -1076,8 +1085,9 @@ bool FMenu::selectNextItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::selectPrevItem()
|
bool FMenu::selectPrevItem()
|
||||||
{
|
{
|
||||||
auto iter = item_list.end();
|
auto list = getItemList();
|
||||||
auto first = item_list.begin();
|
auto iter = list.end();
|
||||||
|
auto first = list.begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1090,8 +1100,8 @@ bool FMenu::selectPrevItem()
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( prev_element == item_list.begin() )
|
if ( prev_element == list.begin() )
|
||||||
prev_element = item_list.end();
|
prev_element = list.end();
|
||||||
--prev_element;
|
--prev_element;
|
||||||
prev = static_cast<FMenuItem*>(*prev_element);
|
prev = static_cast<FMenuItem*>(*prev_element);
|
||||||
}
|
}
|
||||||
|
@ -1134,8 +1144,9 @@ void FMenu::keypressMenuBar (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -1192,6 +1203,7 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||||
void FMenu::draw()
|
void FMenu::draw()
|
||||||
{
|
{
|
||||||
// Fill the background
|
// Fill the background
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -1210,8 +1222,9 @@ void FMenu::draw()
|
||||||
void FMenu::drawItems()
|
void FMenu::drawItems()
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -1228,6 +1241,7 @@ void FMenu::drawItems()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawSeparator (int y)
|
inline void FMenu::drawSeparator (int y)
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
print() << FPoint(1, 2 + y)
|
print() << FPoint(1, 2 + y)
|
||||||
<< FColorPair(wc.menu_active_fg, wc.menu_active_bg);
|
<< FColorPair(wc.menu_active_fg, wc.menu_active_bg);
|
||||||
|
|
||||||
|
@ -1347,6 +1361,7 @@ inline void FMenu::drawCheckMarkPrefix (FMenuItem* menuitem)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.menu_inactive_fg, getBackgroundColor());
|
setColor (wc.menu_inactive_fg, getBackgroundColor());
|
||||||
|
|
||||||
if ( getEncoding() == fc::ASCII )
|
if ( getEncoding() == fc::ASCII )
|
||||||
|
@ -1381,6 +1396,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
||||||
|
|
||||||
if ( z == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
|
|
||||||
if ( ! data.no_underline )
|
if ( ! data.no_underline )
|
||||||
|
@ -1446,6 +1462,7 @@ inline void FMenu::setLineAttributes (FMenuItem* menuitem, int y)
|
||||||
{
|
{
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( is_enabled )
|
if ( is_enabled )
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,7 @@ void FMenuBar::resetMenu()
|
||||||
void FMenuBar::hide()
|
void FMenuBar::hide()
|
||||||
{
|
{
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
FColor fg = wc.term_fg;
|
FColor fg = wc.term_fg;
|
||||||
FColor bg = wc.term_bg;
|
FColor bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -152,7 +153,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
mouse_down = false;
|
mouse_down = false;
|
||||||
|
|
||||||
if ( ! item_list.empty() && hasSelectedItem() )
|
if ( ! getItemList().empty() && hasSelectedItem() )
|
||||||
leaveMenuBar();
|
leaveMenuBar();
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
@ -249,6 +250,7 @@ void FMenuBar::init()
|
||||||
|
|
||||||
addAccelerator (fc::Fkey_f10);
|
addAccelerator (fc::Fkey_f10);
|
||||||
addAccelerator (fc::Fckey_space);
|
addAccelerator (fc::Fckey_space);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc.menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
@ -258,8 +260,9 @@ void FMenuBar::init()
|
||||||
void FMenuBar::calculateDimensions()
|
void FMenuBar::calculateDimensions()
|
||||||
{
|
{
|
||||||
FPoint item_pos (1, 1);
|
FPoint item_pos (1, 1);
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -283,8 +286,9 @@ void FMenuBar::calculateDimensions()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::selectNextItem()
|
bool FMenuBar::selectNextItem()
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -297,8 +301,8 @@ bool FMenuBar::selectNextItem()
|
||||||
{
|
{
|
||||||
++next_element;
|
++next_element;
|
||||||
|
|
||||||
if ( next_element == item_list.end() )
|
if ( next_element == list.end() )
|
||||||
next_element = item_list.begin();
|
next_element = list.begin();
|
||||||
|
|
||||||
next = static_cast<FMenuItem*>(*next_element);
|
next = static_cast<FMenuItem*>(*next_element);
|
||||||
} while ( ! next->isEnabled()
|
} while ( ! next->isEnabled()
|
||||||
|
@ -345,8 +349,9 @@ bool FMenuBar::selectNextItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::selectPrevItem()
|
bool FMenuBar::selectPrevItem()
|
||||||
{
|
{
|
||||||
auto iter = item_list.end();
|
auto list = getItemList();
|
||||||
auto first = item_list.begin();
|
auto iter = list.end();
|
||||||
|
auto first = list.begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -359,8 +364,8 @@ bool FMenuBar::selectPrevItem()
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( prev_element == item_list.begin() )
|
if ( prev_element == list.begin() )
|
||||||
prev_element = item_list.end();
|
prev_element = list.end();
|
||||||
|
|
||||||
--prev_element;
|
--prev_element;
|
||||||
prev = static_cast<FMenuItem*>(*prev_element);
|
prev = static_cast<FMenuItem*>(*prev_element);
|
||||||
|
@ -408,8 +413,9 @@ bool FMenuBar::selectPrevItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||||
{
|
{
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -476,7 +482,9 @@ void FMenuBar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::drawItems()
|
void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
if ( item_list.empty() )
|
auto list = getItemList();
|
||||||
|
|
||||||
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
|
@ -485,8 +493,8 @@ void FMenuBar::drawItems()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
screenWidth = getDesktopWidth();
|
screenWidth = getDesktopWidth();
|
||||||
auto iter = item_list.begin();
|
auto iter = list.begin();
|
||||||
auto last = item_list.end();
|
auto last = list.end();
|
||||||
std::size_t x{1};
|
std::size_t x{1};
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -556,6 +564,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
drawEllipsis (txtdata, x);
|
drawEllipsis (txtdata, x);
|
||||||
drawTrailingSpace (x);
|
drawTrailingSpace (x);
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
||||||
|
|
||||||
if ( isMonochron() && is_enabled && is_selected )
|
if ( isMonochron() && is_enabled && is_selected )
|
||||||
|
@ -569,6 +578,7 @@ inline void FMenuBar::setLineAttributes (FMenuItem* menuitem)
|
||||||
{
|
{
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( is_enabled )
|
if ( is_enabled )
|
||||||
{
|
{
|
||||||
|
@ -617,6 +627,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
|
|
||||||
if ( z == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
|
|
||||||
if ( ! data.no_underline )
|
if ( ! data.no_underline )
|
||||||
|
@ -681,8 +692,9 @@ void FMenuBar::adjustItems()
|
||||||
{
|
{
|
||||||
int item_X = 1;
|
int item_X = 1;
|
||||||
int item_Y = 1;
|
int item_Y = 1;
|
||||||
auto iter = item_list.begin();
|
auto list = getItemList();
|
||||||
auto last = item_list.end();
|
auto iter = list.begin();
|
||||||
|
auto last = list.end();
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -799,12 +811,14 @@ void FMenuBar::unselectMenuItem (FMenuItem* item)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
|
void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( item_list.empty() )
|
auto list = getItemList();
|
||||||
|
|
||||||
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
focus_changed = false;
|
focus_changed = false;
|
||||||
auto iter = item_list.begin();
|
auto iter = list.begin();
|
||||||
auto last = item_list.end();
|
auto last = list.end();
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
|
@ -847,11 +861,13 @@ void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
|
void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( item_list.empty() )
|
auto list = getItemList();
|
||||||
|
|
||||||
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = item_list.begin();
|
auto iter = list.begin();
|
||||||
auto last = item_list.end();
|
auto last = list.end();
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
|
@ -889,13 +905,15 @@ void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
|
void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( item_list.empty() )
|
auto list = getItemList();
|
||||||
|
|
||||||
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
focus_changed = false;
|
focus_changed = false;
|
||||||
bool mouse_over_menubar{false};
|
bool mouse_over_menubar{false};
|
||||||
auto iter = item_list.begin();
|
auto iter = list.begin();
|
||||||
auto last = item_list.end();
|
auto last = list.end();
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
|
|
|
@ -204,10 +204,10 @@ void FMenuItem::addAccelerator (FKey key, FWidget* obj)
|
||||||
auto root = getRootWidget();
|
auto root = getRootWidget();
|
||||||
accelerator accel = { key, obj };
|
accelerator accel = { key, obj };
|
||||||
|
|
||||||
if ( root && root->accelerator_list )
|
if ( root && root->getAcceleratorList() )
|
||||||
{
|
{
|
||||||
accel_key = key;
|
accel_key = key;
|
||||||
root->accelerator_list->push_back(accel);
|
root->getAcceleratorList()->push_back(accel);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSuperMenuDimensions();
|
updateSuperMenuDimensions();
|
||||||
|
@ -219,17 +219,17 @@ void FMenuItem::delAccelerator (FWidget* obj)
|
||||||
auto root = getRootWidget();
|
auto root = getRootWidget();
|
||||||
|
|
||||||
if ( root
|
if ( root
|
||||||
&& root->accelerator_list
|
&& root->getAcceleratorList()
|
||||||
&& ! root->accelerator_list->empty() )
|
&& ! root->getAcceleratorList()->empty() )
|
||||||
{
|
{
|
||||||
auto iter = root->accelerator_list->begin();
|
auto iter = root->getAcceleratorList()->begin();
|
||||||
|
|
||||||
while ( iter != root->accelerator_list->end() )
|
while ( iter != root->getAcceleratorList()->end() )
|
||||||
{
|
{
|
||||||
if ( iter->object == obj )
|
if ( iter->object == obj )
|
||||||
{
|
{
|
||||||
accel_key = 0;
|
accel_key = 0;
|
||||||
iter = root->accelerator_list->erase(iter);
|
iter = root->getAcceleratorList()->erase(iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -415,7 +415,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
||||||
mbar->getSelectedItem()->unsetSelected();
|
mbar->getSelectedItem()->unsetSelected();
|
||||||
|
|
||||||
setSelected();
|
setSelected();
|
||||||
mbar->selected_item = this;
|
mbar->setSelectedItem(this);
|
||||||
openMenu();
|
openMenu();
|
||||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||||
menu->unselectItem();
|
menu->unselectItem();
|
||||||
|
@ -438,7 +438,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsetSelected();
|
unsetSelected();
|
||||||
mbar->selected_item = nullptr;
|
mbar->unsetSelectedItem();
|
||||||
mbar->redraw();
|
mbar->redraw();
|
||||||
processClicked();
|
processClicked();
|
||||||
mbar->drop_down = false;
|
mbar->drop_down = false;
|
||||||
|
@ -619,12 +619,12 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
{
|
{
|
||||||
winmenu->clear();
|
winmenu->clear();
|
||||||
|
|
||||||
if ( dialog_list && ! dialog_list->empty() )
|
if ( getDialogList() && ! getDialogList()->empty() )
|
||||||
{
|
{
|
||||||
auto first = dialog_list->begin();
|
auto first = getDialogList()->begin();
|
||||||
auto iter = first;
|
auto iter = first;
|
||||||
|
|
||||||
while ( iter != dialog_list->end() && *iter )
|
while ( iter != getDialogList()->end() && *iter )
|
||||||
{
|
{
|
||||||
auto win = static_cast<FDialog*>(*iter);
|
auto win = static_cast<FDialog*>(*iter);
|
||||||
|
|
||||||
|
|
354
src/fmouse.cpp
354
src/fmouse.cpp
|
@ -46,11 +46,8 @@ namespace finalcut
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMouse::FMouse()
|
FMouse::FMouse()
|
||||||
{
|
{
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
clearButtonState();
|
||||||
|
|
||||||
// init bit field with 0
|
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,78 +97,78 @@ inline bool FMouse::hasEvent()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isLeftButtonPressed()
|
inline bool FMouse::isLeftButtonPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.left_button == Pressed);
|
return bool(getButtonState().left_button == Pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isLeftButtonReleased()
|
inline bool FMouse::isLeftButtonReleased()
|
||||||
{
|
{
|
||||||
return bool(b_state.left_button == Released);
|
return bool(getButtonState().left_button == Released);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isLeftButtonDoubleClick()
|
inline bool FMouse::isLeftButtonDoubleClick()
|
||||||
{
|
{
|
||||||
return bool(b_state.left_button == DoubleClick);
|
return bool(getButtonState().left_button == DoubleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isRightButtonPressed()
|
inline bool FMouse::isRightButtonPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.right_button == Pressed);
|
return bool(getButtonState().right_button == Pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isRightButtonReleased()
|
inline bool FMouse::isRightButtonReleased()
|
||||||
{
|
{
|
||||||
return bool(b_state.right_button == Released);
|
return bool(getButtonState().right_button == Released);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isMiddleButtonPressed()
|
inline bool FMouse::isMiddleButtonPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.middle_button == Pressed);
|
return bool(getButtonState().middle_button == Pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isMiddleButtonReleased()
|
inline bool FMouse::isMiddleButtonReleased()
|
||||||
{
|
{
|
||||||
return bool(b_state.middle_button == Released);
|
return bool(getButtonState().middle_button == Released);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isShiftKeyPressed()
|
inline bool FMouse::isShiftKeyPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.shift_button);
|
return bool(getButtonState().shift_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isControlKeyPressed()
|
inline bool FMouse::isControlKeyPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.control_button);
|
return bool(getButtonState().control_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isMetaKeyPressed()
|
inline bool FMouse::isMetaKeyPressed()
|
||||||
{
|
{
|
||||||
return bool(b_state.meta_button);
|
return bool(getButtonState().meta_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isWheelUp()
|
inline bool FMouse::isWheelUp()
|
||||||
{
|
{
|
||||||
return bool(b_state.wheel_up);
|
return bool(getButtonState().wheel_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isWheelDown()
|
inline bool FMouse::isWheelDown()
|
||||||
{
|
{
|
||||||
return bool(b_state.wheel_down);
|
return bool(getButtonState().wheel_down);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMouse::isMoved()
|
inline bool FMouse::isMoved()
|
||||||
{
|
{
|
||||||
return bool(b_state.mouse_moved);
|
return bool(getButtonState().mouse_moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -208,14 +205,88 @@ inline FMouse* FMouse::createMouseObject (mouse_type mt)
|
||||||
return new FMouseX11;
|
return new FMouseX11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::clearButtonState()
|
||||||
|
{
|
||||||
|
// Fill bit field with 0
|
||||||
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// protected methods of FMouse
|
// protected methods of FMouse
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FMouse::button& FMouse::getButtonState()
|
||||||
|
{
|
||||||
|
return b_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FPoint& FMouse::getNewPos()
|
||||||
|
{
|
||||||
|
return new_mouse_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
uInt16 FMouse::getMaxWidth()
|
||||||
|
{
|
||||||
|
return max_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
uInt16 FMouse::getMaxHeight()
|
||||||
|
{
|
||||||
|
return max_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
uInt64 FMouse::getDblclickInterval()
|
||||||
|
{
|
||||||
|
return dblclick_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
timeval* FMouse::getMousePressedTime()
|
||||||
|
{
|
||||||
|
return &time_mousepressed;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouse::setPos (const FPoint& m)
|
void FMouse::setPos (const FPoint& m)
|
||||||
{
|
{
|
||||||
mouse = m;
|
mouse = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::setNewPos (int x, int y)
|
||||||
|
{
|
||||||
|
new_mouse_position.setPoint (x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::setPending (bool is_pending)
|
||||||
|
{
|
||||||
|
input_data_pending = is_pending;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::setMousePressedTime (timeval* time)
|
||||||
|
{
|
||||||
|
time_mousepressed = *time;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::resetMousePressedTime()
|
||||||
|
{
|
||||||
|
time_mousepressed.tv_sec = 0;
|
||||||
|
time_mousepressed.tv_usec = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMouse::setEvent()
|
||||||
|
{
|
||||||
|
mouse_event_occurred = true;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMouse::isDblclickTimeout (timeval* time)
|
bool FMouse::isDblclickTimeout (timeval* time)
|
||||||
{
|
{
|
||||||
|
@ -267,8 +338,7 @@ void FMouseGPM::setRawData (FKeyboard::keybuffer&)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseGPM::processEvent (struct timeval*)
|
void FMouseGPM::processEvent (struct timeval*)
|
||||||
{
|
{
|
||||||
// Fill bit field with 0
|
clearButtonState();
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
|
||||||
|
|
||||||
if ( Gpm_GetEvent(&gpm_ev) == 1 )
|
if ( Gpm_GetEvent(&gpm_ev) == 1 )
|
||||||
{
|
{
|
||||||
|
@ -278,17 +348,17 @@ void FMouseGPM::processEvent (struct timeval*)
|
||||||
{
|
{
|
||||||
GPM_DRAWPOINTER(&gpm_ev);
|
GPM_DRAWPOINTER(&gpm_ev);
|
||||||
has_gpm_mouse_data = false;
|
has_gpm_mouse_data = false;
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gpm_ev.type & GPM_DRAG && gpm_ev.wdx == 0 && gpm_ev.wdy == 0 )
|
if ( gpm_ev.type & GPM_DRAG && gpm_ev.wdx == 0 && gpm_ev.wdy == 0 )
|
||||||
b_state.mouse_moved = true;
|
getButtonState().mouse_moved = true;
|
||||||
|
|
||||||
if ( gpm_ev.wdy > 0 )
|
if ( gpm_ev.wdy > 0 )
|
||||||
b_state.wheel_up = true;
|
getButtonState().wheel_up = true;
|
||||||
else if ( gpm_ev.wdy < 0 )
|
else if ( gpm_ev.wdy < 0 )
|
||||||
b_state.wheel_down = true;
|
getButtonState().wheel_down = true;
|
||||||
|
|
||||||
switch ( gpm_ev.type & 0x0f )
|
switch ( gpm_ev.type & 0x0f )
|
||||||
{
|
{
|
||||||
|
@ -309,20 +379,20 @@ void FMouseGPM::processEvent (struct timeval*)
|
||||||
, std::max(gpm_ev.y, sInt16(1)) ));
|
, std::max(gpm_ev.y, sInt16(1)) ));
|
||||||
|
|
||||||
if ( gpmEvent(false) == mouse_event )
|
if ( gpmEvent(false) == mouse_event )
|
||||||
input_data_pending = true;
|
setPending(true);
|
||||||
else
|
else
|
||||||
input_data_pending = false;
|
setPending(false);
|
||||||
|
|
||||||
GPM_DRAWPOINTER(&gpm_ev);
|
GPM_DRAWPOINTER(&gpm_ev);
|
||||||
has_gpm_mouse_data = false;
|
has_gpm_mouse_data = false;
|
||||||
mouse_event_occurred = true;
|
setEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gpm_fd = -1;
|
gpm_fd = -1;
|
||||||
|
|
||||||
has_gpm_mouse_data = false;
|
has_gpm_mouse_data = false;
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -375,51 +445,51 @@ void FMouseGPM::interpretKeyDown()
|
||||||
if ( gpm_ev.buttons & GPM_B_LEFT )
|
if ( gpm_ev.buttons & GPM_B_LEFT )
|
||||||
{
|
{
|
||||||
if ( gpm_ev.type & GPM_DOUBLE )
|
if ( gpm_ev.type & GPM_DOUBLE )
|
||||||
b_state.left_button = DoubleClick;
|
getButtonState().left_button = DoubleClick;
|
||||||
else
|
else
|
||||||
b_state.left_button = Pressed;
|
getButtonState().left_button = Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_MIDDLE )
|
if ( gpm_ev.buttons & GPM_B_MIDDLE )
|
||||||
b_state.middle_button = Pressed;
|
getButtonState().middle_button = Pressed;
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
||||||
b_state.right_button = Pressed;
|
getButtonState().right_button = Pressed;
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_UP )
|
if ( gpm_ev.buttons & GPM_B_UP )
|
||||||
b_state.wheel_up = true;
|
getButtonState().wheel_up = true;
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_DOWN )
|
if ( gpm_ev.buttons & GPM_B_DOWN )
|
||||||
b_state.wheel_down = true;
|
getButtonState().wheel_down = true;
|
||||||
|
|
||||||
// Keyboard modifiers
|
// Keyboard modifiers
|
||||||
if ( gpm_ev.modifiers & (1 << KG_SHIFT) )
|
if ( gpm_ev.modifiers & (1 << KG_SHIFT) )
|
||||||
b_state.shift_button = true;
|
getButtonState().shift_button = true;
|
||||||
|
|
||||||
if ( gpm_ev.modifiers & ((1 << KG_ALT) | (1 << KG_ALTGR)) )
|
if ( gpm_ev.modifiers & ((1 << KG_ALT) | (1 << KG_ALTGR)) )
|
||||||
b_state.meta_button = true;
|
getButtonState().meta_button = true;
|
||||||
|
|
||||||
if ( gpm_ev.modifiers & (1 << KG_CTRL) )
|
if ( gpm_ev.modifiers & (1 << KG_CTRL) )
|
||||||
b_state.control_button = true;
|
getButtonState().control_button = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseGPM::interpretKeyUp()
|
void FMouseGPM::interpretKeyUp()
|
||||||
{
|
{
|
||||||
if ( gpm_ev.buttons & GPM_B_LEFT )
|
if ( gpm_ev.buttons & GPM_B_LEFT )
|
||||||
b_state.left_button = Released;
|
getButtonState().left_button = Released;
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_MIDDLE )
|
if ( gpm_ev.buttons & GPM_B_MIDDLE )
|
||||||
b_state.middle_button = Released;
|
getButtonState().middle_button = Released;
|
||||||
|
|
||||||
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
if ( gpm_ev.buttons & GPM_B_RIGHT )
|
||||||
b_state.right_button = Released;
|
getButtonState().right_button = Released;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMouseGPM::getGpmKeyPressed (bool pending)
|
bool FMouseGPM::getGpmKeyPressed (bool is_pending)
|
||||||
{
|
{
|
||||||
input_data_pending = pending;
|
setPending(is_pending);
|
||||||
has_gpm_mouse_data = false;
|
has_gpm_mouse_data = false;
|
||||||
int type = gpmEvent();
|
int type = gpmEvent();
|
||||||
|
|
||||||
|
@ -519,7 +589,7 @@ void FMouseX11::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
for (; n < fifo_buf_size; n++)
|
for (; n < fifo_buf_size; n++)
|
||||||
fifo_buf[n] = '\0';
|
fifo_buf[n] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
setPending(bool(fifo_buf[0] != '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -531,24 +601,23 @@ void FMouseX11::processEvent (struct timeval* time)
|
||||||
uChar x = uChar(x11_mouse[1] - 0x20);
|
uChar x = uChar(x11_mouse[1] - 0x20);
|
||||||
uChar y = uChar(x11_mouse[2] - 0x20);
|
uChar y = uChar(x11_mouse[2] - 0x20);
|
||||||
int btn = x11_mouse[0];
|
int btn = x11_mouse[0];
|
||||||
new_mouse_position.setPoint (x, y);
|
setNewPos (x, y);
|
||||||
// Fill bit field with 0
|
clearButtonState();
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
|
||||||
setKeyState (btn);
|
setKeyState (btn);
|
||||||
setMoveState (mouse_position, btn);
|
setMoveState (mouse_position, btn);
|
||||||
setButtonState (btn & button_mask, time);
|
setButtonState (btn & button_mask, time);
|
||||||
|
|
||||||
if ( new_mouse_position == mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& ! isWheelUp()
|
&& ! isWheelUp()
|
||||||
&& ! isWheelDown()
|
&& ! isWheelDown()
|
||||||
&& uChar(btn) == x11_button_state )
|
&& uChar(btn) == x11_button_state )
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
x11_mouse[0] = '\0'; // Delete already interpreted data
|
x11_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_event_occurred = true;
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint(x, y));
|
||||||
// Get the button state from string
|
// Get the button state from string
|
||||||
x11_button_state = uChar(btn);
|
x11_button_state = uChar(btn);
|
||||||
|
@ -562,13 +631,13 @@ void FMouseX11::processEvent (struct timeval* time)
|
||||||
void FMouseX11::setKeyState (int btn)
|
void FMouseX11::setKeyState (int btn)
|
||||||
{
|
{
|
||||||
if ( (btn & key_shift) == key_shift )
|
if ( (btn & key_shift) == key_shift )
|
||||||
b_state.shift_button = Pressed;
|
getButtonState().shift_button = Pressed;
|
||||||
|
|
||||||
if ( (btn & key_meta) == key_meta )
|
if ( (btn & key_meta) == key_meta )
|
||||||
b_state.meta_button = Pressed;
|
getButtonState().meta_button = Pressed;
|
||||||
|
|
||||||
if ( (btn & key_ctrl) == key_ctrl )
|
if ( (btn & key_ctrl) == key_ctrl )
|
||||||
b_state.control_button = Pressed;
|
getButtonState().control_button = Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -578,7 +647,7 @@ void FMouseX11::setMoveState (const FPoint& mouse_position, int btn)
|
||||||
&& (btn & button_mask) <= button3_pressed_move
|
&& (btn & button_mask) <= button3_pressed_move
|
||||||
&& ! mouse_position.isOrigin() )
|
&& ! mouse_position.isOrigin() )
|
||||||
{
|
{
|
||||||
b_state.mouse_moved = true;
|
getButtonState().mouse_moved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,33 +662,30 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
case button1_pressed:
|
case button1_pressed:
|
||||||
case button1_pressed_move:
|
case button1_pressed_move:
|
||||||
if ( mouse_position == new_mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& x11_button_state == all_buttons_released
|
&& x11_button_state == all_buttons_released
|
||||||
&& ! isDblclickTimeout(&time_mousepressed) )
|
&& ! isDblclickTimeout(getMousePressedTime()) )
|
||||||
{
|
{
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().left_button = DoubleClick;
|
||||||
b_state.left_button = DoubleClick;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time_mousepressed = *time; // save click time
|
setMousePressedTime (time); // save click time
|
||||||
b_state.left_button = Pressed;
|
getButtonState().left_button = Pressed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2_pressed:
|
case button2_pressed:
|
||||||
case button2_pressed_move:
|
case button2_pressed_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().middle_button = Pressed;
|
||||||
b_state.middle_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3_pressed:
|
case button3_pressed:
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().right_button = Pressed;
|
||||||
b_state.right_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case all_buttons_released:
|
case all_buttons_released:
|
||||||
|
@ -627,17 +693,17 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
case button1_pressed:
|
case button1_pressed:
|
||||||
case button1_pressed_move:
|
case button1_pressed_move:
|
||||||
b_state.left_button = Released;
|
getButtonState().left_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2_pressed:
|
case button2_pressed:
|
||||||
case button2_pressed_move:
|
case button2_pressed_move:
|
||||||
b_state.middle_button = Released;
|
getButtonState().middle_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3_pressed:
|
case button3_pressed:
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
b_state.right_button = Released;
|
getButtonState().right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -646,15 +712,13 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_up:
|
case button_up:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_up = Pressed;
|
||||||
b_state.wheel_up = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_down:
|
case button_down:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_down = Pressed;
|
||||||
b_state.wheel_down = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -708,7 +772,7 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||||
fifo_buf[n] = '\0';
|
fifo_buf[n] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
setPending(bool(fifo_buf[0] != '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -726,7 +790,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +803,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +815,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -759,9 +823,8 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
y = uInt16(10 * y + (*p - '0'));
|
y = uInt16(10 * y + (*p - '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
new_mouse_position.setPoint (x, y);
|
setNewPos (x, y);
|
||||||
// Fill bit field with 0
|
clearButtonState();
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
|
||||||
setKeyState (btn);
|
setKeyState (btn);
|
||||||
setMoveState (mouse_position, btn);
|
setMoveState (mouse_position, btn);
|
||||||
|
|
||||||
|
@ -770,17 +833,17 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
else // *p == released
|
else // *p == released
|
||||||
setReleasedButtonState (btn & button_mask);
|
setReleasedButtonState (btn & button_mask);
|
||||||
|
|
||||||
if ( mouse_position == new_mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& ! isWheelUp()
|
&& ! isWheelUp()
|
||||||
&& ! isWheelDown()
|
&& ! isWheelDown()
|
||||||
&& sgr_button_state == uChar(((*p & 0x20) << 2) + btn) )
|
&& sgr_button_state == uChar(((*p & 0x20) << 2) + btn) )
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
sgr_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_event_occurred = true;
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint(x, y));
|
||||||
// Get the button state from string
|
// Get the button state from string
|
||||||
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
|
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
|
||||||
|
@ -793,13 +856,13 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
void FMouseSGR::setKeyState (int btn)
|
void FMouseSGR::setKeyState (int btn)
|
||||||
{
|
{
|
||||||
if ( (btn & key_shift) == key_shift )
|
if ( (btn & key_shift) == key_shift )
|
||||||
b_state.shift_button = true;
|
getButtonState().shift_button = true;
|
||||||
|
|
||||||
if ( (btn & key_meta) == key_meta )
|
if ( (btn & key_meta) == key_meta )
|
||||||
b_state.meta_button = true;
|
getButtonState().meta_button = true;
|
||||||
|
|
||||||
if ( (btn & key_ctrl) == key_ctrl )
|
if ( (btn & key_ctrl) == key_ctrl )
|
||||||
b_state.control_button = true;
|
getButtonState().control_button = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -809,7 +872,7 @@ void FMouseSGR::setMoveState (const FPoint& mouse_position, int btn)
|
||||||
&& (btn & button_mask) <= button3_move
|
&& (btn & button_mask) <= button3_move
|
||||||
&& ! mouse_position.isOrigin() )
|
&& ! mouse_position.isOrigin() )
|
||||||
{
|
{
|
||||||
b_state.mouse_moved = true;
|
getButtonState().mouse_moved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,45 +887,40 @@ void FMouseSGR::setPressedButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
case button1:
|
case button1:
|
||||||
case button1_move:
|
case button1_move:
|
||||||
if ( mouse_position == new_mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& (((sgr_button_state & 0x80) >> 2) + 'M') == released
|
&& (((sgr_button_state & 0x80) >> 2) + 'M') == released
|
||||||
&& ! isDblclickTimeout(&time_mousepressed) )
|
&& ! isDblclickTimeout(getMousePressedTime()) )
|
||||||
{
|
{
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().left_button = DoubleClick;
|
||||||
b_state.left_button = DoubleClick;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time_mousepressed = *time; // save click time
|
setMousePressedTime (time); // save click time
|
||||||
b_state.left_button = Pressed;
|
getButtonState().left_button = Pressed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2:
|
case button2:
|
||||||
case button2_move:
|
case button2_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().middle_button = Pressed;
|
||||||
b_state.middle_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3:
|
case button3:
|
||||||
case button3_move:
|
case button3_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().right_button = Pressed;
|
||||||
b_state.right_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_up:
|
case button_up:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_up = true;
|
||||||
b_state.wheel_up = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_down:
|
case button_down:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_down = true;
|
||||||
b_state.wheel_down = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -879,17 +937,17 @@ void FMouseSGR::setReleasedButtonState (int btn)
|
||||||
{
|
{
|
||||||
case button1:
|
case button1:
|
||||||
case button1_move:
|
case button1_move:
|
||||||
b_state.left_button = Released;
|
getButtonState().left_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2:
|
case button2:
|
||||||
case button2_move:
|
case button2_move:
|
||||||
b_state.middle_button = Released;
|
getButtonState().middle_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3:
|
case button3:
|
||||||
case button3_move:
|
case button3_move:
|
||||||
b_state.right_button = Released;
|
getButtonState().right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -943,7 +1001,7 @@ void FMouseUrxvt::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||||
fifo_buf[n] = '\0';
|
fifo_buf[n] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
setPending(bool(fifo_buf[0] != '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -965,7 +1023,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -984,7 +1042,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1061,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
if ( *p < '0' || *p > '9')
|
if ( *p < '0' || *p > '9')
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1018,30 +1076,29 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
if ( y_neg || y == 0 )
|
if ( y_neg || y == 0 )
|
||||||
y = 1;
|
y = 1;
|
||||||
|
|
||||||
if ( x > max_width )
|
if ( x > getMaxWidth() )
|
||||||
x = max_width;
|
x = getMaxWidth();
|
||||||
|
|
||||||
if ( y > max_height )
|
if ( y > getMaxHeight() )
|
||||||
y = max_height;
|
y = getMaxHeight();
|
||||||
|
|
||||||
new_mouse_position.setPoint (x, y);
|
setNewPos (x, y);
|
||||||
// Fill bit field with 0
|
clearButtonState();
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
|
||||||
setKeyState (btn);
|
setKeyState (btn);
|
||||||
setMoveState (mouse_position, btn);
|
setMoveState (mouse_position, btn);
|
||||||
setButtonState (btn & button_mask, time);
|
setButtonState (btn & button_mask, time);
|
||||||
|
|
||||||
if ( mouse_position == new_mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& ! isWheelUp()
|
&& ! isWheelUp()
|
||||||
&& ! isWheelDown()
|
&& ! isWheelDown()
|
||||||
&& urxvt_button_state == uChar(btn) )
|
&& urxvt_button_state == uChar(btn) )
|
||||||
{
|
{
|
||||||
mouse_event_occurred = false;
|
clearEvent();
|
||||||
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
urxvt_mouse[0] = '\0'; // Delete already interpreted data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_event_occurred = true;
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint(x, y));
|
||||||
urxvt_button_state = uChar(btn);
|
urxvt_button_state = uChar(btn);
|
||||||
// Delete already interpreted data
|
// Delete already interpreted data
|
||||||
|
@ -1054,13 +1111,13 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
void FMouseUrxvt::setKeyState (int btn)
|
void FMouseUrxvt::setKeyState (int btn)
|
||||||
{
|
{
|
||||||
if ( (btn & key_shift) == key_shift )
|
if ( (btn & key_shift) == key_shift )
|
||||||
b_state.shift_button = Pressed;
|
getButtonState().shift_button = Pressed;
|
||||||
|
|
||||||
if ( (btn & key_meta) == key_meta )
|
if ( (btn & key_meta) == key_meta )
|
||||||
b_state.meta_button = Pressed;
|
getButtonState().meta_button = Pressed;
|
||||||
|
|
||||||
if ( (btn & key_ctrl) == key_ctrl )
|
if ( (btn & key_ctrl) == key_ctrl )
|
||||||
b_state.control_button = Pressed;
|
getButtonState().control_button = Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1070,7 +1127,7 @@ void FMouseUrxvt::setMoveState (const FPoint& mouse_position, int btn)
|
||||||
&& (btn & button_mask) <= button3_pressed_move
|
&& (btn & button_mask) <= button3_pressed_move
|
||||||
&& ! mouse_position.isOrigin() )
|
&& ! mouse_position.isOrigin() )
|
||||||
{
|
{
|
||||||
b_state.mouse_moved = true;
|
getButtonState().mouse_moved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,33 +1142,30 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
case button1_pressed:
|
case button1_pressed:
|
||||||
case button1_pressed_move:
|
case button1_pressed_move:
|
||||||
if ( mouse_position == new_mouse_position
|
if ( mouse_position == getNewPos()
|
||||||
&& urxvt_button_state == all_buttons_released
|
&& urxvt_button_state == all_buttons_released
|
||||||
&& ! isDblclickTimeout(&time_mousepressed) )
|
&& ! isDblclickTimeout(getMousePressedTime()) )
|
||||||
{
|
{
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().left_button = DoubleClick;
|
||||||
b_state.left_button = DoubleClick;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time_mousepressed = *time; // save click time
|
setMousePressedTime (time); // save click time
|
||||||
b_state.left_button = Pressed;
|
getButtonState().left_button = Pressed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2_pressed:
|
case button2_pressed:
|
||||||
case button2_pressed_move:
|
case button2_pressed_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().middle_button = Pressed;
|
||||||
b_state.middle_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3_pressed:
|
case button3_pressed:
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().right_button = Pressed;
|
||||||
b_state.right_button = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case all_buttons_released:
|
case all_buttons_released:
|
||||||
|
@ -1119,17 +1173,17 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
case button1_pressed:
|
case button1_pressed:
|
||||||
case button1_pressed_move:
|
case button1_pressed_move:
|
||||||
b_state.left_button = Released;
|
getButtonState().left_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button2_pressed:
|
case button2_pressed:
|
||||||
case button2_pressed_move:
|
case button2_pressed_move:
|
||||||
b_state.middle_button = Released;
|
getButtonState().middle_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button3_pressed:
|
case button3_pressed:
|
||||||
case button3_pressed_move:
|
case button3_pressed_move:
|
||||||
b_state.right_button = Released;
|
getButtonState().right_button = Released;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1138,15 +1192,13 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_up:
|
case button_up:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_up = Pressed;
|
||||||
b_state.wheel_up = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case button_down:
|
case button_down:
|
||||||
time_mousepressed.tv_sec = 0;
|
resetMousePressedTime();
|
||||||
time_mousepressed.tv_usec = 0;
|
getButtonState().wheel_down = Pressed;
|
||||||
b_state.wheel_down = Pressed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -86,12 +86,12 @@ bool FProgressbar::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::VT100
|
&& getEncoding() != fc::VT100
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
flags.shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize(1, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags.shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void FProgressbar::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
||||||
hideSize (getSize() + shadow);
|
hideArea (getSize() + shadow);
|
||||||
print() << FPoint(int(getWidth()) - 4, 0)
|
print() << FPoint(int(getWidth()) - 4, 0)
|
||||||
<< (" "); // hide percentage
|
<< (" "); // hide percentage
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ void FProgressbar::draw()
|
||||||
drawProgressLabel();
|
drawProgressLabel();
|
||||||
drawProgressBar();
|
drawProgressBar();
|
||||||
|
|
||||||
if ( flags.shadow )
|
if ( getFlags().shadow )
|
||||||
drawShadow ();
|
drawShadow ();
|
||||||
|
|
||||||
flush_out();
|
flush_out();
|
||||||
|
@ -145,7 +145,10 @@ void FProgressbar::drawProgressLabel()
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor ( wc.dialog_fg, wc.dialog_bg );
|
setColor ( wc.dialog_fg, wc.dialog_bg );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -189,6 +192,7 @@ std::size_t FProgressbar::drawProgressIndicator()
|
||||||
|
|
||||||
double length = double(bar_length * percentage) / 100;
|
double length = double(bar_length * percentage) / 100;
|
||||||
auto len = std::size_t(trunc(length));
|
auto len = std::size_t(trunc(length));
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
print() << FColorPair (wc.progressbar_fg, wc.progressbar_fg)
|
print() << FColorPair (wc.progressbar_fg, wc.progressbar_fg)
|
||||||
<< FString (len, fc::FullBlock); // █
|
<< FString (len, fc::FullBlock); // █
|
||||||
|
|
||||||
|
@ -221,6 +225,7 @@ void FProgressbar::drawProgressBackground (std::size_t len)
|
||||||
// Draw the progress background
|
// Draw the progress background
|
||||||
|
|
||||||
std::size_t bg_len = bar_length - len;
|
std::size_t bg_len = bar_length - len;
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.progressbar_fg, wc.progressbar_bg);
|
setColor (wc.progressbar_fg, wc.progressbar_bg);
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
|
|
|
@ -55,8 +55,8 @@ FRadioMenuItem::~FRadioMenuItem() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRadioMenuItem::init (FWidget* parent)
|
void FRadioMenuItem::init (FWidget* parent)
|
||||||
{
|
{
|
||||||
checkable = true;
|
setCheckable();
|
||||||
radio_button = true;
|
setRadioButton();
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
return;
|
return;
|
||||||
|
@ -83,9 +83,9 @@ void FRadioMenuItem::processToggle()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRadioMenuItem::processClicked()
|
void FRadioMenuItem::processClicked()
|
||||||
{
|
{
|
||||||
if ( ! checked )
|
if ( ! isChecked() )
|
||||||
{
|
{
|
||||||
checked = true;
|
setChecked();
|
||||||
processToggle();
|
processToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -472,6 +472,7 @@ void FScrollbar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawVerticalBar()
|
void FScrollbar::drawVerticalBar()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
for (int z{1}; z <= slider_pos; z++)
|
for (int z{1}; z <= slider_pos; z++)
|
||||||
|
@ -530,6 +531,7 @@ inline void FScrollbar::drawVerticalBackgroundLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawHorizontalBar()
|
void FScrollbar::drawHorizontalBar()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
@ -575,6 +577,7 @@ inline void FScrollbar::drawHorizontalBackgroundColumn()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawButtons()
|
void FScrollbar::drawButtons()
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.scrollbar_button_fg, wc.scrollbar_button_bg);
|
setColor (wc.scrollbar_button_fg, wc.scrollbar_button_bg);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
|
|
@ -47,7 +47,8 @@ FScrollView::FScrollView (FWidget* parent)
|
||||||
FScrollView::~FScrollView() // destructor
|
FScrollView::~FScrollView() // destructor
|
||||||
{
|
{
|
||||||
removeArea (viewport);
|
removeArea (viewport);
|
||||||
child_print_area = viewport = nullptr;
|
viewport = nullptr;
|
||||||
|
setChildPrintArea (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ void FScrollView::setScrollWidth (std::size_t width)
|
||||||
(
|
(
|
||||||
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
||||||
);
|
);
|
||||||
child_print_area = viewport;
|
setChildPrintArea (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
hbar->setMaximum (int(width - getViewportWidth()));
|
hbar->setMaximum (int(width - getViewportWidth()));
|
||||||
|
@ -100,7 +101,7 @@ void FScrollView::setScrollHeight (std::size_t height)
|
||||||
(
|
(
|
||||||
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
||||||
);
|
);
|
||||||
child_print_area = viewport;
|
setChildPrintArea (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->setMaximum (int(height - getViewportHeight()));
|
vbar->setMaximum (int(height - getViewportHeight()));
|
||||||
|
@ -135,7 +136,7 @@ void FScrollView::setScrollSize (const FSize& size)
|
||||||
(
|
(
|
||||||
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
|
||||||
);
|
);
|
||||||
child_print_area = viewport;
|
setChildPrintArea (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
|
@ -634,9 +635,9 @@ FVTerm::term_area* FScrollView::getPrintArea()
|
||||||
|
|
||||||
if ( use_own_print_area || ! viewport )
|
if ( use_own_print_area || ! viewport )
|
||||||
{
|
{
|
||||||
child_print_area = nullptr;
|
setChildPrintArea (nullptr);
|
||||||
auto area = FWidget::getPrintArea();
|
auto area = FWidget::getPrintArea();
|
||||||
child_print_area = viewport;
|
setChildPrintArea (viewport);
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -696,41 +697,42 @@ void FScrollView::copy2area()
|
||||||
if ( ! viewport->has_changes )
|
if ( ! viewport->has_changes )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ax = getTermX() - print_area->offset_left
|
auto printarea = getCurrentPrintArea();
|
||||||
, ay = getTermY() - print_area->offset_top
|
int ax = getTermX() - printarea->offset_left
|
||||||
|
, ay = getTermY() - printarea->offset_top
|
||||||
, dx = viewport_geometry.getX()
|
, dx = viewport_geometry.getX()
|
||||||
, dy = viewport_geometry.getY()
|
, dy = viewport_geometry.getY()
|
||||||
, y_end = int(getViewportHeight())
|
, y_end = int(getViewportHeight())
|
||||||
, x_end = int(getViewportWidth());
|
, x_end = int(getViewportWidth());
|
||||||
|
|
||||||
// viewport width does not fit into the print_area
|
// viewport width does not fit into the print_area
|
||||||
if ( print_area->width <= ax + x_end )
|
if ( printarea->width <= ax + x_end )
|
||||||
x_end = print_area->width - ax;
|
x_end = printarea->width - ax;
|
||||||
|
|
||||||
// viewport height does not fit into the print_area
|
// viewport height does not fit into the print_area
|
||||||
if ( print_area->height <= ay + y_end )
|
if ( printarea->height <= ay + y_end )
|
||||||
y_end = print_area->height - ay;
|
y_end = printarea->height - ay;
|
||||||
|
|
||||||
for (int y{0}; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
charData* vc{}; // viewport character
|
charData* vc{}; // viewport character
|
||||||
charData* ac{}; // area character
|
charData* ac{}; // area character
|
||||||
int v_line_len = viewport->width;
|
int v_line_len = viewport->width;
|
||||||
int a_line_len = print_area->width + print_area->right_shadow;
|
int a_line_len = printarea->width + printarea->right_shadow;
|
||||||
vc = &viewport->text[(dy + y) * v_line_len + dx];
|
vc = &viewport->text[(dy + y) * v_line_len + dx];
|
||||||
ac = &print_area->text[(ay + y) * a_line_len + ax];
|
ac = &printarea->text[(ay + y) * a_line_len + ax];
|
||||||
std::memcpy (ac, vc, sizeof(charData) * unsigned(x_end));
|
std::memcpy (ac, vc, sizeof(charData) * unsigned(x_end));
|
||||||
|
|
||||||
if ( int(print_area->changes[ay + y].xmin) > ax )
|
if ( int(printarea->changes[ay + y].xmin) > ax )
|
||||||
print_area->changes[ay + y].xmin = uInt(ax);
|
printarea->changes[ay + y].xmin = uInt(ax);
|
||||||
|
|
||||||
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
|
if ( int(printarea->changes[ay + y].xmax) < ax + x_end - 1 )
|
||||||
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
|
printarea->changes[ay + y].xmax = uInt(ax + x_end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setViewportCursor();
|
setViewportCursor();
|
||||||
viewport->has_changes = false;
|
viewport->has_changes = false;
|
||||||
print_area->has_changes = true;
|
printarea->has_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -762,6 +764,7 @@ void FScrollView::init (FWidget* parent)
|
||||||
|
|
||||||
initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange);
|
initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_HBarChange);
|
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_HBarChange);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
setGeometry (FPoint(1, 1), FSize(4, 4));
|
setGeometry (FPoint(1, 1), FSize(4, 4));
|
||||||
|
@ -791,7 +794,7 @@ void FScrollView::init (FWidget* parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( viewport )
|
if ( viewport )
|
||||||
child_print_area = viewport;
|
setChildPrintArea (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -896,14 +899,15 @@ void FScrollView::setViewportCursor()
|
||||||
FPoint cursor_pos ( viewport->input_cursor_x - 1
|
FPoint cursor_pos ( viewport->input_cursor_x - 1
|
||||||
, viewport->input_cursor_y - 1 );
|
, viewport->input_cursor_y - 1 );
|
||||||
FPoint window_cursor_pos(getViewportCursorPos());
|
FPoint window_cursor_pos(getViewportCursorPos());
|
||||||
print_area->input_cursor_x = window_cursor_pos.getX();
|
auto printarea = getCurrentPrintArea();
|
||||||
print_area->input_cursor_y = window_cursor_pos.getY();
|
printarea->input_cursor_x = window_cursor_pos.getX();
|
||||||
|
printarea->input_cursor_y = window_cursor_pos.getY();
|
||||||
|
|
||||||
if ( viewport->input_cursor_visible
|
if ( viewport->input_cursor_visible
|
||||||
&& viewport_geometry.contains(cursor_pos) )
|
&& viewport_geometry.contains(cursor_pos) )
|
||||||
print_area->input_cursor_visible = true;
|
printarea->input_cursor_visible = true;
|
||||||
else
|
else
|
||||||
print_area->input_cursor_visible = false;
|
printarea->input_cursor_visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -175,6 +175,7 @@ bool FStatusBar::hasActivatedKey()
|
||||||
void FStatusBar::hide()
|
void FStatusBar::hide()
|
||||||
{
|
{
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
FColor fg = wc.term_fg;
|
FColor fg = wc.term_fg;
|
||||||
FColor bg = wc.term_bg;
|
FColor bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -211,6 +212,7 @@ void FStatusBar::drawMessage()
|
||||||
if ( isLastActiveFocus )
|
if ( isLastActiveFocus )
|
||||||
space_offset = 0;
|
space_offset = 0;
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
setPrintPos (FPoint(x, 1));
|
setPrintPos (FPoint(x, 1));
|
||||||
|
|
||||||
|
@ -516,6 +518,7 @@ void FStatusBar::init()
|
||||||
if ( getRootWidget() )
|
if ( getRootWidget() )
|
||||||
getRootWidget()->setBottomPadding(1, true);
|
getRootWidget()->setBottomPadding(1, true);
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.statusbar_fg);
|
setForegroundColor (wc.statusbar_fg);
|
||||||
setBackgroundColor (wc.statusbar_bg);
|
setBackgroundColor (wc.statusbar_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
@ -561,6 +564,7 @@ void FStatusBar::drawKeys()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
|
|
||||||
for (; x <= int(screenWidth); x++)
|
for (; x <= int(screenWidth); x++)
|
||||||
|
@ -582,6 +586,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
// Draw not active key
|
// Draw not active key
|
||||||
|
|
||||||
auto item = *iter;
|
auto item = *iter;
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -644,6 +649,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor ( wc.statusbar_active_hotkey_fg
|
setColor ( wc.statusbar_active_hotkey_fg
|
||||||
, wc.statusbar_active_hotkey_bg );
|
, wc.statusbar_active_hotkey_bg );
|
||||||
x++;
|
x++;
|
||||||
|
|
|
@ -143,6 +143,7 @@ inline void FSwitch::drawChecked()
|
||||||
{
|
{
|
||||||
wchar_t on[6]{L" On "};
|
wchar_t on[6]{L" On "};
|
||||||
wchar_t off[6]{L" Off "};
|
wchar_t off[6]{L" Off "};
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( hasFocus() && ! button_pressed )
|
if ( hasFocus() && ! button_pressed )
|
||||||
{
|
{
|
||||||
|
@ -193,6 +194,7 @@ inline void FSwitch::drawUnchecked()
|
||||||
wchar_t on[6]{L" On "};
|
wchar_t on[6]{L" On "};
|
||||||
wchar_t off[6]{L" Off "};
|
wchar_t off[6]{L" Off "};
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
|
|
@ -195,7 +195,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
void FTextView::hide()
|
void FTextView::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
hideSize (getSize());
|
hideArea (getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -597,6 +597,7 @@ void FTextView::init()
|
||||||
{
|
{
|
||||||
initScrollbar (vbar, fc::vertical, &FTextView::cb_VBarChange);
|
initScrollbar (vbar, fc::vertical, &FTextView::cb_VBarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, &FTextView::cb_HBarChange);
|
initScrollbar (hbar, fc::horizontal, &FTextView::cb_HBarChange);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
|
|
@ -109,6 +109,7 @@ bool FToggleButton::setNoUnderline (bool enable)
|
||||||
bool FToggleButton::setEnable (bool enable)
|
bool FToggleButton::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
FWidget::setEnable(enable);
|
FWidget::setEnable(enable);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
|
@ -139,6 +140,7 @@ bool FToggleButton::setEnable (bool enable)
|
||||||
bool FToggleButton::setFocus (bool enable)
|
bool FToggleButton::setFocus (bool enable)
|
||||||
{
|
{
|
||||||
FWidget::setFocus(enable);
|
FWidget::setFocus(enable);
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
|
@ -206,7 +208,7 @@ void FToggleButton::setText (const FString& txt)
|
||||||
void FToggleButton::hide()
|
void FToggleButton::hide()
|
||||||
{
|
{
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
hideSize (getSize());
|
hideArea (getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -532,6 +534,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
|
||||||
void FToggleButton::init()
|
void FToggleButton::init()
|
||||||
{
|
{
|
||||||
setGeometry (FPoint(1, 1), FSize(4, 1), false); // initialize geometry values
|
setGeometry (FPoint(1, 1), FSize(4, 1), false); // initialize geometry values
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
|
@ -561,6 +564,8 @@ void FToggleButton::drawText ( wchar_t LabelText[]
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
else
|
else
|
||||||
|
|
|
@ -126,6 +126,7 @@ void FToolTip::init()
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
||||||
setMinimumSize (FSize(3, 3));
|
setMinimumSize (FSize(3, 3));
|
||||||
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.tooltip_fg);
|
setForegroundColor (wc.tooltip_fg);
|
||||||
setBackgroundColor (wc.tooltip_bg);
|
setBackgroundColor (wc.tooltip_bg);
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
|
|
|
@ -876,9 +876,9 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
||||||
bool found = bool(area == vdesktop);
|
bool found = bool(area == vdesktop);
|
||||||
auto is_covered = non_covered;
|
auto is_covered = non_covered;
|
||||||
|
|
||||||
if ( FWidget::window_list && ! FWidget::window_list->empty() )
|
if ( FWidget::getWindowList() && ! FWidget::getWindowList()->empty() )
|
||||||
{
|
{
|
||||||
for (auto& win_obj : *FWidget::window_list)
|
for (auto& win_obj : *FWidget::getWindowList())
|
||||||
{
|
{
|
||||||
auto win = win_obj->getVWin();
|
auto win = win_obj->getVWin();
|
||||||
|
|
||||||
|
@ -1137,11 +1137,11 @@ void FVTerm::updateVTerm()
|
||||||
|
|
||||||
FWidget* widget = static_cast<FWidget*>(vterm->widget);
|
FWidget* widget = static_cast<FWidget*>(vterm->widget);
|
||||||
|
|
||||||
if ( ! widget->window_list || widget->window_list->empty() )
|
if ( ! widget->getWindowList() || widget->getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = widget->window_list->begin();
|
auto iter = widget->getWindowList()->begin();
|
||||||
auto end = widget->window_list->end();
|
auto end = widget->getWindowList()->end();
|
||||||
|
|
||||||
for (; iter != end; ++iter)
|
for (; iter != end; ++iter)
|
||||||
{
|
{
|
||||||
|
@ -1663,10 +1663,10 @@ charData FVTerm::generateCharacter (const FPoint& pos)
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
||||||
|
|
||||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
if ( ! FWidget::getWindowList() || FWidget::getWindowList()->empty() )
|
||||||
return *sc;
|
return *sc;
|
||||||
|
|
||||||
for (auto& win_obj : *FWidget::window_list)
|
for (auto& win_obj : *FWidget::getWindowList())
|
||||||
{
|
{
|
||||||
auto win = win_obj->getVWin();
|
auto win = win_obj->getVWin();
|
||||||
|
|
||||||
|
@ -1751,14 +1751,14 @@ charData FVTerm::getCharacter ( character_type char_type
|
||||||
|
|
||||||
auto cc = &vdesktop->text[yy * vdesktop->width + xx]; // covered character
|
auto cc = &vdesktop->text[yy * vdesktop->width + xx]; // covered character
|
||||||
|
|
||||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
if ( ! FWidget::getWindowList() || FWidget::getWindowList()->empty() )
|
||||||
return *cc;
|
return *cc;
|
||||||
|
|
||||||
// Get the window layer of this object
|
// Get the window layer of this object
|
||||||
auto w = static_cast<FWidget*>(obj);
|
auto w = static_cast<FWidget*>(obj);
|
||||||
int layer = FWindow::getWindowLayer(w);
|
int layer = FWindow::getWindowLayer(w);
|
||||||
|
|
||||||
for (auto&& win_obj : *FWidget::window_list)
|
for (auto&& win_obj : *FWidget::getWindowList())
|
||||||
{
|
{
|
||||||
bool significant_char;
|
bool significant_char;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ FWidget::widgetList* FWidget::close_widget{nullptr};
|
||||||
FWidgetColors FWidget::wc{};
|
FWidgetColors FWidget::wc{};
|
||||||
bool FWidget::init_desktop{false};
|
bool FWidget::init_desktop{false};
|
||||||
bool FWidget::hideable{false};
|
bool FWidget::hideable{false};
|
||||||
uInt FWidget::modal_dialogs{};
|
uInt FWidget::modal_dialog_counter{};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FWidget
|
// class FWidget
|
||||||
|
@ -78,7 +78,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
||||||
rootObject = this;
|
rootObject = this;
|
||||||
show_root_widget = nullptr;
|
show_root_widget = nullptr;
|
||||||
redraw_root_widget = nullptr;
|
redraw_root_widget = nullptr;
|
||||||
modal_dialogs = 0;
|
modal_dialog_counter = 0;
|
||||||
statusbar = nullptr;
|
statusbar = nullptr;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,12 @@ FWidget::~FWidget() // destructor
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( accelerator_list )
|
||||||
|
{
|
||||||
|
delete accelerator_list;
|
||||||
|
accelerator_list = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// finish the program
|
// finish the program
|
||||||
if ( rootObject == this )
|
if ( rootObject == this )
|
||||||
finish();
|
finish();
|
||||||
|
@ -992,7 +998,7 @@ void FWidget::redraw()
|
||||||
startTerminalUpdate();
|
startTerminalUpdate();
|
||||||
// clean desktop
|
// clean desktop
|
||||||
setColor (wc.term_fg, wc.term_bg);
|
setColor (wc.term_fg, wc.term_bg);
|
||||||
clearArea (vdesktop);
|
clearArea (getVirtualDesktop());
|
||||||
}
|
}
|
||||||
else if ( ! isShown() )
|
else if ( ! isShown() )
|
||||||
return;
|
return;
|
||||||
|
@ -1029,7 +1035,7 @@ void FWidget::resize()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
resizeVTerm (term_geometry.getSize());
|
resizeVTerm (term_geometry.getSize());
|
||||||
resizeArea (term_geometry, getShadow(), vdesktop);
|
resizeArea (term_geometry, getShadow(), getVirtualDesktop());
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1056,7 +1062,7 @@ void FWidget::show()
|
||||||
// draw the vdesktop
|
// draw the vdesktop
|
||||||
auto r = getRootWidget();
|
auto r = getRootWidget();
|
||||||
setColor(r->getForegroundColor(), r->getBackgroundColor());
|
setColor(r->getForegroundColor(), r->getBackgroundColor());
|
||||||
clearArea (vdesktop);
|
clearArea (getVirtualDesktop());
|
||||||
init_desktop = true;
|
init_desktop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1437,8 +1443,8 @@ FVTerm::term_area* FWidget::getPrintArea()
|
||||||
{
|
{
|
||||||
// returns the print area of this object
|
// returns the print area of this object
|
||||||
|
|
||||||
if ( print_area )
|
if ( getCurrentPrintArea() )
|
||||||
return print_area;
|
return getCurrentPrintArea();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FWidget* obj{};
|
FWidget* obj{};
|
||||||
|
@ -1449,28 +1455,28 @@ FVTerm::term_area* FWidget::getPrintArea()
|
||||||
obj = p_obj;
|
obj = p_obj;
|
||||||
p_obj = static_cast<FWidget*>(obj->getParent());
|
p_obj = static_cast<FWidget*>(obj->getParent());
|
||||||
}
|
}
|
||||||
while ( ! obj->vwin && ! obj->child_print_area && p_obj );
|
while ( ! obj->getVWin() && ! obj->getChildPrintArea() && p_obj );
|
||||||
|
|
||||||
if ( obj->vwin )
|
if ( obj->getVWin() )
|
||||||
{
|
{
|
||||||
print_area = obj->vwin;
|
setPrintArea (obj->getVWin());
|
||||||
return print_area;
|
return getCurrentPrintArea();
|
||||||
}
|
}
|
||||||
else if ( obj->child_print_area )
|
else if ( obj->getChildPrintArea() )
|
||||||
{
|
{
|
||||||
print_area = obj->child_print_area;
|
setPrintArea (obj->getChildPrintArea());
|
||||||
return print_area;
|
return getCurrentPrintArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return vdesktop;
|
return getVirtualDesktop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::addPreprocessingHandler ( FVTerm* instance
|
void FWidget::addPreprocessingHandler ( FVTerm* instance
|
||||||
, FPreprocessingHandler handler )
|
, FPreprocessingHandler handler )
|
||||||
{
|
{
|
||||||
if ( ! print_area )
|
if ( ! getCurrentPrintArea() )
|
||||||
FWidget::getPrintArea();
|
FWidget::getPrintArea();
|
||||||
|
|
||||||
FVTerm::addPreprocessingHandler (instance, handler);
|
FVTerm::addPreprocessingHandler (instance, handler);
|
||||||
|
@ -1479,7 +1485,7 @@ void FWidget::addPreprocessingHandler ( FVTerm* instance
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::delPreprocessingHandler (FVTerm* instance)
|
void FWidget::delPreprocessingHandler (FVTerm* instance)
|
||||||
{
|
{
|
||||||
if ( ! print_area )
|
if ( ! getCurrentPrintArea() )
|
||||||
FWidget::getPrintArea();
|
FWidget::getPrintArea();
|
||||||
|
|
||||||
FVTerm::delPreprocessingHandler (instance);
|
FVTerm::delPreprocessingHandler (instance);
|
||||||
|
@ -1491,8 +1497,8 @@ bool FWidget::isChildPrintArea() const
|
||||||
auto p_obj = static_cast<FWidget*>(getParent());
|
auto p_obj = static_cast<FWidget*>(getParent());
|
||||||
|
|
||||||
if ( p_obj
|
if ( p_obj
|
||||||
&& p_obj->child_print_area
|
&& p_obj->getChildPrintArea()
|
||||||
&& p_obj->child_print_area == print_area )
|
&& p_obj->getChildPrintArea() == getCurrentPrintArea() )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1597,7 +1603,7 @@ void FWidget::adjustSizeGlobal()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::hideSize (const FSize& size)
|
void FWidget::hideArea (const FSize& size)
|
||||||
{
|
{
|
||||||
if ( size.isEmpty() )
|
if ( size.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
@ -1622,7 +1628,7 @@ void FWidget::hideSize (const FSize& size)
|
||||||
if ( blank == 0 )
|
if ( blank == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int y{0}; y < int(size.getWidth()); y++)
|
for (int y{0}; y < int(size.getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + y) << blank;
|
print() << FPoint(1, 1 + y) << blank;
|
||||||
}
|
}
|
||||||
|
@ -1631,6 +1637,23 @@ void FWidget::hideSize (const FSize& size)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::createWidgetAcceleratorList()
|
||||||
|
{
|
||||||
|
if ( accelerator_list == 0 )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
accelerator_list = new Accelerators();
|
||||||
|
}
|
||||||
|
catch (const std::bad_alloc& ex)
|
||||||
|
{
|
||||||
|
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::focusNextChild()
|
bool FWidget::focusNextChild()
|
||||||
{
|
{
|
||||||
|
@ -1956,22 +1979,13 @@ void FWidget::init()
|
||||||
background_color = wc.term_bg;
|
background_color = wc.term_bg;
|
||||||
init_desktop = false;
|
init_desktop = false;
|
||||||
|
|
||||||
try
|
// Create the root object accelerator list
|
||||||
{
|
createWidgetAcceleratorList();
|
||||||
accelerator_list = new Accelerators();
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::finish()
|
void FWidget::finish()
|
||||||
{
|
{
|
||||||
delete accelerator_list;
|
|
||||||
accelerator_list = nullptr;
|
|
||||||
|
|
||||||
if ( close_widget )
|
if ( close_widget )
|
||||||
{
|
{
|
||||||
delete close_widget;
|
delete close_widget;
|
||||||
|
|
162
src/fwindow.cpp
162
src/fwindow.cpp
|
@ -47,7 +47,7 @@ FWindow::FWindow(FWidget* parent)
|
||||||
setWindowWidget();
|
setWindowWidget();
|
||||||
FRect geometry (getTermGeometry());
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
createArea (geometry, getShadow(), vwin);
|
createArea (geometry, getShadow(), getVWin());
|
||||||
addWindow (this);
|
addWindow (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ FWindow::~FWindow() // destructor
|
||||||
restoreVTerm (t_geometry);
|
restoreVTerm (t_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeArea (vwin);
|
removeArea (getVWin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ bool FWindow::setWindowWidget (bool enable)
|
||||||
if ( isWindowWidget() == enable )
|
if ( isWindowWidget() == enable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
flags.window_widget = enable;
|
setFlags().window_widget = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
setTermOffset();
|
setTermOffset();
|
||||||
|
@ -107,14 +107,14 @@ void FWindow::setActiveWindow (FWindow* window)
|
||||||
{
|
{
|
||||||
// activate FWindow object window
|
// activate FWindow object window
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
auto end = window_list->end();
|
auto end = getWindowList()->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ bool FWindow::activateWindow (bool enable)
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
FWidget::setActiveWindow (this);
|
FWidget::setActiveWindow (this);
|
||||||
active_area = getVWin();
|
setActiveArea (getVWin());
|
||||||
}
|
}
|
||||||
|
|
||||||
return (window_active = enable);
|
return (window_active = enable);
|
||||||
|
@ -173,13 +173,13 @@ void FWindow::unsetActiveWindow()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWindow::setResizeable (bool enable)
|
bool FWindow::setResizeable (bool enable)
|
||||||
{
|
{
|
||||||
return (flags.resizeable = enable);
|
return (setFlags().resizeable = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWindow::setTransparentShadow (bool enable)
|
bool FWindow::setTransparentShadow (bool enable)
|
||||||
{
|
{
|
||||||
flags.shadow = flags.trans_shadow = enable;
|
setFlags().shadow = setFlags().trans_shadow = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
setShadowSize (FSize(2, 1));
|
setShadowSize (FSize(2, 1));
|
||||||
|
@ -197,14 +197,14 @@ bool FWindow::setShadow (bool enable)
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
flags.shadow = true;
|
setFlags().shadow = true;
|
||||||
flags.trans_shadow = false;
|
setFlags().trans_shadow = false;
|
||||||
setShadowSize (FSize(1, 1));
|
setShadowSize (FSize(1, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags.shadow = false;
|
setFlags().shadow = false;
|
||||||
flags.trans_shadow = false;
|
setFlags().trans_shadow = false;
|
||||||
setShadowSize (FSize(0, 0));
|
setShadowSize (FSize(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,14 +217,14 @@ bool FWindow::setAlwaysOnTop (bool enable)
|
||||||
if ( isAlwaysOnTop() == enable )
|
if ( isAlwaysOnTop() == enable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
flags.always_on_top = enable;
|
setFlags().always_on_top = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
if ( always_on_top_list )
|
if ( getAlwaysOnTopList() )
|
||||||
{
|
{
|
||||||
deleteFromAlwaysOnTopList (this);
|
deleteFromAlwaysOnTopList (this);
|
||||||
always_on_top_list->push_back (this);
|
getAlwaysOnTopList()->push_back (this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -239,7 +239,7 @@ bool FWindow::isWindowHidden() const
|
||||||
// returns the window hidden state
|
// returns the window hidden state
|
||||||
|
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
return ! vwin->visible;
|
return ! getVWin()->visible;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ void FWindow::drawBorder()
|
||||||
void FWindow::show()
|
void FWindow::show()
|
||||||
{
|
{
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
vwin->visible = true;
|
getVWin()->visible = true;
|
||||||
|
|
||||||
FWidget::show();
|
FWidget::show();
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ void FWindow::show()
|
||||||
void FWindow::hide()
|
void FWindow::hide()
|
||||||
{
|
{
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
vwin->visible = false;
|
getVWin()->visible = false;
|
||||||
|
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ void FWindow::setX (int x, bool adjust)
|
||||||
FWidget::setX (x, adjust);
|
FWidget::setX (x, adjust);
|
||||||
|
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
vwin->offset_left = getTermX() - 1;
|
getVWin()->offset_left = getTermX() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -316,7 +316,7 @@ void FWindow::setY (int y, bool adjust)
|
||||||
FWidget::setY (y, adjust);
|
FWidget::setY (y, adjust);
|
||||||
|
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
vwin->offset_top = getTermY() - 1;
|
getVWin()->offset_top = getTermY() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -331,8 +331,9 @@ void FWindow::setPos (const FPoint& p, bool adjust)
|
||||||
|
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
{
|
{
|
||||||
vwin->offset_left = getTermX() - 1;
|
auto virtual_win = getVWin();
|
||||||
vwin->offset_top = getTermY() - 1;
|
virtual_win->offset_left = getTermX() - 1;
|
||||||
|
virtual_win->offset_top = getTermY() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +347,7 @@ void FWindow::setWidth (std::size_t w, bool adjust)
|
||||||
{
|
{
|
||||||
FRect geometry (getTermGeometry());
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +361,7 @@ void FWindow::setHeight (std::size_t h, bool adjust)
|
||||||
{
|
{
|
||||||
FRect geometry (getTermGeometry());
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +377,7 @@ void FWindow::setSize (const FSize& size, bool adjust)
|
||||||
{
|
{
|
||||||
FRect geometry (getTermGeometry());
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,15 +403,15 @@ void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
|
||||||
{
|
{
|
||||||
FRect geometry (getTermGeometry());
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( getX() != old_x )
|
if ( getX() != old_x )
|
||||||
vwin->offset_left = getTermX() - 1;
|
getVWin()->offset_left = getTermX() - 1;
|
||||||
|
|
||||||
if ( getY() != old_y )
|
if ( getY() != old_y )
|
||||||
vwin->offset_top = getTermY() - 1;
|
getVWin()->offset_top = getTermY() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,8 +422,9 @@ void FWindow::move (const FPoint& pos)
|
||||||
|
|
||||||
if ( isVirtualWindow() )
|
if ( isVirtualWindow() )
|
||||||
{
|
{
|
||||||
vwin->offset_left = getTermX() - 1;
|
auto virtual_win = getVWin();
|
||||||
vwin->offset_top = getTermY() - 1;
|
virtual_win->offset_left = getTermX() - 1;
|
||||||
|
virtual_win->offset_top = getTermY() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,10 +432,10 @@ void FWindow::move (const FPoint& pos)
|
||||||
FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
||||||
{
|
{
|
||||||
// returns the window object to the corresponding coordinates
|
// returns the window object to the corresponding coordinates
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( getWindowList() && ! getWindowList()->empty() )
|
||||||
{
|
{
|
||||||
auto iter = window_list->end();
|
auto iter = getWindowList()->end();
|
||||||
auto begin = window_list->begin();
|
auto begin = getWindowList()->begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -457,8 +459,8 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
||||||
void FWindow::addWindow (FWidget* obj)
|
void FWindow::addWindow (FWidget* obj)
|
||||||
{
|
{
|
||||||
// add the window object obj to the window list
|
// add the window object obj to the window list
|
||||||
if ( window_list )
|
if ( getWindowList() )
|
||||||
window_list->push_back(obj);
|
getWindowList()->push_back(obj);
|
||||||
|
|
||||||
processAlwaysOnTop();
|
processAlwaysOnTop();
|
||||||
}
|
}
|
||||||
|
@ -467,16 +469,16 @@ void FWindow::addWindow (FWidget* obj)
|
||||||
void FWindow::delWindow (FWidget* obj)
|
void FWindow::delWindow (FWidget* obj)
|
||||||
{
|
{
|
||||||
// delete the window object obj from the window list
|
// delete the window object obj from the window list
|
||||||
if ( ! window_list || window_list->empty() )
|
if ( ! getWindowList() || getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
|
|
||||||
while ( iter != window_list->end() )
|
while ( iter != getWindowList()->end() )
|
||||||
{
|
{
|
||||||
if ( (*iter) == obj )
|
if ( (*iter) == obj )
|
||||||
{
|
{
|
||||||
window_list->erase (iter);
|
getWindowList()->erase (iter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,10 +511,10 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
||||||
|
|
||||||
const FWidget* window;
|
const FWidget* window;
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( ! obj->isWindowWidget() )
|
if ( ! obj->isWindowWidget() )
|
||||||
|
@ -523,8 +525,8 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
||||||
else
|
else
|
||||||
window = obj;
|
window = obj;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
auto end = window_list->end();
|
auto end = getWindowList()->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
|
@ -534,7 +536,7 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return int(std::distance(window_list->begin(), iter) + 1);
|
return int(std::distance(getWindowList()->begin(), iter) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -542,10 +544,10 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
||||||
{
|
{
|
||||||
// swaps the window layer between obj1 and obj2
|
// swaps the window layer between obj1 and obj2
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( obj1->getFlags().modal )
|
if ( obj1->getFlags().modal )
|
||||||
|
@ -554,8 +556,8 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
||||||
if ( obj2->getFlags().modal )
|
if ( obj2->getFlags().modal )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
auto end = window_list->end();
|
auto end = getWindowList()->end();
|
||||||
auto iter1 = end;
|
auto iter1 = end;
|
||||||
auto iter2 = end;
|
auto iter2 = end;
|
||||||
|
|
||||||
|
@ -578,30 +580,30 @@ bool FWindow::raiseWindow (FWidget* obj)
|
||||||
{
|
{
|
||||||
// raises the window widget obj to the top
|
// raises the window widget obj to the top
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! obj->isWindowWidget() )
|
if ( ! obj->isWindowWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->back() == obj )
|
if ( getWindowList()->back() == obj )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->back()->getFlags().modal
|
if ( getWindowList()->back()->getFlags().modal
|
||||||
&& ! obj->isMenuWidget() )
|
&& ! obj->isMenuWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
|
|
||||||
while ( iter != window_list->end() )
|
while ( iter != getWindowList()->end() )
|
||||||
{
|
{
|
||||||
if ( *iter == obj )
|
if ( *iter == obj )
|
||||||
{
|
{
|
||||||
window_list->erase (iter);
|
getWindowList()->erase (iter);
|
||||||
window_list->push_back (obj);
|
getWindowList()->push_back (obj);
|
||||||
FEvent ev(fc::WindowRaised_Event);
|
FEvent ev(fc::WindowRaised_Event);
|
||||||
FApplication::sendEvent(obj, &ev);
|
FApplication::sendEvent(obj, &ev);
|
||||||
processAlwaysOnTop();
|
processAlwaysOnTop();
|
||||||
|
@ -619,29 +621,29 @@ bool FWindow::lowerWindow (FWidget* obj)
|
||||||
{
|
{
|
||||||
// lowers the window widget obj to the bottom
|
// lowers the window widget obj to the bottom
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! getWindowList() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->empty() )
|
if ( getWindowList()->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! obj->isWindowWidget() )
|
if ( ! obj->isWindowWidget() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( window_list->front() == obj )
|
if ( getWindowList()->front() == obj )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( obj->getFlags().modal )
|
if ( obj->getFlags().modal )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto iter = window_list->begin();
|
auto iter = getWindowList()->begin();
|
||||||
|
|
||||||
while ( iter != window_list->end() )
|
while ( iter != getWindowList()->end() )
|
||||||
{
|
{
|
||||||
if ( *iter == obj )
|
if ( *iter == obj )
|
||||||
{
|
{
|
||||||
window_list->erase (iter);
|
getWindowList()->erase (iter);
|
||||||
window_list->insert (window_list->begin(), obj);
|
getWindowList()->insert (getWindowList()->begin(), obj);
|
||||||
FEvent ev(fc::WindowLowered_Event);
|
FEvent ev(fc::WindowLowered_Event);
|
||||||
FApplication::sendEvent(obj, &ev);
|
FApplication::sendEvent(obj, &ev);
|
||||||
return true;
|
return true;
|
||||||
|
@ -694,10 +696,10 @@ void FWindow::switchToPrevWindow (FWidget* widget)
|
||||||
if ( ! is_activated )
|
if ( ! is_activated )
|
||||||
{
|
{
|
||||||
// no previous window -> looking for another window
|
// no previous window -> looking for another window
|
||||||
if ( window_list && window_list->size() > 1 )
|
if ( getWindowList() && getWindowList()->size() > 1 )
|
||||||
{
|
{
|
||||||
auto iter = window_list->end();
|
auto iter = getWindowList()->end();
|
||||||
auto begin = window_list->begin();
|
auto begin = getWindowList()->begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -771,7 +773,7 @@ void FWindow::setShadowSize (const FSize& size)
|
||||||
{
|
{
|
||||||
auto geometry = getTermGeometry();
|
auto geometry = getTermGeometry();
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,10 +791,10 @@ void FWindow::adjustSize()
|
||||||
else if ( isVirtualWindow() )
|
else if ( isVirtualWindow() )
|
||||||
{
|
{
|
||||||
if ( getX() != old_x )
|
if ( getX() != old_x )
|
||||||
vwin->offset_left = getTermX() - 1;
|
getVWin()->offset_left = getTermX() - 1;
|
||||||
|
|
||||||
if ( getY() != old_y )
|
if ( getY() != old_y )
|
||||||
vwin->offset_top = getTermY() - 1;
|
getVWin()->offset_top = getTermY() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,16 +848,16 @@ void FWindow::onWindowLowered (FEvent*)
|
||||||
void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
||||||
{
|
{
|
||||||
// delete the window object obj from the always-on-top list
|
// delete the window object obj from the always-on-top list
|
||||||
if ( ! always_on_top_list || always_on_top_list->empty() )
|
if ( ! getAlwaysOnTopList() || getAlwaysOnTopList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = always_on_top_list->begin();
|
auto iter = getAlwaysOnTopList()->begin();
|
||||||
|
|
||||||
while ( iter != always_on_top_list->end() )
|
while ( iter != getAlwaysOnTopList()->end() )
|
||||||
{
|
{
|
||||||
if ( *iter == obj )
|
if ( *iter == obj )
|
||||||
{
|
{
|
||||||
always_on_top_list->erase (iter);
|
getAlwaysOnTopList()->erase (iter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,17 +869,17 @@ void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
||||||
void FWindow::processAlwaysOnTop()
|
void FWindow::processAlwaysOnTop()
|
||||||
{
|
{
|
||||||
// Raise all always-on-top windows
|
// Raise all always-on-top windows
|
||||||
if ( ! always_on_top_list || always_on_top_list->empty() )
|
if ( ! getAlwaysOnTopList() || getAlwaysOnTopList()->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto iter = always_on_top_list->begin();
|
auto iter = getAlwaysOnTopList()->begin();
|
||||||
|
|
||||||
while ( iter != always_on_top_list->end() )
|
while ( iter != getAlwaysOnTopList()->end() )
|
||||||
{
|
{
|
||||||
delWindow (*iter);
|
delWindow (*iter);
|
||||||
|
|
||||||
if ( window_list )
|
if ( getWindowList() )
|
||||||
window_list->push_back(*iter);
|
getWindowList()->push_back(*iter);
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,13 +170,13 @@ class FButton : public FWidget
|
||||||
std::size_t center_offset{0};
|
std::size_t center_offset{0};
|
||||||
std::size_t vcenter_offset{0};
|
std::size_t vcenter_offset{0};
|
||||||
std::size_t txtlength{0};
|
std::size_t txtlength{0};
|
||||||
FColor button_fg{wc.button_active_fg};
|
FColor button_fg{getFWidgetColors().button_active_fg};
|
||||||
FColor button_bg{wc.button_active_bg};
|
FColor button_bg{getFWidgetColors().button_active_bg};
|
||||||
FColor button_hotkey_fg{wc.button_hotkey_fg};
|
FColor button_hotkey_fg{getFWidgetColors().button_hotkey_fg};
|
||||||
FColor button_focus_fg{wc.button_active_focus_fg};
|
FColor button_focus_fg{getFWidgetColors().button_active_focus_fg};
|
||||||
FColor button_focus_bg{wc.button_active_focus_bg};
|
FColor button_focus_bg{getFWidgetColors().button_active_focus_bg};
|
||||||
FColor button_inactive_fg{wc.button_inactive_fg};
|
FColor button_inactive_fg{getFWidgetColors().button_inactive_fg};
|
||||||
FColor button_inactive_bg{wc.button_inactive_bg};
|
FColor button_inactive_bg{getFWidgetColors().button_inactive_bg};
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ inline bool FButton::unsetClickAnimation()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FButton::isFlat() const
|
inline bool FButton::isFlat() const
|
||||||
{ return flags.flat; }
|
{ return getFlags().flat; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FButton::isDown() const
|
inline bool FButton::isDown() const
|
||||||
|
@ -264,7 +264,7 @@ inline bool FButton::isDown() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FButton::hasShadow() const
|
inline bool FButton::hasShadow() const
|
||||||
{ return flags.shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FButton::hasClickAnimation()
|
inline bool FButton::hasClickAnimation()
|
||||||
|
|
|
@ -116,8 +116,8 @@ class FDialog : public FWindow
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isModal();
|
bool isModal() const;
|
||||||
bool isScrollable();
|
bool isScrollable() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void show() override;
|
void show() override;
|
||||||
|
@ -278,12 +278,12 @@ inline void FDialog::setText (const FString& txt)
|
||||||
{ tb_text.setString(txt); }
|
{ tb_text.setString(txt); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::isModal()
|
inline bool FDialog::isModal() const
|
||||||
{ return flags.modal; }
|
{ return getFlags().modal; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::isScrollable()
|
inline bool FDialog::isScrollable() const
|
||||||
{ return flags.scrollable; }
|
{ return getFlags().scrollable; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class FEvent // event base class
|
||||||
explicit FEvent(fc::events);
|
explicit FEvent(fc::events);
|
||||||
fc::events type() const;
|
fc::events type() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
fc::events t{fc::None_Event};
|
fc::events t{fc::None_Event};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class FKeyEvent : public FEvent // keyboard event
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
FKey k{0};
|
FKey k{0};
|
||||||
bool accpt{false};
|
bool accpt{false};
|
||||||
};
|
};
|
||||||
|
@ -161,10 +161,10 @@ class FMouseEvent : public FEvent // mouse event
|
||||||
int getTermY() const;
|
int getTermY() const;
|
||||||
int getButton() const;
|
int getButton() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
FPoint p;
|
FPoint p{};
|
||||||
FPoint tp;
|
FPoint tp{};
|
||||||
int b;
|
int b{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -193,7 +193,7 @@ class FWheelEvent : public FEvent // wheel event
|
||||||
int getTermY() const;
|
int getTermY() const;
|
||||||
int getWheel() const;
|
int getWheel() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
FPoint p;
|
FPoint p;
|
||||||
FPoint tp;
|
FPoint tp;
|
||||||
int w;
|
int w;
|
||||||
|
@ -223,7 +223,8 @@ class FFocusEvent : public FEvent // focus event
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
protected:
|
|
||||||
|
private:
|
||||||
bool accpt{true};
|
bool accpt{true};
|
||||||
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
|
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
|
||||||
};
|
};
|
||||||
|
@ -252,9 +253,9 @@ class FAccelEvent : public FEvent // focus event
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool accpt{false};
|
bool accpt{false};
|
||||||
void* focus_widget;
|
void* focus_widget{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -275,7 +276,7 @@ class FResizeEvent : public FEvent // resize event
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool accpt{false};
|
bool accpt{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -321,7 +322,7 @@ class FCloseEvent : public FEvent // close event
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool accpt{false};
|
bool accpt{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -342,7 +343,7 @@ class FTimerEvent : public FEvent // timer event
|
||||||
|
|
||||||
int getTimerId() const;
|
int getTimerId() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int id{0};
|
int id{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ class FUserEvent : public FEvent // timer event
|
||||||
FDataPtr getData() const;
|
FDataPtr getData() const;
|
||||||
void setData (FDataPtr);
|
void setData (FDataPtr);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int uid{0};
|
int uid{0};
|
||||||
FDataPtr data_pointer{nullptr};
|
FDataPtr data_pointer{nullptr};
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
#include <final/ftooltip.h>
|
#include <final/ftooltip.h>
|
||||||
#include <final/ftypes.h>
|
#include <final/ftypes.h>
|
||||||
#include <final/fwidget.h>
|
#include <final/fwidget.h>
|
||||||
|
#include "final/fwidgetcolors.h"
|
||||||
|
|
||||||
#if defined(UNIT_TEST)
|
#if defined(UNIT_TEST)
|
||||||
#include <final/ftermlinux.h>
|
#include <final/ftermlinux.h>
|
||||||
|
|
|
@ -157,8 +157,8 @@ class FLabel : public FWidget
|
||||||
bool multiline{false};
|
bool multiline{false};
|
||||||
FString text{};
|
FString text{};
|
||||||
fc::text_alignment alignment{fc::alignLeft};
|
fc::text_alignment alignment{fc::alignLeft};
|
||||||
FColor emphasis_color{wc.label_emphasis_fg};
|
FColor emphasis_color{getFWidgetColors().label_emphasis_fg};
|
||||||
FColor ellipsis_color{wc.label_ellipsis_fg};
|
FColor ellipsis_color{getFWidgetColors().label_ellipsis_fg};
|
||||||
bool emphasis{false};
|
bool emphasis{false};
|
||||||
bool reverse_mode{false};
|
bool reverse_mode{false};
|
||||||
FWidget* accel_widget{nullptr};
|
FWidget* accel_widget{nullptr};
|
||||||
|
|
|
@ -261,7 +261,7 @@ inline bool FLineEdit::unsetShadow()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FLineEdit::hasShadow()
|
inline bool FLineEdit::hasShadow()
|
||||||
{ return flags.shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
|
@ -111,15 +111,21 @@ class FMenuItem : public FWidget
|
||||||
void unsetSelected();
|
void unsetSelected();
|
||||||
void setSeparator();
|
void setSeparator();
|
||||||
void unsetSeparator();
|
void unsetSeparator();
|
||||||
|
void setCheckable();
|
||||||
|
void unsetCheckable();
|
||||||
void setChecked();
|
void setChecked();
|
||||||
void unsetChecked();
|
void unsetChecked();
|
||||||
|
void setRadioButton();
|
||||||
|
void unsetRadioButton();
|
||||||
void setMenu (FMenu*);
|
void setMenu (FMenu*);
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected() const;
|
bool isSelected() const;
|
||||||
bool isSeparator() const;
|
bool isSeparator() const;
|
||||||
|
bool isCheckable() const;
|
||||||
bool isChecked() const;
|
bool isChecked() const;
|
||||||
|
bool isRadioButton() const;
|
||||||
bool hasHotkey() const;
|
bool hasHotkey() const;
|
||||||
bool hasMenu() const;
|
bool hasMenu() const;
|
||||||
|
|
||||||
|
@ -150,21 +156,6 @@ class FMenuItem : public FWidget
|
||||||
bool isMenuBar (FWidget*) const;
|
bool isMenuBar (FWidget*) const;
|
||||||
bool isMenu (FWidget*) const;
|
bool isMenu (FWidget*) const;
|
||||||
|
|
||||||
// Data Members
|
|
||||||
FString text{};
|
|
||||||
bool selected{false};
|
|
||||||
bool separator{false};
|
|
||||||
bool checkable{false};
|
|
||||||
bool checked{false};
|
|
||||||
bool radio_button{false};
|
|
||||||
bool dialog_index{false};
|
|
||||||
std::size_t text_length{0};
|
|
||||||
uChar hotkey{0};
|
|
||||||
FKey accel_key{0};
|
|
||||||
FMenu* menu{nullptr};
|
|
||||||
FWidget* super_menu{nullptr};
|
|
||||||
FDialog* associated_window{nullptr};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Accessor
|
// Accessor
|
||||||
FMenuList* getFMenuList (FWidget&);
|
FMenuList* getFMenuList (FWidget&);
|
||||||
|
@ -185,6 +176,21 @@ class FMenuItem : public FWidget
|
||||||
|
|
||||||
virtual void processClicked();
|
virtual void processClicked();
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
FString text{};
|
||||||
|
bool selected{false};
|
||||||
|
bool separator{false};
|
||||||
|
bool checkable{false};
|
||||||
|
bool checked{false};
|
||||||
|
bool radio_button{false};
|
||||||
|
bool dialog_index{false};
|
||||||
|
std::size_t text_length{0};
|
||||||
|
uChar hotkey{0};
|
||||||
|
FKey accel_key{0};
|
||||||
|
FMenu* menu{nullptr};
|
||||||
|
FWidget* super_menu{nullptr};
|
||||||
|
FDialog* associated_window{nullptr};
|
||||||
|
|
||||||
// Friend classes
|
// Friend classes
|
||||||
friend class FDialogListMenu;
|
friend class FDialogListMenu;
|
||||||
friend class FMenuList;
|
friend class FMenuList;
|
||||||
|
@ -237,6 +243,14 @@ inline void FMenuItem::unsetSeparator()
|
||||||
setFocusable();
|
setFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FMenuItem::setCheckable()
|
||||||
|
{ checkable = true; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FMenuItem::unsetCheckable()
|
||||||
|
{ checkable = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuItem::setChecked()
|
inline void FMenuItem::setChecked()
|
||||||
{ checked = true; }
|
{ checked = true; }
|
||||||
|
@ -245,6 +259,14 @@ inline void FMenuItem::setChecked()
|
||||||
inline void FMenuItem::unsetChecked()
|
inline void FMenuItem::unsetChecked()
|
||||||
{ checked = false; }
|
{ checked = false; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FMenuItem::setRadioButton()
|
||||||
|
{ radio_button = true; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FMenuItem::unsetRadioButton()
|
||||||
|
{ radio_button = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuItem::setMenu(FMenu* m)
|
inline void FMenuItem::setMenu(FMenu* m)
|
||||||
{ menu = m; }
|
{ menu = m; }
|
||||||
|
@ -257,10 +279,18 @@ inline bool FMenuItem::isSelected() const
|
||||||
inline bool FMenuItem::isSeparator() const
|
inline bool FMenuItem::isSeparator() const
|
||||||
{ return separator; }
|
{ return separator; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FMenuItem::isCheckable() const
|
||||||
|
{ return checkable; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenuItem::isChecked() const
|
inline bool FMenuItem::isChecked() const
|
||||||
{ return checked; }
|
{ return checked; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FMenuItem::isRadioButton() const
|
||||||
|
{ return radio_button; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenuItem::hasHotkey() const
|
inline bool FMenuItem::hasHotkey() const
|
||||||
{ return bool(hotkey != 0); }
|
{ return bool(hotkey != 0); }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2018 Markus Gans *
|
* Copyright 2015-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -74,31 +74,34 @@ class FMenuList
|
||||||
FMenuList& operator = (const FMenuList&) = delete;
|
FMenuList& operator = (const FMenuList&) = delete;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
std::size_t getCount() const;
|
std::size_t getCount() const;
|
||||||
FMenuItem* getItem (int) const;
|
FMenuItem* getItem (int) const;
|
||||||
FMenuItem* getSelectedItem() const;
|
FMenuItem* getSelectedItem() const;
|
||||||
|
std::vector<FMenuItem*> getItemList() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void enableItem (int);
|
void enableItem (int);
|
||||||
void disableItem (int);
|
void disableItem (int);
|
||||||
void setSelectedItem (FMenuItem*);
|
void setSelectedItem (FMenuItem*);
|
||||||
|
void unsetSelectedItem();
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected (int) const;
|
bool isSelected (int) const;
|
||||||
bool hasSelectedItem() const;
|
bool hasSelectedItem() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void insert (FMenuItem*);
|
virtual void insert (FMenuItem*);
|
||||||
virtual void remove (FMenuItem*);
|
virtual void remove (FMenuItem*);
|
||||||
void remove (int);
|
void remove (int);
|
||||||
void clear();
|
void clear();
|
||||||
void selectFirstItem();
|
void selectFirstItem();
|
||||||
void unselectItem();
|
void unselectItem();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
FMenuItem* selected_item{};
|
// Data Members
|
||||||
std::vector<FMenuItem*> item_list{};
|
FMenuItem* selected_item{};
|
||||||
|
std::vector<FMenuItem*> item_list{};
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -120,6 +123,10 @@ inline FMenuItem* FMenuList::getItem (int index) const
|
||||||
inline FMenuItem* FMenuList::getSelectedItem() const
|
inline FMenuItem* FMenuList::getSelectedItem() const
|
||||||
{ return selected_item; }
|
{ return selected_item; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline std::vector<FMenuItem*> FMenuList::getItemList() const
|
||||||
|
{ return item_list; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuList::enableItem (int index)
|
inline void FMenuList::enableItem (int index)
|
||||||
{ item_list[uInt(index - 1)]->setEnable(); }
|
{ item_list[uInt(index - 1)]->setEnable(); }
|
||||||
|
@ -132,6 +139,10 @@ inline void FMenuList::disableItem (int index)
|
||||||
inline void FMenuList::setSelectedItem (FMenuItem* menuitem)
|
inline void FMenuList::setSelectedItem (FMenuItem* menuitem)
|
||||||
{ selected_item = menuitem; }
|
{ selected_item = menuitem; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FMenuList::unsetSelectedItem()
|
||||||
|
{ selected_item = nullptr; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenuList::isSelected(int index) const
|
inline bool FMenuList::isSelected(int index) const
|
||||||
{ return ( index > 0 ) ? item_list[uInt(index - 1)]->isSelected() : false; }
|
{ return ( index > 0 ) ? item_list[uInt(index - 1)]->isSelected() : false; }
|
||||||
|
|
|
@ -162,7 +162,7 @@ class FMessageBox : public FDialog
|
||||||
FStringList text_split{};
|
FStringList text_split{};
|
||||||
std::size_t max_line_width{0};
|
std::size_t max_line_width{0};
|
||||||
bool center_text{false};
|
bool center_text{false};
|
||||||
FColor emphasis_color{wc.dialog_emphasis_fg};
|
FColor emphasis_color{getFWidgetColors().dialog_emphasis_fg};
|
||||||
uInt num_buttons{0};
|
uInt num_buttons{0};
|
||||||
uInt text_num_lines{0};
|
uInt text_num_lines{0};
|
||||||
int button_digit[3]{0};
|
int button_digit[3]{0};
|
||||||
|
@ -230,6 +230,7 @@ int FMessageBox::error ( FWidget* parent
|
||||||
, int button2 )
|
, int button2 )
|
||||||
{
|
{
|
||||||
const FString caption{"Error message"};
|
const FString caption{"Error message"};
|
||||||
|
|
||||||
FMessageBox mbox ( caption
|
FMessageBox mbox ( caption
|
||||||
, FString() << message
|
, FString() << message
|
||||||
, button0, button1, button2
|
, button0, button1, button2
|
||||||
|
@ -237,9 +238,10 @@ int FMessageBox::error ( FWidget* parent
|
||||||
mbox.beep();
|
mbox.beep();
|
||||||
mbox.setHeadline("Warning:");
|
mbox.setHeadline("Warning:");
|
||||||
mbox.setCenterText();
|
mbox.setCenterText();
|
||||||
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
const FWidgetColors& wc = mbox.getFWidgetColors();
|
||||||
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
mbox.setForegroundColor(wc.error_box_fg);
|
||||||
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
mbox.setBackgroundColor(wc.error_box_bg);
|
||||||
|
mbox.emphasis_color = wc.error_box_emphasis_fg;
|
||||||
int reply = mbox.exec();
|
int reply = mbox.exec();
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,7 @@ class FMouse
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static FMouse* createMouseObject (mouse_type);
|
static FMouse* createMouseObject (mouse_type);
|
||||||
|
void clearButtonState();
|
||||||
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
||||||
virtual void processEvent (struct timeval*) = 0;
|
virtual void processEvent (struct timeval*) = 0;
|
||||||
|
|
||||||
|
@ -161,19 +162,33 @@ class FMouse
|
||||||
DoubleClick = 3
|
DoubleClick = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
button& getButtonState();
|
||||||
|
FPoint& getNewPos();
|
||||||
|
uInt16 getMaxWidth();
|
||||||
|
uInt16 getMaxHeight();
|
||||||
|
uInt64 getDblclickInterval();
|
||||||
|
timeval* getMousePressedTime();
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setPos (const FPoint&);
|
void setPos (const FPoint&);
|
||||||
|
void setNewPos (int, int);
|
||||||
|
void setPending (bool);
|
||||||
|
void setEvent();
|
||||||
|
void setMousePressedTime (timeval*);
|
||||||
|
void resetMousePressedTime();
|
||||||
|
|
||||||
// Method
|
// Inquiry
|
||||||
bool isDblclickTimeout (timeval*);
|
bool isDblclickTimeout (timeval*);
|
||||||
|
|
||||||
|
private:
|
||||||
// Data Members
|
// Data Members
|
||||||
button b_state{};
|
button b_state{};
|
||||||
bool mouse_event_occurred{false};
|
bool mouse_event_occurred{false};
|
||||||
bool input_data_pending{false};
|
bool input_data_pending{false};
|
||||||
uInt64 dblclick_interval{500000}; // 500 ms
|
|
||||||
uInt16 max_width{80};
|
uInt16 max_width{80};
|
||||||
uInt16 max_height{25};
|
uInt16 max_height{25};
|
||||||
|
uInt64 dblclick_interval{500000}; // 500 ms
|
||||||
struct timeval time_mousepressed{};
|
struct timeval time_mousepressed{};
|
||||||
FPoint mouse{0, 0}; // mouse click position
|
FPoint mouse{0, 0}; // mouse click position
|
||||||
FPoint new_mouse_position{};
|
FPoint new_mouse_position{};
|
||||||
|
|
|
@ -132,7 +132,7 @@ inline bool FProgressbar::unsetShadow()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FProgressbar::hasShadow()
|
inline bool FProgressbar::hasShadow()
|
||||||
{ return flags.shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,8 @@ class FVTerm
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
static FColor getTermForegroundColor();
|
static FColor getTermForegroundColor();
|
||||||
static FColor getTermBackgroundColor();
|
static FColor getTermBackgroundColor();
|
||||||
term_area* getVWin() const;
|
term_area*& getVWin();
|
||||||
|
const term_area* getVWin() const;
|
||||||
FPoint getPrintCursor();
|
FPoint getPrintCursor();
|
||||||
static charData getAttribute();
|
static charData getAttribute();
|
||||||
static int getMaxColor();
|
static int getMaxColor();
|
||||||
|
@ -320,6 +321,9 @@ class FVTerm
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
virtual term_area* getPrintArea();
|
virtual term_area* getPrintArea();
|
||||||
|
term_area* getChildPrintArea() const;
|
||||||
|
term_area* getCurrentPrintArea() const;
|
||||||
|
term_area* getVirtualDesktop() const;
|
||||||
std::size_t getLineNumber();
|
std::size_t getLineNumber();
|
||||||
std::size_t getColumnNumber();
|
std::size_t getColumnNumber();
|
||||||
static bool charEncodable (wchar_t);
|
static bool charEncodable (wchar_t);
|
||||||
|
@ -329,6 +333,8 @@ class FVTerm
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setPrintArea (term_area*);
|
void setPrintArea (term_area*);
|
||||||
|
void setChildPrintArea (term_area*);
|
||||||
|
void setActiveArea (term_area*);
|
||||||
static void setInsertCursor (bool);
|
static void setInsertCursor (bool);
|
||||||
static void setInsertCursor();
|
static void setInsertCursor();
|
||||||
static void unsetInsertCursor();
|
static void unsetInsertCursor();
|
||||||
|
@ -410,9 +416,7 @@ class FVTerm
|
||||||
;
|
;
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static term_area* vterm; // virtual terminal
|
private:
|
||||||
static term_area* vdesktop; // virtual desktop
|
|
||||||
static term_area* active_area; // active area
|
|
||||||
term_area* print_area{nullptr}; // print area for this object
|
term_area* print_area{nullptr}; // print area for this object
|
||||||
term_area* child_print_area{nullptr}; // print area for children
|
term_area* child_print_area{nullptr}; // print area for children
|
||||||
term_area* vwin{nullptr}; // virtual window
|
term_area* vwin{nullptr}; // virtual window
|
||||||
|
@ -471,6 +475,9 @@ class FVTerm
|
||||||
// Data Members
|
// Data Members
|
||||||
static FSystem* fsystem;
|
static FSystem* fsystem;
|
||||||
static FTerm* fterm;
|
static FTerm* fterm;
|
||||||
|
static term_area* vterm; // virtual terminal
|
||||||
|
static term_area* vdesktop; // virtual desktop
|
||||||
|
static term_area* active_area; // active area
|
||||||
static std::queue<int>* output_buffer;
|
static std::queue<int>* output_buffer;
|
||||||
static charData term_attribute;
|
static charData term_attribute;
|
||||||
static charData next_attribute;
|
static charData next_attribute;
|
||||||
|
@ -596,7 +603,11 @@ inline FColor FVTerm::getTermBackgroundColor()
|
||||||
{ return next_attribute.bg_color; }
|
{ return next_attribute.bg_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FVTerm::term_area* FVTerm::getVWin() const
|
inline FVTerm::term_area*& FVTerm::getVWin()
|
||||||
|
{ return vwin; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FVTerm::term_area* FVTerm::getVWin() const
|
||||||
{ return vwin; }
|
{ return vwin; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1047,8 +1058,16 @@ inline void FVTerm::redefineDefaultColors (bool enable)
|
||||||
{ FTerm::redefineDefaultColors(enable); }
|
{ FTerm::redefineDefaultColors(enable); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FVTerm::setPrintArea (term_area* area)
|
inline FVTerm::term_area* FVTerm::getChildPrintArea() const
|
||||||
{ print_area = area; }
|
{ return child_print_area; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FVTerm::term_area* FVTerm::getCurrentPrintArea() const
|
||||||
|
{ return print_area; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FVTerm::term_area* FVTerm::getVirtualDesktop() const
|
||||||
|
{ return vdesktop; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FVTerm::getLineNumber()
|
inline std::size_t FVTerm::getLineNumber()
|
||||||
|
@ -1074,6 +1093,18 @@ inline FMouseControl* FVTerm::getFMouseControl()
|
||||||
inline FTerm::initializationValues& FVTerm::getInitValues()
|
inline FTerm::initializationValues& FVTerm::getInitValues()
|
||||||
{ return FTerm::init_values; }
|
{ return FTerm::init_values; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FVTerm::setPrintArea (term_area* area)
|
||||||
|
{ print_area = area; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FVTerm::setChildPrintArea (term_area* area)
|
||||||
|
{ child_print_area = area; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FVTerm::setActiveArea (term_area* area)
|
||||||
|
{ active_area = area; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FVTerm::setInsertCursor (bool enable)
|
inline void FVTerm::setInsertCursor (bool enable)
|
||||||
{ return FTerm::setInsertCursor(enable); }
|
{ return FTerm::setInsertCursor(enable); }
|
||||||
|
|
|
@ -186,165 +186,164 @@ class FWidget : public FVTerm, public FObject
|
||||||
FWidget& operator = (const FWidget&) = delete;
|
FWidget& operator = (const FWidget&) = delete;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const override;
|
const char* getClassName() const override;
|
||||||
FWidget* getRootWidget() const;
|
FWidget* getRootWidget() const;
|
||||||
FWidget* getParentWidget() const;
|
FWidget* getParentWidget() const;
|
||||||
static FWidget*& getMainWidget();
|
static FWidget*& getMainWidget();
|
||||||
static FWidget*& getActiveWindow();
|
static FWidget*& getActiveWindow();
|
||||||
static FWidget*& getFocusWidget();
|
static FWidget*& getFocusWidget();
|
||||||
static FWidget*& getClickedWidget();
|
static FWidget*& getClickedWidget();
|
||||||
static FWidget*& getOpenMenu();
|
static FWidget*& getOpenMenu();
|
||||||
static FWidget*& getMoveSizeWidget();
|
static FWidget*& getMoveSizeWidget();
|
||||||
virtual FWidget* getFirstFocusableWidget (FObjectList);
|
virtual FWidget* getFirstFocusableWidget (FObjectList);
|
||||||
virtual FWidget* getLastFocusableWidget (FObjectList);
|
virtual FWidget* getLastFocusableWidget (FObjectList);
|
||||||
static FMenuBar* getMenuBar();
|
Accelerators* getAcceleratorList() const;
|
||||||
static FStatusBar* getStatusBar();
|
static widgetList*& getWindowList();
|
||||||
FString getStatusbarMessage() const;
|
static FMenuBar* getMenuBar();
|
||||||
FColor getForegroundColor() const; // get the primary
|
static FStatusBar* getStatusBar();
|
||||||
FColor getBackgroundColor() const; // widget colors
|
FString getStatusbarMessage() const;
|
||||||
int getX() const; // positioning
|
FColor getForegroundColor() const; // get the primary
|
||||||
int getY() const;
|
FColor getBackgroundColor() const; // widget colors
|
||||||
const FPoint getPos() const;
|
int getX() const; // positioning
|
||||||
int getTermX() const;
|
int getY() const;
|
||||||
int getTermY() const;
|
const FPoint getPos() const;
|
||||||
const FPoint getTermPos() const;
|
int getTermX() const;
|
||||||
std::size_t getWidth() const;
|
int getTermY() const;
|
||||||
std::size_t getHeight() const;
|
const FPoint getTermPos() const;
|
||||||
const FSize getSize() const;
|
std::size_t getWidth() const;
|
||||||
int getTopPadding() const;
|
std::size_t getHeight() const;
|
||||||
int getLeftPadding() const;
|
const FSize getSize() const;
|
||||||
int getBottomPadding() const;
|
int getTopPadding() const;
|
||||||
int getRightPadding() const;
|
int getLeftPadding() const;
|
||||||
std::size_t getClientWidth() const;
|
int getBottomPadding() const;
|
||||||
std::size_t getClientHeight() const;
|
int getRightPadding() const;
|
||||||
std::size_t getMaxWidth() const;
|
std::size_t getClientWidth() const;
|
||||||
std::size_t getMaxHeight() const;
|
std::size_t getClientHeight() const;
|
||||||
const FSize& getShadow() const;
|
std::size_t getMaxWidth() const;
|
||||||
const FRect& getGeometry() const;
|
std::size_t getMaxHeight() const;
|
||||||
const FRect& getGeometryWithShadow();
|
const FSize& getShadow() const;
|
||||||
const FRect& getTermGeometry();
|
const FRect& getGeometry() const;
|
||||||
const FRect& getTermGeometryWithShadow();
|
const FRect& getGeometryWithShadow();
|
||||||
std::size_t getDesktopWidth();
|
const FRect& getTermGeometry();
|
||||||
std::size_t getDesktopHeight();
|
const FRect& getTermGeometryWithShadow();
|
||||||
widget_flags getFlags() const;
|
std::size_t getDesktopWidth();
|
||||||
FPoint getCursorPos();
|
std::size_t getDesktopHeight();
|
||||||
FPoint getPrintPos();
|
const widget_flags& getFlags() const;
|
||||||
std::vector<bool>& doubleFlatLine_ref (fc::sides);
|
FPoint getCursorPos();
|
||||||
|
FPoint getPrintPos();
|
||||||
|
std::vector<bool>& doubleFlatLine_ref (fc::sides);
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setMainWidget (FWidget*);
|
static void setMainWidget (FWidget*);
|
||||||
static void setFocusWidget (FWidget*);
|
static void setFocusWidget (FWidget*);
|
||||||
static void setClickedWidget (FWidget*);
|
static void setClickedWidget (FWidget*);
|
||||||
static void setMoveSizeWidget (FWidget*);
|
static void setMoveSizeWidget (FWidget*);
|
||||||
static void setActiveWindow (FWidget*);
|
static void setActiveWindow (FWidget*);
|
||||||
static void setOpenMenu (FWidget*);
|
static void setOpenMenu (FWidget*);
|
||||||
virtual void setStatusbarMessage (const FString&);
|
virtual void setStatusbarMessage (const FString&);
|
||||||
bool setVisible (bool);
|
bool setVisible (bool);
|
||||||
bool setVisible();
|
bool setVisible();
|
||||||
bool unsetVisible();
|
bool unsetVisible();
|
||||||
virtual bool setEnable (bool);
|
virtual bool setEnable (bool);
|
||||||
virtual bool setEnable();
|
virtual bool setEnable();
|
||||||
virtual bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
virtual bool setDisable();
|
virtual bool setDisable();
|
||||||
virtual bool setVisibleCursor (bool); // input cursor visibility
|
virtual bool setVisibleCursor (bool); // input cursor visibility
|
||||||
virtual bool setVisibleCursor(); // for the widget
|
virtual bool setVisibleCursor(); // for the widget
|
||||||
virtual bool unsetVisibleCursor();
|
virtual bool unsetVisibleCursor();
|
||||||
virtual bool setFocus (bool);
|
virtual bool setFocus (bool);
|
||||||
virtual bool setFocus();
|
virtual bool setFocus();
|
||||||
virtual bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
void setFocusable();
|
void setFocusable();
|
||||||
void unsetFocusable();
|
void unsetFocusable();
|
||||||
bool ignorePadding (bool); // ignore padding from
|
bool ignorePadding (bool); // ignore padding from
|
||||||
bool ignorePadding(); // the parent widget
|
bool ignorePadding(); // the parent widget
|
||||||
bool acceptPadding();
|
bool acceptPadding();
|
||||||
void setForegroundColor (FColor);
|
void setForegroundColor (FColor);
|
||||||
void setBackgroundColor (FColor);
|
void setBackgroundColor (FColor);
|
||||||
void setColor();
|
void setColor();
|
||||||
virtual void setX (int, bool = true); // positioning
|
virtual void setX (int, bool = true); // positioning
|
||||||
virtual void setY (int, bool = true);
|
virtual void setY (int, bool = true);
|
||||||
virtual void setPos (const FPoint&, bool = true);
|
virtual void setPos (const FPoint&, bool = true);
|
||||||
virtual void setWidth (std::size_t, bool = true);
|
virtual void setWidth (std::size_t, bool = true);
|
||||||
virtual void setHeight (std::size_t, bool = true);
|
virtual void setHeight (std::size_t, bool = true);
|
||||||
virtual void setSize (const FSize&, bool = true);
|
virtual void setSize (const FSize&, bool = true);
|
||||||
void setTopPadding (int, bool = true);
|
void setTopPadding (int, bool = true);
|
||||||
void setLeftPadding (int, bool = true);
|
void setLeftPadding (int, bool = true);
|
||||||
void setBottomPadding (int, bool = true);
|
void setBottomPadding (int, bool = true);
|
||||||
void setRightPadding (int, bool = true);
|
void setRightPadding (int, bool = true);
|
||||||
void setParentOffset();
|
void setParentOffset();
|
||||||
void setTermOffset();
|
void setTermOffset();
|
||||||
void setTermOffsetWithPadding();
|
void setTermOffsetWithPadding();
|
||||||
void setTermSize (const FSize&);
|
void setTermSize (const FSize&);
|
||||||
virtual void setGeometry (const FRect&, bool = true);
|
virtual void setGeometry (const FRect&, bool = true);
|
||||||
virtual void setGeometry (const FPoint&, const FSize&, bool = true);
|
virtual void setGeometry (const FPoint&, const FSize&, bool = true);
|
||||||
virtual void setShadowSize (const FSize&);
|
virtual void setShadowSize (const FSize&);
|
||||||
void setMinimumWidth (std::size_t);
|
void setMinimumWidth (std::size_t);
|
||||||
void setMinimumHeight (std::size_t);
|
void setMinimumHeight (std::size_t);
|
||||||
void setMinimumSize (const FSize&);
|
void setMinimumSize (const FSize&);
|
||||||
void setMaximumWidth (std::size_t);
|
void setMaximumWidth (std::size_t);
|
||||||
void setMaximumHeight (const FSize&);
|
void setMaximumHeight (const FSize&);
|
||||||
void setMaximumSize (std::size_t, std::size_t);
|
void setMaximumSize (std::size_t, std::size_t);
|
||||||
void setFixedSize (const FSize&);
|
void setFixedSize (const FSize&);
|
||||||
bool setCursorPos (const FPoint&);
|
bool setCursorPos (const FPoint&);
|
||||||
void unsetCursorPos();
|
void unsetCursorPos();
|
||||||
void setPrintPos (const FPoint&);
|
void setPrintPos (const FPoint&);
|
||||||
void setDoubleFlatLine (fc::sides, bool = true);
|
void setDoubleFlatLine (fc::sides, bool = true);
|
||||||
void unsetDoubleFlatLine (fc::sides);
|
void unsetDoubleFlatLine (fc::sides);
|
||||||
void setDoubleFlatLine (fc::sides, int, bool = true);
|
void setDoubleFlatLine (fc::sides, int, bool = true);
|
||||||
void unsetDoubleFlatLine (fc::sides, int);
|
void unsetDoubleFlatLine (fc::sides, int);
|
||||||
|
widget_flags& setFlags();
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isRootWidget() const;
|
bool isRootWidget() const;
|
||||||
bool isWindowWidget() const;
|
bool isWindowWidget() const;
|
||||||
bool isDialogWidget() const;
|
bool isDialogWidget() const;
|
||||||
bool isMenuWidget() const;
|
bool isMenuWidget() const;
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
bool isShown() const;
|
bool isShown() const;
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool hasVisibleCursor() const;
|
bool hasVisibleCursor() const;
|
||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
bool acceptFocus() const; // is focusable
|
bool acceptFocus() const; // is focusable
|
||||||
bool isPaddingIgnored();
|
bool isPaddingIgnored();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static FWidget* childWidgetAt (FWidget*, const FPoint&);
|
static FWidget* childWidgetAt (FWidget*, const FPoint&);
|
||||||
int numOfFocusableChildren();
|
int numOfFocusableChildren();
|
||||||
virtual bool close();
|
virtual bool close();
|
||||||
void clearStatusbarMessage();
|
void clearStatusbarMessage();
|
||||||
void addCallback ( const FString&
|
void addCallback ( const FString&
|
||||||
, FCallback
|
, FCallback
|
||||||
, FDataPtr = nullptr );
|
, FDataPtr = nullptr );
|
||||||
void addCallback ( const FString&
|
void addCallback ( const FString&
|
||||||
, FWidget*
|
, FWidget*
|
||||||
, FMemberCallback
|
, FMemberCallback
|
||||||
, FDataPtr = nullptr );
|
, FDataPtr = nullptr );
|
||||||
void delCallback (FCallback);
|
void delCallback (FCallback);
|
||||||
void delCallback (FWidget*);
|
void delCallback (FWidget*);
|
||||||
void delCallbacks();
|
void delCallbacks();
|
||||||
void emitCallback (const FString&);
|
void emitCallback (const FString&);
|
||||||
void addAccelerator (FKey);
|
void addAccelerator (FKey);
|
||||||
virtual void addAccelerator (FKey, FWidget*);
|
virtual void addAccelerator (FKey, FWidget*);
|
||||||
void delAccelerator ();
|
void delAccelerator ();
|
||||||
virtual void delAccelerator (FWidget*);
|
virtual void delAccelerator (FWidget*);
|
||||||
virtual void redraw();
|
virtual void redraw();
|
||||||
virtual void resize();
|
virtual void resize();
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual bool focusFirstChild(); // widget focusing
|
virtual bool focusFirstChild(); // widget focusing
|
||||||
virtual bool focusLastChild();
|
virtual bool focusLastChild();
|
||||||
FPoint termToWidgetPos (const FPoint&);
|
FPoint termToWidgetPos (const FPoint&);
|
||||||
void detectTermSize();
|
void detectTermSize();
|
||||||
void print (const FPoint&) override;
|
void print (const FPoint&) override;
|
||||||
virtual void move (const FPoint&);
|
virtual void move (const FPoint&);
|
||||||
void drawShadow();
|
void drawShadow();
|
||||||
void clearShadow();
|
void clearShadow();
|
||||||
void drawFlatBorder();
|
void drawFlatBorder();
|
||||||
void clearFlatBorder();
|
void clearFlatBorder();
|
||||||
virtual void drawBorder();
|
virtual void drawBorder();
|
||||||
static void quit();
|
static void quit();
|
||||||
|
|
||||||
// Data Members
|
|
||||||
static widgetList* window_list;
|
|
||||||
Accelerators* accelerator_list{nullptr};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct callback_data
|
struct callback_data
|
||||||
|
@ -367,73 +366,71 @@ class FWidget : public FVTerm, public FObject
|
||||||
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
term_area* getPrintArea() override;
|
term_area* getPrintArea() override;
|
||||||
void addPreprocessingHandler ( FVTerm*
|
const FWidgetColors& getFWidgetColors() const;
|
||||||
, FPreprocessingHandler ) override;
|
static uInt getModalDialogCounter();
|
||||||
void delPreprocessingHandler (FVTerm*) override;
|
static widgetList*& getDialogList();
|
||||||
|
static widgetList*& getAlwaysOnTopList();
|
||||||
|
static widgetList*& getWidgetCloseList();
|
||||||
|
void addPreprocessingHandler ( FVTerm*
|
||||||
|
, FPreprocessingHandler ) override;
|
||||||
|
void delPreprocessingHandler (FVTerm*) override;
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isChildPrintArea() const;
|
bool isChildPrintArea() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
virtual void setStatusBar (FStatusBar*);
|
virtual void setStatusBar (FStatusBar*);
|
||||||
virtual void setMenuBar (FMenuBar*);
|
virtual void setMenuBar (FMenuBar*);
|
||||||
|
FWidgetColors& setFWidgetColors();
|
||||||
|
static uInt& setModalDialogCounter();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void adjustSize();
|
virtual void adjustSize();
|
||||||
void adjustSizeGlobal();
|
void adjustSizeGlobal();
|
||||||
void hideSize (const FSize&);
|
void hideArea (const FSize&);
|
||||||
virtual bool focusNextChild(); // Change child...
|
void createWidgetAcceleratorList();
|
||||||
virtual bool focusPrevChild(); // ...focus
|
virtual bool focusNextChild(); // Change child...
|
||||||
|
virtual bool focusPrevChild(); // ...focus
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
bool event (FEvent*) override;
|
bool event (FEvent*) override;
|
||||||
virtual void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
virtual void onKeyUp (FKeyEvent*);
|
virtual void onKeyUp (FKeyEvent*);
|
||||||
virtual void onKeyDown (FKeyEvent*);
|
virtual void onKeyDown (FKeyEvent*);
|
||||||
virtual void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
virtual void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
virtual void onMouseDoubleClick (FMouseEvent*);
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||||
virtual void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
virtual void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
virtual void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
virtual void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
virtual void onChildFocusIn (FFocusEvent*);
|
virtual void onChildFocusIn (FFocusEvent*);
|
||||||
virtual void onChildFocusOut (FFocusEvent*);
|
virtual void onChildFocusOut (FFocusEvent*);
|
||||||
virtual void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
virtual void onResize (FResizeEvent*);
|
virtual void onResize (FResizeEvent*);
|
||||||
virtual void onShow (FShowEvent*);
|
virtual void onShow (FShowEvent*);
|
||||||
virtual void onHide (FHideEvent*);
|
virtual void onHide (FHideEvent*);
|
||||||
virtual void onClose (FCloseEvent*);
|
virtual void onClose (FCloseEvent*);
|
||||||
|
|
||||||
// Data Members
|
|
||||||
struct widget_flags flags{};
|
|
||||||
static uInt modal_dialogs;
|
|
||||||
static FWidgetColors wc;
|
|
||||||
static widgetList* dialog_list;
|
|
||||||
static widgetList* always_on_top_list;
|
|
||||||
static widgetList* close_widget;
|
|
||||||
MemberCallbackObjects member_callback_objects{};
|
|
||||||
CallbackObjects callback_objects{};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void finish();
|
void finish();
|
||||||
void insufficientSpaceAdjust();
|
void insufficientSpaceAdjust();
|
||||||
void KeyPressEvent (FKeyEvent*);
|
void KeyPressEvent (FKeyEvent*);
|
||||||
void KeyDownEvent (FKeyEvent*);
|
void KeyDownEvent (FKeyEvent*);
|
||||||
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
|
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
|
||||||
void processDestroy();
|
void processDestroy();
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawWindows();
|
void drawWindows();
|
||||||
void drawChildren();
|
void drawChildren();
|
||||||
void drawTransparentShadow (int, int, int, int);
|
void drawTransparentShadow (int, int, int, int);
|
||||||
void drawBlockShadow (int, int, int, int);
|
void drawBlockShadow (int, int, int, int);
|
||||||
static void setColorTheme();
|
static void setColorTheme();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FPoint widget_cursor_position{-1, -1};
|
FPoint widget_cursor_position{-1, -1};
|
||||||
|
|
||||||
struct widget_size_hints
|
struct widget_size_hints
|
||||||
{
|
{
|
||||||
|
@ -480,38 +477,48 @@ class FWidget : public FVTerm, public FObject
|
||||||
int right{0};
|
int right{0};
|
||||||
} padding{};
|
} padding{};
|
||||||
|
|
||||||
bool ignore_padding{false};
|
struct widget_flags flags{};
|
||||||
|
bool ignore_padding{false};
|
||||||
|
|
||||||
// widget size
|
// widget size
|
||||||
FRect wsize{1, 1, 1, 1};
|
FRect wsize{1, 1, 1, 1};
|
||||||
FRect adjust_wsize{1, 1, 1, 1};
|
FRect adjust_wsize{1, 1, 1, 1};
|
||||||
FRect adjust_wsize_term{};
|
FRect adjust_wsize_term{};
|
||||||
FRect adjust_wsize_shadow{};
|
FRect adjust_wsize_shadow{};
|
||||||
FRect adjust_wsize_term_shadow{};
|
FRect adjust_wsize_term_shadow{};
|
||||||
// widget offset
|
// widget offset
|
||||||
FRect offset{};
|
FRect offset{};
|
||||||
// offset of the widget client area
|
// offset of the widget client area
|
||||||
FRect client_offset{};
|
FRect client_offset{};
|
||||||
// widget shadow size (on the right and bottom side)
|
// widget shadow size (on the right and bottom side)
|
||||||
FSize wshadow{0, 0};
|
FSize wshadow{0, 0};
|
||||||
|
|
||||||
// default widget foreground and background color
|
// default widget foreground and background color
|
||||||
FColor foreground_color{fc::Default};
|
FColor foreground_color{fc::Default};
|
||||||
FColor background_color{fc::Default};
|
FColor background_color{fc::Default};
|
||||||
|
FString statusbar_message{};
|
||||||
|
Accelerators* accelerator_list{nullptr};
|
||||||
|
MemberCallbackObjects member_callback_objects{};
|
||||||
|
CallbackObjects callback_objects{};
|
||||||
|
|
||||||
FString statusbar_message{};
|
static FStatusBar* statusbar;
|
||||||
static FStatusBar* statusbar;
|
static FMenuBar* menubar;
|
||||||
static FMenuBar* menubar;
|
static FWidget* main_widget;
|
||||||
static FWidget* main_widget;
|
static FWidget* active_window;
|
||||||
static FWidget* active_window;
|
static FWidget* focus_widget;
|
||||||
static FWidget* focus_widget;
|
static FWidget* clicked_widget;
|
||||||
static FWidget* clicked_widget;
|
static FWidget* open_menu;
|
||||||
static FWidget* open_menu;
|
static FWidget* move_size_widget;
|
||||||
static FWidget* move_size_widget;
|
static FWidget* show_root_widget;
|
||||||
static FWidget* show_root_widget;
|
static FWidget* redraw_root_widget;
|
||||||
static FWidget* redraw_root_widget;
|
static widgetList* window_list;
|
||||||
static bool init_desktop;
|
static widgetList* dialog_list;
|
||||||
static bool hideable;
|
static widgetList* always_on_top_list;
|
||||||
|
static widgetList* close_widget;
|
||||||
|
static FWidgetColors wc;
|
||||||
|
static uInt modal_dialog_counter;
|
||||||
|
static bool init_desktop;
|
||||||
|
static bool hideable;
|
||||||
|
|
||||||
// Friend classes
|
// Friend classes
|
||||||
friend class FToggleButton;
|
friend class FToggleButton;
|
||||||
|
@ -557,6 +564,14 @@ inline FWidget*& FWidget::getOpenMenu()
|
||||||
inline FWidget*& FWidget::getMoveSizeWidget()
|
inline FWidget*& FWidget::getMoveSizeWidget()
|
||||||
{ return move_size_widget; }
|
{ return move_size_widget; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::Accelerators* FWidget::getAcceleratorList() const
|
||||||
|
{ return accelerator_list; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::widgetList*& FWidget::getWindowList()
|
||||||
|
{ return window_list; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FMenuBar* FWidget::getMenuBar()
|
inline FMenuBar* FWidget::getMenuBar()
|
||||||
{ return menubar; }
|
{ return menubar; }
|
||||||
|
@ -704,7 +719,7 @@ inline std::size_t FWidget::getDesktopHeight()
|
||||||
{ return getLineNumber(); }
|
{ return getLineNumber(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FWidget::widget_flags FWidget::getFlags() const
|
inline const FWidget::widget_flags& FWidget::getFlags() const
|
||||||
{ return flags; }
|
{ return flags; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -871,6 +886,10 @@ inline void FWidget::unsetDoubleFlatLine (fc::sides side)
|
||||||
inline void FWidget::unsetDoubleFlatLine (fc::sides side, int pos)
|
inline void FWidget::unsetDoubleFlatLine (fc::sides side, int pos)
|
||||||
{ setDoubleFlatLine(side, pos, false); }
|
{ setDoubleFlatLine(side, pos, false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::widget_flags& FWidget::setFlags()
|
||||||
|
{ return flags; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isRootWidget() const
|
inline bool FWidget::isRootWidget() const
|
||||||
{ return (! hasParent()); }
|
{ return (! hasParent()); }
|
||||||
|
@ -946,6 +965,34 @@ inline void FWidget::drawBorder()
|
||||||
finalcut::drawBorder (this, FRect(FPoint(1, 1), getSize()));
|
finalcut::drawBorder (this, FRect(FPoint(1, 1), getSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FWidgetColors& FWidget::getFWidgetColors() const
|
||||||
|
{ return wc; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline uInt FWidget::getModalDialogCounter()
|
||||||
|
{ return modal_dialog_counter; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::widgetList*& FWidget::getDialogList()
|
||||||
|
{ return dialog_list; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::widgetList*& FWidget::getAlwaysOnTopList()
|
||||||
|
{ return always_on_top_list; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::widgetList*& FWidget::getWidgetCloseList()
|
||||||
|
{ return close_widget; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidgetColors& FWidget::setFWidgetColors()
|
||||||
|
{ return wc; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline uInt& FWidget::setModalDialogCounter()
|
||||||
|
{ return modal_dialog_counter; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::processDestroy()
|
inline void FWidget::processDestroy()
|
||||||
{ emitCallback("destroy"); }
|
{ emitCallback("destroy"); }
|
||||||
|
|
|
@ -247,19 +247,19 @@ inline bool FWindow::isWindowActive() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWindow::isResizeable() const
|
inline bool FWindow::isResizeable() const
|
||||||
{ return flags.resizeable; }
|
{ return getFlags().resizeable; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWindow::isAlwaysOnTop() const
|
inline bool FWindow::isAlwaysOnTop() const
|
||||||
{ return flags.always_on_top; }
|
{ return getFlags().always_on_top; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWindow::hasTransparentShadow() const
|
inline bool FWindow::hasTransparentShadow() const
|
||||||
{ return flags.trans_shadow; }
|
{ return getFlags().trans_shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWindow::hasShadow() const
|
inline bool FWindow::hasShadow() const
|
||||||
{ return flags.shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)
|
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)
|
||||||
|
|
|
@ -54,22 +54,22 @@ class FMouse_protected : public finalcut::FMouse
|
||||||
|
|
||||||
uInt16 getMaxWidth()
|
uInt16 getMaxWidth()
|
||||||
{
|
{
|
||||||
return max_width;
|
return finalcut::FMouse::getMaxWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
uInt16 getMaxHeight()
|
uInt16 getMaxHeight()
|
||||||
{
|
{
|
||||||
return max_height;
|
return finalcut::FMouse::getMaxHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FPoint& getNewMousePosition()
|
finalcut::FPoint& getNewMousePosition()
|
||||||
{
|
{
|
||||||
return new_mouse_position;
|
return finalcut::FMouse::getNewPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
uInt64 getDblclickInterval()
|
uInt64 getDblclickInterval()
|
||||||
{
|
{
|
||||||
return dblclick_interval;
|
return finalcut::FMouse::getDblclickInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDblclickTimeout (timeval* t)
|
bool isDblclickTimeout (timeval* t)
|
||||||
|
|
Loading…
Reference in New Issue