add very rudimentary right-alignment text option
This commit is contained in:
@@ -53,12 +53,18 @@ bool cTextMsg::parseAttribute(ticpp::Attribute& attr, std::string tagName, std::
|
||||
throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname);
|
||||
}
|
||||
return true;
|
||||
} else if(attr.Name() == "underline") {
|
||||
}else if(attr.Name() == "underline"){
|
||||
std::string val = attr.Value();
|
||||
if(val == "true") underlined = true;
|
||||
else if(val == "false") underlined = false;
|
||||
else throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname);
|
||||
return true;
|
||||
}else if(attr.Name() == "align"){
|
||||
std::string val = attr.Value();
|
||||
if(val == "right") right_align = true;
|
||||
else if(val == "left") right_align = false;
|
||||
else throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname);
|
||||
return true;
|
||||
}
|
||||
return cControl::parseAttribute(attr, tagName, fname);
|
||||
}
|
||||
@@ -233,7 +239,7 @@ void cTextMsg::draw(){
|
||||
}
|
||||
style.colour = draw_color;
|
||||
if (!calculated) calculate_layout();
|
||||
win_draw_string(*inWindow,to_rect,msg,text_mode,style,break_info);
|
||||
win_draw_string(*inWindow,to_rect,msg,text_mode,style,break_info,right_align);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -63,5 +63,6 @@ private:
|
||||
std::string msg;
|
||||
void calculate_layout();
|
||||
bool calculated = false;
|
||||
bool right_align = false;
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user