mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Changed: Set <textarea>, <input> font style
--HG-- branch : develop
This commit is contained in:
parent
caf8c5195c
commit
f201abe6db
2 changed files with 52 additions and 9 deletions
|
@ -55,6 +55,7 @@ using namespace NLMISC;
|
|||
// Allow up to 10 redirects, then give up
|
||||
#define DEFAULT_RYZOM_REDIRECT_LIMIT (10)
|
||||
//
|
||||
#define FONT_WEIGHT_NORMAL 400
|
||||
#define FONT_WEIGHT_BOLD 700
|
||||
|
||||
namespace NLGUI
|
||||
|
@ -1417,14 +1418,24 @@ namespace NLGUI
|
|||
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
||||
tooltip = value[MY_HTML_INPUT_ALT];
|
||||
|
||||
// by default not inherited
|
||||
CStyleParams style;
|
||||
style.TextColor = TextColor;
|
||||
style.FontSize = TextFontSize;
|
||||
style.FontWeight = FONT_WEIGHT_NORMAL;
|
||||
style.FontOblique = false;
|
||||
|
||||
if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE])
|
||||
getStyleParams(value[MY_HTML_INPUT_STYLE], style);
|
||||
|
||||
_TextColor.push_back(style.TextColor);
|
||||
_FontSize.push_back(style.FontSize);
|
||||
_FontWeight.push_back(style.FontWeight);
|
||||
_FontOblique.push_back(style.FontOblique);
|
||||
|
||||
string type = toLower(value[MY_HTML_INPUT_TYPE]);
|
||||
if (type == "image")
|
||||
{
|
||||
CStyleParams style;
|
||||
// width, height from inline css
|
||||
if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE])
|
||||
getStyleParams(value[MY_HTML_INPUT_STYLE], style);
|
||||
|
||||
// The submit button
|
||||
string name;
|
||||
string normal;
|
||||
|
@ -1632,6 +1643,11 @@ namespace NLGUI
|
|||
_Forms.back().Entries.push_back (entry);
|
||||
}
|
||||
}
|
||||
|
||||
popIfNotEmpty(_FontSize);
|
||||
popIfNotEmpty(_TextColor);
|
||||
popIfNotEmpty(_FontWeight);
|
||||
popIfNotEmpty(_FontOblique);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1871,6 +1887,21 @@ namespace NLGUI
|
|||
// Got one form ?
|
||||
if (!(_Forms.empty()))
|
||||
{
|
||||
// not inherited by default
|
||||
CStyleParams style;
|
||||
style.TextColor = TextColor;
|
||||
style.FontWeight = FONT_WEIGHT_NORMAL;
|
||||
style.FontOblique = false;
|
||||
style.FontSize = TextFontSize;
|
||||
|
||||
if (present[MY_HTML_TEXTAREA_STYLE] && value[MY_HTML_TEXTAREA_STYLE])
|
||||
getStyleParams(value[MY_HTML_TEXTAREA_STYLE], style);
|
||||
|
||||
_TextColor.push_back(style.TextColor);
|
||||
_FontSize.push_back(style.FontSize);
|
||||
_FontWeight.push_back(style.FontWeight);
|
||||
_FontOblique.push_back(style.FontOblique);
|
||||
|
||||
// read general property
|
||||
string templateName;
|
||||
|
||||
|
@ -2187,6 +2218,11 @@ namespace NLGUI
|
|||
entry.TextArea = textArea;
|
||||
_Forms.back().Entries.push_back (entry);
|
||||
}
|
||||
|
||||
popIfNotEmpty (_FontSize);
|
||||
popIfNotEmpty (_FontWeight);
|
||||
popIfNotEmpty (_FontOblique);
|
||||
popIfNotEmpty (_TextColor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3988,11 +4024,16 @@ namespace NLGUI
|
|||
{
|
||||
// Not added ?
|
||||
std::vector<std::pair<std::string,std::string> > templateParams;
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("w", toString (cols*12)));
|
||||
//templateParams.push_back (std::pair<std::string,std::string> ("h", toString (rows*12)));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("w", toString (cols*getFontSize())));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("id", name));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("prompt", ""));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("multiline", multiLine?"true":"false"));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("fontsize", toString (getFontSize())));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("color", getTextColor().toString()));
|
||||
if (getFontWeight() >= FONT_WEIGHT_BOLD)
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("fontweight", "bold"));
|
||||
if (getFontOblique())
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("fontstyle", "oblique"));
|
||||
if (multiLine)
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("multi_min_line", toString(rows)));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false"));
|
||||
|
|
|
@ -111,7 +111,9 @@
|
|||
entry_type="text"
|
||||
keep="true"
|
||||
max_historic="40"
|
||||
fontsize="10"
|
||||
fontsize="10"
|
||||
fontweight=""
|
||||
fontstyle=""
|
||||
backup_father_container_pos="false"
|
||||
want_return="false"
|
||||
color="255 255 255 255"
|
||||
|
@ -122,7 +124,7 @@
|
|||
<group id="#id" posref="#posref" x="#x" y="#y" posparent="#posparent" child_resize_h="#child_resize_h" sizeref="#sizeref" w="#w" h="#h" render_layer="#render_layer">
|
||||
<group type="edit_box" sizeref="#sizeref_eb" w="-16" id="eb" posref="TL TL" x="8" y="-8" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer">
|
||||
<view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="log_eb_m.tga" inherit_gc_alpha="false" render_layer="#render_layer"/>
|
||||
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" multi_min_line="#multi_min_line" fontsize="#fontsize" color="#color" shadow="true" hardtext="" global_color="false" render_layer="#render_layer"/>
|
||||
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" multi_min_line="#multi_min_line" fontsize="#fontsize" color="#color" fontweight="#fontweight" fontstyle="#fontstyle" shadow="true" hardtext="" global_color="false" render_layer="#render_layer"/>
|
||||
</group>
|
||||
|
||||
<!-- border around the list -->
|
||||
|
|
Loading…
Reference in a new issue