CHintBox: add possibility to left hintbox with RC_up and RC_down

RC_up and RC_down are used for text scroll, but most message texts
are small and no scroll mode is required. In case of large texts
it should falling back to scroll mode.
This commit is contained in:
2017-01-10 22:07:49 +01:00
committed by Jacek Jendrzej
parent 002cc4c74e
commit 1d8de839d5
2 changed files with 11 additions and 3 deletions

View File

@@ -134,6 +134,8 @@ void CHintBox::init(const std::string& Text, const int& Width, const std::string
hb_font = MSG_FONT; hb_font = MSG_FONT;
enable_txt_scroll = false;
//enable shadow //enable shadow
shadow = CC_SHADOW_ON; shadow = CC_SHADOW_ON;
@@ -219,10 +221,14 @@ int CHintBox::exec()
} }
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
{ {
if (msg == CRCInput::RC_up) if (enable_txt_scroll){
this->scroll_up(); if (msg == CRCInput::RC_up)
this->scroll_up();
else
this->scroll_down();
}
else else
this->scroll_down(); res = messages_return::cancel_all;
} }
else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ else if (CNeutrinoApp::getInstance()->listModeKey(msg)){
// do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!!
@@ -274,6 +280,7 @@ void CHintBox::addHintItem(const std::string& Text, const int& text_mode, const
if (h_lines > h_hint_obj){ if (h_lines > h_hint_obj){
txt_mode = text_mode | CTextBox::SCROLL; txt_mode = text_mode | CTextBox::SCROLL;
ccw_buttons = ccw_buttons | CComponentsHeader::CC_BTN_UP | CComponentsHeader::CC_BTN_DOWN; ccw_buttons = ccw_buttons | CComponentsHeader::CC_BTN_UP | CComponentsHeader::CC_BTN_DOWN;
enable_txt_scroll = true;
} }
/* define y start position of infobox inside body */ /* define y start position of infobox inside body */

View File

@@ -60,6 +60,7 @@ class CHintBox : public CComponentsWindow
int y_hint_obj; int y_hint_obj;
int h_hint_obj; int h_hint_obj;
int w_indentation; int w_indentation;
bool enable_txt_scroll;
Font* hb_font; Font* hb_font;