add OFN_NOCHANGEDIR flag to OPENFILENAME::Flags in nana::filebox::show
http://blogs.msdn.com/b/oldnewthing/archive/2010/11/12/10089878.aspx setting OFN_NOCHANGEDIR flag to OPENFILENAME::Flags is effective for GetOpenFileName API on Windows7. add const qualifier to nana::paint::graphics::save_as_file add support for small icon on Windows. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption. https://msdn.microsoft.com/en-us/library/windows/desktop/ms632643%28v=vs.85%29.aspx
This commit is contained in:
@@ -69,6 +69,31 @@ namespace paint
|
||||
return false;
|
||||
}
|
||||
|
||||
bool image_ico::open(void* buff, size_t sz)
|
||||
{
|
||||
close();
|
||||
#if defined(NANA_WINDOWS)
|
||||
HICON handle = CreateIconFromResource((PBYTE)buff, sz, TRUE, 0x00030000);
|
||||
if(handle)
|
||||
{
|
||||
ICONINFO info;
|
||||
if (::GetIconInfo(handle, &info) != 0)
|
||||
{
|
||||
HICON * p = new HICON(handle);
|
||||
ptr_ = std::shared_ptr<HICON>(p, handle_deleter());
|
||||
size_.width = (info.xHotspot << 1);
|
||||
size_.height = (info.yHotspot << 1);
|
||||
::DeleteObject(info.hbmColor);
|
||||
::DeleteObject(info.hbmMask);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(is_ico_){} //kill the unused compiler warning in Linux.
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool image_ico::alpha_channel() const
|
||||
{
|
||||
return false;
|
||||
@@ -235,6 +260,13 @@ namespace paint
|
||||
return false;
|
||||
}
|
||||
|
||||
bool image::open_icon(void* buff, size_t sz)
|
||||
{
|
||||
image::image_impl_interface * helper = new detail::image_ico(true);
|
||||
image_ptr_ = std::shared_ptr<image_impl_interface>(helper);
|
||||
return helper->open(buff, sz);
|
||||
}
|
||||
|
||||
bool image::empty() const
|
||||
{
|
||||
return ((nullptr == image_ptr_) || image_ptr_->empty());
|
||||
|
||||
Reference in New Issue
Block a user