CComponents: implement scroll functionality into CComponentsForm

CComponentsForm provides page scroll if found more
than one pre defined page and is working with all derivated sub classes from CComponentsForm .

Pages are defined with setPageNumber(0...n) in items (1st page = 0). The item page number property is
defined in variable cc_page_number. The highest page number sets the
count of pages inside container to required value. Thats compellingly!

To show a page, we can use setCurrentPage(0...n ) and paintCurPage() or use directly paintPage(0...n).
Note: global paint() will show the current page. Default page is 0 (as first).
Use setCurrentPage(0...n) to change this before first call of paint().
Note: In CComponentsWindow class, these methods are applied to window body.

For examples, take a look into CTestMenu
This commit is contained in:
2014-06-26 09:59:19 +02:00
parent e6f6931b72
commit 672757606c
13 changed files with 485 additions and 24 deletions

View File

@@ -360,6 +360,34 @@ void CComponentsWindow::addWindowItem(CComponentsItem* cc_Item)
ccw_body->addCCItem(cc_Item);
}
void CComponentsWindow::setCurrentPage(const u_int8_t& current_page)
{
ccw_body->setCurrentPage(current_page);
}
u_int8_t CComponentsWindow::getCurrentPage()
{
return ccw_body->getCurrentPage();
}
void CComponentsWindow::setScrollBarWidth(const int& scrollbar_width)
{
ccw_body->setScrollBarWidth(scrollbar_width);
}
void CComponentsWindow::paintCurPage(bool do_save_bg)
{
if (is_painted) //ensure that we have painted already the parent form before paint body
ccw_body->paint(do_save_bg);
else
paint(do_save_bg);
}
void CComponentsWindow::paintPage(const u_int8_t& page_number, bool do_save_bg)
{
CComponentsWindow::setCurrentPage(page_number);
CComponentsWindow::paintCurPage(do_save_bg);
}
void CComponentsWindow::paint(bool do_save_bg)
{