]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Add a page size feature to Slider
[libs/gltk.git] / source / entry.cpp
index ed0d7e2081a270a90894277f619f33c4daf4aeb5..4c1713a022306d4b7670ef3953be2a62457f85a9 100644 (file)
@@ -5,8 +5,8 @@
 #include "entry.h"
 #include "graphic.h"
 #include "part.h"
+#include "slider.h"
 #include "style.h"
-#include "vslider.h"
 
 using namespace std;
 
@@ -446,18 +446,21 @@ void Entry::erase_selection(bool emit_change)
 
 void Entry::check_cursor_blink()
 {
+       const Part *cursor_part = style->get_part("cursor");
+       bool has_blink = (cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS));
+
        cursor_blink = (state&FOCUS);
-       if((state&FOCUS) && style)
+       if((state&FOCUS) && style && has_blink)
        {
-               const Part *cursor_part = style->get_part("cursor");
-               if(cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS))
-               {
-                       set_animation_interval(Time::sec/2);
-                       return;
-               }
+               set_animation_interval(Time::sec/2);
+               mark_rebuild();
+       }
+       else
+       {
+               if(has_blink)
+                       mark_rebuild();
+               stop_animation();
        }
-
-       stop_animation();
 }
 
 void Entry::check_view_range()
@@ -484,6 +487,7 @@ void Entry::check_view_range()
                signal_scroll_position_changed.emit(first_row);
 
        slider->set_range(0, scroll);
+       slider->set_page_size(visible_rows);
        slider->set_value(scroll-first_row);
 }