fix issues of textbox and filebox
no refresh when calling textbox line_wrapped add filebox overwrite prompt for saving file the first non-* filter to be set default extentsion for filebox
This commit is contained in:
parent
dcead38544
commit
34e2c6b143
@ -972,6 +972,7 @@ namespace nana
|
||||
|
||||
const nana::char_t * filter;
|
||||
nana::string filter_holder;
|
||||
nana::string default_extension;
|
||||
if(impl_->filters.size())
|
||||
{
|
||||
for(auto & f : impl_->filters)
|
||||
@ -989,6 +990,21 @@ namespace nana
|
||||
}
|
||||
filter_holder += fs;
|
||||
filter_holder += static_cast<nana::string::value_type>('\0');
|
||||
|
||||
//Get the default file extentsion
|
||||
if (default_extension.empty())
|
||||
{
|
||||
pos = fs.find_last_of('.');
|
||||
if (pos != fs.npos)
|
||||
{
|
||||
fs = fs.substr(pos + 1);
|
||||
if (fs != L"*")
|
||||
{
|
||||
default_extension = fs;
|
||||
ofn.lpstrDefExt = default_extension.data();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
filter = filter_holder.data();
|
||||
}
|
||||
@ -1001,6 +1017,10 @@ namespace nana
|
||||
ofn.lpstrFileTitle = nullptr;
|
||||
ofn.nMaxFileTitle = 0;
|
||||
ofn.lpstrInitialDir = (impl_->path.size() ? impl_->path.c_str() : nullptr);
|
||||
|
||||
if (!impl_->open_or_save)
|
||||
ofn.Flags = OFN_OVERWRITEPROMPT; //Overwrite prompt if it is save mode
|
||||
|
||||
if(FALSE == (impl_->open_or_save ? ::GetOpenFileName(&ofn) : ::GetSaveFileName(&ofn)))
|
||||
return false;
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ namespace drawerbase {
|
||||
internal_scope_guard lock;
|
||||
auto editor = get_drawer_trigger().editor();
|
||||
if (editor->line_wrapped(autl))
|
||||
editor->render(API::is_focus_window(handle()));
|
||||
API::update_window(handle());
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -389,7 +389,7 @@ namespace drawerbase {
|
||||
internal_scope_guard lock;
|
||||
auto editor = get_drawer_trigger().editor();
|
||||
if(editor && editor->select(yes))
|
||||
API::refresh_window(*this);
|
||||
API::update_window(*this);
|
||||
}
|
||||
|
||||
void textbox::copy() const
|
||||
@ -407,7 +407,7 @@ namespace drawerbase {
|
||||
if(editor)
|
||||
{
|
||||
editor->paste();
|
||||
API::refresh_window(*this);
|
||||
API::update_window(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user