Merge branch 'JamesBremner-develop' into develop

This commit is contained in:
Jinhao 2017-07-29 07:14:13 +08:00
commit 18d2e2a84f
2 changed files with 26 additions and 7 deletions

View File

@ -46,7 +46,7 @@ namespace nana
/// Construct that creates a message box with a specified title and default button.
msgbox(const ::std::string&);
/// Construct that creates a message box with an owner windoow, a specified title and buttons.
/// Construct that creates a message box with an owner windoow, a specified title and buttons.
msgbox(window, const ::std::string&, button_t = ok);
/// Sets an icon for informing user.
@ -108,6 +108,7 @@ namespace nana
virtual window create(window, unsigned label_px) = 0;
virtual unsigned fixed_pixels() const;
};
public:
class boolean
: public abstract_content
@ -240,7 +241,6 @@ namespace nana
{
std::vector<abstract_content*> contents;
_m_fetch_args(contents, std::forward<Args>(args)...);
if (contents.empty())
return false;
@ -261,6 +261,14 @@ namespace nana
/// Sets a verifier to verify the user input.
void verify(std::function<bool(window)> verifier);
/** Sets the minimum width for the entry fields
@param[in] pixels new minimum width
If not called, the default is 100 pixels
*/
void min_width_entry_field( int pixels );
private:
void _m_fetch_args(std::vector<abstract_content*>&);
@ -279,6 +287,7 @@ namespace nana
std::function<bool(window)> verifier_;
::nana::paint::image images_[4];
::nana::rectangle valid_areas_[4];
int min_width_entry_field_pixels_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>

View File

@ -685,7 +685,7 @@ namespace nana
{
return impl_->empty_label_text;
}
window inputbox::boolean::create(window owner, unsigned label_px)
{
auto impl = impl_.get();
@ -1258,7 +1258,8 @@ namespace nana
inputbox::inputbox(window owner, ::std::string desc, ::std::string title)
: owner_{ owner },
description_(std::move(desc)),
title_(std::move(title))
title_(std::move(title)),
min_width_entry_field_pixels_( 100 )
{}
void inputbox::image(::nana::paint::image img, bool is_left, const rectangle& valid_area)
@ -1280,6 +1281,15 @@ namespace nana
verifier_ = std::move(verifier);
}
void inputbox::min_width_entry_field( int pixels )
{
// don't let the entry fields vanish entirely
if( pixels < 10 )
pixels = 10;
min_width_entry_field_pixels_ = pixels;
}
void inputbox::_m_fetch_args(std::vector<abstract_content*>&)
{}
@ -1304,9 +1314,9 @@ namespace nana
each_pixels.push_back(px.height);
}
//Adjust the fixed_px for good looking
if (has_0_fixed_px && (fixed_px < 100))
fixed_px = 100;
//Ensure that the entry fields are at least as wide as the minimum
if (has_0_fixed_px && (fixed_px < min_width_entry_field_pixels_ ))
fixed_px = min_width_entry_field_pixels_;
inputbox_window input_wd(owner_, images_, valid_areas_, description_, title_, contents.size(), label_px + 10 + fixed_px, each_pixels);