Removing public + protected data members from classes

This commit is contained in:
Markus Gans 2019-09-01 23:29:27 +02:00
parent 9a40890026
commit 69db7417ad
49 changed files with 1133 additions and 826 deletions

View File

@ -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>
* More use of direct initializations

View File

@ -84,6 +84,7 @@ void Button::setChecked (bool enable)
}
else
{
const finalcut::FWidgetColors& wc = getFWidgetColors();
setBackgroundColor(wc.button_active_bg);
setFocusForegroundColor(wc.button_active_focus_fg);
setFocusBackgroundColor(wc.button_active_focus_bg);
@ -335,6 +336,7 @@ void Calc::drawDispay()
if ( isMonochron() )
setReverse(false);
const finalcut::FWidgetColors& wc = getFWidgetColors();
print() << FColorPair(fc::Black, fc::LightGray)
<< FPoint(3, 3) << display << ' '
<< FColorPair(wc.dialog_fg, wc.dialog_bg);
@ -837,7 +839,7 @@ void Calc::draw()
{
setBold();
setColor (fc::LightBlue, fc::Cyan);
clearArea (vdesktop, fc::MediumShade);
clearArea (getVirtualDesktop(), fc::MediumShade);
unsetBold();
finalcut::FDialog::draw();
drawDispay();

View File

@ -46,8 +46,8 @@ class Keyboard : public finalcut::FWidget
Keyboard::Keyboard (finalcut::FWidget* parent)
: finalcut::FWidget(parent)
{
wc.term_fg = finalcut::fc::Default;
wc.term_bg = finalcut::fc::Default;
setFWidgetColors().term_fg = finalcut::fc::Default;
setFWidgetColors().term_bg = finalcut::fc::Default;
}
//----------------------------------------------------------------------
@ -63,10 +63,10 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
<< " (id " << key_id << ")\n";
if ( is_last_line )
scrollAreaForward (vdesktop);
scrollAreaForward (getVirtualDesktop());
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
, true, vdesktop );
, true, getVirtualDesktop() );
}
//----------------------------------------------------------------------
@ -83,7 +83,7 @@ void Keyboard::draw()
<< "---------------\n"
<< "Press Q to quit\n"
<< "---------------\n";
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);
setAreaCursor (finalcut::FPoint(1, 4), true, getVirtualDesktop());
}
//----------------------------------------------------------------------

View File

@ -497,30 +497,31 @@ void MouseDraw::drawCanvas()
if ( ! (hasPrintArea() && canvas) )
return;
int ax = 9 + getTermX() - print_area->offset_left
, ay = 1 + getTermY() - print_area->offset_top
auto printarea = getCurrentPrintArea();
int ax = 9 + getTermX() - printarea->offset_left
, ay = 1 + getTermY() - printarea->offset_top
, y_end = canvas->height
, 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
{
finalcut::charData* canvaschar{}; // canvas character
finalcut::charData* winchar{}; // window character
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
, canvaschar
, sizeof(finalcut::charData) * unsigned(x_end) );
if ( int(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);
if ( int(printarea->changes[ay + y].xmin) > ax )
printarea->changes[ay + y].xmin = uInt(ax);
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
if ( int(printarea->changes[ay + y].xmax) < ax + x_end - 1 )
printarea->changes[ay + y].xmax = uInt(ax + x_end - 1);
}
print_area->has_changes = true;
printarea->has_changes = true;
}
//----------------------------------------------------------------------

View File

@ -135,6 +135,7 @@ void Scrollview::draw()
if ( isMonochron() )
setReverse(true);
const finalcut::FWidgetColors& wc = getFWidgetColors();
setColor (wc.label_inactive_fg, wc.dialog_bg);
clearArea();

View File

