mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
CHintbox/CMsgBox: add vizualized timeout bar
Origin commit data
------------------
Commit: cb3699deb5
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-10-11 (Tue, 11 Oct 2016)
This commit is contained in:
@@ -125,6 +125,7 @@ CHintBox::CHintBox( const char * const Caption,
|
||||
init(g_Locale->getText(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent);
|
||||
}
|
||||
|
||||
|
||||
void CHintBox::init(const std::string& Text, const int& Width, const std::string& Picon, const int& header_buttons, const int& text_mode, const int& indent)
|
||||
{
|
||||
lines = 0;
|
||||
@@ -154,10 +155,40 @@ void CHintBox::init(const std::string& Text, const int& Width, const std::string
|
||||
y_hint_obj = 0;
|
||||
h_hint_obj = obj_content->getHeight();
|
||||
|
||||
//initialize timeout bar and its timer
|
||||
timeout_pb = NULL;
|
||||
timeout_pb_timer= NULL;
|
||||
|
||||
if (!Text.empty())
|
||||
addHintItem(Text, text_mode, Picon);
|
||||
}
|
||||
|
||||
CHintBox::~CHintBox()
|
||||
{
|
||||
if(timeout_pb){
|
||||
delete timeout_pb; timeout_pb = NULL;
|
||||
}
|
||||
if(timeout_pb_timer){
|
||||
delete timeout_pb_timer; timeout_pb_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CHintBox::showTimeOutBar()
|
||||
{
|
||||
if(timeout_pb){
|
||||
timeout_pb->paint0();
|
||||
timeout_pb->setValues(timeout_pb->getValue()+1, timeout);
|
||||
}else{
|
||||
timeout_pb = new CProgressBar();
|
||||
timeout_pb->setDimensionsAll(ccw_body->getRealXPos(), ccw_body->getRealYPos(), ccw_body->getWidth(), 8);
|
||||
timeout_pb->setValues(0, timeout);
|
||||
if (!timeout_pb_timer)
|
||||
timeout_pb_timer = new CComponentsTimer(1);
|
||||
timeout_pb_timer->OnTimer.connect(sigc::mem_fun0(this, &CHintBox::showTimeOutBar));
|
||||
timeout_pb_timer->startTimer();
|
||||
}
|
||||
}
|
||||
|
||||
int CHintBox::exec()
|
||||
{
|
||||
neutrino_msg_t msg;
|
||||
@@ -165,6 +196,9 @@ int CHintBox::exec()
|
||||
int res = messages_return::none;
|
||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout );
|
||||
|
||||
if (timeout > 0)
|
||||
showTimeOutBar();
|
||||
|
||||
while ( ! ( res & ( messages_return::cancel_info | messages_return::cancel_all ) ) )
|
||||
{
|
||||
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
|
||||
@@ -394,7 +428,6 @@ void CHintBox::scroll_down(const uint& hint_id)
|
||||
Scroll(true, hint_id);
|
||||
}
|
||||
|
||||
|
||||
int ShowHint(const char * const Caption, const char * const Text, const int Width, int timeout, const char * const Icon, const char * const Picon, const int& header_buttons)
|
||||
{
|
||||
int res = messages_return::none;
|
||||
|
Reference in New Issue
Block a user