textbox and combox behaviours

textbox: when uneditable the caret is hide
combox: when uneditable (default)
- inherit the textbox behaviour
- open the lister clicking the textbox area also
This commit is contained in:
Besh81
2016-05-10 18:10:53 +02:00
parent 760a0a9b78
commit 3069d998f0
2 changed files with 30 additions and 20 deletions

View File

@@ -1639,11 +1639,14 @@ namespace nana{ namespace widgets
bool text_editor::mouse_move(bool left_button, const point& scrpos)
{
cursor cur = cursor::iterm;
if ((!hit_text_area(scrpos)) && (!text_area_.captured))
if(((!hit_text_area(scrpos)) && (!text_area_.captured)) || !attributes_.editable || !API::window_enabled(window_))
cur = cursor::arrow;
API::window_cursor(window_, cur);
if(!attributes_.editable)
return false;
if(left_button)
{
auto caret_pos_before = caret();
@@ -1662,6 +1665,9 @@ namespace nana{ namespace widgets
bool text_editor::mouse_pressed(const arg_mouse& arg)
{
if(!attributes_.editable)
return false;
if (event_code::mouse_down == arg.evt_code)
{
if (!hit_text_area(arg.pos))
@@ -1790,6 +1796,9 @@ namespace nana{ namespace widgets
reset_caret_pixels();
}
if(!attributes_.editable)
visible = false;
API::caret_visible(window_, visible);
if(visible)
@@ -3065,7 +3074,7 @@ namespace nana{ namespace widgets
graph_.palette(false, scheme_->selection.get_color());
//The text is not selected or the whole line text is selected
if (!focused || (!_m_get_sort_select_points(a, b)) || (select_.a.y != str_pos.y && select_.b.y != str_pos.y))
if(!focused || (!_m_get_sort_select_points(a, b)) || (select_.a.y != str_pos.y && select_.b.y != str_pos.y) || !attributes_.editable)
{
bool selected = (a.y < str_pos.y && str_pos.y < b.y);
for (auto & ent : reordered)