Better widget visibility handling with the methods hide() and show()
This commit is contained in:
parent
6a91738f48
commit
60e64be37b
|
@ -1,3 +1,7 @@
|
||||||
|
2019-01-09 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Improvement in widget focusing
|
||||||
|
* Better widget visibility handling with the methods hide() and show()
|
||||||
|
|
||||||
2019-01-05 Markus Gans <guru.mail@muenster.de>
|
2019-01-05 Markus Gans <guru.mail@muenster.de>
|
||||||
* Use of initializer_list for FListBox, FListView and FTextView
|
* Use of initializer_list for FListBox, FListView and FTextView
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, FDataPtr)
|
||||||
{
|
{
|
||||||
toggle_button->unsetChecked();
|
toggle_button->unsetChecked();
|
||||||
|
|
||||||
if ( toggle_button->isVisible() && toggle_button->isShown() )
|
if ( toggle_button->isShown() )
|
||||||
toggle_button->redraw();
|
toggle_button->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2012-2018 Markus Gans *
|
* Copyright 2012-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -350,7 +350,7 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||||
// set the cursor to the focus widget
|
// set the cursor to the focus widget
|
||||||
auto focus = FWidget::getFocusWidget();
|
auto focus = FWidget::getFocusWidget();
|
||||||
if ( focus
|
if ( focus
|
||||||
&& focus->isVisible()
|
&& focus->isShown()
|
||||||
&& focus->hasVisibleCursor() )
|
&& focus->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus->getCursorPos();
|
FPoint cursor_pos = focus->getCursorPos();
|
||||||
|
@ -511,7 +511,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
// Click on titlebar menu button
|
// Click on titlebar menu button
|
||||||
if ( ms.mouse_x < 4 && ms.mouse_y == 1
|
if ( ms.mouse_x < 4 && ms.mouse_y == 1
|
||||||
&& dialog_menu->isVisible() )
|
&& dialog_menu->isShown() )
|
||||||
leaveMenu(); // close menu
|
leaveMenu(); // close menu
|
||||||
|
|
||||||
cancelMouseResize(); // Cancel resize
|
cancelMouseResize(); // Cancel resize
|
||||||
|
@ -561,7 +561,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
// Click on titlebar menu button
|
// Click on titlebar menu button
|
||||||
if ( ms.mouse_x < 4
|
if ( ms.mouse_x < 4
|
||||||
&& ms.mouse_y == 1
|
&& ms.mouse_y == 1
|
||||||
&& dialog_menu->isVisible()
|
&& dialog_menu->isShown()
|
||||||
&& ! dialog_menu->hasSelectedItem() )
|
&& ! dialog_menu->hasSelectedItem() )
|
||||||
{
|
{
|
||||||
// Sets focus to the first item
|
// Sets focus to the first item
|
||||||
|
@ -679,7 +679,7 @@ void FDialog::onAccel (FAccelEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowActive (FEvent*)
|
void FDialog::onWindowActive (FEvent*)
|
||||||
{
|
{
|
||||||
if ( isVisible() && isShown() )
|
if ( isShown() )
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
|
|
||||||
if ( ! FWidget::getFocusWidget() )
|
if ( ! FWidget::getFocusWidget() )
|
||||||
|
@ -687,7 +687,6 @@ void FDialog::onWindowActive (FEvent*)
|
||||||
auto win_focus = getWindowFocusWidget();
|
auto win_focus = getWindowFocusWidget();
|
||||||
|
|
||||||
if ( win_focus
|
if ( win_focus
|
||||||
&& win_focus->isVisible()
|
|
||||||
&& win_focus->isShown() )
|
&& win_focus->isShown() )
|
||||||
{
|
{
|
||||||
win_focus->setFocus();
|
win_focus->setFocus();
|
||||||
|
@ -706,10 +705,10 @@ void FDialog::onWindowActive (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowInactive (FEvent*)
|
void FDialog::onWindowInactive (FEvent*)
|
||||||
{
|
{
|
||||||
if ( dialog_menu && ! dialog_menu->isVisible() )
|
if ( dialog_menu && ! dialog_menu->isShown() )
|
||||||
FWindow::setPreviousWindow(this);
|
FWindow::setPreviousWindow(this);
|
||||||
|
|
||||||
if ( isVisible() && isEnabled() )
|
if ( isShown() && isEnabled() )
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
|
@ -719,7 +718,7 @@ void FDialog::onWindowInactive (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowRaised (FEvent*)
|
void FDialog::onWindowRaised (FEvent*)
|
||||||
{
|
{
|
||||||
if ( ! (isVisible() && isShown()) )
|
if ( ! (isShown() && isShown()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
putArea (getTermPos(), vwin);
|
putArea (getTermPos(), vwin);
|
||||||
|
@ -1016,7 +1015,7 @@ void FDialog::drawBarButton()
|
||||||
// Print the title button
|
// Print the title button
|
||||||
setPrintPos (1, 1);
|
setPrintPos (1, 1);
|
||||||
|
|
||||||
if ( dialog_menu && dialog_menu->isVisible() )
|
if ( dialog_menu && dialog_menu->isShown() )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
||||||
|
@ -1138,7 +1137,7 @@ void FDialog::drawTextBar()
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
if ( isWindowActive() || (dialog_menu && dialog_menu->isVisible()) )
|
if ( isWindowActive() || (dialog_menu && dialog_menu->isShown()) )
|
||||||
setColor (wc.titlebar_active_fg, wc.titlebar_active_bg);
|
setColor (wc.titlebar_active_fg, wc.titlebar_active_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
||||||
|
@ -1202,7 +1201,7 @@ void FDialog::setCursorToFocusWidget()
|
||||||
auto focus = FWidget::getFocusWidget();
|
auto focus = FWidget::getFocusWidget();
|
||||||
|
|
||||||
if ( focus
|
if ( focus
|
||||||
&& focus->isVisible()
|
&& focus->isShown()
|
||||||
&& focus->hasVisibleCursor() )
|
&& focus->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus->getCursorPos();
|
FPoint cursor_pos = focus->getCursorPos();
|
||||||
|
@ -1238,7 +1237,7 @@ void FDialog::openMenu()
|
||||||
if ( ! dialog_menu )
|
if ( ! dialog_menu )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( dialog_menu->isVisible() )
|
if ( dialog_menu->isShown() )
|
||||||
{
|
{
|
||||||
leaveMenu();
|
leaveMenu();
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
|
@ -1248,10 +1247,10 @@ void FDialog::openMenu()
|
||||||
setOpenMenu(dialog_menu);
|
setOpenMenu(dialog_menu);
|
||||||
dialog_menu->setPos (getX(), getY() + 1);
|
dialog_menu->setPos (getX(), getY() + 1);
|
||||||
dialog_menu->setVisible();
|
dialog_menu->setVisible();
|
||||||
drawTitleBar();
|
|
||||||
dialog_menu->show();
|
dialog_menu->show();
|
||||||
dialog_menu->raiseWindow();
|
dialog_menu->raiseWindow();
|
||||||
dialog_menu->redraw();
|
dialog_menu->redraw();
|
||||||
|
drawTitleBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,7 +1371,6 @@ inline void FDialog::passEventToSubMenu ( const mouseStates& ms
|
||||||
{
|
{
|
||||||
// Mouse event handover to the dialog menu
|
// Mouse event handover to the dialog menu
|
||||||
if ( ! ms.mouse_over_menu
|
if ( ! ms.mouse_over_menu
|
||||||
|| ! dialog_menu->isVisible()
|
|
||||||
|| ! dialog_menu->isShown() )
|
|| ! dialog_menu->isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
101
src/flistbox.cpp
101
src/flistbox.cpp
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2014-2018 Markus Gans *
|
* Copyright 2014-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -118,9 +118,7 @@ void FListBox::setCurrentItem (std::size_t index)
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
vbar->setValue(yoffset);
|
vbar->setValue(yoffset);
|
||||||
|
redraw();
|
||||||
if ( isVisible() )
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -155,8 +153,8 @@ void FListBox::showInsideBrackets ( std::size_t index
|
||||||
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( ! hbar->isShown() )
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,7 +287,7 @@ void FListBox::remove (std::size_t item)
|
||||||
hbar->setMaximum (hmax);
|
hbar->setMaximum (hmax);
|
||||||
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
||||||
|
|
||||||
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
|
if ( hbar->isShown() && isHorizontallyScrollable() )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
int vmax = ( element_count > getHeight() - 2 )
|
int vmax = ( element_count > getHeight() - 2 )
|
||||||
|
@ -298,7 +296,7 @@ void FListBox::remove (std::size_t item)
|
||||||
vbar->setMaximum (vmax);
|
vbar->setMaximum (vmax);
|
||||||
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
||||||
|
|
||||||
if ( vbar->isVisible() && element_count < getHeight() - 1 )
|
if ( vbar->isShown() && isVerticallyScrollable() )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
|
||||||
if ( current >= item && current > 1 )
|
if ( current >= item && current > 1 )
|
||||||
|
@ -490,12 +488,12 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
if ( ev->getButton() == fc::RightButton )
|
if ( ev->getButton() == fc::RightButton )
|
||||||
multiSelection(current);
|
multiSelection(current);
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
if ( yoffset_before != yoffset )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -558,12 +556,12 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
multiSelectionUpTo(current);
|
multiSelectionUpTo(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
if ( yoffset_before != yoffset )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -637,12 +635,12 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
multiSelectionUpTo(current);
|
multiSelectionUpTo(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
if ( yoffset_before != yoffset )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -685,12 +683,12 @@ void FListBox::onWheel (FWheelEvent* ev)
|
||||||
processSelect();
|
processSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
if ( yoffset_before != yoffset )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -770,15 +768,15 @@ void FListBox::adjustSize()
|
||||||
hbar->setWidth (width + nf_offset, false);
|
hbar->setWidth (width + nf_offset, false);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
|
|
||||||
if ( element_count <= height )
|
if ( isHorizontallyScrollable() )
|
||||||
vbar->hide();
|
hbar->show();
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
|
||||||
|
|
||||||
if ( max_line_width < width - 1 )
|
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
|
if ( isVerticallyScrollable() )
|
||||||
|
vbar->show();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
vbar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -792,20 +790,10 @@ inline FString& FListBox::getString (listBoxItems::iterator iter)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::init()
|
void FListBox::init()
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.dialog_fg);
|
|
||||||
setBackgroundColor (wc.dialog_bg);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||||
vbar->setMinimum(0);
|
|
||||||
vbar->setValue(0);
|
|
||||||
vbar->hide();
|
|
||||||
|
|
||||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||||
hbar->setMinimum(0);
|
|
||||||
hbar->setValue(0);
|
|
||||||
hbar->hide();
|
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -813,7 +801,13 @@ void FListBox::init()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
vbar->setMinimum(0);
|
||||||
|
vbar->setValue(0);
|
||||||
|
vbar->hide();
|
||||||
|
|
||||||
|
hbar->setMinimum(0);
|
||||||
|
hbar->setValue(0);
|
||||||
|
hbar->hide();
|
||||||
|
|
||||||
vbar->addCallback
|
vbar->addCallback
|
||||||
(
|
(
|
||||||
|
@ -827,6 +821,9 @@ void FListBox::init()
|
||||||
F_METHOD_CALLBACK (this, &FListBox::cb_HBarChange)
|
F_METHOD_CALLBACK (this, &FListBox::cb_HBarChange)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
||||||
|
setForegroundColor (wc.dialog_fg);
|
||||||
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -850,7 +847,7 @@ void FListBox::draw()
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
if ( isNewFont() && ! vbar->isVisible() )
|
if ( isNewFont() && ! vbar->isShown() )
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
|
@ -866,12 +863,8 @@ void FListBox::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
if ( vbar->isVisible() )
|
vbar->redraw();
|
||||||
vbar->redraw();
|
hbar->redraw();
|
||||||
|
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->redraw();
|
|
||||||
|
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
|
@ -1185,17 +1178,17 @@ inline void FListBox::unsetAttributes()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar)
|
inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar)
|
||||||
{
|
{
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && draw_vbar )
|
if ( draw_vbar )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( hbar->isVisible() && draw_hbar )
|
if ( draw_hbar )
|
||||||
hbar->drawBar();
|
hbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1222,8 +1215,10 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
|
||||||
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( isHorizontallyScrollable() )
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
|
else
|
||||||
|
hbar->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1237,8 +1232,10 @@ void FListBox::recalculateVerticalBar (std::size_t element_count)
|
||||||
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
if ( isVerticallyScrollable() )
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
|
else
|
||||||
|
vbar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1823,7 +1820,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
||||||
std::size_t len = iter->text.getLength();
|
std::size_t len = iter->text.getLength();
|
||||||
recalculateHorizontalBar (len, hasBrackets(iter));
|
recalculateHorizontalBar (len, hasBrackets(iter));
|
||||||
|
|
||||||
if ( hbar->isVisible() )
|
if ( hbar->isShown() )
|
||||||
hbar->redraw();
|
hbar->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1878,7 +1875,7 @@ void FListBox::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
processSelect();
|
processSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
|
@ -1886,7 +1883,7 @@ void FListBox::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
if ( vbar->isVisible() && yoffset_before != yoffset )
|
if ( yoffset_before != yoffset )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1939,7 +1936,7 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
if ( xoffset_before != xoffset )
|
if ( xoffset_before != xoffset )
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
{
|
{
|
||||||
drawList();
|
drawList();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1951,7 +1948,7 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( hbar->isVisible() && xoffset_before != xoffset )
|
if ( xoffset_before != xoffset )
|
||||||
hbar->drawBar();
|
hbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
|
|
@ -1018,13 +1018,12 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible()
|
if ( first_line_position_before != first_visible_line.getPosition() )
|
||||||
&& first_line_position_before != first_visible_line.getPosition() )
|
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1069,7 +1068,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1085,7 +1084,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
item->setChecked(! item->isChecked());
|
item->setChecked(! item->isChecked());
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1121,13 +1120,12 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
||||||
if ( new_pos < int(getCount()) )
|
if ( new_pos < int(getCount()) )
|
||||||
setRelativePosition (mouse_y - 2);
|
setRelativePosition (mouse_y - 2);
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible()
|
if ( first_line_position_before != first_visible_line.getPosition() )
|
||||||
&& first_line_position_before != first_visible_line.getPosition() )
|
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1171,7 +1169,7 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,13 +1206,12 @@ void FListView::onTimer (FTimerEvent*)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible()
|
if ( first_line_position_before != first_visible_line.getPosition() )
|
||||||
&& first_line_position_before != first_visible_line.getPosition() )
|
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1248,13 +1245,12 @@ void FListView::onWheel (FWheelEvent* ev)
|
||||||
if ( position_before != current_iter.getPosition() )
|
if ( position_before != current_iter.getPosition() )
|
||||||
processChanged();
|
processChanged();
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible()
|
if ( first_line_position_before != first_visible_line.getPosition() )
|
||||||
&& first_line_position_before != first_visible_line.getPosition() )
|
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1350,15 +1346,15 @@ void FListView::adjustSize()
|
||||||
hbar->setWidth (width, false);
|
hbar->setWidth (width, false);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
|
|
||||||
if ( element_count <= height )
|
if ( isHorizontallyScrollable() )
|
||||||
vbar->hide();
|
hbar->show();
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
|
||||||
|
|
||||||
if ( max_line_width <= width )
|
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
|
if ( isVerticallyScrollable() )
|
||||||
|
vbar->show();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
vbar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1366,24 +1362,10 @@ void FListView::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::init()
|
void FListView::init()
|
||||||
{
|
{
|
||||||
selflist.push_back(this);
|
|
||||||
root = selflist.begin();
|
|
||||||
null_iter = selflist.end();
|
|
||||||
|
|
||||||
setForegroundColor (wc.dialog_fg);
|
|
||||||
setBackgroundColor (wc.dialog_bg);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||||
vbar->setMinimum(0);
|
|
||||||
vbar->setValue(0);
|
|
||||||
vbar->hide();
|
|
||||||
|
|
||||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||||
hbar->setMinimum(0);
|
|
||||||
hbar->setValue(0);
|
|
||||||
hbar->hide();
|
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -1391,7 +1373,13 @@ void FListView::init()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
vbar->setMinimum(0);
|
||||||
|
vbar->setValue(0);
|
||||||
|
vbar->hide();
|
||||||
|
|
||||||
|
hbar->setMinimum(0);
|
||||||
|
hbar->setValue(0);
|
||||||
|
hbar->hide();
|
||||||
|
|
||||||
vbar->addCallback
|
vbar->addCallback
|
||||||
(
|
(
|
||||||
|
@ -1405,6 +1393,12 @@ void FListView::init()
|
||||||
F_METHOD_CALLBACK (this, &FListView::cb_HBarChange)
|
F_METHOD_CALLBACK (this, &FListView::cb_HBarChange)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
selflist.push_back(this);
|
||||||
|
root = selflist.begin();
|
||||||
|
null_iter = selflist.end();
|
||||||
|
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
||||||
|
setForegroundColor (wc.dialog_fg);
|
||||||
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -1466,7 +1460,7 @@ void FListView::draw()
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
if ( isNewFont() && ! vbar->isVisible() )
|
if ( isNewFont() && ! vbar->isShown() )
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
|
@ -1482,12 +1476,8 @@ void FListView::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
if ( vbar->isVisible() )
|
vbar->redraw();
|
||||||
vbar->redraw();
|
hbar->redraw();
|
||||||
|
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->redraw();
|
|
||||||
|
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
|
@ -1869,17 +1859,17 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
||||||
{
|
{
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible() && draw_vbar )
|
if ( draw_vbar )
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( hbar->isVisible() && draw_hbar )
|
if ( draw_hbar )
|
||||||
hbar->drawBar();
|
hbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1964,8 +1954,10 @@ void FListView::recalculateHorizontalBar (std::size_t len)
|
||||||
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4);
|
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4);
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( isHorizontallyScrollable() )
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
|
else
|
||||||
|
hbar->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1979,8 +1971,10 @@ void FListView::recalculateVerticalBar (std::size_t element_count)
|
||||||
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
if ( isVerticallyScrollable() )
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
|
else
|
||||||
|
vbar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -2014,7 +2008,7 @@ void FListView::mouseHeaderClicked()
|
||||||
|
|
||||||
sort();
|
sort();
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
updateDrawing (true, false);
|
updateDrawing (true, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -2533,7 +2527,7 @@ void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
|
@ -2541,8 +2535,7 @@ void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
vbar->setValue (first_visible_line.getPosition());
|
vbar->setValue (first_visible_line.getPosition());
|
||||||
|
|
||||||
if ( vbar->isVisible()
|
if ( first_line_position_before != first_visible_line.getPosition() )
|
||||||
&& first_line_position_before != first_visible_line.getPosition() )
|
|
||||||
vbar->drawBar();
|
vbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -2593,7 +2586,7 @@ void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
{
|
{
|
||||||
drawHeadlines();
|
drawHeadlines();
|
||||||
drawList();
|
drawList();
|
||||||
|
@ -2606,7 +2599,7 @@ void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( hbar->isVisible() && xoffset_before != xoffset )
|
if ( xoffset_before != xoffset )
|
||||||
hbar->drawBar();
|
hbar->drawBar();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
|
|
@ -437,6 +437,7 @@ void FMenu::init(FWidget* parent)
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
hide();
|
hide();
|
||||||
|
//unsetVisible();
|
||||||
|
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc.menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
|
@ -574,7 +575,7 @@ void FMenu::openSubMenu (FMenu* sub_menu, bool select)
|
||||||
if ( ! sub_menu )
|
if ( ! sub_menu )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( sub_menu->isVisible() )
|
if ( sub_menu->isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( select )
|
if ( select )
|
||||||
|
@ -585,7 +586,7 @@ void FMenu::openSubMenu (FMenu* sub_menu, bool select)
|
||||||
sub_menu->getSelectedItem()->setFocus();
|
sub_menu->getSelectedItem()->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_menu->setVisible();
|
//sub_menu->setVisible();
|
||||||
sub_menu->show();
|
sub_menu->show();
|
||||||
opened_sub_menu = sub_menu;
|
opened_sub_menu = sub_menu;
|
||||||
raiseWindow (sub_menu);
|
raiseWindow (sub_menu);
|
||||||
|
@ -737,7 +738,7 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
||||||
if ( m_item->hasMenu() )
|
if ( m_item->hasMenu() )
|
||||||
{
|
{
|
||||||
auto sub_menu = m_item->getMenu();
|
auto sub_menu = m_item->getMenu();
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isShown() )
|
||||||
shown_sub_menu = sub_menu;
|
shown_sub_menu = sub_menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -766,7 +767,7 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||||
if ( (*iter)->hasMenu() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
auto sub_menu = (*iter)->getMenu();
|
auto sub_menu = (*iter)->getMenu();
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isShown() )
|
||||||
openSubMenu (sub_menu, SELECT_ITEM);
|
openSubMenu (sub_menu, SELECT_ITEM);
|
||||||
else if ( opened_sub_menu )
|
else if ( opened_sub_menu )
|
||||||
{
|
{
|
||||||
|
@ -851,7 +852,7 @@ void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
||||||
{
|
{
|
||||||
auto sub_menu = m_item->getMenu();
|
auto sub_menu = m_item->getMenu();
|
||||||
|
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isShown() )
|
||||||
shown_sub_menu = sub_menu;
|
shown_sub_menu = sub_menu;
|
||||||
}
|
}
|
||||||
else if ( opened_sub_menu )
|
else if ( opened_sub_menu )
|
||||||
|
@ -1045,7 +1046,7 @@ bool FMenu::selectNextItem()
|
||||||
}
|
}
|
||||||
while ( ! next->isEnabled()
|
while ( ! next->isEnabled()
|
||||||
|| ! next->acceptFocus()
|
|| ! next->acceptFocus()
|
||||||
|| ! next->isVisible()
|
|| ! next->isShown()
|
||||||
|| next->isSeparator() );
|
|| next->isSeparator() );
|
||||||
|
|
||||||
if ( next == *iter )
|
if ( next == *iter )
|
||||||
|
@ -1095,7 +1096,7 @@ bool FMenu::selectPrevItem()
|
||||||
}
|
}
|
||||||
while ( ! prev->isEnabled()
|
while ( ! prev->isEnabled()
|
||||||
|| ! prev->acceptFocus()
|
|| ! prev->acceptFocus()
|
||||||
|| ! prev->isVisible()
|
|| ! prev->isShown()
|
||||||
|| prev->isSeparator() );
|
|| prev->isSeparator() );
|
||||||
|
|
||||||
if ( prev == *iter )
|
if ( prev == *iter )
|
||||||
|
@ -1575,7 +1576,7 @@ inline void FMenu::keyRight (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
auto sub_menu = getSelectedItem()->getMenu();
|
auto sub_menu = getSelectedItem()->getMenu();
|
||||||
|
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isShown() )
|
||||||
openSubMenu (sub_menu, SELECT_ITEM);
|
openSubMenu (sub_menu, SELECT_ITEM);
|
||||||
else
|
else
|
||||||
keypressMenuBar(ev); // select next menu
|
keypressMenuBar(ev); // select next menu
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2018 Markus Gans *
|
* Copyright 2015-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -301,7 +301,7 @@ bool FMenuBar::selectNextItem()
|
||||||
next = static_cast<FMenuItem*>(*next_element);
|
next = static_cast<FMenuItem*>(*next_element);
|
||||||
} while ( ! next->isEnabled()
|
} while ( ! next->isEnabled()
|
||||||
|| ! next->acceptFocus()
|
|| ! next->acceptFocus()
|
||||||
|| ! next->isVisible()
|
|| ! next->isShown()
|
||||||
|| next->isSeparator() );
|
|| next->isSeparator() );
|
||||||
|
|
||||||
if ( next == *iter )
|
if ( next == *iter )
|
||||||
|
@ -365,7 +365,7 @@ bool FMenuBar::selectPrevItem()
|
||||||
}
|
}
|
||||||
while ( ! prev->isEnabled()
|
while ( ! prev->isEnabled()
|
||||||
|| ! prev->acceptFocus()
|
|| ! prev->acceptFocus()
|
||||||
|| ! prev->isVisible()
|
|| ! prev->isShown()
|
||||||
|| prev->isSeparator() );
|
|| prev->isSeparator() );
|
||||||
|
|
||||||
if ( prev == *iter )
|
if ( prev == *iter )
|
||||||
|
@ -737,6 +737,7 @@ void FMenuBar::selectMenuItem (FMenuItem* item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto focused_widget = getFocusWidget();
|
auto focused_widget = getFocusWidget();
|
||||||
|
unselectItem();
|
||||||
item->setSelected();
|
item->setSelected();
|
||||||
item->setFocus();
|
item->setFocus();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2018 Markus Gans *
|
* Copyright 2015-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -258,7 +258,7 @@ void FMenuItem::openMenu()
|
||||||
|
|
||||||
auto dd_menu = getMenu(); // Drop-down menu
|
auto dd_menu = getMenu(); // Drop-down menu
|
||||||
|
|
||||||
if ( dd_menu->isVisible() )
|
if ( dd_menu->isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto openmenu = static_cast<FMenu*>(getOpenMenu());
|
auto openmenu = static_cast<FMenu*>(getOpenMenu());
|
||||||
|
@ -273,7 +273,7 @@ void FMenuItem::openMenu()
|
||||||
createDialogList (dd_menu);
|
createDialogList (dd_menu);
|
||||||
|
|
||||||
setOpenMenu(dd_menu);
|
setOpenMenu(dd_menu);
|
||||||
dd_menu->setVisible();
|
//dd_menu->setVisible();
|
||||||
dd_menu->show();
|
dd_menu->show();
|
||||||
dd_menu->raiseWindow();
|
dd_menu->raiseWindow();
|
||||||
dd_menu->redraw();
|
dd_menu->redraw();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2014-2018 Markus Gans *
|
* Copyright 2014-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -56,7 +56,7 @@ void FProgressbar::setPercentage (std::size_t percentage_value)
|
||||||
else
|
else
|
||||||
percentage = percentage_value;
|
percentage = percentage_value;
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
{
|
{
|
||||||
drawPercentage();
|
drawPercentage();
|
||||||
drawBar();
|
drawBar();
|
||||||
|
@ -139,7 +139,7 @@ void FProgressbar::reset()
|
||||||
{
|
{
|
||||||
percentage = NOT_SET;
|
percentage = NOT_SET;
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
{
|
{
|
||||||
drawPercentage();
|
drawPercentage();
|
||||||
drawBar();
|
drawBar();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2012-2018 Markus Gans *
|
* Copyright 2012-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -188,7 +188,8 @@ void FScrollbar::resize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::redraw()
|
void FScrollbar::redraw()
|
||||||
{
|
{
|
||||||
draw();
|
if ( isShown() )
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -348,6 +349,9 @@ void FScrollbar::drawHorizontalBar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawBar()
|
void FScrollbar::drawBar()
|
||||||
{
|
{
|
||||||
|
if ( ! isShown() )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( slider_pos == current_slider_pos || length < 3 )
|
if ( slider_pos == current_slider_pos || length < 3 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2017-2018 Markus Gans *
|
* Copyright 2017-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -356,7 +356,7 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
changeX = bool(xoffset_before != xoffset);
|
changeX = bool(xoffset_before != xoffset);
|
||||||
changeY = bool(yoffset_before != yoffset);
|
changeY = bool(yoffset_before != yoffset);
|
||||||
|
|
||||||
if ( ! isVisible() || ! viewport || ! (changeX || changeY) )
|
if ( ! isShown() || ! viewport || ! (changeX || changeY) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( changeX )
|
if ( changeX )
|
||||||
|
@ -719,9 +719,6 @@ inline FPoint FScrollView::getViewportCursorPos()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::init (FWidget* parent)
|
void FScrollView::init (FWidget* parent)
|
||||||
{
|
{
|
||||||
int xoffset_end;
|
|
||||||
int yoffset_end;
|
|
||||||
|
|
||||||
assert ( parent != 0 );
|
assert ( parent != 0 );
|
||||||
assert ( ! parent->isInstanceOf("FScrollView") );
|
assert ( ! parent->isInstanceOf("FScrollView") );
|
||||||
|
|
||||||
|
@ -730,14 +727,13 @@ void FScrollView::init (FWidget* parent)
|
||||||
init_scrollbar();
|
init_scrollbar();
|
||||||
setGeometry (1, 1, 4, 4);
|
setGeometry (1, 1, 4, 4);
|
||||||
setMinimumSize (4, 4);
|
setMinimumSize (4, 4);
|
||||||
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
setTopPadding (1 - getScrollY());
|
setTopPadding (1 - getScrollY());
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
||||||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||||
|
|
||||||
FPoint no_shadow(0, 0);
|
FPoint no_shadow(0, 0);
|
||||||
std::size_t w = getViewportWidth();
|
std::size_t w = getViewportWidth();
|
||||||
std::size_t h = getViewportHeight();
|
std::size_t h = getViewportHeight();
|
||||||
|
@ -765,14 +761,7 @@ void FScrollView::init_scrollbar()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||||
vbar->setMinimum(0);
|
|
||||||
vbar->setValue(0);
|
|
||||||
vbar->hide();
|
|
||||||
|
|
||||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||||
hbar->setMinimum(0);
|
|
||||||
hbar->setValue(0);
|
|
||||||
hbar->hide();
|
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -780,6 +769,17 @@ void FScrollView::init_scrollbar()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
term_area* area = getPrintArea();
|
||||||
|
vbar->setPrintArea(area);
|
||||||
|
vbar->setMinimum(0);
|
||||||
|
vbar->setValue(0);
|
||||||
|
vbar->hide();
|
||||||
|
|
||||||
|
hbar->setPrintArea(area);
|
||||||
|
hbar->setMinimum(0);
|
||||||
|
hbar->setValue(0);
|
||||||
|
hbar->hide();
|
||||||
|
|
||||||
vbar->addCallback
|
vbar->addCallback
|
||||||
(
|
(
|
||||||
"change-value",
|
"change-value",
|
||||||
|
@ -821,7 +821,7 @@ void FScrollView::setHorizontalScrollBarVisibility()
|
||||||
{
|
{
|
||||||
case fc::Auto:
|
case fc::Auto:
|
||||||
if ( getScrollWidth() > getViewportWidth() )
|
if ( getScrollWidth() > getViewportWidth() )
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
else
|
else
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
break;
|
break;
|
||||||
|
@ -831,7 +831,7 @@ void FScrollView::setHorizontalScrollBarVisibility()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Scroll:
|
case fc::Scroll:
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,7 +843,7 @@ void FScrollView::setVerticalScrollBarVisibility()
|
||||||
{
|
{
|
||||||
case fc::Auto:
|
case fc::Auto:
|
||||||
if ( getScrollHeight() > getViewportHeight() )
|
if ( getScrollHeight() > getViewportHeight() )
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
else
|
else
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
break;
|
break;
|
||||||
|
@ -853,7 +853,7 @@ void FScrollView::setVerticalScrollBarVisibility()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Scroll:
|
case fc::Scroll:
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -985,10 +985,7 @@ void FScrollView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
inline void FScrollView::redrawHBar()
|
inline void FScrollView::redrawHBar()
|
||||||
{
|
{
|
||||||
child_print_area = nullptr;
|
child_print_area = nullptr;
|
||||||
|
hbar->redraw();
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->redraw();
|
|
||||||
|
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,10 +993,7 @@ inline void FScrollView::redrawHBar()
|
||||||
inline void FScrollView::redrawVBar()
|
inline void FScrollView::redrawVBar()
|
||||||
{
|
{
|
||||||
child_print_area = nullptr;
|
child_print_area = nullptr;
|
||||||
|
vbar->redraw();
|
||||||
if ( vbar->isVisible() )
|
|
||||||
vbar->redraw();
|
|
||||||
|
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,10 +1001,7 @@ inline void FScrollView::redrawVBar()
|
||||||
inline void FScrollView::drawHBar()
|
inline void FScrollView::drawHBar()
|
||||||
{
|
{
|
||||||
child_print_area = nullptr;
|
child_print_area = nullptr;
|
||||||
|
hbar->drawBar();
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->drawBar();
|
|
||||||
|
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,10 +1009,7 @@ inline void FScrollView::drawHBar()
|
||||||
inline void FScrollView::drawVBar()
|
inline void FScrollView::drawVBar()
|
||||||
{
|
{
|
||||||
child_print_area = nullptr;
|
child_print_area = nullptr;
|
||||||
|
vbar->drawBar();
|
||||||
if ( vbar->isVisible() )
|
|
||||||
vbar->drawBar();
|
|
||||||
|
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2014-2018 Markus Gans *
|
* Copyright 2014-2019 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -495,8 +495,7 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, FDataPtr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() && isShown() )
|
redraw();
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
bool changeX = bool(x != xoffset);
|
bool changeX = bool(x != xoffset);
|
||||||
bool changeY = bool(y != yoffset);
|
bool changeY = bool(y != yoffset);
|
||||||
|
|
||||||
if ( ! isVisible() || ! (changeX || changeY) )
|
if ( ! isShown() || ! (changeX || changeY) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( changeX && isHorizontallyScrollable() )
|
if ( changeX && isHorizontallyScrollable() )
|
||||||
|
@ -157,7 +157,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
if ( update_scrollbar )
|
if ( update_scrollbar )
|
||||||
{
|
{
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
drawHBar();
|
hbar->drawBar();;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
if ( update_scrollbar )
|
if ( update_scrollbar )
|
||||||
{
|
{
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
drawVBar();
|
vbar->drawBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +264,8 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
|
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( ! hbar->isShown() )
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,10 +278,10 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && getRows() > getTextHeight() )
|
if ( ! vbar->isShown() && getRows() > getTextHeight() )
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
|
|
||||||
if ( vbar->isVisible() && getRows() <= getTextHeight() )
|
if ( vbar->isShown() && getRows() <= getTextHeight() )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -462,11 +462,8 @@ void FTextView::onMouseUp (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vbar->isVisible() )
|
vbar->redraw();
|
||||||
vbar->redraw();
|
hbar->redraw();
|
||||||
|
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -518,7 +515,7 @@ void FTextView::onWheel (FWheelEvent* ev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isShown() )
|
||||||
drawText();
|
drawText();
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -593,12 +590,12 @@ void FTextView::adjustSize()
|
||||||
if ( last_line < int(height) + nf_offset - 1 )
|
if ( last_line < int(height) + nf_offset - 1 )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
vbar->show();
|
||||||
|
|
||||||
if ( max_width < int(width) - nf_offset - 1 )
|
if ( max_width < int(width) - nf_offset - 1 )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
hbar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -618,20 +615,10 @@ std::size_t FTextView::getTextWidth()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::init()
|
void FTextView::init()
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.dialog_fg);
|
|
||||||
setBackgroundColor (wc.dialog_bg);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||||
vbar->setMinimum(0);
|
|
||||||
vbar->setValue(0);
|
|
||||||
vbar->hide();
|
|
||||||
|
|
||||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||||
hbar->setMinimum(0);
|
|
||||||
hbar->setValue(0);
|
|
||||||
hbar->hide();
|
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -639,6 +626,14 @@ void FTextView::init()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vbar->setMinimum(0);
|
||||||
|
vbar->setValue(0);
|
||||||
|
vbar->hide();
|
||||||
|
|
||||||
|
hbar->setMinimum(0);
|
||||||
|
hbar->setValue(0);
|
||||||
|
hbar->hide();
|
||||||
|
|
||||||
vbar->addCallback
|
vbar->addCallback
|
||||||
(
|
(
|
||||||
"change-value",
|
"change-value",
|
||||||
|
@ -651,6 +646,8 @@ void FTextView::init()
|
||||||
F_METHOD_CALLBACK (this, &FTextView::cb_HBarChange)
|
F_METHOD_CALLBACK (this, &FTextView::cb_HBarChange)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setForegroundColor (wc.dialog_fg);
|
||||||
|
setBackgroundColor (wc.dialog_bg);
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -687,10 +684,10 @@ void FTextView::draw()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
if ( vbar->isVisible() )
|
if ( vbar->isShown() )
|
||||||
vbar->redraw();
|
vbar->redraw();
|
||||||
|
|
||||||
if ( hbar->isVisible() )
|
if ( hbar->isShown() )
|
||||||
hbar->redraw();
|
hbar->redraw();
|
||||||
|
|
||||||
drawText();
|
drawText();
|
||||||
|
@ -768,20 +765,6 @@ void FTextView::processChanged()
|
||||||
emitCallback("changed");
|
emitCallback("changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTextView::drawHBar()
|
|
||||||
{
|
|
||||||
if ( hbar->isVisible() )
|
|
||||||
hbar->drawBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTextView::drawVBar()
|
|
||||||
{
|
|
||||||
if ( vbar->isVisible() )
|
|
||||||
vbar->drawBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,6 +247,12 @@ void FWidget::setMainWidget (FWidget* obj)
|
||||||
app_object->focusFirstChild();
|
app_object->focusFirstChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FWidget::setVisible (bool enable)
|
||||||
|
{
|
||||||
|
return (flags.visible = enable);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::setEnable (bool enable)
|
bool FWidget::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
|
@ -754,7 +760,7 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
||||||
auto widget = static_cast<FWidget*>(*iter);
|
auto widget = static_cast<FWidget*>(*iter);
|
||||||
|
|
||||||
if ( widget->isEnabled()
|
if ( widget->isEnabled()
|
||||||
&& widget->isVisible()
|
&& widget->isShown()
|
||||||
&& ! widget->isWindowWidget()
|
&& ! widget->isWindowWidget()
|
||||||
&& widget->getTermGeometry().contains(x, y) )
|
&& widget->getTermGeometry().contains(x, y) )
|
||||||
{
|
{
|
||||||
|
@ -785,7 +791,7 @@ int FWidget::numOfFocusableChildren()
|
||||||
{
|
{
|
||||||
auto widget = static_cast<FWidget*>(*iter);
|
auto widget = static_cast<FWidget*>(*iter);
|
||||||
|
|
||||||
if ( widget->isVisible()
|
if ( widget->isShown()
|
||||||
&& widget->acceptFocus()
|
&& widget->acceptFocus()
|
||||||
&& ! widget->isWindowWidget() )
|
&& ! widget->isWindowWidget() )
|
||||||
num++;
|
num++;
|
||||||
|
@ -981,7 +987,7 @@ void FWidget::redraw()
|
||||||
setColor (wc.term_fg, wc.term_bg);
|
setColor (wc.term_fg, wc.term_bg);
|
||||||
clearArea (vdesktop);
|
clearArea (vdesktop);
|
||||||
}
|
}
|
||||||
else if ( ! isVisible() )
|
else if ( ! isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
@ -1050,6 +1056,7 @@ void FWidget::show()
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
flags.hidden = false;
|
||||||
flags.shown = true;
|
flags.shown = true;
|
||||||
|
|
||||||
if ( hasChildren() )
|
if ( hasChildren() )
|
||||||
|
@ -1062,7 +1069,9 @@ void FWidget::show()
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
auto widget = static_cast<FWidget*>(*iter);
|
auto widget = static_cast<FWidget*>(*iter);
|
||||||
widget->show();
|
|
||||||
|
if ( ! widget->flags.hidden )
|
||||||
|
widget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -1084,9 +1093,10 @@ void FWidget::show()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::hide()
|
void FWidget::hide()
|
||||||
{
|
{
|
||||||
|
flags.hidden = true;
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
{
|
{
|
||||||
flags.visible = false;
|
|
||||||
flags.shown = false;
|
flags.shown = false;
|
||||||
|
|
||||||
if ( ! isDialogWidget()
|
if ( ! isDialogWidget()
|
||||||
|
@ -1652,7 +1662,7 @@ bool FWidget::focusNextChild()
|
||||||
} while ( ! next
|
} while ( ! next
|
||||||
|| ! next->isEnabled()
|
|| ! next->isEnabled()
|
||||||
|| ! next->acceptFocus()
|
|| ! next->acceptFocus()
|
||||||
|| ! next->isVisible()
|
|| ! next->isShown()
|
||||||
|| next->isWindowWidget() );
|
|| next->isWindowWidget() );
|
||||||
|
|
||||||
bool accpt = changeFocus (next, parent, fc::FocusNextWidget);
|
bool accpt = changeFocus (next, parent, fc::FocusNextWidget);
|
||||||
|
@ -1713,7 +1723,7 @@ bool FWidget::focusPrevChild()
|
||||||
} while ( ! prev
|
} while ( ! prev
|
||||||
|| ! prev->isEnabled()
|
|| ! prev->isEnabled()
|
||||||
|| ! prev->acceptFocus()
|
|| ! prev->acceptFocus()
|
||||||
|| ! prev->isVisible()
|
|| ! prev->isShown()
|
||||||
|| prev->isWindowWidget() );
|
|| prev->isWindowWidget() );
|
||||||
|
|
||||||
bool accpt = changeFocus (prev, parent, fc::FocusPreviousWidget);
|
bool accpt = changeFocus (prev, parent, fc::FocusPreviousWidget);
|
||||||
|
@ -2137,7 +2147,7 @@ void FWidget::drawWindows()
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isVisible() )
|
if ( (*iter)->isShown() )
|
||||||
{
|
{
|
||||||
auto win = (*iter)->getVWin();
|
auto win = (*iter)->getVWin();
|
||||||
int w = win->width + win->right_shadow;
|
int w = win->width + win->right_shadow;
|
||||||
|
@ -2167,7 +2177,7 @@ void FWidget::drawChildren()
|
||||||
{
|
{
|
||||||
auto widget = static_cast<FWidget*>(*iter);
|
auto widget = static_cast<FWidget*>(*iter);
|
||||||
|
|
||||||
if ( widget->isVisible() && ! widget->isWindowWidget() )
|
if ( widget->isShown() && ! widget->isWindowWidget() )
|
||||||
widget->redraw();
|
widget->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,10 @@ class FListBox : public FWidget
|
||||||
// Accessors
|
// Accessors
|
||||||
static FString& getString (listBoxItems::iterator);
|
static FString& getString (listBoxItems::iterator);
|
||||||
|
|
||||||
|
// Inquiry
|
||||||
|
bool isHorizontallyScrollable();
|
||||||
|
bool isVerticallyScrollable();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
|
@ -523,6 +527,14 @@ void FListBox::insert ( const ItemT& item
|
||||||
insert (listItem);
|
insert (listItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FListBox::isHorizontallyScrollable()
|
||||||
|
{ return bool( max_line_width >= getClientWidth() - 1 ); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FListBox::isVerticallyScrollable()
|
||||||
|
{ return bool( getCount() > getClientHeight() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBox::listBoxItems::iterator \
|
inline FListBox::listBoxItems::iterator \
|
||||||
FListBox::index2iterator (std::size_t index)
|
FListBox::index2iterator (std::size_t index)
|
||||||
|
|
|
@ -378,6 +378,10 @@ class FListView : public FWidget
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr int USE_MAX_SIZE = -1;
|
static constexpr int USE_MAX_SIZE = -1;
|
||||||
|
|
||||||
|
// Inquiry
|
||||||
|
bool isHorizontallyScrollable();
|
||||||
|
bool isVerticallyScrollable();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
template <typename Compare>
|
template <typename Compare>
|
||||||
|
@ -616,6 +620,14 @@ inline FObject::FObjectIterator FListView::beginOfList()
|
||||||
inline FObject::FObjectIterator FListView::endOfList()
|
inline FObject::FObjectIterator FListView::endOfList()
|
||||||
{ return itemlist.end(); }
|
{ return itemlist.end(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FListView::isHorizontallyScrollable()
|
||||||
|
{ return bool( max_line_width > getClientWidth() ); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FListView::isVerticallyScrollable()
|
||||||
|
{ return bool( getCount() > getClientHeight() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListView::scrollTo (const FPoint& pos)
|
inline void FListView::scrollTo (const FPoint& pos)
|
||||||
{ scrollTo(pos.getX(), pos.getY()); }
|
{ scrollTo(pos.getX(), pos.getY()); }
|
||||||
|
|
|
@ -150,8 +150,6 @@ class FTextView : public FWidget
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
void drawText();
|
void drawText();
|
||||||
void processChanged();
|
void processChanged();
|
||||||
void drawHBar();
|
|
||||||
void drawVBar();
|
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_VBarChange (FWidget*, FDataPtr);
|
void cb_VBarChange (FWidget*, FDataPtr);
|
||||||
|
|
|
@ -321,6 +321,7 @@ class FVTerm
|
||||||
FTerm::initializationValues& getInitValues();
|
FTerm::initializationValues& getInitValues();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
void setPrintArea (term_area*);
|
||||||
static void setInsertCursor (bool);
|
static void setInsertCursor (bool);
|
||||||
static void setInsertCursor();
|
static void setInsertCursor();
|
||||||
static void unsetInsertCursor();
|
static void unsetInsertCursor();
|
||||||
|
@ -451,9 +452,6 @@ class FVTerm
|
||||||
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
||||||
// Buffer size for character output on the terminal
|
// Buffer size for character output on the terminal
|
||||||
|
|
||||||
// Mutators
|
|
||||||
void setPrintArea (term_area*);
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init (bool);
|
void init (bool);
|
||||||
static void init_characterLengths (FOptiMove*);
|
static void init_characterLengths (FOptiMove*);
|
||||||
|
@ -1063,6 +1061,10 @@ inline char* FVTerm::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
inline void FVTerm::printMoveDurations()
|
inline void FVTerm::printMoveDurations()
|
||||||
{ return FTerm::printMoveDurations(); }
|
{ return FTerm::printMoveDurations(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FVTerm::setPrintArea (term_area* area)
|
||||||
|
{ print_area = area; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FVTerm::getLineNumber()
|
inline std::size_t FVTerm::getLineNumber()
|
||||||
{ return FTerm::getLineNumber(); }
|
{ return FTerm::getLineNumber(); }
|
||||||
|
@ -1143,10 +1145,6 @@ inline void FVTerm::changeTermSizeFinished()
|
||||||
inline void FVTerm::exitWithMessage (const FString& message)
|
inline void FVTerm::exitWithMessage (const FString& message)
|
||||||
{ FTerm::exitWithMessage(message); }
|
{ FTerm::exitWithMessage(message); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FVTerm::setPrintArea (term_area* area)
|
|
||||||
{ print_area = area; }
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FVTERM_H
|
#endif // FVTERM_H
|
||||||
|
|
|
@ -149,6 +149,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
uInt32 active : 1;
|
uInt32 active : 1;
|
||||||
uInt32 visible : 1;
|
uInt32 visible : 1;
|
||||||
uInt32 shown : 1;
|
uInt32 shown : 1;
|
||||||
|
uInt32 hidden : 1;
|
||||||
uInt32 focus : 1;
|
uInt32 focus : 1;
|
||||||
uInt32 focusable : 1;
|
uInt32 focusable : 1;
|
||||||
uInt32 scrollable : 1;
|
uInt32 scrollable : 1;
|
||||||
|
@ -161,7 +162,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
uInt32 always_on_top : 1;
|
uInt32 always_on_top : 1;
|
||||||
uInt32 flat : 1;
|
uInt32 flat : 1;
|
||||||
uInt32 no_underline : 1;
|
uInt32 no_underline : 1;
|
||||||
uInt32 : 15; // padding bits
|
uInt32 : 14; // padding bits
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -229,7 +230,9 @@ class FWidget : public FVTerm, public FObject
|
||||||
static void setActiveWindow (FWidget*);
|
static void setActiveWindow (FWidget*);
|
||||||
static void setOpenMenu (FWidget*);
|
static void setOpenMenu (FWidget*);
|
||||||
virtual void setStatusbarMessage (const FString&);
|
virtual void setStatusbarMessage (const FString&);
|
||||||
|
bool setVisible (bool);
|
||||||
bool setVisible();
|
bool setVisible();
|
||||||
|
bool unsetVisible();
|
||||||
virtual bool setEnable (bool);
|
virtual bool setEnable (bool);
|
||||||
virtual bool setEnable();
|
virtual bool setEnable();
|
||||||
virtual bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
|
@ -721,7 +724,11 @@ inline void FWidget::setStatusbarMessage (const FString& msg)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::setVisible()
|
inline bool FWidget::setVisible()
|
||||||
{ return (flags.visible = true); }
|
{ return setVisible(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWidget::unsetVisible()
|
||||||
|
{ return setVisible(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::setEnable()
|
inline bool FWidget::setEnable()
|
||||||
|
|
Loading…
Reference in New Issue