]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Make sure classes follow the rule of 0/3/5
[libs/gltk.git] / source / entry.cpp
index f75f2005bc2cdd880d4960cf26b6f1db2cde6cf1..b113b2040de556001b5a3e28e631761860eb0909 100644 (file)
@@ -13,20 +13,7 @@ using namespace std;
 namespace Msp {
 namespace GLtk {
 
-Entry::Entry(const string &t):
-       text(),
-       multiline(false),
-       edit_width(10),
-       edit_height(1),
-       edit_pos(0),
-       first_row(0),
-       visible_rows(1),
-       text_part(0),
-       slider(0),
-       got_key_press(false),
-       cursor_blink(true),
-       selection_active(false),
-       selection_pos(0)
+Entry::Entry(const string &t)
 {
        input_type = INPUT_TEXT;
        set_text(t);
@@ -161,7 +148,7 @@ void Entry::rebuild_special(const Part &part)
                Geometry rgeom = text.coords_to_geometry(*text_part, geom, first_row, row, col);
 
                GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture()));
-               bld.matrix() *= GL::Matrix::translation(rgeom.x, rgeom.y, 0);
+               bld.transform(GL::Matrix::translation(rgeom.x, rgeom.y, 0));
                graphic->build(part.get_geometry().w, part.get_geometry().h, bld);
        }
        else if(part.get_name()=="selection")
@@ -205,7 +192,7 @@ void Entry::rebuild_special(const Part &part)
                                Geometry egeom = text.coords_to_geometry(*text_part, geom, first_row, row, ec);
 
                                GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture()));
-                               bld.matrix() *= GL::Matrix::translation(rgeom.x, rgeom.y, 0);
+                               bld.transform(GL::Matrix::translation(rgeom.x, rgeom.y, 0));
                                graphic->build(egeom.x-rgeom.x, part.get_geometry().h, bld);
                        }
 
@@ -332,8 +319,6 @@ bool Entry::navigate(Navigation nav)
 {
        if(nav==NAV_LEFT || nav==NAV_RIGHT || ((nav==NAV_DOWN || nav==NAV_UP) && multiline))
                move_edit_position(nav, false);
-       else if(nav==NAV_ACCEPT && !signal_enter.empty())
-               signal_enter.emit();
        else
                return false;
 
@@ -358,11 +343,11 @@ void Entry::on_style_change()
 
        if(!style)
        {
-               text_part = 0;
+               text_part = nullptr;
                return;
        }
 
-       text_part = style->get_part("text");
+       text_part = style->find_part("text");
 
        if(multiline)
                check_view_range();
@@ -461,7 +446,7 @@ void Entry::erase_selection(bool emit_change)
 
 void Entry::check_cursor_blink()
 {
-       const Part *cursor_part = style->get_part("cursor");
+       const Part *cursor_part = style->find_part("cursor");
        bool has_blink = (cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS));
 
        cursor_blink = (state&FOCUS);
@@ -483,7 +468,7 @@ void Entry::check_view_range()
        if(!multiline || !text_part)
                return;
 
-       visible_rows = text.get_visible_lines(*text_part, geom, 0);
+       visible_rows = text.get_visible_lines(*text_part, geom, nullptr);
 
        unsigned row, col;
        text.offset_to_coords(edit_pos, row, col);