add tip string and mask character for inputbox::text

This commit is contained in:
Jinhao 2015-02-17 23:14:39 +08:00
parent 0ffa3e54ca
commit ef705bbb5a
2 changed files with 25 additions and 2 deletions

View File

@ -149,6 +149,11 @@ namespace nana
~text();
void tip_string(std::wstring tip);
void tip_string(std::string tip_utf8);
void mask_character(wchar_t ch);
::nana::string value() const;
private:
//Implementation of abstract_content

View File

@ -723,7 +723,9 @@ namespace nana
//class text
struct inputbox::text::implement
{
::nana::string value;
::nana::string value;
::nana::string tip;
wchar_t mask_character{0};
std::vector< ::nana::string> options;
::nana::string label_text;
@ -749,6 +751,21 @@ namespace nana
//Instance for impl_ because implmenet is incomplete type at the point of declaration
inputbox::text::~text(){}
void inputbox::text::tip_string(std::wstring tip)
{
impl_->tip = std::move(tip);
}
void inputbox::text::tip_string(std::string tip_utf8)
{
impl_->tip = ::nana::charset(tip_utf8, ::nana::unicode::utf8);
}
void inputbox::text::mask_character(wchar_t ch)
{
impl_->mask_character = ch;
}
::nana::string inputbox::text::value() const
{
return impl_->value;
@ -774,6 +791,8 @@ namespace nana
if (impl->options.empty())
{
impl->textbox.create(impl->dock, rectangle{ static_cast<int>(label_px + 10), 0, 0, 0 });
impl->textbox.tip_string(impl->tip);
impl->textbox.mask(impl->mask_character);
}
else
{
@ -970,7 +989,6 @@ namespace nana
void inputbox::_m_fetch_args(std::vector<abstract_content*>&)
{}
bool inputbox::_m_open(std::vector<abstract_content*>& contents, bool modal)
{
std::vector<unsigned> each_pixels;