FListBox: Import of data from a container via "lazy conversion" during item print

This commit is contained in:
Markus Gans 2017-05-19 22:47:13 +02:00
parent b3505af040
commit baea344b3c
3 changed files with 43 additions and 5 deletions

View File

@ -1,6 +1,6 @@
2017-05-19 Markus Gans <guru.mail@muenster.de>
* FListBox: Import of data from a container via
"lazy conversion" during item print.
"lazy conversion" during item print
2017-04-23 Markus Gans <guru.mail@muenster.de>
* Import of data from a standard container in FListBox

View File

@ -115,6 +115,8 @@ class FListBox : public FWidget
explicit FListBox (FWidget* = 0);
template <class Iterator, class InsertConverter>
FListBox (Iterator, Iterator, InsertConverter, FWidget* = 0);
template <class Container, class LazyConverter>
FListBox (Container, LazyConverter, FWidget* = 0);
// Destructor
~FListBox();
@ -303,6 +305,39 @@ inline FListBox::FListBox ( Iterator first
}
}
//----------------------------------------------------------------------
template <class Container, class LazyConverter>
inline FListBox::FListBox ( Container container
, LazyConverter convert
, FWidget* parent )
: FWidget(parent)
, convertToItem(0)
, data()
, source_container(0)
, conv_type(FListBox::no_convert)
, vbar(0)
, hbar(0)
, text()
, inc_search()
, multi_select(false)
, mouse_select(false)
, drag_scroll(FListBox::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, scroll_distance(1)
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, max_line_width(0)
{
init();
insert (container, convert);
}
//----------------------------------------------------------------------
inline const char* FListBox::getClassName() const
{ return "FListBox"; }

View File

@ -88,24 +88,27 @@ Listbox::Listbox (FWidget* parent)
list1->insert (L"----- " + FString().setNumber(i) + L" -----");
// listbox 2
double_list = new std::list<double>;
for (double i=1; i<=15; i++)
double_list->push_back(2*i + (i/100));
FListBox* list2 = new FListBox (this);
list2->setGeometry(21, 1, 10, 10);
list2->setText ("double");
double_list = new std::list<double>;
for (double i=1; i<=15; i++)
double_list->push_back(2*i + (i/100));
//
// Import via lazy conversion on print
//
//list2->insert (double_list, doubleToItem);
list2->insert (double_list, doubleToItem);
//
// Direct import of the complete list
//
list2->insert (double_list->begin(), double_list->end(), doubleToString);
//list2->insert (double_list->begin(), double_list->end(), doubleToString);
// listbox 3
std::map<FString, FString> TLD;