finalcut/src/flistbox.cpp

1830 lines
38 KiB
C++
Raw Normal View History

// File: flistbox.cpp
// Provides: class FListBoxItem
// class FListBox
2015-05-23 13:35:12 +02:00
#include "fapp.h"
#include "flistbox.h"
#include "fscrollbar.h"
#include "fstatusbar.h"
//----------------------------------------------------------------------
// class FListBoxItem
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem()
2015-09-22 04:18:20 +02:00
: text()
, data_pointer(0)
2015-09-22 04:18:20 +02:00
, brackets(fc::NoBrackets)
, selected(false)
{ }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const FListBoxItem& item)
: text(item.text)
, data_pointer(item.data_pointer)
, brackets(item.brackets)
, selected(item.selected)
{ }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
2017-03-17 22:59:06 +01:00
FListBoxItem::FListBoxItem (const FString& txt, FWidget::data_ptr data)
2015-09-22 04:18:20 +02:00
: text(txt)
, data_pointer(data)
2015-09-22 04:18:20 +02:00
, brackets(fc::NoBrackets)
, selected(false)
{ }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
FListBoxItem::~FListBoxItem()
2015-09-22 04:18:20 +02:00
{ }
2015-05-23 13:35:12 +02:00
// public methods of FListBoxItem
//----------------------------------------------------------------------
FListBoxItem& FListBoxItem::operator = (const FListBoxItem& item)
{
if ( &item == this )
{
return *this;
}
else
{
text = item.text;
data_pointer = item.data_pointer;
brackets = item.brackets;
selected = item.selected;
return *this;
}
}
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
// class FListBox
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
FListBox::FListBox (FWidget* parent)
2015-09-22 04:18:20 +02:00
: FWidget(parent)
, data()
, vbar(0)
, hbar(0)
2015-09-22 04:18:20 +02:00
, text()
, inc_search()
, multi_select(false)
, mouse_select(false)
, drag_scroll(FListBox::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, scroll_distance(1)
2015-09-22 04:18:20 +02:00
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, max_line_width(0)
2015-05-23 13:35:12 +02:00
{
2015-09-22 04:18:20 +02:00
init();
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
FListBox::~FListBox() // destructor
{
2015-12-19 20:49:01 +01:00
delOwnTimer();
delete vbar;
delete hbar;
2015-05-23 13:35:12 +02:00
}
// public methods of FListBox
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
void FListBox::setCurrentItem (int index)
2015-05-23 13:35:12 +02:00
{
int element_count;
2015-05-23 13:35:12 +02:00
if ( index == current )
return;
2015-05-23 13:35:12 +02:00
element_count = int(getCount());
2015-05-23 13:35:12 +02:00
if ( index > element_count )
current = element_count;
else if ( index < 1 )
current = 1;
else
current = index;
2015-05-23 13:35:12 +02:00
xoffset = 0;
yoffset = 0;
adjustSize();
vbar->setValue(yoffset);
if ( isVisible() )
redraw();
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::showInsideBrackets ( int index
, fc::brackets_type b )
2015-05-23 13:35:12 +02:00
{
data[uInt(index-1)].brackets = b;
if ( b == fc::NoBrackets )
return;
int len = int(data[uInt(index-1)].getText().getLength() + 2);
if ( len > max_line_width )
2015-05-23 13:35:12 +02:00
{
max_line_width = len;
if ( len >= getWidth() - nf_offset - 3 )
2015-05-23 13:35:12 +02:00
{
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
hbar->setValue (xoffset);
if ( ! hbar->isVisible() )
hbar->setVisible();
2015-05-23 13:35:12 +02:00
}
}
}
//----------------------------------------------------------------------
void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
{
FWidget::setGeometry(x, y, w, h, adjust);
if ( isNewFont() )
{
vbar->setGeometry (getWidth(), 2, 2, getHeight()-2);
hbar->setGeometry (1, getHeight(), getWidth()-2, 1);
}
else
{
vbar->setGeometry (getWidth(), 2, 1, getHeight()-2);
hbar->setGeometry (2, getHeight(), getWidth()-2, 1);
}
}
//----------------------------------------------------------------------
bool FListBox::setEnable (bool on)
{
FWidget::setEnable(on);
2015-05-23 13:35:12 +02:00
if ( on )
flags |= fc::active;
else
flags &= ~fc::active;
return on;
}
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
bool FListBox::setFocus (bool on)
{
FWidget::setFocus(on);
2015-05-23 13:35:12 +02:00
if ( on )
2015-05-23 13:35:12 +02:00
{
flags |= fc::focus;
if ( getStatusBar() )
2015-05-23 13:35:12 +02:00
{
2017-03-26 20:40:04 +02:00
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
getStatusBar()->setMessage(msg);
2015-05-23 13:35:12 +02:00
}
}
else
{
flags &= ~fc::focus;
if ( getStatusBar() )
getStatusBar()->clearMessage();
}
return on;
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
2017-03-26 20:40:04 +02:00
void FListBox::setText (const FString& txt)
2015-05-23 13:35:12 +02:00
{
text = txt;
}
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
void FListBox::hide()
{
int n, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
2015-05-23 13:35:12 +02:00
FWidget::hide();
if ( parent_widget )
{
fg = parent_widget->getForegroundColor();
bg = parent_widget->getBackgroundColor();
}
2015-05-23 13:35:12 +02:00
else
{
fg = wc.dialog_fg;
bg = wc.dialog_bg;
2015-05-23 13:35:12 +02:00
}
setColor (fg, bg);
n = isNewFont() ? 1 : 0;
size = getWidth() + n;
2015-05-23 13:35:12 +02:00
if ( size < 0 )
2015-05-23 13:35:12 +02:00
return;
blank = new char[size+1];
std::memset (blank, ' ', uLong(size));
blank[size] = '\0';
2015-05-23 13:35:12 +02:00
for (int y=0; y < getHeight(); y++)
2015-05-23 13:35:12 +02:00
{
setPrintPos (1, 1 + y);
print (blank);
2015-05-23 13:35:12 +02:00
}
delete[] blank;
}
//----------------------------------------------------------------------
2017-03-26 20:40:04 +02:00
void FListBox::insert ( const FString& item
, fc::brackets_type b
, bool s
, data_ptr d )
{
int len, element_count;
len = int(item.getLength());
if ( b )
len += 2;
if ( len > max_line_width )
2015-05-23 13:35:12 +02:00
{
max_line_width = len;
2015-05-23 13:35:12 +02:00
if ( len >= getWidth() - nf_offset - 3 )
2015-05-23 13:35:12 +02:00
{
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
hbar->calculateSliderValues();
2015-05-23 13:35:12 +02:00
if ( ! hbar->isVisible() )
hbar->setVisible();
}
}
FListBoxItem listItem (item);
listItem.data_pointer = d;
listItem.brackets = b;
listItem.selected = s;
data.push_back (listItem);
element_count = int(getCount());
vbar->setMaximum(element_count - getHeight() + 2);
vbar->setPageSize(element_count, getHeight() - 2);
vbar->calculateSliderValues();
2015-05-23 13:35:12 +02:00
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
vbar->setVisible();
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::insert ( long item
, fc::brackets_type b
, bool s
, data_ptr d )
2015-05-23 13:35:12 +02:00
{
insert (FString().setNumber(item), b, s, d);
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::remove (int item)
2015-05-23 13:35:12 +02:00
{
int element_count;
if ( int(getCount()) < item )
return;
data.erase (data.begin() + item - 1);
element_count = int(getCount());
max_line_width = 0;
2015-05-23 13:35:12 +02:00
for (int i=0; i < element_count; i++)
{
int len = int(data[uInt(i)].getText().getLength());
2015-05-23 13:35:12 +02:00
if ( len > max_line_width )
max_line_width = len;
}
hbar->setMaximum(max_line_width - getWidth() + nf_offset + 4);
hbar->setPageSize(max_line_width, getWidth() - nf_offset - 4);
2015-05-23 13:35:12 +02:00
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
hbar->hide();
2015-05-23 13:35:12 +02:00
vbar->setMaximum(element_count - getHeight() + 2);
vbar->setPageSize(element_count, getHeight() - 2);
if ( vbar->isVisible() && element_count < getHeight() - 1 )
vbar->hide();
2015-05-23 13:35:12 +02:00
if ( current >= item && current > 1 )
current--;
if ( current > element_count )
2015-05-23 13:35:12 +02:00
current = element_count;
if ( yoffset > element_count - getHeight() + 2 )
yoffset = element_count - getHeight() + 2;
if ( yoffset < 0 )
yoffset = 0;
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::clear()
2015-05-23 13:35:12 +02:00
{
int size;
2015-05-23 13:35:12 +02:00
char* blank;
data.clear();
2015-05-23 13:35:12 +02:00
current = 0;
xoffset = 0;
yoffset = 0;
max_line_width = 0;
last_current = -1;
last_yoffset = -1;
vbar->setMinimum(0);
vbar->setValue(0);
vbar->hide();
2015-05-23 13:35:12 +02:00
hbar->setMinimum(0);
hbar->setValue(0);
hbar->hide();
2015-05-23 13:35:12 +02:00
// clear list from screen
setColor (wc.list_fg, wc.list_bg);
size = getWidth() - 2;
2015-05-23 13:35:12 +02:00
if ( size < 0 )
return;
blank = new char[size+1];
std::memset (blank, ' ', uLong(size));
blank[size] = '\0';
2015-05-23 13:35:12 +02:00
for (int y=0; y < getHeight()-2; y++)
{
setPrintPos (2, 2 + y);
print (blank);
2015-05-23 13:35:12 +02:00
}
delete[] blank;
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onKeyPress (FKeyEvent* ev)
2015-05-23 13:35:12 +02:00
{
int element_count = int(getCount());
int padding_space = 2; // 1 leading space + 1 tailing space
2015-05-23 13:35:12 +02:00
int current_before = current;
int xoffset_before = xoffset;
int xoffset_end = max_line_width - getClientWidth() + padding_space;
2015-05-23 13:35:12 +02:00
int yoffset_before = yoffset;
int yoffset_end = element_count - getClientHeight();
2015-09-20 05:44:50 +02:00
int key = ev->key();
2015-05-23 13:35:12 +02:00
switch ( key )
{
case fc::Fkey_return:
case fc::Fkey_enter:
processClick();
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_up:
current--;
2015-05-23 13:35:12 +02:00
if ( current < 1 )
current=1;
2015-05-23 13:35:12 +02:00
if ( current <= yoffset )
yoffset--;
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_down:
current++;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
if ( current - yoffset > getClientHeight() )
2015-05-23 13:35:12 +02:00
yoffset++;
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_left:
xoffset--;
2015-05-23 13:35:12 +02:00
if ( xoffset < 0 )
xoffset = 0;
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_right:
xoffset++;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
2015-05-23 13:35:12 +02:00
if ( xoffset < 0 )
xoffset = 0;
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_ppage:
current -= getClientHeight() - 1;
2015-05-23 13:35:12 +02:00
if ( current < 1 )
current=1;
2015-05-23 13:35:12 +02:00
if ( current <= yoffset )
{
yoffset -= getClientHeight() - 1;
2015-05-23 13:35:12 +02:00
if ( yoffset < 0 )
yoffset=0;
}
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_npage:
current += getClientHeight() - 1;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
if ( current - yoffset > getClientHeight() )
2015-05-23 13:35:12 +02:00
{
yoffset += getClientHeight() - 1;
if ( yoffset > yoffset_end )
yoffset = yoffset_end;
2015-05-23 13:35:12 +02:00
}
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_home:
current = 1;
yoffset = 0;
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_end:
current = element_count;
if ( current > getClientHeight() )
yoffset = yoffset_end;
2015-05-23 13:35:12 +02:00
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
break;
case fc::Fkey_ic: // insert key
if ( isMultiSelection() )
{
if ( isSelected(current) )
unselectItem(current);
else
selectItem(current);
2015-05-23 13:35:12 +02:00
processSelect();
current++;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
if ( current-yoffset >= getHeight() - 1 )
2015-05-23 13:35:12 +02:00
yoffset++;
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
2015-05-23 13:35:12 +02:00
inc_search.clear();
break;
case fc::Fkey_space:
{
uInt inc_len = inc_search.getLength();
2015-05-23 13:35:12 +02:00
if ( inc_len > 0 )
{
inc_search += L' ';
bool inc_found = false;
uInt end = getCount();
2015-05-23 13:35:12 +02:00
for (uInt i=0; i < end; i++)
{
if ( ! inc_found
&& inc_search.toLower()
== data[i].getText().left(inc_len+1).toLower() )
2015-05-23 13:35:12 +02:00
{
setCurrentItem(int(i+1));
inc_found = true;
break;
}
}
2015-05-23 13:35:12 +02:00
if ( ! inc_found )
{
inc_search.remove(inc_len, 1);
2015-09-20 05:44:50 +02:00
ev->ignore();
2015-05-23 13:35:12 +02:00
}
else
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
else if ( isMultiSelection() )
{
if ( isSelected(current) )
unselectItem(current);
else
selectItem(current);
2015-05-23 13:35:12 +02:00
processSelect();
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
}
break;
case fc::Fkey_erase:
case fc::Fkey_backspace:
{
uInt inc_len = inc_search.getLength();
2015-05-23 13:35:12 +02:00
if ( inc_len > 0 )
{
inc_search.remove(inc_len-1, 1);
if ( inc_len > 1 )
{
uInt end = getCount();
2015-05-23 13:35:12 +02:00
for (uInt i=0; i < end; i++)
{
if ( inc_search.toLower()
== data[i].getText().left(inc_len-1).toLower() )
{
setCurrentItem(int(i+1));
break;
}
}
}
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
else
2015-09-20 05:44:50 +02:00
ev->ignore();
2015-05-23 13:35:12 +02:00
}
break;
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
if ( inc_search.getLength() > 0 )
{
inc_search.clear();
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
break;
default:
if ( key > 0x20 && key <= 0x10fff )
{
// incremental search
if ( inc_search.getLength() == 0 )
inc_search = wchar_t(key);
else
inc_search += wchar_t(key);
2015-05-23 13:35:12 +02:00
uInt inc_len = inc_search.getLength();
bool inc_found = false;
uInt end = getCount();
2015-05-23 13:35:12 +02:00
for (uInt i=0; i < end; i++)
{
if ( ! inc_found
&& inc_search.toLower()
== data[i].getText().left(inc_len).toLower() )
2015-05-23 13:35:12 +02:00
{
setCurrentItem(int(i+1));
inc_found = true;
break;
}
}
2015-05-23 13:35:12 +02:00
if ( ! inc_found )
{
inc_search.remove(inc_len-1, 1);
2015-05-23 13:35:12 +02:00
if ( inc_len == 1 )
2015-09-20 05:44:50 +02:00
ev->ignore();
2015-05-23 13:35:12 +02:00
else
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
else
2015-09-20 05:44:50 +02:00
ev->accept();
2015-05-23 13:35:12 +02:00
}
else
2015-09-20 05:44:50 +02:00
ev->ignore();
2015-05-23 13:35:12 +02:00
}
if ( current_before != current )
{
processChanged();
2015-05-23 13:35:12 +02:00
if ( ! isMultiSelection() )
processSelect();
}
2015-09-20 05:44:50 +02:00
if ( ev->isAccepted() )
2015-05-23 13:35:12 +02:00
{
if ( isVisible() )
drawList();
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
hbar->setValue (xoffset);
if ( hbar->isVisible() && xoffset_before != xoffset )
hbar->drawBar();
2015-05-23 13:35:12 +02:00
updateTerminal();
flush_out();
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onMouseDown (FMouseEvent* ev)
2015-05-23 13:35:12 +02:00
{
int yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton )
2015-05-23 13:35:12 +02:00
{
return;
}
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
2015-05-23 13:35:12 +02:00
return;
if ( ! hasFocus() )
{
FWidget* focused_widget = getFocusWidget();
2016-01-17 02:57:08 +01:00
FFocusEvent out (fc::FocusOut_Event);
2015-05-23 13:35:12 +02:00
FApplication::queueEvent(focused_widget, &out);
2015-09-22 04:18:20 +02:00
setFocus();
2015-05-23 13:35:12 +02:00
if ( focused_widget )
focused_widget->redraw();
if ( getStatusBar() )
getStatusBar()->drawMessage();
2015-05-23 13:35:12 +02:00
}
yoffset_before = yoffset;
2015-09-20 05:44:50 +02:00
mouse_x = ev->getX();
mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() )
2015-05-23 13:35:12 +02:00
{
current = yoffset + mouse_y - 1;
if ( current > int(getCount()) )
current = int(getCount());
2015-05-23 13:35:12 +02:00
inc_search.clear();
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::RightButton )
2015-05-23 13:35:12 +02:00
{
if ( isMultiSelection() )
{
if ( isSelected(current) )
{
mouse_select = false;
2015-05-23 13:35:12 +02:00
unselectItem(current);
}
else
{
mouse_select = true;
2015-05-23 13:35:12 +02:00
selectItem(current);
}
2015-05-23 13:35:12 +02:00
processSelect();
secect_from_item = current;
}
}
2015-05-23 13:35:12 +02:00
if ( isVisible() )
drawList();
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
2015-05-23 13:35:12 +02:00
updateTerminal();
flush_out();
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onMouseUp (FMouseEvent* ev)
2015-05-23 13:35:12 +02:00
{
if ( drag_scroll != FListBox::noScroll )
2015-05-23 13:35:12 +02:00
{
2015-12-19 20:49:01 +01:00
delOwnTimer();
drag_scroll = FListBox::noScroll;
scroll_distance = 1;
scroll_timer = false;
2015-05-23 13:35:12 +02:00
}
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::LeftButton )
2015-05-23 13:35:12 +02:00
{
2015-09-20 05:44:50 +02:00
int mouse_x = ev->getX();
int mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() )
2015-05-23 13:35:12 +02:00
{
processChanged();
2015-05-23 13:35:12 +02:00
if ( ! isMultiSelection() )
processSelect();
}
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onMouseMove (FMouseEvent* ev)
2015-05-23 13:35:12 +02:00
{
int current_before, yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton )
2015-05-23 13:35:12 +02:00
{
return;
}
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
2015-05-23 13:35:12 +02:00
return;
current_before = current;
yoffset_before = yoffset;
2015-09-20 05:44:50 +02:00
mouse_x = ev->getX();
mouse_y = ev->getY();
2015-05-23 13:35:12 +02:00
if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() )
2015-05-23 13:35:12 +02:00
{
current = yoffset + mouse_y - 1;
if ( current > int(getCount()) )
current = int(getCount());
2015-05-23 13:35:12 +02:00
inc_search.clear();
// handle multiple selections
if ( ev->getButton() == fc::RightButton
&& isMultiSelection()
&& current_before != current )
2015-05-23 13:35:12 +02:00
{
int from, to;
if ( secect_from_item > current )
{
from = current;
to = secect_from_item - 1;
}
else
{
from = secect_from_item + 1;
to = current;
}
for (int i=from; i <= to; i++)
{
if ( mouse_select )
2015-05-23 13:35:12 +02:00
{
selectItem(i);
processSelect();
}
else
{
unselectItem(i);
processSelect();
}
}
2015-05-23 13:35:12 +02:00
secect_from_item = current;
}
if ( isVisible() )
drawList();
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
2015-05-23 13:35:12 +02:00
updateTerminal();
flush_out();
}
// auto-scrolling when dragging mouse outside the widget
if ( mouse_y < 2 )
{
// drag up
if ( drag_scroll != FListBox::noScroll
&& scroll_distance < getClientHeight() )
scroll_distance++;
if ( ! scroll_timer && current > 1 )
2015-05-23 13:35:12 +02:00
{
scroll_timer = true;
addTimer(scroll_repeat);
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::RightButton )
drag_scroll = FListBox::scrollUpSelect;
2015-05-23 13:35:12 +02:00
else
drag_scroll = FListBox::scrollUp;
2015-05-23 13:35:12 +02:00
}
2015-05-23 13:35:12 +02:00
if ( current == 1 )
{
2015-12-19 20:49:01 +01:00
delOwnTimer();
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
}
}
else if ( mouse_y >= getHeight() )
2015-05-23 13:35:12 +02:00
{
// drag down
if ( drag_scroll != FListBox::noScroll
&& scroll_distance < getClientHeight() )
scroll_distance++;
if ( ! scroll_timer && current < int(getCount()) )
2015-05-23 13:35:12 +02:00
{
scroll_timer = true;
addTimer(scroll_repeat);
2016-01-17 02:57:08 +01:00
if ( ev->getButton() == fc::RightButton )
drag_scroll = FListBox::scrollDownSelect;
2015-05-23 13:35:12 +02:00
else
drag_scroll = FListBox::scrollDown;
2015-05-23 13:35:12 +02:00
}
if ( current == int(getCount()) )
2015-05-23 13:35:12 +02:00
{
2015-12-19 20:49:01 +01:00
delOwnTimer();
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
}
}
else
{
// no dragging
2015-12-19 20:49:01 +01:00
delOwnTimer();
scroll_timer = false;
scroll_distance = 1;
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onMouseDoubleClick (FMouseEvent* ev)
2015-05-23 13:35:12 +02:00
{
int mouse_x, mouse_y;
2016-01-17 02:57:08 +01:00
if ( ev->getButton() != fc::LeftButton )
2015-05-23 13:35:12 +02:00
return;
2015-09-20 05:44:50 +02:00
mouse_x = ev->getX();
mouse_y = ev->getY();
2015-05-23 13:35:12 +02:00
if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() )
2015-05-23 13:35:12 +02:00
{
if ( yoffset + mouse_y - 1 > int(getCount()) )
2015-05-23 13:35:12 +02:00
return;
2015-05-23 13:35:12 +02:00
processClick();
}
}
//----------------------------------------------------------------------
void FListBox::onTimer (FTimerEvent*)
{
int element_count = int(getCount());
2015-05-23 13:35:12 +02:00
int current_before = current;
int yoffset_before = yoffset;
int yoffset_end = element_count - getClientHeight();
2015-05-23 13:35:12 +02:00
switch ( int(drag_scroll) )
2015-05-23 13:35:12 +02:00
{
case FListBox::noScroll:
return;
case FListBox::scrollUp:
case FListBox::scrollUpSelect:
if ( current_before == 1)
{
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
return;
}
current -= scroll_distance;
2015-05-23 13:35:12 +02:00
if ( current < 1 )
current=1;
2015-05-23 13:35:12 +02:00
if ( current <= yoffset )
yoffset -= scroll_distance;
2015-05-23 13:35:12 +02:00
if ( yoffset < 0 )
yoffset=0;
break;
case FListBox::scrollDown:
case FListBox::scrollDownSelect:
if ( current_before == element_count )
{
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
return;
}
current += scroll_distance;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
if ( current - yoffset > getClientHeight() )
yoffset += scroll_distance;
if ( yoffset > yoffset_end )
yoffset = yoffset_end;
2015-09-20 05:44:50 +02:00
break;
2015-09-20 05:44:50 +02:00
default:
break;
2015-05-23 13:35:12 +02:00
}
// handle multiple selections
if ( drag_scroll == FListBox::scrollUpSelect
|| drag_scroll == FListBox::scrollDownSelect )
2015-05-23 13:35:12 +02:00
{
if ( isMultiSelection() && current_before != current )
{
int from, to;
if ( secect_from_item > current )
{
from = current;
to = secect_from_item - 1;
}
else
{
from = secect_from_item + 1;
to = current;
}
2015-05-23 13:35:12 +02:00
for (int i=from; i <= to; i++)
{
if ( mouse_select )
2015-05-23 13:35:12 +02:00
{
selectItem(i);
processSelect();
}
else
{
unselectItem(i);
processSelect();
}
}
2015-05-23 13:35:12 +02:00
secect_from_item = current;
}
}
if ( isVisible() )
drawList();
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
2015-05-23 13:35:12 +02:00
updateTerminal();
flush_out();
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FListBox::onWheel (FWheelEvent* ev)
2015-05-23 13:35:12 +02:00
{
int element_count, current_before, yoffset_before, yoffset_end, wheel;
element_count = int(getCount());
2015-05-23 13:35:12 +02:00
current_before = current;
yoffset_before = yoffset;
yoffset_end = element_count - getClientHeight();
2015-05-23 13:35:12 +02:00
if ( yoffset_end < 0 )
yoffset_end = 0;
2015-09-20 05:44:50 +02:00
wheel = ev->getWheel();
2015-05-23 13:35:12 +02:00
if ( drag_scroll != FListBox::noScroll )
2015-05-23 13:35:12 +02:00
{
2015-12-19 20:49:01 +01:00
delOwnTimer();
scroll_timer = false;
scroll_distance = 1;
drag_scroll = FListBox::noScroll;
2015-05-23 13:35:12 +02:00
}
switch ( wheel )
{
2016-01-17 02:57:08 +01:00
case fc::WheelUp:
2015-05-23 13:35:12 +02:00
if ( yoffset == 0 )
break;
2015-05-23 13:35:12 +02:00
yoffset -= 4;
2015-05-23 13:35:12 +02:00
if ( yoffset < 0 )
{
current -= 4+yoffset;
yoffset=0;
}
else
current -= 4;
2015-05-23 13:35:12 +02:00
if ( current < 1 )
current=1;
2015-05-23 13:35:12 +02:00
inc_search.clear();
break;
2016-01-17 02:57:08 +01:00
case fc::WheelDown:
2015-05-23 13:35:12 +02:00
if ( yoffset == yoffset_end )
break;
2015-05-23 13:35:12 +02:00
yoffset += 4;
2015-05-23 13:35:12 +02:00
if ( yoffset > yoffset_end )
{
2015-09-24 00:41:43 +02:00
current += 4 - (yoffset - yoffset_end);
2015-05-23 13:35:12 +02:00
yoffset = yoffset_end;
}
else
current += 4;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
2015-05-23 13:35:12 +02:00
inc_search.clear();
break;
2015-09-20 05:44:50 +02:00
default:
break;
2015-05-23 13:35:12 +02:00
}
if ( current_before != current )
{
processChanged();
2015-05-23 13:35:12 +02:00
if ( ! isMultiSelection() )
processSelect();
}
if ( isVisible() )
drawList();
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
2015-05-23 13:35:12 +02:00
updateTerminal();
flush_out();
}
//----------------------------------------------------------------------
void FListBox::onFocusIn (FFocusEvent*)
{
if ( getStatusBar() )
getStatusBar()->drawMessage();
2015-05-23 13:35:12 +02:00
inc_search.clear();
}
//----------------------------------------------------------------------
void FListBox::onFocusOut (FFocusEvent*)
{
if ( getStatusBar() )
2015-05-23 13:35:12 +02:00
{
getStatusBar()->clearMessage();
getStatusBar()->drawMessage();
2015-05-23 13:35:12 +02:00
}
2015-12-19 20:49:01 +01:00
delOwnTimer();
2015-05-23 13:35:12 +02:00
inc_search.clear();
}
//----------------------------------------------------------------------
void FListBox::cb_VBarChange (FWidget*, data_ptr)
2015-05-23 13:35:12 +02:00
{
FScrollbar::sType scrollType;
2015-05-23 13:35:12 +02:00
int distance = 1;
int element_count = int(getCount());
2015-05-23 13:35:12 +02:00
int yoffset_before = yoffset;
int yoffset_end = element_count - getClientHeight();
scrollType = vbar->getScrollType();
2015-05-23 13:35:12 +02:00
switch ( scrollType )
{
case FScrollbar::noScroll:
break;
2015-05-23 13:35:12 +02:00
case FScrollbar::scrollPageBackward:
distance = getClientHeight();
2015-10-01 03:48:58 +02:00
// fall through
2015-05-23 13:35:12 +02:00
case FScrollbar::scrollStepBackward:
current -= distance;
2015-05-23 13:35:12 +02:00
if ( current < 1 )
current=1;
2015-05-23 13:35:12 +02:00
if ( current <= yoffset )
yoffset -= distance;
2015-05-23 13:35:12 +02:00
if ( yoffset < 0 )
yoffset = 0;
2015-05-23 13:35:12 +02:00
break;
case FScrollbar::scrollPageForward:
distance = getClientHeight();
2015-10-01 03:48:58 +02:00
// fall through
2015-05-23 13:35:12 +02:00
case FScrollbar::scrollStepForward:
current += distance;
2015-05-23 13:35:12 +02:00
if ( current > element_count )
current = element_count;
if ( current - yoffset > getClientHeight() )
2015-05-23 13:35:12 +02:00
yoffset += distance;
if ( yoffset > yoffset_end )
yoffset = yoffset_end;
break;
case FScrollbar::scrollJump:
{
int val = vbar->getValue();
if ( yoffset == val )
break;
int c = current - yoffset;
yoffset = val;
if ( yoffset > yoffset_end )
yoffset = yoffset_end;
if ( yoffset < 0 )
yoffset = 0;
current = yoffset + c;
if ( current < yoffset )
current = yoffset;
if ( current > element_count )
current = element_count;
break;
}
case FScrollbar::scrollWheelUp:
{
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelUp);
onWheel(&wheel_ev);
}
break;
case FScrollbar::scrollWheelDown:
{
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelDown);
onWheel(&wheel_ev);
}
break;
}
if ( isVisible() )
drawList();
if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward )
{
vbar->setValue (yoffset);
if ( vbar->isVisible() && yoffset_before != yoffset )
vbar->drawBar();
updateTerminal();
flush_out();
}
}
//----------------------------------------------------------------------
void FListBox::cb_HBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
int distance = 1;
int padding_space = 2; // 1 leading space + 1 tailing space
int xoffset_before = xoffset;
int xoffset_end = max_line_width - getClientWidth() + padding_space;
scrollType = hbar->getScrollType();
switch ( scrollType )
{
case FScrollbar::noScroll:
break;
case FScrollbar::scrollPageBackward:
distance = getClientWidth() - padding_space;
// fall through
case FScrollbar::scrollStepBackward:
xoffset -= distance;
if ( xoffset < 0 )
xoffset = 0;
break;
case FScrollbar::scrollPageForward:
distance = getClientWidth() - padding_space;
// fall through
case FScrollbar::scrollStepForward:
xoffset += distance;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
if ( xoffset < 0 )
xoffset = 0;
break;
case FScrollbar::scrollJump:
{
int val = hbar->getValue();
if ( xoffset == val )
break;
xoffset = val;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
if ( xoffset < 0 )
xoffset = 0;
break;
}
case FScrollbar::scrollWheelUp:
if ( xoffset == 0 )
break;
xoffset -= 4;
if ( xoffset < 0 )
xoffset=0;
break;
case FScrollbar::scrollWheelDown:
if ( xoffset == xoffset_end )
break;
xoffset += 4;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
break;
}
if ( isVisible() )
{
drawList();
updateTerminal();
flush_out();
}
if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown )
{
hbar->setValue (xoffset);
if ( hbar->isVisible() && xoffset_before != xoffset )
hbar->drawBar();
updateTerminal();
flush_out();
}
}
// protected methods of FListBox
//----------------------------------------------------------------------
void FListBox::adjustYOffset()
{
int element_count = int(getCount());
if ( yoffset > element_count - getClientHeight() )
yoffset = element_count - getClientHeight();
if ( yoffset < 0 )
yoffset = 0;
if ( current < yoffset )
current = yoffset;
if ( yoffset < current - getClientHeight() )
yoffset = current - getClientHeight();
}
//----------------------------------------------------------------------
void FListBox::adjustSize()
{
int element_count;
FWidget::adjustSize();
adjustYOffset();
element_count = int(getCount());
vbar->setMaximum(element_count - getClientHeight());
vbar->setPageSize(element_count, getClientHeight());
vbar->setX(getWidth());
vbar->setHeight (getClientHeight(), false);
vbar->resize();
hbar->setMaximum(max_line_width - getClientWidth() + 2);
hbar->setPageSize(max_line_width, getClientWidth() - 2);
hbar->setY(getHeight());
hbar->setWidth (getClientWidth(), false);
hbar->resize();
if ( element_count <= getClientHeight() )
vbar->hide();
else
vbar->setVisible();
if ( max_line_width < getClientWidth() - 1 )
hbar->hide();
else
hbar->setVisible();
}
// private methods of FListBox
//----------------------------------------------------------------------
void FListBox::init()
{
if ( hasFocus() )
flags = fc::focus;
if ( isEnabled() )
flags |= fc::active;
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
vbar = new FScrollbar(fc::vertical, this);
vbar->setMinimum(0);
vbar->setValue(0);
vbar->hide();
hbar = new FScrollbar(fc::horizontal, this);
hbar->setMinimum(0);
hbar->setValue(0);
hbar->hide();
2015-05-23 13:35:12 +02:00
setGeometry (1, 1, 5, 4, false); // initialize geometry values
vbar->addCallback
(
"change-value",
_METHOD_CALLBACK (this, &FListBox::cb_VBarChange)
);
hbar->addCallback
(
"change-value",
_METHOD_CALLBACK (this, &FListBox::cb_HBarChange)
);
nf_offset = isNewFont() ? 1 : 0;
setTopPadding(1);
setLeftPadding(1);
setBottomPadding(1);
setRightPadding(1 + nf_offset);
}
//----------------------------------------------------------------------
void FListBox::draw()
{
bool isFocus;
if ( current < 1 )
current = 1;
setColor();
if ( isMonochron() )
setReverse(true);
if ( isNewFont() )
drawBorder (1, 1, getWidth() - 1, getHeight());
else
drawBorder();
if ( isNewFont() && ! vbar->isVisible() )
{
setColor();
2015-05-23 13:35:12 +02:00
for (int y=2; y < getHeight(); y++)
2015-05-23 13:35:12 +02:00
{
setPrintPos (getWidth(),y);
print (' '); // clear right side of the scrollbar
2015-05-23 13:35:12 +02:00
}
}
2015-05-23 13:35:12 +02:00
drawLabel();
2015-09-20 05:44:50 +02:00
if ( isMonochron() )
setReverse(false);
2015-05-23 13:35:12 +02:00
if ( vbar->isVisible() )
vbar->redraw();
if ( hbar->isVisible() )
hbar->redraw();
drawList();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
{
getStatusBar()->setMessage(msg);
getStatusBar()->drawMessage();
}
2015-05-23 13:35:12 +02:00
}
}
//----------------------------------------------------------------------
void FListBox::drawLabel()
2015-05-23 13:35:12 +02:00
{
FString txt;
uInt length;
2015-05-23 13:35:12 +02:00
if ( text.isNull() || text.isEmpty() )
return;
txt = " " + text + " ";
length = txt.getLength();
setPrintPos (2, 1);
2015-05-23 13:35:12 +02:00
if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg);
else
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
if ( length <= uInt(getClientWidth()) )
print (txt);
else
{
print (text.left(uInt(getClientWidth()-2)));
setColor (wc.label_ellipsis_fg, wc.label_bg);
print("..");
}
}
//----------------------------------------------------------------------
void FListBox::drawList()
{
FString element;
uInt start, end, inc_len;
bool isFocus;
if ( data.empty() || getHeight() <= 2 || getWidth() <= 4 )
return;
2015-05-23 13:35:12 +02:00
isFocus = ((flags & fc::focus) != 0);
start = 0;
end = uInt(getHeight()-2);
inc_len = inc_search.getLength();
if ( end > getCount() )
end = getCount();
if ( last_yoffset >= 0
&& last_yoffset == yoffset
&& last_current != current )
{
// speed up: redraw only the changed rows
uInt last_pos = uInt(current - yoffset) - 1;
uInt current_pos = uInt(last_current - yoffset) - 1;
start = std::min(last_pos, current_pos);
end = std::max(last_pos, current_pos)+1;
}
for (uInt y=start; y < end; y++)
{
setPrintPos (2, 2 + int(y));
bool serach_mark = false;
bool lineHasBrackets = hasBrackets(int(y) + yoffset + 1);
bool isLineSelected = isSelected(int(y) + yoffset + 1);
bool isCurrentLine = bool(uInt(y) + uInt(yoffset) + 1 == uInt(current));
if ( isLineSelected )
{
if ( isMonochron() )
setBold();
else
setColor (wc.selected_list_fg, wc.selected_list_bg);
}
else
{
if ( isMonochron() )
unsetBold();
else
setColor (wc.list_fg, wc.list_bg);
2015-05-23 13:35:12 +02:00
}
if ( isCurrentLine )
{
if ( isFocus && getMaxColor() < 16 )
setBold();
if ( isLineSelected )
{
if ( isMonochron() )
setBold();
else if ( isFocus )
setColor ( wc.selected_current_element_focus_fg
, wc.selected_current_element_focus_bg );
else
setColor ( wc.selected_current_element_fg
, wc.selected_current_element_bg );
setCursorPos (3, 2 + int(y)); // first character
}
else
{
if ( isMonochron() )
unsetBold();
if ( isFocus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
int b = ( lineHasBrackets ) ? 1: 0;
2015-05-23 13:35:12 +02:00
if ( inc_len > 0 ) // incremental search
{
serach_mark = true;
setCursorPos (2 + b + int(inc_len), 2 + int(y)); // last found character
}
else // only highlighted
setCursorPos (3 + b, 2 + int(y)); // first character
}
else
setColor ( wc.current_element_fg
, wc.current_element_bg );
}
if ( isMonochron() )
setReverse(false);
}
else
{
if ( isMonochron() )
setReverse(true);
else if ( isFocus && getMaxColor() < 16 )
unsetBold();
}
// print the entry
if ( isMonochron() && isCurrentLine )
print ('>');
else
print (' ');
if ( lineHasBrackets )
{
int full_length;
uInt len;
uInt i = 0;
uInt b = 0;
if ( xoffset == 0 )
{
b=1;
2015-09-20 05:44:50 +02:00
switch ( data[y+uInt(yoffset)].brackets )
{
case fc::NoBrackets:
break;
2015-05-23 13:35:12 +02:00
case fc::SquareBrackets:
print ('[');
break;
2015-05-23 13:35:12 +02:00
case fc::Parenthesis:
print ('(');
break;
case fc::CurlyBrackets:
print ('{');
break;
case fc::AngleBrackets:
print ('<');
break;
}
2015-05-23 13:35:12 +02:00
element = data[y+uInt(yoffset)].getText()
.mid ( uInt(1+xoffset)
, uInt(getWidth()-nf_offset-5) );
}
else
element = data[y+uInt(yoffset)].getText()
.mid ( uInt(xoffset)
, uInt(getWidth()-nf_offset-4) );
2015-05-23 13:35:12 +02:00
2017-03-17 22:59:06 +01:00
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
for (; i < len; i++)
{
if ( serach_mark && i == 0 )
setColor ( wc.current_inc_search_element_fg
, wc.current_element_focus_bg );
2015-05-23 13:35:12 +02:00
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
full_length = int(data[y+uInt(yoffset)].getText().getLength());
2015-05-23 13:35:12 +02:00
if ( b+i < uInt(getWidth()-nf_offset-4) && xoffset <= full_length+1 )
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
switch ( data[y+uInt(yoffset)].brackets )
{
case fc::NoBrackets:
break;
2015-05-23 13:35:12 +02:00
case fc::SquareBrackets:
print (']');
break;
2015-05-23 13:35:12 +02:00
case fc::Parenthesis:
print (')');
break;
2015-05-23 13:35:12 +02:00
case fc::CurlyBrackets:
print ('}');
break;
2015-05-23 13:35:12 +02:00
case fc::AngleBrackets:
print ('>');
break;
}
2015-05-23 13:35:12 +02:00
i++;
}
if ( isMonochron() && isCurrentLine )
{
print ('<');
i++;
}
for (; b+i < uInt(getWidth()-nf_offset-3); i++)
print (' ');
}
else // line has no brackets
{
uInt i, len;
element = data[y+uInt(yoffset)].getText()
.mid ( uInt(1+xoffset)
, uInt(getWidth()-nf_offset-4) );
2017-03-17 22:59:06 +01:00
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
if ( serach_mark )
setColor ( wc.current_inc_search_element_fg
, wc.current_element_focus_bg );
2015-05-23 13:35:12 +02:00
for (i=0; i < len; i++)
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
2015-05-23 13:35:12 +02:00
if ( isMonochron() && isCurrentLine )
{
print ('<');
i++;
}
for (; i < uInt(getWidth()-nf_offset-3); i++)
print (' ');
}
}
if ( isMonochron() ) // unset for the last element
setReverse(false);
unsetBold();
last_yoffset = yoffset;
last_current = current;
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::processClick()
2015-05-23 13:35:12 +02:00
{
emitCallback("clicked");
}
//----------------------------------------------------------------------
void FListBox::processSelect()
{
emitCallback("row-selected");
2015-05-23 13:35:12 +02:00
}
//----------------------------------------------------------------------
void FListBox::processChanged()
2015-05-23 13:35:12 +02:00
{
emitCallback("row-changed");
2015-05-23 13:35:12 +02:00
}