fix crash where create combox with specified rectangle
This commit is contained in:
parent
cf088ddbfb
commit
2853c652e5
@ -143,6 +143,7 @@ namespace nana
|
|||||||
|
|
||||||
auto scheme = dynamic_cast< ::nana::widgets::skeletons::text_editor_scheme*>(API::dev::get_scheme(wd));
|
auto scheme = dynamic_cast< ::nana::widgets::skeletons::text_editor_scheme*>(API::dev::get_scheme(wd));
|
||||||
editor_ = new widgets::skeletons::text_editor(widget_->handle(), graph, scheme);
|
editor_ = new widgets::skeletons::text_editor(widget_->handle(), graph, scheme);
|
||||||
|
_m_text_area(graph.size());
|
||||||
editor_->multi_lines(false);
|
editor_->multi_lines(false);
|
||||||
editable(false);
|
editable(false);
|
||||||
graph_ = &graph;
|
graph_ = &graph;
|
||||||
@ -177,21 +178,6 @@ namespace nana
|
|||||||
return any_ptr.get();
|
return any_ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_area(const nana::size& s)
|
|
||||||
{
|
|
||||||
auto extension = measurer_->extension();
|
|
||||||
|
|
||||||
nana::rectangle r(2, 2, s.width > extension.width ? s.width - extension.width : 0, s.height > extension.height ? s.height - extension.height : 0);
|
|
||||||
if(image_enabled_)
|
|
||||||
{
|
|
||||||
unsigned place = image_pixels_ + 2;
|
|
||||||
r.x += place;
|
|
||||||
if(r.width > place) r.width -= place;
|
|
||||||
}
|
|
||||||
editor_->text_area(r);
|
|
||||||
editor_->render(state_.focused);
|
|
||||||
}
|
|
||||||
|
|
||||||
widgets::skeletons::text_editor * editor() const
|
widgets::skeletons::text_editor * editor() const
|
||||||
{
|
{
|
||||||
return editor_;
|
return editor_;
|
||||||
@ -364,12 +350,13 @@ namespace nana
|
|||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
bool enb = widget_->enabled();
|
bool enb = widget_->enabled();
|
||||||
if(editor_)
|
|
||||||
{
|
_m_text_area(widget_->size());
|
||||||
text_area(widget_->size());
|
editor_->render(state_.focused);
|
||||||
}
|
|
||||||
_m_draw_push_button(enb);
|
_m_draw_push_button(enb);
|
||||||
_m_draw_image();
|
_m_draw_image();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t the_number_of_options() const
|
std::size_t the_number_of_options() const
|
||||||
@ -496,6 +483,20 @@ namespace nana
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
void _m_text_area(const nana::size& s)
|
||||||
|
{
|
||||||
|
auto extension = measurer_->extension();
|
||||||
|
|
||||||
|
nana::rectangle r(2, 2, s.width > extension.width ? s.width - extension.width : 0, s.height > extension.height ? s.height - extension.height : 0);
|
||||||
|
if (image_enabled_)
|
||||||
|
{
|
||||||
|
unsigned place = image_pixels_ + 2;
|
||||||
|
r.x += place;
|
||||||
|
if (r.width > place) r.width -= place;
|
||||||
|
}
|
||||||
|
editor_->text_area(r);
|
||||||
|
}
|
||||||
|
|
||||||
void _m_draw_push_button(bool enabled)
|
void _m_draw_push_button(bool enabled)
|
||||||
{
|
{
|
||||||
::nana::rectangle r{graph_->size()};
|
::nana::rectangle r{graph_->size()};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user