adjust inputbox element width for good looking
This commit is contained in:
@@ -1288,6 +1288,8 @@ namespace nana
|
|||||||
std::vector<unsigned> each_pixels;
|
std::vector<unsigned> each_pixels;
|
||||||
unsigned label_px = 0, fixed_px = 0;
|
unsigned label_px = 0, fixed_px = 0;
|
||||||
paint::graphics graph({ 5, 5 });
|
paint::graphics graph({ 5, 5 });
|
||||||
|
|
||||||
|
bool has_0_fixed_px = false;
|
||||||
for (auto p : contents)
|
for (auto p : contents)
|
||||||
{
|
{
|
||||||
auto px = label::measure(graph, p->label(), 150, true, align::right, align_v::center);
|
auto px = label::measure(graph, p->label(), 150, true, align::right, align_v::center);
|
||||||
@@ -1295,13 +1297,15 @@ namespace nana
|
|||||||
label_px = px.width;
|
label_px = px.width;
|
||||||
|
|
||||||
px.width = p->fixed_pixels();
|
px.width = p->fixed_pixels();
|
||||||
|
has_0_fixed_px |= (px.width == 0);
|
||||||
if (px.width > fixed_px)
|
if (px.width > fixed_px)
|
||||||
fixed_px = px.width;
|
fixed_px = px.width;
|
||||||
|
|
||||||
each_pixels.push_back(px.height);
|
each_pixels.push_back(px.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixed_px < 100)
|
//Adjust the fixed_px for good looking
|
||||||
|
if (has_0_fixed_px && (fixed_px < 100))
|
||||||
fixed_px = 100;
|
fixed_px = 100;
|
||||||
|
|
||||||
inputbox_window input_wd(owner_, images_, valid_areas_, description_, title_, contents.size(), label_px + 10 + fixed_px, each_pixels);
|
inputbox_window input_wd(owner_, images_, valid_areas_, description_, title_, contents.size(), label_px + 10 + fixed_px, each_pixels);
|
||||||
|
|||||||
Reference in New Issue
Block a user