@ -77,7 +77,7 @@ class AttribDlg : public finalcut::FDialog
//----------------------------------------------------------------------
AttribDlg::AttribDlg (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, bgcolor(wc.label_bg)
, bgcolor(getFWidgetColors().label_bg)
{
setText ( "A terminal attributes test ("
+ finalcut::FString(getTermType())
@ -270,6 +270,7 @@ void AttribDemo::printColorLine()
//----------------------------------------------------------------------
void AttribDemo::printAltCharset()
{
const finalcut::FWidgetColors& wc = getFWidgetColors();
auto parent = static_cast<AttribDlg*>(getParent());
if ( ! isMonochron() )
@ -420,6 +421,7 @@ void AttribDemo::printProtected()
void AttribDemo::draw()
{
// test alternate character set
const finalcut::FWidgetColors& wc = getFWidgetColors();
printAltCharset();
std::vector<std::function<void()> > effect

View File

@ -54,8 +54,8 @@ Timer::Timer (finalcut::FWidget* parent)
delTimer (id);
addTimer (250); // 250-millisecond timer
wc.term_fg = fc::Default;
wc.term_bg = fc::Default;
setFWidgetColors().term_fg = fc::Default;
setFWidgetColors().term_bg = fc::Default;
}
//----------------------------------------------------------------------
@ -65,7 +65,7 @@ void Timer::draw()
<< "---------------\n"
<< "Press Q to quit\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';
if ( is_last_line )
scrollAreaForward (vdesktop);
scrollAreaForward (getVirtualDesktop());
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
, true, vdesktop );
, true, getVirtualDesktop() );
}
//----------------------------------------------------------------------

View File

@ -93,6 +93,7 @@ void Transparent::draw()
if ( type == shadow )
{
const finalcut::FWidgetColors& wc = getFWidgetColors();
setColor(wc.shadow_bg, wc.shadow_fg);
setTransShadow();
}

View File

@ -71,6 +71,7 @@ class SmallWindow : public finalcut::FDialog
SmallWindow::SmallWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
{
const finalcut::FWidgetColors& wc = getFWidgetColors();
wchar_t arrow_up, arrow_down;
arrow_up = fc::BlackUpPointingTriangle;
arrow_down = fc::BlackDownPointingTriangle;
@ -455,11 +456,11 @@ void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
//----------------------------------------------------------------------
void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
{
if ( ! dialog_list || dialog_list->empty() )
if ( ! getDialogList() || getDialogList()->empty() )
return;
auto iter = dialog_list->end();
auto first = dialog_list->begin();
auto iter = getDialogList()->end();
auto first = getDialogList()->begin();
activateWindow(this);
do
@ -475,12 +476,12 @@ void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
//----------------------------------------------------------------------
void Window::cb_next (finalcut::FWidget*, FDataPtr)
{
if ( ! dialog_list || dialog_list->empty() )
if ( ! getDialogList() || getDialogList()->empty() )
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() )
{
@ -491,8 +492,8 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
{
++next_element;
if ( next_element == dialog_list->end() )
next_element = dialog_list->begin();
if ( next_element == getDialogList()->end() )
next_element = getDialogList()->begin();
next = static_cast<finalcut::FDialog*>(*next_element);
} while ( ! next->isEnabled()
@ -511,10 +512,10 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
//----------------------------------------------------------------------
void Window::cb_previous (finalcut::FWidget*, FDataPtr)
{
if ( ! dialog_list || dialog_list->empty() )
if ( ! getDialogList() || getDialogList()->empty() )
return;
auto iter = dialog_list->end();
auto iter = getDialogList()->end();
do
{
@ -528,8 +529,8 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
do
{
if ( prev_element == dialog_list->begin() )
prev_element = dialog_list->end();
if ( prev_element == getDialogList()->begin() )
prev_element = getDialogList()->end();
--prev_element;
prev = static_cast<finalcut::FDialog*>(*prev_element);
@ -542,7 +543,7 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
break;
}
}
while ( iter != dialog_list->begin() );
while ( iter != getDialogList()->begin() );
}
//----------------------------------------------------------------------

View File

@ -182,7 +182,7 @@ bool FApplication::sendEvent ( const FObject* receiver
const auto r_widget = static_cast<const FWidget*>(receiver);
auto widget = const_cast<FWidget*>(r_widget);
if ( modal_dialogs > 0 )
if ( getModalDialogCounter() > 0 )
{
const FWidget* window;
@ -680,7 +680,7 @@ bool FApplication::processDialogSwitchAccelerator()
{
FKey key = keyboard->getKey();
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 )
{
@ -695,7 +695,7 @@ bool FApplication::processDialogSwitchAccelerator()
}
FAccelEvent a_ev (fc::Accelerator_Event, getFocusWidget());
sendEvent (dialog_list->at(n - 1), &a_ev);
sendEvent (getDialogList()->at(n - 1), &a_ev);
return true;
}
}
@ -709,11 +709,11 @@ bool FApplication::processAccelerator (const FWidget*& widget)
bool accpt{false};
if ( widget
&& widget->accelerator_list
&& ! widget->accelerator_list->empty() )
&& widget->getAcceleratorList()
&& ! widget->getAcceleratorList()->empty() )
{
auto iter = widget->accelerator_list->begin();
auto last = widget->accelerator_list->end();
auto iter = widget->getAcceleratorList()->begin();
auto last = widget->getAcceleratorList()->end();
while ( iter != last )
{
@ -1156,17 +1156,17 @@ void FApplication::processCloseWidget()
{
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;
++iter;
}
close_widget->clear();
getWidgetCloseList()->clear();
}
updateTerminal (FVTerm::start_refresh);

View File

@ -130,7 +130,7 @@ void FButton::setInactiveBackgroundColor (FColor color)
//----------------------------------------------------------------------
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)
{
return (flags.flat = enable);
return (setFlags().flat = enable);
}
//----------------------------------------------------------------------
@ -189,16 +189,16 @@ bool FButton::setShadow (bool enable)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags.shadow = true;
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
}
else
{
flags.shadow = false;
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
}
return flags.shadow;
return getFlags().shadow;
}
//----------------------------------------------------------------------
@ -238,6 +238,7 @@ void FButton::hide()
}
else
{
const FWidgetColors& wc = getFWidgetColors();
fg = wc.dialog_fg;
bg = wc.dialog_bg;
}
@ -409,6 +410,7 @@ void FButton::onFocusOut (FFocusEvent*)
//----------------------------------------------------------------------
void FButton::init()
{
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.button_active_fg);
setBackgroundColor (wc.button_active_bg);
setShadow();
@ -455,7 +457,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
return 0;
// noshadow + indent one character to the right
if ( flags.flat )
if ( getFlags().flat )
clearFlatBorder();
else if ( hasShadow() )
clearShadow();
@ -490,7 +492,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
if ( flags.active && isMonochron() )
if ( getFlags().active && isMonochron() )
setReverse(false); // Dark background
}
}
@ -577,7 +579,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
, 1 + int(vcenter_offset) )); // hotkey
if ( ! flags.active && isMonochron() )
if ( ! getFlags().active && isMonochron() )
setReverse(true); // Light background
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
; z++, pos++)
{
if ( z == hotkeypos && flags.active )
if ( z == hotkeypos && getFlags().active )
{
setColor (button_hotkey_fg, button_bg);
if ( ! active_focus && getMaxColor() < 16 )
setBold();
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
setUnderline();
print (button_text[z]);
@ -602,7 +604,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
if ( ! active_focus && getMaxColor() < 16 )
unsetBold();
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
unsetUnderline();
setColor (button_fg, button_bg);
@ -633,7 +635,7 @@ void FButton::draw()
auto parent_widget = getParentWidget();
txtlength = text.getLength();
space_char = int(' ');
active_focus = flags.active && flags.focus;
active_focus = getFlags().active && getFlags().focus;
try
{
@ -654,13 +656,13 @@ void FButton::draw()
// Clear right margin after animation
clearRightMargin (parent_widget);
if ( ! flags.active && isMonochron() )
if ( ! getFlags().active && isMonochron() )
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
if ( flags.flat && ! button_down )
if ( getFlags().flat && ! button_down )
drawFlatBorder();
hotkeypos = finalcut::getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
@ -686,7 +688,7 @@ void FButton::draw()
drawTopBottomBackground();
// Draw button shadow
if ( ! flags.flat && flags.shadow && ! button_down )
if ( ! getFlags().flat && getFlags().shadow && ! button_down )
drawShadow();
if ( isMonochron() )
@ -699,7 +701,7 @@ void FButton::draw()
//----------------------------------------------------------------------
void FButton::updateStatusBar()
{
if ( ! flags.focus || ! getStatusBar() )
if ( ! getFlags().focus || ! getStatusBar() )
return;
const auto& msg = getStatusbarMessage();

View File

@ -207,6 +207,7 @@ void FButtonGroup::hide()
}
else
{
const FWidgetColors& wc = getFWidgetColors();
fg = wc.dialog_fg;
bg = wc.dialog_bg;
}
@ -324,6 +325,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
{
auto iter = buttonlist.begin();
auto last = buttonlist.end();
in_ev->ignore();
while ( iter != last )
{
@ -334,7 +336,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
if ( isRadioButton(toggle_button) )
{
auto prev_element = getFocusWidget();
in_ev->ignore();
toggle_button->setFocus();
FFocusEvent cfi (fc::ChildFocusIn_Event);
@ -343,6 +345,9 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
FFocusEvent in (fc::FocusIn_Event);
FApplication::sendEvent(toggle_button, &in);
if ( in.isAccepted() )
in_ev->accept();
if ( prev_element )
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();
if ( in_ev->getFocusType() == fc::FocusNextWidget )
@ -473,6 +478,7 @@ bool FButtonGroup::isRadioButton (const FToggleButton* button) const
//----------------------------------------------------------------------
void FButtonGroup::init()
{
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.label_fg);
setBackgroundColor (wc.label_bg);
setMinimumSize (FSize(7, 4));
@ -487,6 +493,8 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
if ( isMonochron() )
setReverse(true);
const FWidgetColors& wc = getFWidgetColors();
if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg);
else
@ -494,16 +502,16 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
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);
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
setUnderline();
print (LabelText[z]);
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
unsetUnderline();
setColor (wc.label_emphasis_fg, wc.label_bg);

View File

@ -55,7 +55,7 @@ FCheckMenuItem::~FCheckMenuItem() // destructor
//----------------------------------------------------------------------
void FCheckMenuItem::init (FWidget* parent)
{
checkable = true;
setCheckable();
if ( ! parent )
return;
@ -76,7 +76,11 @@ void FCheckMenuItem::processToggle()
//----------------------------------------------------------------------
void FCheckMenuItem::processClicked()
{
checked = ! checked;
if ( isChecked() )
unsetChecked();
else
setChecked();
processToggle();
emitCallback("clicked");
}

View File

@ -60,8 +60,6 @@ FDialog::~FDialog() // destructor
bool is_quit = fapp->isQuit();
delete dialog_menu;
dgl_menuitem = nullptr;
delete accelerator_list;
accelerator_list = nullptr;
if ( ! is_quit )
switchToPrevWindow(this);
@ -80,7 +78,7 @@ bool FDialog::setDialogWidget (bool enable)
if ( isDialogWidget() == enable )
return true;
flags.dialog_widget = enable;
setFlags().dialog_widget = enable;
if ( enable )
setTermOffsetWithPadding();
@ -96,12 +94,12 @@ bool FDialog::setModal (bool enable)
if ( isModal() == enable )
return true;
flags.modal = enable;
setFlags().modal = enable;
if ( enable )
modal_dialogs++;
setModalDialogCounter()++;
else
modal_dialogs--;
setModalDialogCounter()--;
return enable;
}
@ -110,7 +108,7 @@ bool FDialog::setModal (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
FWindow::setPos(pos, false);
putArea (getTermPos(), vwin);
putArea (getTermPos(), getVWin());
// restoring the non-covered terminal areas
if ( getTermGeometry().overlap(old_geometry) )
@ -686,12 +684,12 @@ void FDialog::onWindowRaised (FEvent*)
if ( ! isShown() )
return;
putArea (getTermPos(), vwin);
putArea (getTermPos(), getVWin());
// 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());
}
}
@ -699,13 +697,13 @@ void FDialog::onWindowRaised (FEvent*)
//----------------------------------------------------------------------
void FDialog::onWindowLowered (FEvent*)
{
if ( ! window_list )
if ( ! getWindowList() )
return;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return;
for (auto&& win : *window_list)
for (auto&& win : *getWindowList())
putArea (win->getTermPos(), win->getVWin());
}
@ -738,7 +736,7 @@ void FDialog::draw()
drawTitleBar();
setCursorPos(FPoint(2, int(getHeight()) - 1));
if ( flags.shadow )
if ( getFlags().shadow )
drawDialogShadow();
if ( isMonochron() )
@ -748,7 +746,7 @@ void FDialog::draw()
//----------------------------------------------------------------------
void FDialog::drawDialogShadow()
{
if ( isMonochron() && ! flags.trans_shadow )
if ( isMonochron() && ! getFlags().trans_shadow )
return;
drawShadow();
@ -786,6 +784,7 @@ void FDialog::init()
addDialog(this);
setActiveWindow(this);
setTransparentShadow();
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
auto old_focus = FWidget::getFocusWidget();
@ -796,15 +795,8 @@ void FDialog::init()
old_focus->redraw();
}
try
{
accelerator_list = new Accelerators();
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
// Create your own accelerator list for this dialog
createWidgetAcceleratorList();
// Add the dialog menu
initDialogMenu();
@ -915,7 +907,10 @@ void FDialog::drawBorder()
{
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
&& ! isZoomed() )
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.dialog_resize_fg, getBackgroundColor());
}
else
setColor();
@ -976,6 +971,7 @@ void FDialog::drawBarButton()
{
// Print the title button
print() << FPoint(1, 1);
const FWidgetColors& wc = getFWidgetColors();
if ( dialog_menu && dialog_menu->isShown() )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
@ -1028,6 +1024,8 @@ void FDialog::drawZoomButton()
if ( ! isResizeable() )
return;
const FWidgetColors& wc = getFWidgetColors();
if ( zoom_button_pressed )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
else
@ -1095,6 +1093,7 @@ void FDialog::drawTextBar()
// Fill with spaces (left of the title)
std::size_t center_offset{0};
std::size_t x{1};
const FWidgetColors& wc = getFWidgetColors();
if ( getMaxColor() < 16 )
setBold();
@ -1140,17 +1139,17 @@ void FDialog::restoreOverlaidWindows()
{
// Restoring overlaid windows
if ( ! window_list || window_list->empty() )
if ( ! getWindowList() || getWindowList()->empty() )
return;
bool overlaid{false};
for (auto&& win : *window_list)
for (auto&& win : *getWindowList())
{
if ( overlaid )
putArea (win->getTermPos(), win->getVWin());
if ( vwin == win->getVWin() )
if ( getVWin() == win->getVWin() )
overlaid = true;
}
}
@ -1168,7 +1167,7 @@ void FDialog::setCursorToFocusWidget()
{
FPoint cursor_pos(focus->getCursorPos());
focus->setCursorPos(cursor_pos);
updateVTermCursor(vwin);
updateVTermCursor(getVWin());
}
}
@ -1597,24 +1596,24 @@ inline void FDialog::cancelMoveSize()
void FDialog::addDialog (FWidget* obj)
{
// Add the dialog object obj to the dialog list
if ( dialog_list )
dialog_list->push_back(obj);
if ( getDialogList() )
getDialogList()->push_back(obj);
}
//----------------------------------------------------------------------
void FDialog::delDialog (FWidget* obj)
{
// Delete the dialog object obj from the dialog list
if ( ! dialog_list || dialog_list->empty() )
if ( ! getDialogList() || getDialogList()->empty() )
return;
auto iter = dialog_list->begin();
auto iter = getDialogList()->begin();
while ( iter != dialog_list->end() )
while ( iter != getDialogList()->end() )
{
if ( (*iter) == obj )
{
dialog_list->erase(iter);
getDialogList()->erase(iter);
return;
}

View File

@ -236,7 +236,7 @@ void FLabel::setText (const FString& txt)
void FLabel::hide()
{
FWidget::hide();
hideSize (getSize());
hideArea (getSize());
}
//----------------------------------------------------------------------
@ -342,6 +342,7 @@ void FLabel::init()
}
else
{
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
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);
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
setUnderline();
print (line[z]);
if ( ! flags.no_underline )
if ( ! getFlags().no_underline )
unsetUnderline();
if ( hasEmphasis() )

View File

@ -168,6 +168,7 @@ const FLineEdit& FLineEdit::operator >> (FString& s)
//----------------------------------------------------------------------
bool FLineEdit::setEnable (bool enable)
{
const FWidgetColors& wc = getFWidgetColors();
FWidget::setEnable(enable);
if ( enable )
@ -195,6 +196,7 @@ bool FLineEdit::setEnable (bool enable)
//----------------------------------------------------------------------
bool FLineEdit::setFocus (bool enable)
{
const FWidgetColors& wc = getFWidgetColors();
FWidget::setFocus(enable);
if ( enable )
@ -236,16 +238,16 @@ bool FLineEdit::setShadow (bool enable)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags.shadow = true;
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
}
else
{
flags.shadow = false;
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
}
return flags.shadow;
return getFlags().shadow;
}
//----------------------------------------------------------------------
@ -318,7 +320,7 @@ void FLineEdit::hide()
FWidget::hide();
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()
{
const FWidgetColors& wc = getFWidgetColors();
label->setAccelWidget(this);
setVisibleCursor();
setShadow();
@ -696,7 +699,7 @@ void FLineEdit::draw()
{
drawInputField();
if ( flags.focus && getStatusBar() )
if ( getFlags().focus && getStatusBar() )
{
const auto& msg = getStatusbarMessage();
const auto& curMsg = getStatusBar()->getMessage();
@ -712,7 +715,7 @@ void FLineEdit::draw()
//----------------------------------------------------------------------
void FLineEdit::drawInputField()
{
bool isActiveFocus = flags.active && flags.focus;
bool isActiveFocus = getFlags().active && getFlags().focus;
print() << FPoint(1, 1);
if ( isMonochron() )
@ -756,7 +759,7 @@ void FLineEdit::drawInputField()
setUnderline(false);
}
if ( flags.shadow )
if ( getFlags().shadow )
drawShadow ();
// set the cursor to the first pos.

View File

@ -216,7 +216,7 @@ void FListBox::setText (const FString& txt)
void FListBox::hide()
{
FWidget::hide();
hideSize (getSize());
hideArea (getSize());
}
//----------------------------------------------------------------------
@ -303,6 +303,7 @@ void FListBox::clear()
hbar->hide();
// clear list from screen
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.list_fg, wc.list_bg);
size = getWidth() - 2;
@ -757,6 +758,7 @@ void FListBox::init()
initScrollbar (vbar, fc::vertical, &FListBox::cb_VBarChange);
initScrollbar (hbar, fc::horizontal, &FListBox::cb_HBarChange);
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
nf_offset = isNewFont() ? 1 : 0;
@ -824,7 +826,7 @@ void FListBox::draw()
drawScrollbars();
drawList();
if ( flags.focus && getStatusBar() )
if ( getFlags().focus && getStatusBar() )
{
const auto& msg = getStatusbarMessage();
const auto& curMsg = getStatusBar()->getMessage();
@ -874,6 +876,7 @@ void FListBox::drawHeadline()
FString txt(" " + text + " ");
std::size_t length = txt.getLength();
print() << FPoint(2, 1);
const FWidgetColors& wc = getFWidgetColors();
if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg);
@ -951,13 +954,14 @@ inline void FListBox::drawListLine ( int y
, bool serach_mark )
{
std::size_t inc_len = inc_search.getLength();
const FWidgetColors& wc = getFWidgetColors();
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
FString element (getString(iter).mid ( std::size_t(1 + xoffset)
, getWidth() - nf_offset - 4 ));
const wchar_t* const& element_str = element.wc_str();
std::size_t len = element.getLength();
if ( isMonochron() && isCurrentLine && flags.focus )
if ( isMonochron() && isCurrentLine && getFlags().focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -970,14 +974,14 @@ inline void FListBox::drawListLine ( int y
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
, wc.current_element_focus_bg );
print (element_str[i]);
}
if ( isMonochron() && isCurrentLine && flags.focus )
if ( isMonochron() && isCurrentLine && getFlags().focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1011,7 +1015,7 @@ inline void FListBox::drawListBracketsLine ( int y
, b{0};
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
if ( isMonochron() && isCurrentLine && flags.focus )
if ( isMonochron() && isCurrentLine && getFlags().focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -1032,6 +1036,7 @@ inline void FListBox::drawListBracketsLine ( int y
std::size_t full_length = getString(iter).getLength()
, len = element.getLength()
, i{0};
const FWidgetColors& wc = getFWidgetColors();
for (; i < len; i++)
{
@ -1057,7 +1062,7 @@ inline void FListBox::drawListBracketsLine ( int y
i++;
}
if ( isMonochron() && isCurrentLine && flags.focus )
if ( isMonochron() && isCurrentLine && getFlags().focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1075,6 +1080,7 @@ inline void FListBox::setLineAttributes ( int y
{
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
std::size_t inc_len = inc_search.getLength();
const FWidgetColors& wc = getFWidgetColors();
print() << FPoint(2, 2 + int(y));
if ( isLineSelected )
@ -1094,14 +1100,14 @@ inline void FListBox::setLineAttributes ( int y
if ( isCurrentLine )
{
if ( flags.focus && getMaxColor() < 16 )
if ( getFlags().focus && getMaxColor() < 16 )
setBold();
if ( isLineSelected )
{
if ( isMonochron() )
setBold();
else if ( flags.focus )
else if ( getFlags().focus )
setColor ( wc.selected_current_element_focus_fg
, wc.selected_current_element_focus_bg );
else
@ -1115,7 +1121,7 @@ inline void FListBox::setLineAttributes ( int y
if ( isMonochron() )
unsetBold();
if ( flags.focus )
if ( getFlags().focus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
@ -1142,7 +1148,7 @@ inline void FListBox::setLineAttributes ( int y
{
if ( isMonochron() )
setReverse(true);
else if ( flags.focus && getMaxColor() < 16 )
else if ( getFlags().focus && getMaxColor() < 16 )
unsetBold();
}
}

View File

@ -758,7 +758,7 @@ int FListView::addColumn (const FString& label, int width)
void FListView::hide()
{
FWidget::hide();
hideSize (getSize());
hideArea (getSize());
}
//----------------------------------------------------------------------
@ -1387,6 +1387,7 @@ void FListView::init()
root = selflist.begin();
null_iter = selflist.end();
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
nf_offset = isNewFont() ? 1 : 0;
@ -1492,7 +1493,7 @@ void FListView::draw()
drawScrollbars();
drawList();
if ( flags.focus && getStatusBar() )
if ( getFlags().focus && getStatusBar() )
{
const auto& msg = getStatusbarMessage();
const auto& curMsg = getStatusBar()->getMessage();
@ -1601,9 +1602,9 @@ void FListView::drawList()
print() << FPoint(2, 2 + int(y));
// 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());
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
, bool is_focus )
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.list_fg, wc.list_bg);
if ( is_current )
@ -1845,6 +1847,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
int column = int(std::distance(first, iter)) + 1;
bool has_sort_indicator = bool ( sort_column == column
&& ! hide_sort_indicator );
const FWidgetColors& wc = getFWidgetColors();
if ( isEnabled() )
setColor (wc.label_emphasis_fg, wc.label_bg);
@ -1885,6 +1888,7 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
// Print lable ellipsis
static constexpr int ellipsis_length = 2;
int width = iter->width;
const FWidgetColors& wc = getFWidgetColors();
headerline << ' '
<< text.left(uInt(width - ellipsis_length))

View File

@ -73,7 +73,7 @@ bool FMenu::setMenuWidget (bool enable)
if ( isMenuWidget() == enable )
return true;
return (flags.menu_widget = enable);
return (setFlags().menu_widget = enable);
}
//----------------------------------------------------------------------
@ -218,7 +218,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
mouse_down = true;
if ( item_list.empty() )
if ( getItemList().empty() )
return;
// Mouse pointer over menu list changed focus
@ -239,7 +239,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
{
mouse_down = false;
if ( item_list.empty() )
if ( getItemList().empty() )
return;
// Mouse pointer over an entry in the menu list
@ -260,7 +260,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
if ( ! isWindowActive() )
setActiveWindow(this);
if ( ! mouse_down || item_list.empty() )
if ( ! mouse_down || getItemList().empty() )
return;
mouseStates ms =
@ -328,11 +328,13 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, FDataPtr)
if ( ! menuitem->isChecked() )
return;
if ( item_list.empty() )
auto list = getItemList();
if ( list.empty() )
return;
auto iter = item_list.begin();
auto last = item_list.end();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -443,6 +445,7 @@ void FMenu::init(FWidget* parent)
setMenuWidget();
hide();
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.menu_active_fg);
setBackgroundColor (wc.menu_active_bg);
item.setMenu(this);
@ -469,8 +472,9 @@ void FMenu::init(FWidget* parent)
//----------------------------------------------------------------------
void FMenu::calculateDimensions()
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
max_item_width = 10; // minimum width
// find the maximum item width
@ -506,7 +510,7 @@ void FMenu::calculateDimensions()
, FSize(max_item_width + 2, getCount() + 2) );
// set geometry of all items
iter = item_list.begin();
iter = list.begin();
int item_X = 1;
int item_Y = 1;
@ -530,8 +534,9 @@ void FMenu::calculateDimensions()
//----------------------------------------------------------------------
void FMenu::adjustItems()
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -659,8 +664,9 @@ void FMenu::hideSuperMenus()
bool FMenu::mouseDownOverList (FPoint mouse_pos)
{
bool focus_changed{false};
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
while ( iter != last )
@ -747,8 +753,9 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
//----------------------------------------------------------------------
bool FMenu::mouseUpOverList (FPoint mouse_pos)
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
while ( iter != last )
@ -806,8 +813,9 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
//----------------------------------------------------------------------
void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
while ( iter != last )
@ -1028,8 +1036,9 @@ FMenu* FMenu::superMenuAt (int x, int y)
//----------------------------------------------------------------------
bool FMenu::selectNextItem()
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -1041,8 +1050,8 @@ bool FMenu::selectNextItem()
do
{
++next_element;
if ( next_element == item_list.end() )
next_element = item_list.begin();
if ( next_element == list.end() )
next_element = list.begin();
next = static_cast<FMenuItem*>(*next_element);
}
while ( ! next->isEnabled()
@ -1076,8 +1085,9 @@ bool FMenu::selectNextItem()
//----------------------------------------------------------------------
bool FMenu::selectPrevItem()
{
auto iter = item_list.end();
auto first = item_list.begin();
auto list = getItemList();
auto iter = list.end();
auto first = list.begin();
do
{
@ -1090,8 +1100,8 @@ bool FMenu::selectPrevItem()
do
{
if ( prev_element == item_list.begin() )
prev_element = item_list.end();
if ( prev_element == list.begin() )
prev_element = list.end();
--prev_element;
prev = static_cast<FMenuItem*>(*prev_element);
}
@ -1134,8 +1144,9 @@ void FMenu::keypressMenuBar (FKeyEvent* ev)
//----------------------------------------------------------------------
bool FMenu::hotkeyMenu (FKeyEvent* ev)
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -1192,6 +1203,7 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
void FMenu::draw()
{
// Fill the background
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( isMonochron() )
@ -1210,8 +1222,9 @@ void FMenu::draw()
void FMenu::drawItems()
{
int y = 0;
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -1228,6 +1241,7 @@ void FMenu::drawItems()
//----------------------------------------------------------------------
inline void FMenu::drawSeparator (int y)
{
const FWidgetColors& wc = getFWidgetColors();
print() << FPoint(1, 2 + y)
<< FColorPair(wc.menu_active_fg, wc.menu_active_bg);
@ -1347,6 +1361,7 @@ inline void FMenu::drawCheckMarkPrefix (FMenuItem* menuitem)
}
else
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.menu_inactive_fg, getBackgroundColor());
if ( getEncoding() == fc::ASCII )
@ -1381,6 +1396,7 @@ inline void FMenu::drawMenuText (menuText& data)
if ( z == data.hotkeypos )
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
if ( ! data.no_underline )
@ -1446,6 +1462,7 @@ inline void FMenu::setLineAttributes (FMenuItem* menuitem, int y)
{
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
const FWidgetColors& wc = getFWidgetColors();
if ( is_enabled )
{

View File

@ -65,6 +65,7 @@ void FMenuBar::resetMenu()
void FMenuBar::hide()
{
FWindow::hide();
const FWidgetColors& wc = getFWidgetColors();
FColor fg = wc.term_fg;
FColor bg = wc.term_bg;
setColor (fg, bg);
@ -152,7 +153,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
{
mouse_down = false;
if ( ! item_list.empty() && hasSelectedItem() )
if ( ! getItemList().empty() && hasSelectedItem() )
leaveMenuBar();
else
return;
@ -249,6 +250,7 @@ void FMenuBar::init()
addAccelerator (fc::Fkey_f10);
addAccelerator (fc::Fckey_space);
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.menu_active_fg);
setBackgroundColor (wc.menu_active_bg);
unsetFocusable();
@ -258,8 +260,9 @@ void FMenuBar::init()
void FMenuBar::calculateDimensions()
{
FPoint item_pos (1, 1);
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
// find the maximum item width
while ( iter != last )
@ -283,8 +286,9 @@ void FMenuBar::calculateDimensions()
//----------------------------------------------------------------------
bool FMenuBar::selectNextItem()
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -297,8 +301,8 @@ bool FMenuBar::selectNextItem()
{
++next_element;
if ( next_element == item_list.end() )
next_element = item_list.begin();
if ( next_element == list.end() )
next_element = list.begin();
next = static_cast<FMenuItem*>(*next_element);
} while ( ! next->isEnabled()
@ -345,8 +349,9 @@ bool FMenuBar::selectNextItem()
//----------------------------------------------------------------------
bool FMenuBar::selectPrevItem()
{
auto iter = item_list.end();
auto first = item_list.begin();
auto list = getItemList();
auto iter = list.end();
auto first = list.begin();
do
{
@ -359,8 +364,8 @@ bool FMenuBar::selectPrevItem()
do
{
if ( prev_element == item_list.begin() )
prev_element = item_list.end();
if ( prev_element == list.begin() )
prev_element = list.end();
--prev_element;
prev = static_cast<FMenuItem*>(*prev_element);
@ -408,8 +413,9 @@ bool FMenuBar::selectPrevItem()
//----------------------------------------------------------------------
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
{
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -476,7 +482,9 @@ void FMenuBar::draw()
//----------------------------------------------------------------------
void FMenuBar::drawItems()
{
if ( item_list.empty() )
auto list = getItemList();
if ( list.empty() )
return;
print() << FPoint(1, 1);
@ -485,8 +493,8 @@ void FMenuBar::drawItems()
setReverse(true);
screenWidth = getDesktopWidth();
auto iter = item_list.begin();
auto last = item_list.end();
auto iter = list.begin();
auto last = list.end();
std::size_t x{1};
while ( iter != last )
@ -556,6 +564,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
drawEllipsis (txtdata, x);
drawTrailingSpace (x);
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( isMonochron() && is_enabled && is_selected )
@ -569,6 +578,7 @@ inline void FMenuBar::setLineAttributes (FMenuItem* menuitem)
{
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
const FWidgetColors& wc = getFWidgetColors();
if ( is_enabled )
{
@ -617,6 +627,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
if ( z == data.hotkeypos )
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
if ( ! data.no_underline )
@ -681,8 +692,9 @@ void FMenuBar::adjustItems()
{
int item_X = 1;
int item_Y = 1;
auto iter = item_list.begin();
auto last = item_list.end();
auto list = getItemList();
auto iter = list.begin();
auto last = list.end();
while ( iter != last )
{
@ -799,12 +811,14 @@ void FMenuBar::unselectMenuItem (FMenuItem* item)
//----------------------------------------------------------------------
void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
{
if ( item_list.empty() )
auto list = getItemList();
if ( list.empty() )
return;
focus_changed = false;
auto iter = item_list.begin();
auto last = item_list.end();
auto iter = list.begin();
auto last = list.end();
int mouse_x = ev->getX();
int mouse_y = ev->getY();
@ -847,11 +861,13 @@ void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
//----------------------------------------------------------------------
void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
{
if ( item_list.empty() )
auto list = getItemList();
if ( list.empty() )
return;
auto iter = item_list.begin();
auto last = item_list.end();
auto iter = list.begin();
auto last = list.end();
int mouse_x = ev->getX();
int mouse_y = ev->getY();
@ -889,13 +905,15 @@ void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
//----------------------------------------------------------------------
void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
{
if ( item_list.empty() )
auto list = getItemList();
if ( list.empty() )
return;
focus_changed = false;
bool mouse_over_menubar{false};
auto iter = item_list.begin();
auto last = item_list.end();
auto iter = list.begin();
auto last = list.end();
int mouse_x = ev->getX();
int mouse_y = ev->getY();

View File

@ -204,10 +204,10 @@ void FMenuItem::addAccelerator (FKey key, FWidget* obj)
auto root = getRootWidget();
accelerator accel = { key, obj };
if ( root && root->accelerator_list )
if ( root && root->getAcceleratorList() )
{
accel_key = key;
root->accelerator_list->push_back(accel);
root->getAcceleratorList()->push_back(accel);
}
updateSuperMenuDimensions();
@ -219,17 +219,17 @@ void FMenuItem::delAccelerator (FWidget* obj)
auto root = getRootWidget();
if ( root
&& root->accelerator_list
&& ! root->accelerator_list->empty() )
&& root->getAcceleratorList()
&& ! 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 )
{
accel_key = 0;
iter = root->accelerator_list->erase(iter);
iter = root->getAcceleratorList()->erase(iter);
}
else
++iter;
@ -415,7 +415,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
mbar->getSelectedItem()->unsetSelected();
setSelected();
mbar->selected_item = this;
mbar->setSelectedItem(this);
openMenu();
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
menu->unselectItem();
@ -438,7 +438,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
else
{
unsetSelected();
mbar->selected_item = nullptr;
mbar->unsetSelectedItem();
mbar->redraw();
processClicked();
mbar->drop_down = false;
@ -619,12 +619,12 @@ void FMenuItem::createDialogList (FMenu* winmenu)
{
winmenu->clear();
if ( dialog_list && ! dialog_list->empty() )
if ( getDialogList() && ! getDialogList()->empty() )
{
auto first = dialog_list->begin();
auto first = getDialogList()->begin();
auto iter = first;
while ( iter != dialog_list->end() && *iter )
while ( iter != getDialogList()->end() && *iter )
{
auto win = static_cast<FDialog*>(*iter);

View File

@ -46,11 +46,8 @@ namespace finalcut
//----------------------------------------------------------------------
FMouse::FMouse()
{
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
// init bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
resetMousePressedTime();
clearButtonState();
}
@ -100,78 +97,78 @@ inline bool FMouse::hasEvent()
//----------------------------------------------------------------------
inline bool FMouse::isLeftButtonPressed()
{
return bool(b_state.left_button == Pressed);
return bool(getButtonState().left_button == Pressed);
}
//----------------------------------------------------------------------
inline bool FMouse::isLeftButtonReleased()
{
return bool(b_state.left_button == Released);
return bool(getButtonState().left_button == Released);
}
//----------------------------------------------------------------------
inline bool FMouse::isLeftButtonDoubleClick()
{
return bool(b_state.left_button == DoubleClick);
return bool(getButtonState().left_button == DoubleClick);
}
//----------------------------------------------------------------------
inline bool FMouse::isRightButtonPressed()
{
return bool(b_state.right_button == Pressed);
return bool(getButtonState().right_button == Pressed);
}
//----------------------------------------------------------------------
inline bool FMouse::isRightButtonReleased()
{
return bool(b_state.right_button == Released);
return bool(getButtonState().right_button == Released);
}
//----------------------------------------------------------------------
inline bool FMouse::isMiddleButtonPressed()
{
return bool(b_state.middle_button == Pressed);
return bool(getButtonState().middle_button == Pressed);
}
//----------------------------------------------------------------------
inline bool FMouse::isMiddleButtonReleased()
{
return bool(b_state.middle_button == Released);
return bool(getButtonState().middle_button == Released);
}
//----------------------------------------------------------------------
inline bool FMouse::isShiftKeyPressed()
{
return bool(b_state.shift_button);
return bool(getButtonState().shift_button);
}
//----------------------------------------------------------------------
inline bool FMouse::isControlKeyPressed()
{
return bool(b_state.control_button);
return bool(getButtonState().control_button);
}
//----------------------------------------------------------------------
inline bool FMouse::isMetaKeyPressed()
{
return bool(b_state.meta_button);
return bool(getButtonState().meta_button);
}
//----------------------------------------------------------------------
inline bool FMouse::isWheelUp()
{
return bool(b_state.wheel_up);
return bool(getButtonState().wheel_up);
}
//----------------------------------------------------------------------
inline bool FMouse::isWheelDown()
{
return bool(b_state.wheel_down);
return bool(getButtonState().wheel_down);
}
//----------------------------------------------------------------------
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;
}
//----------------------------------------------------------------------
void FMouse::clearButtonState()
{
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
}
// 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)
{
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)
{
@ -267,8 +338,7 @@ void FMouseGPM::setRawData (FKeyboard::keybuffer&)
//----------------------------------------------------------------------
void FMouseGPM::processEvent (struct timeval*)
{
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
clearButtonState();
if ( Gpm_GetEvent(&gpm_ev) == 1 )
{
@ -278,17 +348,17 @@ void FMouseGPM::processEvent (struct timeval*)
{
GPM_DRAWPOINTER(&gpm_ev);
has_gpm_mouse_data = false;
mouse_event_occurred = false;
clearEvent();
return;
}
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 )
b_state.wheel_up = true;
getButtonState().wheel_up = true;
else if ( gpm_ev.wdy < 0 )
b_state.wheel_down = true;
getButtonState().wheel_down = true;
switch ( gpm_ev.type & 0x0f )
{
@ -309,20 +379,20 @@ void FMouseGPM::processEvent (struct timeval*)
, std::max(gpm_ev.y, sInt16(1)) ));
if ( gpmEvent(false) == mouse_event )
input_data_pending = true;
setPending(true);
else
input_data_pending = false;
setPending(false);
GPM_DRAWPOINTER(&gpm_ev);
has_gpm_mouse_data = false;
mouse_event_occurred = true;
setEvent();
return;
}
else
gpm_fd = -1;
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.type & GPM_DOUBLE )
b_state.left_button = DoubleClick;
getButtonState().left_button = DoubleClick;
else
b_state.left_button = Pressed;
getButtonState().left_button = Pressed;
}
if ( gpm_ev.buttons & GPM_B_MIDDLE )
b_state.middle_button = Pressed;
getButtonState().middle_button = Pressed;
if ( gpm_ev.buttons & GPM_B_RIGHT )
b_state.right_button = Pressed;
getButtonState().right_button = Pressed;
if ( gpm_ev.buttons & GPM_B_UP )
b_state.wheel_up = true;
getButtonState().wheel_up = true;
if ( gpm_ev.buttons & GPM_B_DOWN )
b_state.wheel_down = true;
getButtonState().wheel_down = true;
// Keyboard modifiers
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)) )
b_state.meta_button = true;
getButtonState().meta_button = true;
if ( gpm_ev.modifiers & (1 << KG_CTRL) )
b_state.control_button = true;
getButtonState().control_button = true;
}
//----------------------------------------------------------------------
void FMouseGPM::interpretKeyUp()
{
if ( gpm_ev.buttons & GPM_B_LEFT )
b_state.left_button = Released;
getButtonState().left_button = Released;
if ( gpm_ev.buttons & GPM_B_MIDDLE )
b_state.middle_button = Released;
getButtonState().middle_button = Released;
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;
int type = gpmEvent();
@ -519,7 +589,7 @@ void FMouseX11::setRawData (FKeyboard::keybuffer& fifo_buf)
for (; n < fifo_buf_size; n++)
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 y = uChar(x11_mouse[2] - 0x20);
int btn = x11_mouse[0];
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setNewPos (x, y);
clearButtonState();
setKeyState (btn);
setMoveState (mouse_position, btn);
setButtonState (btn & button_mask, time);
if ( new_mouse_position == mouse_position
if ( mouse_position == getNewPos()
&& ! isWheelUp()
&& ! isWheelDown()
&& uChar(btn) == x11_button_state )
{
mouse_event_occurred = false;
clearEvent();
x11_mouse[0] = '\0'; // Delete already interpreted data
return;
}
mouse_event_occurred = true;
setEvent();
setPos (FPoint(x, y));
// Get the button state from string
x11_button_state = uChar(btn);
@ -562,13 +631,13 @@ void FMouseX11::processEvent (struct timeval* time)
void FMouseX11::setKeyState (int btn)
{
if ( (btn & key_shift) == key_shift )
b_state.shift_button = Pressed;
getButtonState().shift_button = Pressed;
if ( (btn & key_meta) == key_meta )
b_state.meta_button = Pressed;
getButtonState().meta_button = Pressed;
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
&& ! 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_move:
if ( mouse_position == new_mouse_position
if ( mouse_position == getNewPos()
&& x11_button_state == all_buttons_released
&& ! isDblclickTimeout(&time_mousepressed) )
&& ! isDblclickTimeout(getMousePressedTime()) )
{
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.left_button = DoubleClick;
resetMousePressedTime();
getButtonState().left_button = DoubleClick;
}
else
{
time_mousepressed = *time; // save click time
b_state.left_button = Pressed;
setMousePressedTime (time); // save click time
getButtonState().left_button = Pressed;
}
break;
case button2_pressed:
case button2_pressed_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.middle_button = Pressed;
resetMousePressedTime();
getButtonState().middle_button = Pressed;
break;
case button3_pressed:
case button3_pressed_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.right_button = Pressed;
resetMousePressedTime();
getButtonState().right_button = Pressed;
break;
case all_buttons_released:
@ -627,17 +693,17 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
{
case button1_pressed:
case button1_pressed_move:
b_state.left_button = Released;
getButtonState().left_button = Released;
break;
case button2_pressed:
case button2_pressed_move:
b_state.middle_button = Released;
getButtonState().middle_button = Released;
break;
case button3_pressed:
case button3_pressed_move:
b_state.right_button = Released;
getButtonState().right_button = Released;
break;
default:
@ -646,15 +712,13 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
break;
case button_up:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_up = Pressed;
resetMousePressedTime();
getButtonState().wheel_up = Pressed;
break;
case button_down:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_down = Pressed;
resetMousePressedTime();
getButtonState().wheel_down = Pressed;
break;
default:
@ -708,7 +772,7 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
for (; n < fifo_buf_size; n++) // Fill rest with '\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')
{
mouse_event_occurred = false;
clearEvent();
sgr_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -739,7 +803,7 @@ void FMouseSGR::processEvent (struct timeval* time)
{
if ( *p < '0' || *p > '9')
{
mouse_event_occurred = false;
clearEvent();
sgr_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -751,7 +815,7 @@ void FMouseSGR::processEvent (struct timeval* time)
{
if ( *p < '0' || *p > '9')
{
mouse_event_occurred = false;
clearEvent();
sgr_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -759,9 +823,8 @@ void FMouseSGR::processEvent (struct timeval* time)
y = uInt16(10 * y + (*p - '0'));
}
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setNewPos (x, y);
clearButtonState();
setKeyState (btn);
setMoveState (mouse_position, btn);
@ -770,17 +833,17 @@ void FMouseSGR::processEvent (struct timeval* time)
else // *p == released
setReleasedButtonState (btn & button_mask);
if ( mouse_position == new_mouse_position
if ( mouse_position == getNewPos()
&& ! isWheelUp()
&& ! isWheelDown()
&& sgr_button_state == uChar(((*p & 0x20) << 2) + btn) )
{
mouse_event_occurred = false;
clearEvent();
sgr_mouse[0] = '\0'; // Delete already interpreted data
return;
}
mouse_event_occurred = true;
setEvent();
setPos (FPoint(x, y));
// Get the button state from string
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
@ -793,13 +856,13 @@ void FMouseSGR::processEvent (struct timeval* time)
void FMouseSGR::setKeyState (int btn)
{
if ( (btn & key_shift) == key_shift )
b_state.shift_button = true;
getButtonState().shift_button = true;
if ( (btn & key_meta) == key_meta )
b_state.meta_button = true;
getButtonState().meta_button = true;
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
&& ! 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_move:
if ( mouse_position == new_mouse_position
if ( mouse_position == getNewPos()
&& (((sgr_button_state & 0x80) >> 2) + 'M') == released
&& ! isDblclickTimeout(&time_mousepressed) )
&& ! isDblclickTimeout(getMousePressedTime()) )
{
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.left_button = DoubleClick;
resetMousePressedTime();
getButtonState().left_button = DoubleClick;
}
else
{
time_mousepressed = *time; // save click time
b_state.left_button = Pressed;
setMousePressedTime (time); // save click time
getButtonState().left_button = Pressed;
}
break;
case button2:
case button2_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.middle_button = Pressed;
resetMousePressedTime();
getButtonState().middle_button = Pressed;
break;
case button3:
case button3_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.right_button = Pressed;
resetMousePressedTime();
getButtonState().right_button = Pressed;
break;
case button_up:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_up = true;
resetMousePressedTime();
getButtonState().wheel_up = true;
break;
case button_down:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_down = true;
resetMousePressedTime();
getButtonState().wheel_down = true;
break;
default:
@ -879,17 +937,17 @@ void FMouseSGR::setReleasedButtonState (int btn)
{
case button1:
case button1_move:
b_state.left_button = Released;
getButtonState().left_button = Released;
break;
case button2:
case button2_move:
b_state.middle_button = Released;
getButtonState().middle_button = Released;
break;
case button3:
case button3_move:
b_state.right_button = Released;
getButtonState().right_button = Released;
break;
default:
@ -943,7 +1001,7 @@ void FMouseUrxvt::setRawData (FKeyboard::keybuffer& fifo_buf)
for (; n < fifo_buf_size; n++) // Fill rest with '\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')
{
mouse_event_occurred = false;
clearEvent();
urxvt_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -984,7 +1042,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
{
if ( *p < '0' || *p > '9')
{
mouse_event_occurred = false;
clearEvent();
urxvt_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -1003,7 +1061,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
{
if ( *p < '0' || *p > '9')
{
mouse_event_occurred = false;
clearEvent();
urxvt_mouse[0] = '\0'; // Delete already interpreted data
return;
}
@ -1018,30 +1076,29 @@ void FMouseUrxvt::processEvent (struct timeval* time)
if ( y_neg || y == 0 )
y = 1;
if ( x > max_width )
x = max_width;
if ( x > getMaxWidth() )
x = getMaxWidth();
if ( y > max_height )
y = max_height;
if ( y > getMaxHeight() )
y = getMaxHeight();
new_mouse_position.setPoint (x, y);
// Fill bit field with 0
std::memset(&b_state, 0x00, sizeof(b_state));
setNewPos (x, y);
clearButtonState();
setKeyState (btn);
setMoveState (mouse_position, btn);
setButtonState (btn & button_mask, time);
if ( mouse_position == new_mouse_position
if ( mouse_position == getNewPos()
&& ! isWheelUp()
&& ! isWheelDown()
&& urxvt_button_state == uChar(btn) )
{
mouse_event_occurred = false;
clearEvent();
urxvt_mouse[0] = '\0'; // Delete already interpreted data
return;
}
mouse_event_occurred = true;
setEvent();
setPos (FPoint(x, y));
urxvt_button_state = uChar(btn);
// Delete already interpreted data
@ -1054,13 +1111,13 @@ void FMouseUrxvt::processEvent (struct timeval* time)
void FMouseUrxvt::setKeyState (int btn)
{
if ( (btn & key_shift) == key_shift )
b_state.shift_button = Pressed;
getButtonState().shift_button = Pressed;
if ( (btn & key_meta) == key_meta )
b_state.meta_button = Pressed;
getButtonState().meta_button = Pressed;
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
&& ! 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_move:
if ( mouse_position == new_mouse_position
if ( mouse_position == getNewPos()
&& urxvt_button_state == all_buttons_released
&& ! isDblclickTimeout(&time_mousepressed) )
&& ! isDblclickTimeout(getMousePressedTime()) )
{
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.left_button = DoubleClick;
resetMousePressedTime();
getButtonState().left_button = DoubleClick;
}
else
{
time_mousepressed = *time; // save click time
b_state.left_button = Pressed;
setMousePressedTime (time); // save click time
getButtonState().left_button = Pressed;
}
break;
case button2_pressed:
case button2_pressed_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.middle_button = Pressed;
resetMousePressedTime();
getButtonState().middle_button = Pressed;
break;
case button3_pressed:
case button3_pressed_move:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.right_button = Pressed;
resetMousePressedTime();
getButtonState().right_button = Pressed;
break;
case all_buttons_released:
@ -1119,17 +1173,17 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
{
case button1_pressed:
case button1_pressed_move:
b_state.left_button = Released;
getButtonState().left_button = Released;
break;
case button2_pressed:
case button2_pressed_move:
b_state.middle_button = Released;
getButtonState().middle_button = Released;
break;
case button3_pressed:
case button3_pressed_move:
b_state.right_button = Released;
getButtonState().right_button = Released;
break;
default:
@ -1138,15 +1192,13 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
break;
case button_up:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_up = Pressed;
resetMousePressedTime();
getButtonState().wheel_up = Pressed;
break;
case button_down:
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
b_state.wheel_down = Pressed;
resetMousePressedTime();
getButtonState().wheel_down = Pressed;
break;
default:

View File

@ -86,12 +86,12 @@ bool FProgressbar::setShadow (bool enable)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags.shadow = true;
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
}
else
{
flags.shadow = false;
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
}
@ -103,7 +103,7 @@ void FProgressbar::hide()
{
FWidget::hide();
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
hideSize (getSize() + shadow);
hideArea (getSize() + shadow);
print() << FPoint(int(getWidth()) - 4, 0)
<< (" "); // hide percentage
}
@ -130,7 +130,7 @@ void FProgressbar::draw()
drawProgressLabel();
drawProgressBar();
if ( flags.shadow )
if ( getFlags().shadow )
drawShadow ();
flush_out();
@ -145,7 +145,10 @@ void FProgressbar::drawProgressLabel()
setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() );
else
{
const FWidgetColors& wc = getFWidgetColors();
setColor ( wc.dialog_fg, wc.dialog_bg );
}
if ( isMonochron() )
setReverse(true);
@ -189,6 +192,7 @@ std::size_t FProgressbar::drawProgressIndicator()
double length = double(bar_length * percentage) / 100;
auto len = std::size_t(trunc(length));
const FWidgetColors& wc = getFWidgetColors();
print() << FColorPair (wc.progressbar_fg, wc.progressbar_fg)
<< FString (len, fc::FullBlock); // █
@ -221,6 +225,7 @@ void FProgressbar::drawProgressBackground (std::size_t len)
// Draw the progress background
std::size_t bg_len = bar_length - len;
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.progressbar_fg, wc.progressbar_bg);
if ( getMaxColor() < 16 )

View File

@ -55,8 +55,8 @@ FRadioMenuItem::~FRadioMenuItem() // destructor
//----------------------------------------------------------------------
void FRadioMenuItem::init (FWidget* parent)
{
checkable = true;
radio_button = true;
setCheckable();
setRadioButton();
if ( ! parent )
return;
@ -83,9 +83,9 @@ void FRadioMenuItem::processToggle()
//----------------------------------------------------------------------
void FRadioMenuItem::processClicked()
{
if ( ! checked )
if ( ! isChecked() )
{
checked = true;
setChecked();
processToggle();
}

View File

@ -472,6 +472,7 @@ void FScrollbar::draw()
//----------------------------------------------------------------------
void FScrollbar::drawVerticalBar()
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
for (int z{1}; z <= slider_pos; z++)
@ -530,6 +531,7 @@ inline void FScrollbar::drawVerticalBackgroundLine()
//----------------------------------------------------------------------
void FScrollbar::drawHorizontalBar()
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
if ( isNewFont() )
@ -575,6 +577,7 @@ inline void FScrollbar::drawHorizontalBackgroundColumn()
//----------------------------------------------------------------------
void FScrollbar::drawButtons()
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.scrollbar_button_fg, wc.scrollbar_button_bg);
if ( isNewFont() )

View File

@ -47,7 +47,8 @@ FScrollView::FScrollView (FWidget* parent)
FScrollView::~FScrollView() // destructor
{
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)
);
child_print_area = viewport;
setChildPrintArea (viewport);
}
hbar->setMaximum (int(width - getViewportWidth()));
@ -100,7 +101,7 @@ void FScrollView::setScrollHeight (std::size_t height)
(
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
);
child_print_area = viewport;
setChildPrintArea (viewport);
}
vbar->setMaximum (int(height - getViewportHeight()));
@ -135,7 +136,7 @@ void FScrollView::setScrollSize (const FSize& size)
(
F_PREPROC_HANDLER (this, &FScrollView::copy2area)
);
child_print_area = viewport;
setChildPrintArea (viewport);
}
int xoffset_end = int(getScrollWidth() - getViewportWidth());
@ -634,9 +635,9 @@ FVTerm::term_area* FScrollView::getPrintArea()
if ( use_own_print_area || ! viewport )
{
child_print_area = nullptr;
setChildPrintArea (nullptr);
auto area = FWidget::getPrintArea();
child_print_area = viewport;
setChildPrintArea (viewport);
return area;
}
else
@ -696,41 +697,42 @@ void FScrollView::copy2area()
if ( ! viewport->has_changes )
return;
int ax = getTermX() - print_area->offset_left
, ay = getTermY() - print_area->offset_top
auto printarea = getCurrentPrintArea();
int ax = getTermX() - printarea->offset_left
, ay = getTermY() - printarea->offset_top
, dx = viewport_geometry.getX()
, dy = viewport_geometry.getY()
, y_end = int(getViewportHeight())
, x_end = int(getViewportWidth());
// viewport width does not fit into the print_area
if ( print_area->width <= ax + x_end )
x_end = print_area->width - ax;
if ( printarea->width <= ax + x_end )
x_end = printarea->width - ax;
// viewport height does not fit into the print_area
if ( print_area->height <= ay + y_end )
y_end = print_area->height - ay;
if ( printarea->height <= ay + y_end )
y_end = printarea->height - ay;
for (int y{0}; y < y_end; y++) // line loop
{
charData* vc{}; // viewport character
charData* ac{}; // area character
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];
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));
if ( int(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);
if ( int(printarea->changes[ay + y].xmin) > ax )
printarea->changes[ay + y].xmin = uInt(ax);
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
if ( int(printarea->changes[ay + y].xmax) < ax + x_end - 1 )
printarea->changes[ay + y].xmax = uInt(ax + x_end - 1);
}
setViewportCursor();
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 (hbar, fc::horizontal, &FScrollView::cb_HBarChange);
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
setGeometry (FPoint(1, 1), FSize(4, 4));
@ -791,7 +794,7 @@ void FScrollView::init (FWidget* parent)
);
if ( viewport )
child_print_area = viewport;
setChildPrintArea (viewport);
}
//----------------------------------------------------------------------
@ -896,14 +899,15 @@ void FScrollView::setViewportCursor()
FPoint cursor_pos ( viewport->input_cursor_x - 1
, viewport->input_cursor_y - 1 );
FPoint window_cursor_pos(getViewportCursorPos());
print_area->input_cursor_x = window_cursor_pos.getX();
print_area->input_cursor_y = window_cursor_pos.getY();
auto printarea = getCurrentPrintArea();
printarea->input_cursor_x = window_cursor_pos.getX();
printarea->input_cursor_y = window_cursor_pos.getY();
if ( viewport->input_cursor_visible
&& viewport_geometry.contains(cursor_pos) )
print_area->input_cursor_visible = true;
printarea->input_cursor_visible = true;
else
print_area->input_cursor_visible = false;
printarea->input_cursor_visible = false;
}
//----------------------------------------------------------------------

View File

@ -175,6 +175,7 @@ bool FStatusBar::hasActivatedKey()
void FStatusBar::hide()
{
FWindow::hide();
const FWidgetColors& wc = getFWidgetColors();
FColor fg = wc.term_fg;
FColor bg = wc.term_bg;
setColor (fg, bg);
@ -211,6 +212,7 @@ void FStatusBar::drawMessage()
if ( isLastActiveFocus )
space_offset = 0;
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.statusbar_fg, wc.statusbar_bg);
setPrintPos (FPoint(x, 1));
@ -516,6 +518,7 @@ void FStatusBar::init()
if ( getRootWidget() )
getRootWidget()->setBottomPadding(1, true);
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.statusbar_fg);
setBackgroundColor (wc.statusbar_bg);
unsetFocusable();
@ -561,6 +564,7 @@ void FStatusBar::drawKeys()
}
else
{
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.statusbar_fg, wc.statusbar_bg);
for (; x <= int(screenWidth); x++)
@ -582,6 +586,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
// Draw not active key
auto item = *iter;
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
x++;
print (' ');
@ -644,6 +649,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
if ( isMonochron() )
setReverse(false);
const FWidgetColors& wc = getFWidgetColors();
setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg );
x++;

View File

@ -143,6 +143,7 @@ inline void FSwitch::drawChecked()
{
wchar_t on[6]{L" On "};
wchar_t off[6]{L" Off "};
const FWidgetColors& wc = getFWidgetColors();
if ( hasFocus() && ! button_pressed )
{
@ -193,6 +194,7 @@ inline void FSwitch::drawUnchecked()
wchar_t on[6]{L" On "};
wchar_t off[6]{L" Off "};
const FWidgetColors& wc = getFWidgetColors();
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
if ( isMonochron() )

View File

@ -195,7 +195,7 @@ void FTextView::scrollTo (int x, int y)
void FTextView::hide()
{
FWidget::hide();
hideSize (getSize());
hideArea (getSize());
}
//----------------------------------------------------------------------
@ -597,6 +597,7 @@ void FTextView::init()
{
initScrollbar (vbar, fc::vertical, &FTextView::cb_VBarChange);
initScrollbar (hbar, fc::horizontal, &FTextView::cb_HBarChange);
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
nf_offset = isNewFont() ? 1 : 0;

View File

@ -109,6 +109,7 @@ bool FToggleButton::setNoUnderline (bool enable)
bool FToggleButton::setEnable (bool enable)
{
FWidget::setEnable(enable);
const FWidgetColors& wc = getFWidgetColors();
if ( enable )
{
@ -139,6 +140,7 @@ bool FToggleButton::setEnable (bool enable)
bool FToggleButton::setFocus (bool enable)
{
FWidget::setFocus(enable);
const FWidgetColors& wc = getFWidgetColors();
if ( enable )
{
@ -206,7 +208,7 @@ void FToggleButton::setText (const FString& txt)
void FToggleButton::hide()
{
FWidget::hide();
hideSize (getSize());
hideArea (getSize());
}
//----------------------------------------------------------------------
@ -532,6 +534,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
void FToggleButton::init()
{
setGeometry (FPoint(1, 1), FSize(4, 1), false); // initialize geometry values
const FWidgetColors& wc = getFWidgetColors();
if ( isEnabled() )
{
@ -561,6 +564,8 @@ void FToggleButton::drawText ( wchar_t LabelText[]
if ( isMonochron() )
setReverse(true);
const FWidgetColors& wc = getFWidgetColors();
if ( isEnabled() )
setColor (wc.label_fg, wc.label_bg);
else

View File

@ -126,6 +126,7 @@ void FToolTip::init()
// initialize geometry values
setGeometry (FPoint(1, 1), FSize(3, 3), false);
setMinimumSize (FSize(3, 3));
const FWidgetColors& wc = getFWidgetColors();
setForegroundColor (wc.tooltip_fg);
setBackgroundColor (wc.tooltip_bg);
calculateDimensions();

View File

@ -876,9 +876,9 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
bool found = bool(area == vdesktop);
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();
@ -1137,11 +1137,11 @@ void FVTerm::updateVTerm()
FWidget* widget = static_cast<FWidget*>(vterm->widget);
if ( ! widget->window_list || widget->window_list->empty() )
if ( ! widget->getWindowList() || widget->getWindowList()->empty() )
return;
auto iter = widget->window_list->begin();
auto end = widget->window_list->end();
auto iter = widget->getWindowList()->begin();
auto end = widget->getWindowList()->end();
for (; iter != end; ++iter)
{
@ -1663,10 +1663,10 @@ charData FVTerm::generateCharacter (const FPoint& pos)
int y = pos.getY();
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;
for (auto& win_obj : *FWidget::window_list)
for (auto& win_obj : *FWidget::getWindowList())
{
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
if ( ! FWidget::window_list || FWidget::window_list->empty() )
if ( ! FWidget::getWindowList() || FWidget::getWindowList()->empty() )
return *cc;
// Get the window layer of this object
auto w = static_cast<FWidget*>(obj);
int layer = FWindow::getWindowLayer(w);
for (auto&& win_obj : *FWidget::window_list)
for (auto&& win_obj : *FWidget::getWindowList())
{
bool significant_char;

View File

@ -49,7 +49,7 @@ FWidget::widgetList* FWidget::close_widget{nullptr};
FWidgetColors FWidget::wc{};
bool FWidget::init_desktop{false};
bool FWidget::hideable{false};
uInt FWidget::modal_dialogs{};
uInt FWidget::modal_dialog_counter{};
//----------------------------------------------------------------------
// class FWidget
@ -78,7 +78,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
rootObject = this;
show_root_widget = nullptr;
redraw_root_widget = nullptr;
modal_dialogs = 0;
modal_dialog_counter = 0;
statusbar = nullptr;
init();
}
@ -122,6 +122,12 @@ FWidget::~FWidget() // destructor
quit();
}
if ( accelerator_list )
{
delete accelerator_list;
accelerator_list = nullptr;
}
// finish the program
if ( rootObject == this )
finish();
@ -992,7 +998,7 @@ void FWidget::redraw()
startTerminalUpdate();
// clean desktop
setColor (wc.term_fg, wc.term_bg);
clearArea (vdesktop);
clearArea (getVirtualDesktop());
}
else if ( ! isShown() )
return;
@ -1029,7 +1035,7 @@ void FWidget::resize()
return;
resizeVTerm (term_geometry.getSize());
resizeArea (term_geometry, getShadow(), vdesktop);
resizeArea (term_geometry, getShadow(), getVirtualDesktop());
adjustSizeGlobal();
}
else
@ -1056,7 +1062,7 @@ void FWidget::show()
// draw the vdesktop
auto r = getRootWidget();
setColor(r->getForegroundColor(), r->getBackgroundColor());
clearArea (vdesktop);
clearArea (getVirtualDesktop());
init_desktop = true;
}
@ -1437,8 +1443,8 @@ FVTerm::term_area* FWidget::getPrintArea()
{
// returns the print area of this object
if ( print_area )
return print_area;
if ( getCurrentPrintArea() )
return getCurrentPrintArea();
else
{
FWidget* obj{};
@ -1449,28 +1455,28 @@ FVTerm::term_area* FWidget::getPrintArea()
obj = p_obj;
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;
return print_area;
setPrintArea (obj->getVWin());
return getCurrentPrintArea();
}
else if ( obj->child_print_area )
else if ( obj->getChildPrintArea() )
{
print_area = obj->child_print_area;
return print_area;
setPrintArea (obj->getChildPrintArea());
return getCurrentPrintArea();
}
}
return vdesktop;
return getVirtualDesktop();
}
//----------------------------------------------------------------------
void FWidget::addPreprocessingHandler ( FVTerm* instance
, FPreprocessingHandler handler )
{
if ( ! print_area )
if ( ! getCurrentPrintArea() )
FWidget::getPrintArea();
FVTerm::addPreprocessingHandler (instance, handler);
@ -1479,7 +1485,7 @@ void FWidget::addPreprocessingHandler ( FVTerm* instance
//----------------------------------------------------------------------
void FWidget::delPreprocessingHandler (FVTerm* instance)
{
if ( ! print_area )
if ( ! getCurrentPrintArea() )
FWidget::getPrintArea();
FVTerm::delPreprocessingHandler (instance);
@ -1491,8 +1497,8 @@ bool FWidget::isChildPrintArea() const
auto p_obj = static_cast<FWidget*>(getParent());
if ( p_obj
&& p_obj->child_print_area
&& p_obj->child_print_area == print_area )
&& p_obj->getChildPrintArea()
&& p_obj->getChildPrintArea() == getCurrentPrintArea() )
return true;
else
return false;
@ -1597,7 +1603,7 @@ void FWidget::adjustSizeGlobal()
}
//----------------------------------------------------------------------
void FWidget::hideSize (const FSize& size)
void FWidget::hideArea (const FSize& size)
{
if ( size.isEmpty() )
return;
@ -1622,7 +1628,7 @@ void FWidget::hideSize (const FSize& size)
if ( blank == 0 )
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;
}
@ -1631,6 +1637,23 @@ void FWidget::hideSize (const FSize& size)
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()
{
@ -1956,22 +1979,13 @@ void FWidget::init()
background_color = wc.term_bg;
init_desktop = false;
try
{
accelerator_list = new Accelerators();
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
// Create the root object accelerator list
createWidgetAcceleratorList();
}
//----------------------------------------------------------------------
void FWidget::finish()
{
delete accelerator_list;
accelerator_list = nullptr;
if ( close_widget )
{
delete close_widget;

View File

@ -47,7 +47,7 @@ FWindow::FWindow(FWidget* parent)
setWindowWidget();
FRect geometry (getTermGeometry());
geometry.move(-1, -1);
createArea (geometry, getShadow(), vwin);
createArea (geometry, getShadow(), getVWin());
addWindow (this);
}
@ -74,7 +74,7 @@ FWindow::~FWindow() // destructor
restoreVTerm (t_geometry);
}
removeArea (vwin);
removeArea (getVWin());
}
@ -92,7 +92,7 @@ bool FWindow::setWindowWidget (bool enable)
if ( isWindowWidget() == enable )
return true;
flags.window_widget = enable;
setFlags().window_widget = enable;
if ( enable )
setTermOffset();
@ -107,14 +107,14 @@ void FWindow::setActiveWindow (FWindow* window)
{
// activate FWindow object window
if ( ! window_list )
if ( ! getWindowList() )
return;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return;
auto iter = window_list->begin();
auto end = window_list->end();
auto iter = getWindowList()->begin();
auto end = getWindowList()->end();
while ( iter != end )
{
@ -157,7 +157,7 @@ bool FWindow::activateWindow (bool enable)
if ( enable )
{
FWidget::setActiveWindow (this);
active_area = getVWin();
setActiveArea (getVWin());
}
return (window_active = enable);
@ -173,13 +173,13 @@ void FWindow::unsetActiveWindow()
//----------------------------------------------------------------------
bool FWindow::setResizeable (bool enable)
{
return (flags.resizeable = enable);
return (setFlags().resizeable = enable);
}
//----------------------------------------------------------------------
bool FWindow::setTransparentShadow (bool enable)
{
flags.shadow = flags.trans_shadow = enable;
setFlags().shadow = setFlags().trans_shadow = enable;
if ( enable )
setShadowSize (FSize(2, 1));
@ -197,14 +197,14 @@ bool FWindow::setShadow (bool enable)
if ( enable )
{
flags.shadow = true;
flags.trans_shadow = false;
setFlags().shadow = true;
setFlags().trans_shadow = false;
setShadowSize (FSize(1, 1));
}
else
{
flags.shadow = false;
flags.trans_shadow = false;
setFlags().shadow = false;
setFlags().trans_shadow = false;
setShadowSize (FSize(0, 0));
}
@ -217,14 +217,14 @@ bool FWindow::setAlwaysOnTop (bool enable)
if ( isAlwaysOnTop() == enable )
return true;
flags.always_on_top = enable;
setFlags().always_on_top = enable;
if ( enable )
{
if ( always_on_top_list )
if ( getAlwaysOnTopList() )
{
deleteFromAlwaysOnTopList (this);
always_on_top_list->push_back (this);
getAlwaysOnTopList()->push_back (this);
}
}
else
@ -239,7 +239,7 @@ bool FWindow::isWindowHidden() const
// returns the window hidden state
if ( isVirtualWindow() )
return ! vwin->visible;
return ! getVWin()->visible;
else
return false;
}
@ -284,7 +284,7 @@ void FWindow::drawBorder()
void FWindow::show()
{
if ( isVirtualWindow() )
vwin->visible = true;
getVWin()->visible = true;
FWidget::show();
}
@ -293,7 +293,7 @@ void FWindow::show()
void FWindow::hide()
{
if ( isVirtualWindow() )
vwin->visible = false;
getVWin()->visible = false;
FWidget::hide();
}
@ -304,7 +304,7 @@ void FWindow::setX (int x, bool adjust)
FWidget::setX (x, adjust);
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);
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() )
{
vwin->offset_left = getTermX() - 1;
vwin->offset_top = getTermY() - 1;
auto virtual_win = getVWin();
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());
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());
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());
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());
geometry.move(-1, -1);
resizeArea (geometry, getShadow(), vwin);
resizeArea (geometry, getShadow(), getVWin());
}
else
{
if ( getX() != old_x )
vwin->offset_left = getTermX() - 1;
getVWin()->offset_left = getTermX() - 1;
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() )
{
vwin->offset_left = getTermX() - 1;
vwin->offset_top = getTermY() - 1;
auto virtual_win = getVWin();
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)
{
// returns the window object to the corresponding coordinates
if ( window_list && ! window_list->empty() )
if ( getWindowList() && ! getWindowList()->empty() )
{
auto iter = window_list->end();
auto begin = window_list->begin();
auto iter = getWindowList()->end();
auto begin = getWindowList()->begin();
do
{
@ -457,8 +459,8 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
void FWindow::addWindow (FWidget* obj)
{
// add the window object obj to the window list
if ( window_list )
window_list->push_back(obj);
if ( getWindowList() )
getWindowList()->push_back(obj);
processAlwaysOnTop();
}
@ -467,16 +469,16 @@ void FWindow::addWindow (FWidget* obj)
void FWindow::delWindow (FWidget* obj)
{
// delete the window object obj from the window list
if ( ! window_list || window_list->empty() )
if ( ! getWindowList() || getWindowList()->empty() )
return;
auto iter = window_list->begin();
auto iter = getWindowList()->begin();
while ( iter != window_list->end() )
while ( iter != getWindowList()->end() )
{
if ( (*iter) == obj )
{
window_list->erase (iter);
getWindowList()->erase (iter);
return;
}
@ -509,10 +511,10 @@ int FWindow::getWindowLayer (const FWidget* obj)
const FWidget* window;
if ( ! window_list )
if ( ! getWindowList() )
return -1;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return -1;
if ( ! obj->isWindowWidget() )
@ -523,8 +525,8 @@ int FWindow::getWindowLayer (const FWidget* obj)
else
window = obj;
auto iter = window_list->begin();
auto end = window_list->end();
auto iter = getWindowList()->begin();
auto end = getWindowList()->end();
while ( iter != end )
{
@ -534,7 +536,7 @@ int FWindow::getWindowLayer (const FWidget* obj)
++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
if ( ! window_list )
if ( ! getWindowList() )
return;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return;
if ( obj1->getFlags().modal )
@ -554,8 +556,8 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
if ( obj2->getFlags().modal )
return;
auto iter = window_list->begin();
auto end = window_list->end();
auto iter = getWindowList()->begin();
auto end = getWindowList()->end();
auto iter1 = end;
auto iter2 = end;
@ -578,30 +580,30 @@ bool FWindow::raiseWindow (FWidget* obj)
{
// raises the window widget obj to the top
if ( ! window_list )
if ( ! getWindowList() )
return false;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return false;
if ( ! obj->isWindowWidget() )
return false;
if ( window_list->back() == obj )
if ( getWindowList()->back() == obj )
return false;
if ( window_list->back()->getFlags().modal
if ( getWindowList()->back()->getFlags().modal
&& ! obj->isMenuWidget() )
return false;
auto iter = window_list->begin();
auto iter = getWindowList()->begin();
while ( iter != window_list->end() )
while ( iter != getWindowList()->end() )
{
if ( *iter == obj )
{
window_list->erase (iter);
window_list->push_back (obj);
getWindowList()->erase (iter);
getWindowList()->push_back (obj);
FEvent ev(fc::WindowRaised_Event);
FApplication::sendEvent(obj, &ev);
processAlwaysOnTop();
@ -619,29 +621,29 @@ bool FWindow::lowerWindow (FWidget* obj)
{
// lowers the window widget obj to the bottom
if ( ! window_list )
if ( ! getWindowList() )
return false;
if ( window_list->empty() )
if ( getWindowList()->empty() )
return false;
if ( ! obj->isWindowWidget() )
return false;
if ( window_list->front() == obj )
if ( getWindowList()->front() == obj )
return false;
if ( obj->getFlags().modal )
return false;
auto iter = window_list->begin();
auto iter = getWindowList()->begin();
while ( iter != window_list->end() )
while ( iter != getWindowList()->end() )
{
if ( *iter == obj )
{
window_list->erase (iter);
window_list->insert (window_list->begin(), obj);
getWindowList()->erase (iter);
getWindowList()->insert (getWindowList()->begin(), obj);
FEvent ev(fc::WindowLowered_Event);
FApplication::sendEvent(obj, &ev);
return true;
@ -694,10 +696,10 @@ void FWindow::switchToPrevWindow (FWidget* widget)
if ( ! is_activated )
{
// 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 begin = window_list->begin();
auto iter = getWindowList()->end();
auto begin = getWindowList()->begin();
do
{
@ -771,7 +773,7 @@ void FWindow::setShadowSize (const FSize& size)
{
auto geometry = getTermGeometry();
geometry.move(-1, -1);
resizeArea (geometry, getShadow(), vwin);
resizeArea (geometry, getShadow(), getVWin());
}
}
@ -789,10 +791,10 @@ void FWindow::adjustSize()
else if ( isVirtualWindow() )
{
if ( getX() != old_x )
vwin->offset_left = getTermX() - 1;
getVWin()->offset_left = getTermX() - 1;
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)
{
// 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;
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 )
{
always_on_top_list->erase (iter);
getAlwaysOnTopList()->erase (iter);
return;
}
@ -867,17 +869,17 @@ void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
void FWindow::processAlwaysOnTop()
{
// Raise all always-on-top windows
if ( ! always_on_top_list || always_on_top_list->empty() )
if ( ! getAlwaysOnTopList() || getAlwaysOnTopList()->empty() )
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);
if ( window_list )
window_list->push_back(*iter);
if ( getWindowList() )
getWindowList()->push_back(*iter);
++iter;
}

View File

@ -170,13 +170,13 @@ class FButton : public FWidget
std::size_t center_offset{0};
std::size_t vcenter_offset{0};
std::size_t txtlength{0};
FColor button_fg{wc.button_active_fg};
FColor button_bg{wc.button_active_bg};
FColor button_hotkey_fg{wc.button_hotkey_fg};
FColor button_focus_fg{wc.button_active_focus_fg};
FColor button_focus_bg{wc.button_active_focus_bg};
FColor button_inactive_fg{wc.button_inactive_fg};
FColor button_inactive_bg{wc.button_inactive_bg};
FColor button_fg{getFWidgetColors().button_active_fg};
FColor button_bg{getFWidgetColors().button_active_bg};
FColor button_hotkey_fg{getFWidgetColors().button_hotkey_fg};
FColor button_focus_fg{getFWidgetColors().button_active_focus_fg};
FColor button_focus_bg{getFWidgetColors().button_active_focus_bg};
FColor button_inactive_fg{getFWidgetColors().button_inactive_fg};
FColor button_inactive_bg{getFWidgetColors().button_inactive_bg};
};
#pragma pack(pop)
@ -256,7 +256,7 @@ inline bool FButton::unsetClickAnimation()
//----------------------------------------------------------------------
inline bool FButton::isFlat() const
{ return flags.flat; }
{ return getFlags().flat; }
//----------------------------------------------------------------------
inline bool FButton::isDown() const
@ -264,7 +264,7 @@ inline bool FButton::isDown() const
//----------------------------------------------------------------------
inline bool FButton::hasShadow() const
{ return flags.shadow; }
{ return getFlags().shadow; }
//----------------------------------------------------------------------
inline bool FButton::hasClickAnimation()

View File

@ -116,8 +116,8 @@ class FDialog : public FWindow
void setText (const FString&);
// Inquiries
bool isModal();
bool isScrollable();
bool isModal() const;
bool isScrollable() const;
// Methods
void show() override;
@ -278,12 +278,12 @@ inline void FDialog::setText (const FString& txt)
{ tb_text.setString(txt); }
//----------------------------------------------------------------------
inline bool FDialog::isModal()
{ return flags.modal; }
inline bool FDialog::isModal() const
{ return getFlags().modal; }
//----------------------------------------------------------------------
inline bool FDialog::isScrollable()
{ return flags.scrollable; }
inline bool FDialog::isScrollable() const
{ return getFlags().scrollable; }
} // namespace finalcut

View File

@ -104,7 +104,7 @@ class FEvent // event base class
explicit FEvent(fc::events);
fc::events type() const;
protected:
private:
fc::events t{fc::None_Event};
};
@ -130,7 +130,7 @@ class FKeyEvent : public FEvent // keyboard event
void accept();
void ignore();
protected:
private:
FKey k{0};
bool accpt{false};
};
@ -161,10 +161,10 @@ class FMouseEvent : public FEvent // mouse event
int getTermY() const;
int getButton() const;
protected:
FPoint p;
FPoint tp;
int b;
private:
FPoint p{};
FPoint tp{};
int b{};
};
#pragma pack(pop)
@ -193,7 +193,7 @@ class FWheelEvent : public FEvent // wheel event
int getTermY() const;
int getWheel() const;
protected:
private:
FPoint p;
FPoint tp;
int w;
@ -223,7 +223,8 @@ class FFocusEvent : public FEvent // focus event
bool isAccepted() const;
void accept();
void ignore();
protected:
private:
bool accpt{true};
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
};
@ -252,9 +253,9 @@ class FAccelEvent : public FEvent // focus event
void accept();
void ignore();
protected:
private:
bool accpt{false};
void* focus_widget;
void* focus_widget{};
};
#pragma pack(pop)
@ -275,7 +276,7 @@ class FResizeEvent : public FEvent // resize event
void accept();
void ignore();
protected:
private:
bool accpt{false};
};
@ -321,7 +322,7 @@ class FCloseEvent : public FEvent // close event
void accept();
void ignore();
protected:
private:
bool accpt{false};
};
@ -342,7 +343,7 @@ class FTimerEvent : public FEvent // timer event
int getTimerId() const;
protected:
private:
int id{0};
};
@ -374,7 +375,7 @@ class FUserEvent : public FEvent // timer event
FDataPtr getData() const;
void setData (FDataPtr);
protected:
private:
int uid{0};
FDataPtr data_pointer{nullptr};
};

View File

@ -73,6 +73,7 @@
#include <final/ftooltip.h>
#include <final/ftypes.h>
#include <final/fwidget.h>
#include "final/fwidgetcolors.h"
#if defined(UNIT_TEST)
#include <final/ftermlinux.h>

View File

@ -157,8 +157,8 @@ class FLabel : public FWidget
bool multiline{false};
FString text{};
fc::text_alignment alignment{fc::alignLeft};
FColor emphasis_color{wc.label_emphasis_fg};
FColor ellipsis_color{wc.label_ellipsis_fg};
FColor emphasis_color{getFWidgetColors().label_emphasis_fg};
FColor ellipsis_color{getFWidgetColors().label_ellipsis_fg};
bool emphasis{false};
bool reverse_mode{false};
FWidget* accel_widget{nullptr};

View File

@ -261,7 +261,7 @@ inline bool FLineEdit::unsetShadow()
//----------------------------------------------------------------------
inline bool FLineEdit::hasShadow()
{ return flags.shadow; }
{ return getFlags().shadow; }
} // namespace finalcut

View File

@ -111,15 +111,21 @@ class FMenuItem : public FWidget
void unsetSelected();
void setSeparator();
void unsetSeparator();
void setCheckable();
void unsetCheckable();
void setChecked();
void unsetChecked();
void setRadioButton();
void unsetRadioButton();
void setMenu (FMenu*);
void setText (const FString&);
// Inquiries
bool isSelected() const;
bool isSeparator() const;
bool isCheckable() const;
bool isChecked() const;
bool isRadioButton() const;
bool hasHotkey() const;
bool hasMenu() const;
@ -150,21 +156,6 @@ class FMenuItem : public FWidget
bool isMenuBar (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:
// Accessor
FMenuList* getFMenuList (FWidget&);
@ -185,6 +176,21 @@ class FMenuItem : public FWidget
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 class FDialogListMenu;
friend class FMenuList;
@ -237,6 +243,14 @@ inline void FMenuItem::unsetSeparator()
setFocusable();
}
//----------------------------------------------------------------------
inline void FMenuItem::setCheckable()
{ checkable = true; }
//----------------------------------------------------------------------
inline void FMenuItem::unsetCheckable()
{ checkable = false; }
//----------------------------------------------------------------------
inline void FMenuItem::setChecked()
{ checked = true; }
@ -245,6 +259,14 @@ inline void FMenuItem::setChecked()
inline void FMenuItem::unsetChecked()
{ checked = false; }
//----------------------------------------------------------------------
inline void FMenuItem::setRadioButton()
{ radio_button = true; }
//----------------------------------------------------------------------
inline void FMenuItem::unsetRadioButton()
{ radio_button = false; }
//----------------------------------------------------------------------
inline void FMenuItem::setMenu(FMenu* m)
{ menu = m; }
@ -257,10 +279,18 @@ inline bool FMenuItem::isSelected() const
inline bool FMenuItem::isSeparator() const
{ return separator; }
//----------------------------------------------------------------------
inline bool FMenuItem::isCheckable() const
{ return checkable; }
//----------------------------------------------------------------------
inline bool FMenuItem::isChecked() const
{ return checked; }
//----------------------------------------------------------------------
inline bool FMenuItem::isRadioButton() const
{ return radio_button; }
//----------------------------------------------------------------------
inline bool FMenuItem::hasHotkey() const
{ return bool(hotkey != 0); }

View File

@ -3,7 +3,7 @@
* *
* 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 *
* modify it under the terms of the GNU Lesser General Public License *
@ -74,31 +74,34 @@ class FMenuList
FMenuList& operator = (const FMenuList&) = delete;
// Accessors
virtual const char* getClassName() const;
std::size_t getCount() const;
FMenuItem* getItem (int) const;
FMenuItem* getSelectedItem() const;
virtual const char* getClassName() const;
std::size_t getCount() const;
FMenuItem* getItem (int) const;
FMenuItem* getSelectedItem() const;
std::vector<FMenuItem*> getItemList() const;
// Mutators
void enableItem (int);
void disableItem (int);
void setSelectedItem (FMenuItem*);
void enableItem (int);
void disableItem (int);
void setSelectedItem (FMenuItem*);
void unsetSelectedItem();
// Inquiries
bool isSelected (int) const;
bool hasSelectedItem() const;
bool isSelected (int) const;
bool hasSelectedItem() const;
// Methods
virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
void remove (int);
void clear();
void selectFirstItem();
void unselectItem();
virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
void remove (int);
void clear();
void selectFirstItem();
void unselectItem();
protected:
FMenuItem* selected_item{};
std::vector<FMenuItem*> item_list{};
private:
// Data Members
FMenuItem* selected_item{};
std::vector<FMenuItem*> item_list{};
};
#pragma pack(pop)
@ -120,6 +123,10 @@ inline FMenuItem* FMenuList::getItem (int index) const
inline FMenuItem* FMenuList::getSelectedItem() const
{ return selected_item; }
//----------------------------------------------------------------------
inline std::vector<FMenuItem*> FMenuList::getItemList() const
{ return item_list; }
//----------------------------------------------------------------------
inline void FMenuList::enableItem (int index)
{ item_list[uInt(index - 1)]->setEnable(); }
@ -132,6 +139,10 @@ inline void FMenuList::disableItem (int index)
inline void FMenuList::setSelectedItem (FMenuItem* menuitem)
{ selected_item = menuitem; }
//----------------------------------------------------------------------
inline void FMenuList::unsetSelectedItem()
{ selected_item = nullptr; }
//----------------------------------------------------------------------
inline bool FMenuList::isSelected(int index) const
{ return ( index > 0 ) ? item_list[uInt(index - 1)]->isSelected() : false; }

View File

@ -162,7 +162,7 @@ class FMessageBox : public FDialog
FStringList text_split{};
std::size_t max_line_width{0};
bool center_text{false};
FColor emphasis_color{wc.dialog_emphasis_fg};
FColor emphasis_color{getFWidgetColors().dialog_emphasis_fg};
uInt num_buttons{0};
uInt text_num_lines{0};
int button_digit[3]{0};
@ -230,6 +230,7 @@ int FMessageBox::error ( FWidget* parent
, int button2 )
{
const FString caption{"Error message"};
FMessageBox mbox ( caption
, FString() << message
, button0, button1, button2
@ -237,9 +238,10 @@ int FMessageBox::error ( FWidget* parent
mbox.beep();
mbox.setHeadline("Warning:");
mbox.setCenterText();
mbox.setForegroundColor(mbox.wc.error_box_fg);
mbox.setBackgroundColor(mbox.wc.error_box_bg);
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
const FWidgetColors& wc = mbox.getFWidgetColors();
mbox.setForegroundColor(wc.error_box_fg);
mbox.setBackgroundColor(wc.error_box_bg);
mbox.emphasis_color = wc.error_box_emphasis_fg;
int reply = mbox.exec();
return reply;
}

View File

@ -134,6 +134,7 @@ class FMouse
// Methods
static FMouse* createMouseObject (mouse_type);
void clearButtonState();
virtual void setRawData (FKeyboard::keybuffer&) = 0;
virtual void processEvent (struct timeval*) = 0;
@ -161,19 +162,33 @@ class FMouse
DoubleClick = 3
};
// Accessors
button& getButtonState();
FPoint& getNewPos();
uInt16 getMaxWidth();
uInt16 getMaxHeight();
uInt64 getDblclickInterval();
timeval* getMousePressedTime();
// Mutator
void setPos (const FPoint&);
void setNewPos (int, int);
void setPending (bool);
void setEvent();
void setMousePressedTime (timeval*);
void resetMousePressedTime();
// Method
// Inquiry
bool isDblclickTimeout (timeval*);
private:
// Data Members
button b_state{};
bool mouse_event_occurred{false};
bool input_data_pending{false};
uInt64 dblclick_interval{500000}; // 500 ms
uInt16 max_width{80};
uInt16 max_height{25};
uInt64 dblclick_interval{500000}; // 500 ms
struct timeval time_mousepressed{};
FPoint mouse{0, 0}; // mouse click position
FPoint new_mouse_position{};

View File

@ -132,7 +132,7 @@ inline bool FProgressbar::unsetShadow()
//----------------------------------------------------------------------
inline bool FProgressbar::hasShadow()
{ return flags.shadow; }
{ return getFlags().shadow; }
} // namespace finalcut

View File

@ -148,7 +148,8 @@ class FVTerm
virtual const char* getClassName() const;
static FColor getTermForegroundColor();
static FColor getTermBackgroundColor();
term_area* getVWin() const;
term_area*& getVWin();
const term_area* getVWin() const;
FPoint getPrintCursor();
static charData getAttribute();
static int getMaxColor();
@ -320,6 +321,9 @@ class FVTerm
// Accessor
virtual term_area* getPrintArea();
term_area* getChildPrintArea() const;
term_area* getCurrentPrintArea() const;
term_area* getVirtualDesktop() const;
std::size_t getLineNumber();
std::size_t getColumnNumber();
static bool charEncodable (wchar_t);
@ -329,6 +333,8 @@ class FVTerm
// Mutators
void setPrintArea (term_area*);
void setChildPrintArea (term_area*);
void setActiveArea (term_area*);
static void setInsertCursor (bool);
static void setInsertCursor();
static void unsetInsertCursor();
@ -410,9 +416,7 @@ class FVTerm
;
// Data Members
static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop
static term_area* active_area; // active area
private:
term_area* print_area{nullptr}; // print area for this object
term_area* child_print_area{nullptr}; // print area for children
term_area* vwin{nullptr}; // virtual window
@ -471,6 +475,9 @@ class FVTerm
// Data Members
static FSystem* fsystem;
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 charData term_attribute;
static charData next_attribute;
@ -596,7 +603,11 @@ inline FColor FVTerm::getTermBackgroundColor()
{ 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; }
//----------------------------------------------------------------------
@ -1047,8 +1058,16 @@ inline void FVTerm::redefineDefaultColors (bool enable)
{ FTerm::redefineDefaultColors(enable); }
//----------------------------------------------------------------------
inline void FVTerm::setPrintArea (term_area* area)
{ print_area = area; }
inline FVTerm::term_area* FVTerm::getChildPrintArea() const
{ 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()
@ -1074,6 +1093,18 @@ inline FMouseControl* FVTerm::getFMouseControl()
inline FTerm::initializationValues& FVTerm::getInitValues()
{ 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)
{ return FTerm::setInsertCursor(enable); }

View File

@ -186,165 +186,164 @@ class FWidget : public FVTerm, public FObject
FWidget& operator = (const FWidget&) = delete;
// Accessors
const char* getClassName() const override;
FWidget* getRootWidget() const;
FWidget* getParentWidget() const;
static FWidget*& getMainWidget();
static FWidget*& getActiveWindow();
static FWidget*& getFocusWidget();
static FWidget*& getClickedWidget();
static FWidget*& getOpenMenu();
static FWidget*& getMoveSizeWidget();
virtual FWidget* getFirstFocusableWidget (FObjectList);
virtual FWidget* getLastFocusableWidget (FObjectList);
static FMenuBar* getMenuBar();
static FStatusBar* getStatusBar();
FString getStatusbarMessage() const;
FColor getForegroundColor() const; // get the primary
FColor getBackgroundColor() const; // widget colors
int getX() const; // positioning
int getY() const;
const FPoint getPos() const;
int getTermX() const;
int getTermY() const;
const FPoint getTermPos() const;
std::size_t getWidth() const;
std::size_t getHeight() const;
const FSize getSize() const;
int getTopPadding() const;
int getLeftPadding() const;
int getBottomPadding() const;
int getRightPadding() const;
std::size_t getClientWidth() const;
std::size_t getClientHeight() const;
std::size_t getMaxWidth() const;
std::size_t getMaxHeight() const;
const FSize& getShadow() const;
const FRect& getGeometry() const;
const FRect& getGeometryWithShadow();
const FRect& getTermGeometry();
const FRect& getTermGeometryWithShadow();
std::size_t getDesktopWidth();
std::size_t getDesktopHeight();
widget_flags getFlags() const;
FPoint getCursorPos();
FPoint getPrintPos();
std::vector<bool>& doubleFlatLine_ref (fc::sides);
const char* getClassName() const override;
FWidget* getRootWidget() const;
FWidget* getParentWidget() const;
static FWidget*& getMainWidget();
static FWidget*& getActiveWindow();
static FWidget*& getFocusWidget();
static FWidget*& getClickedWidget();
static FWidget*& getOpenMenu();
static FWidget*& getMoveSizeWidget();
virtual FWidget* getFirstFocusableWidget (FObjectList);
virtual FWidget* getLastFocusableWidget (FObjectList);
Accelerators* getAcceleratorList() const;
static widgetList*& getWindowList();
static FMenuBar* getMenuBar();
static FStatusBar* getStatusBar();
FString getStatusbarMessage() const;
FColor getForegroundColor() const; // get the primary
FColor getBackgroundColor() const; // widget colors
int getX() const; // positioning
int getY() const;
const FPoint getPos() const;
int getTermX() const;
int getTermY() const;
const FPoint getTermPos() const;
std::size_t getWidth() const;
std::size_t getHeight() const;
const FSize getSize() const;
int getTopPadding() const;
int getLeftPadding() const;
int getBottomPadding() const;
int getRightPadding() const;
std::size_t getClientWidth() const;
std::size_t getClientHeight() const;
std::size_t getMaxWidth() const;
std::size_t getMaxHeight() const;
const FSize& getShadow() const;
const FRect& getGeometry() const;
const FRect& getGeometryWithShadow();
const FRect& getTermGeometry();
const FRect& getTermGeometryWithShadow();
std::size_t getDesktopWidth();
std::size_t getDesktopHeight();
const widget_flags& getFlags() const;
FPoint getCursorPos();
FPoint getPrintPos();
std::vector<bool>& doubleFlatLine_ref (fc::sides);
// Mutators
static void setMainWidget (FWidget*);
static void setFocusWidget (FWidget*);
static void setClickedWidget (FWidget*);
static void setMoveSizeWidget (FWidget*);
static void setActiveWindow (FWidget*);
static void setOpenMenu (FWidget*);
virtual void setStatusbarMessage (const FString&);
bool setVisible (bool);
bool setVisible();
bool unsetVisible();
virtual bool setEnable (bool);
virtual bool setEnable();
virtual bool unsetEnable();
virtual bool setDisable();
virtual bool setVisibleCursor (bool); // input cursor visibility
virtual bool setVisibleCursor(); // for the widget
virtual bool unsetVisibleCursor();
virtual bool setFocus (bool);
virtual bool setFocus();
virtual bool unsetFocus();
void setFocusable();
void unsetFocusable();
bool ignorePadding (bool); // ignore padding from
bool ignorePadding(); // the parent widget
bool acceptPadding();
void setForegroundColor (FColor);
void setBackgroundColor (FColor);
void setColor();
virtual void setX (int, bool = true); // positioning
virtual void setY (int, bool = true);
virtual void setPos (const FPoint&, bool = true);
virtual void setWidth (std::size_t, bool = true);
virtual void setHeight (std::size_t, bool = true);
virtual void setSize (const FSize&, bool = true);
void setTopPadding (int, bool = true);
void setLeftPadding (int, bool = true);
void setBottomPadding (int, bool = true);
void setRightPadding (int, bool = true);
void setParentOffset();
void setTermOffset();
void setTermOffsetWithPadding();
void setTermSize (const FSize&);
virtual void setGeometry (const FRect&, bool = true);
virtual void setGeometry (const FPoint&, const FSize&, bool = true);
virtual void setShadowSize (const FSize&);
void setMinimumWidth (std::size_t);
void setMinimumHeight (std::size_t);
void setMinimumSize (const FSize&);
void setMaximumWidth (std::size_t);
void setMaximumHeight (const FSize&);
void setMaximumSize (std::size_t, std::size_t);
void setFixedSize (const FSize&);
bool setCursorPos (const FPoint&);
void unsetCursorPos();
void setPrintPos (const FPoint&);
void setDoubleFlatLine (fc::sides, bool = true);
void unsetDoubleFlatLine (fc::sides);
void setDoubleFlatLine (fc::sides, int, bool = true);
void unsetDoubleFlatLine (fc::sides, int);
static void setMainWidget (FWidget*);
static void setFocusWidget (FWidget*);
static void setClickedWidget (FWidget*);
static void setMoveSizeWidget (FWidget*);
static void setActiveWindow (FWidget*);
static void setOpenMenu (FWidget*);
virtual void setStatusbarMessage (const FString&);
bool setVisible (bool);
bool setVisible();
bool unsetVisible();
virtual bool setEnable (bool);
virtual bool setEnable();
virtual bool unsetEnable();
virtual bool setDisable();
virtual bool setVisibleCursor (bool); // input cursor visibility
virtual bool setVisibleCursor(); // for the widget
virtual bool unsetVisibleCursor();
virtual bool setFocus (bool);
virtual bool setFocus();
virtual bool unsetFocus();
void setFocusable();
void unsetFocusable();
bool ignorePadding (bool); // ignore padding from
bool ignorePadding(); // the parent widget
bool acceptPadding();
void setForegroundColor (FColor);
void setBackgroundColor (FColor);
void setColor();
virtual void setX (int, bool = true); // positioning
virtual void setY (int, bool = true);
virtual void setPos (const FPoint&, bool = true);
virtual void setWidth (std::size_t, bool = true);
virtual void setHeight (std::size_t, bool = true);
virtual void setSize (const FSize&, bool = true);
void setTopPadding (int, bool = true);
void setLeftPadding (int, bool = true);
void setBottomPadding (int, bool = true);
void setRightPadding (int, bool = true);
void setParentOffset();
void setTermOffset();
void setTermOffsetWithPadding();
void setTermSize (const FSize&);
virtual void setGeometry (const FRect&, bool = true);
virtual void setGeometry (const FPoint&, const FSize&, bool = true);
virtual void setShadowSize (const FSize&);
void setMinimumWidth (std::size_t);
void setMinimumHeight (std::size_t);
void setMinimumSize (const FSize&);
void setMaximumWidth (std::size_t);
void setMaximumHeight (const FSize&);
void setMaximumSize (std::size_t, std::size_t);
void setFixedSize (const FSize&);
bool setCursorPos (const FPoint&);
void unsetCursorPos();
void setPrintPos (const FPoint&);
void setDoubleFlatLine (fc::sides, bool = true);
void unsetDoubleFlatLine (fc::sides);
void setDoubleFlatLine (fc::sides, int, bool = true);
void unsetDoubleFlatLine (fc::sides, int);
widget_flags& setFlags();
// Inquiries
bool isRootWidget() const;
bool isWindowWidget() const;
bool isDialogWidget() const;
bool isMenuWidget() const;
bool isVisible() const;
bool isShown() const;
bool isEnabled() const;
bool hasVisibleCursor() const;
bool hasFocus() const;
bool acceptFocus() const; // is focusable
bool isPaddingIgnored();
bool isRootWidget() const;
bool isWindowWidget() const;
bool isDialogWidget() const;
bool isMenuWidget() const;
bool isVisible() const;
bool isShown() const;
bool isEnabled() const;
bool hasVisibleCursor() const;
bool hasFocus() const;
bool acceptFocus() const; // is focusable
bool isPaddingIgnored();
// Methods
static FWidget* childWidgetAt (FWidget*, const FPoint&);
int numOfFocusableChildren();
virtual bool close();
void clearStatusbarMessage();
void addCallback ( const FString&
, FCallback
, FDataPtr = nullptr );
void addCallback ( const FString&
, FWidget*
, FMemberCallback
, FDataPtr = nullptr );
void delCallback (FCallback);
void delCallback (FWidget*);
void delCallbacks();
void emitCallback (const FString&);
void addAccelerator (FKey);
virtual void addAccelerator (FKey, FWidget*);
void delAccelerator ();
virtual void delAccelerator (FWidget*);
virtual void redraw();
virtual void resize();
virtual void show();
virtual void hide();
virtual bool focusFirstChild(); // widget focusing
virtual bool focusLastChild();
FPoint termToWidgetPos (const FPoint&);
void detectTermSize();
void print (const FPoint&) override;
virtual void move (const FPoint&);
void drawShadow();
void clearShadow();
void drawFlatBorder();
void clearFlatBorder();
virtual void drawBorder();
static void quit();
// Data Members
static widgetList* window_list;
Accelerators* accelerator_list{nullptr};
static FWidget* childWidgetAt (FWidget*, const FPoint&);
int numOfFocusableChildren();
virtual bool close();
void clearStatusbarMessage();
void addCallback ( const FString&
, FCallback
, FDataPtr = nullptr );
void addCallback ( const FString&
, FWidget*
, FMemberCallback
, FDataPtr = nullptr );
void delCallback (FCallback);
void delCallback (FWidget*);
void delCallbacks();
void emitCallback (const FString&);
void addAccelerator (FKey);
virtual void addAccelerator (FKey, FWidget*);
void delAccelerator ();
virtual void delAccelerator (FWidget*);
virtual void redraw();
virtual void resize();
virtual void show();
virtual void hide();
virtual bool focusFirstChild(); // widget focusing
virtual bool focusLastChild();
FPoint termToWidgetPos (const FPoint&);
void detectTermSize();
void print (const FPoint&) override;
virtual void move (const FPoint&);
void drawShadow();
void clearShadow();
void drawFlatBorder();
void clearFlatBorder();
virtual void drawBorder();
static void quit();
protected:
struct callback_data
@ -367,73 +366,71 @@ class FWidget : public FVTerm, public FObject
typedef std::vector<member_callback_data> MemberCallbackObjects;
// Accessor
term_area* getPrintArea() override;
void addPreprocessingHandler ( FVTerm*
, FPreprocessingHandler ) override;
void delPreprocessingHandler (FVTerm*) override;
term_area* getPrintArea() override;
const FWidgetColors& getFWidgetColors() const;
static uInt getModalDialogCounter();
static widgetList*& getDialogList();
static widgetList*& getAlwaysOnTopList();
static widgetList*& getWidgetCloseList();
void addPreprocessingHandler ( FVTerm*
, FPreprocessingHandler ) override;
void delPreprocessingHandler (FVTerm*) override;
// Inquiry
bool isChildPrintArea() const;
bool isChildPrintArea() const;
// Mutators
virtual void setStatusBar (FStatusBar*);
virtual void setMenuBar (FMenuBar*);
virtual void setStatusBar (FStatusBar*);
virtual void setMenuBar (FMenuBar*);
FWidgetColors& setFWidgetColors();
static uInt& setModalDialogCounter();
// Methods
virtual void adjustSize();
void adjustSizeGlobal();
void hideSize (const FSize&);
virtual bool focusNextChild(); // Change child...
virtual bool focusPrevChild(); // ...focus
virtual void adjustSize();
void adjustSizeGlobal();
void hideArea (const FSize&);
void createWidgetAcceleratorList();
virtual bool focusNextChild(); // Change child...
virtual bool focusPrevChild(); // ...focus
// Event handlers
bool event (FEvent*) override;
virtual void onKeyPress (FKeyEvent*);
virtual void onKeyUp (FKeyEvent*);
virtual void onKeyDown (FKeyEvent*);
virtual void onMouseDown (FMouseEvent*);
virtual void onMouseUp (FMouseEvent*);
virtual void onMouseDoubleClick (FMouseEvent*);
virtual void onWheel (FWheelEvent*);
virtual void onMouseMove (FMouseEvent*);
virtual void onFocusIn (FFocusEvent*);
virtual void onFocusOut (FFocusEvent*);
virtual void onChildFocusIn (FFocusEvent*);
virtual void onChildFocusOut (FFocusEvent*);
virtual void onAccel (FAccelEvent*);
virtual void onResize (FResizeEvent*);
virtual void onShow (FShowEvent*);
virtual void onHide (FHideEvent*);
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{};
bool event (FEvent*) override;
virtual void onKeyPress (FKeyEvent*);
virtual void onKeyUp (FKeyEvent*);
virtual void onKeyDown (FKeyEvent*);
virtual void onMouseDown (FMouseEvent*);
virtual void onMouseUp (FMouseEvent*);
virtual void onMouseDoubleClick (FMouseEvent*);
virtual void onWheel (FWheelEvent*);
virtual void onMouseMove (FMouseEvent*);
virtual void onFocusIn (FFocusEvent*);
virtual void onFocusOut (FFocusEvent*);
virtual void onChildFocusIn (FFocusEvent*);
virtual void onChildFocusOut (FFocusEvent*);
virtual void onAccel (FAccelEvent*);
virtual void onResize (FResizeEvent*);
virtual void onShow (FShowEvent*);
virtual void onHide (FHideEvent*);
virtual void onClose (FCloseEvent*);
private:
// Methods
void init();
void finish();
void insufficientSpaceAdjust();
void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*);
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
void processDestroy();
virtual void draw();
void drawWindows();
void drawChildren();
void drawTransparentShadow (int, int, int, int);
void drawBlockShadow (int, int, int, int);
static void setColorTheme();
void init();
void finish();
void insufficientSpaceAdjust();
void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*);
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
void processDestroy();
virtual void draw();
void drawWindows();
void drawChildren();
void drawTransparentShadow (int, int, int, int);
void drawBlockShadow (int, int, int, int);
static void setColorTheme();
// Data Members
FPoint widget_cursor_position{-1, -1};
FPoint widget_cursor_position{-1, -1};
struct widget_size_hints
{
@ -480,38 +477,48 @@ class FWidget : public FVTerm, public FObject
int right{0};
} padding{};
bool ignore_padding{false};
struct widget_flags flags{};
bool ignore_padding{false};
// widget size
FRect wsize{1, 1, 1, 1};
FRect adjust_wsize{1, 1, 1, 1};
FRect adjust_wsize_term{};
FRect adjust_wsize_shadow{};
FRect adjust_wsize_term_shadow{};
FRect wsize{1, 1, 1, 1};
FRect adjust_wsize{1, 1, 1, 1};
FRect adjust_wsize_term{};
FRect adjust_wsize_shadow{};
FRect adjust_wsize_term_shadow{};
// widget offset
FRect offset{};
FRect offset{};
// offset of the widget client area
FRect client_offset{};
FRect client_offset{};
// widget shadow size (on the right and bottom side)
FSize wshadow{0, 0};
FSize wshadow{0, 0};
// default widget foreground and background color
FColor foreground_color{fc::Default};
FColor background_color{fc::Default};
FColor foreground_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 FMenuBar* menubar;
static FWidget* main_widget;
static FWidget* active_window;
static FWidget* focus_widget;
static FWidget* clicked_widget;
static FWidget* open_menu;
static FWidget* move_size_widget;
static FWidget* show_root_widget;
static FWidget* redraw_root_widget;
static bool init_desktop;
static bool hideable;
static FStatusBar* statusbar;
static FMenuBar* menubar;
static FWidget* main_widget;
static FWidget* active_window;
static FWidget* focus_widget;
static FWidget* clicked_widget;
static FWidget* open_menu;
static FWidget* move_size_widget;
static FWidget* show_root_widget;
static FWidget* redraw_root_widget;
static widgetList* window_list;
static widgetList* dialog_list;
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 class FToggleButton;
@ -557,6 +564,14 @@ inline FWidget*& FWidget::getOpenMenu()
inline FWidget*& FWidget::getMoveSizeWidget()
{ 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()
{ return menubar; }
@ -704,7 +719,7 @@ inline std::size_t FWidget::getDesktopHeight()
{ return getLineNumber(); }
//----------------------------------------------------------------------
inline FWidget::widget_flags FWidget::getFlags() const
inline const FWidget::widget_flags& FWidget::getFlags() const
{ return flags; }
//----------------------------------------------------------------------
@ -871,6 +886,10 @@ inline void FWidget::unsetDoubleFlatLine (fc::sides side)
inline void FWidget::unsetDoubleFlatLine (fc::sides side, int pos)
{ setDoubleFlatLine(side, pos, false); }
//----------------------------------------------------------------------
inline FWidget::widget_flags& FWidget::setFlags()
{ return flags; }
//----------------------------------------------------------------------
inline bool FWidget::isRootWidget() const
{ return (! hasParent()); }
@ -946,6 +965,34 @@ inline void FWidget::drawBorder()
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()
{ emitCallback("destroy"); }

View File

@ -247,19 +247,19 @@ inline bool FWindow::isWindowActive() const
//----------------------------------------------------------------------
inline bool FWindow::isResizeable() const
{ return flags.resizeable; }
{ return getFlags().resizeable; }
//----------------------------------------------------------------------
inline bool FWindow::isAlwaysOnTop() const
{ return flags.always_on_top; }
{ return getFlags().always_on_top; }
//----------------------------------------------------------------------
inline bool FWindow::hasTransparentShadow() const
{ return flags.trans_shadow; }
{ return getFlags().trans_shadow; }
//----------------------------------------------------------------------
inline bool FWindow::hasShadow() const
{ return flags.shadow; }
{ return getFlags().shadow; }
//----------------------------------------------------------------------
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)

View File

@ -54,22 +54,22 @@ class FMouse_protected : public finalcut::FMouse
uInt16 getMaxWidth()
{
return max_width;
return finalcut::FMouse::getMaxWidth();
}
uInt16 getMaxHeight()
{
return max_height;
return finalcut::FMouse::getMaxHeight();
}
finalcut::FPoint& getNewMousePosition()
{
return new_mouse_position;
return finalcut::FMouse::getNewPos();
}
uInt64 getDblclickInterval()
{
return dblclick_interval;
return finalcut::FMouse::getDblclickInterval();
}
bool isDblclickTimeout (timeval* t)