aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ag_render.f9055
1 files changed, 39 insertions, 16 deletions
diff --git a/ag_render.f90 b/ag_render.f90
index 3a91b92..8dfbb78 100644
--- a/ag_render.f90
+++ b/ag_render.f90
@@ -35,13 +35,14 @@ implicit none
integer, volatile::ag_render_event
integer, volatile::scroll_position
- integer, parameter::ag_render_event_none = 0
- integer, parameter::ag_render_event_closed = 1
- integer, parameter::ag_render_event_mouse = 2
- integer, parameter::ag_render_event_back = 3
- integer, parameter::ag_render_event_go = 4
- integer, parameter::ag_render_event_scroll = 5
- integer, parameter::ag_render_event_resize = 6
+ integer, parameter::ag_render_event_none = 0
+ integer, parameter::ag_render_event_closed = 1
+ integer, parameter::ag_render_event_mouseclick = 2
+ integer, parameter::ag_render_event_back = 3
+ integer, parameter::ag_render_event_go = 4
+ integer, parameter::ag_render_event_scroll = 5
+ integer, parameter::ag_render_event_resize = 6
+ integer, parameter::ag_render_event_mousemove = 7
type :: link
integer, dimension(4)::location
@@ -158,11 +159,22 @@ contains
integer::x, y
- ag_render_event = ag_render_event_mouse
+ ag_render_event = ag_render_event_mouseclick
call stopidle()
end subroutine mouse_button_callback
+ subroutine mouse_move_callback(x, y)
+ use appgraphics, only: stopidle
+ implicit none
+
+ integer::x, y
+
+ ag_render_event = ag_render_event_mousemove
+ call stopidle()
+
+ end subroutine mouse_move_callback
+
subroutine scrolled_callback(x)
use appgraphics, only: stopidle
implicit none
@@ -335,6 +347,7 @@ contains
call setwindowclosecallback(window_closing_callback)
call registermousehandler(MOUSE_LB_UP, mouse_button_callback)
+ call registermousehandler(MOUSE_MOVE, mouse_move_callback)
call enableresize(resize_callback)
call setbkcolor(LIGHTGRAY)
@@ -367,16 +380,16 @@ contains
end subroutine ag_initialize
- function get_clicked_link(self)
+ function get_link_at_mouse(self)
use appgraphics
implicit none
class(appgraphics_renderer)::self
- integer::get_clicked_link
+ integer::get_link_at_mouse
integer::i, mx, my
- get_clicked_link = -1
+ get_link_at_mouse = -1
mx = mousex()
my = mousey()
my = my - self%address_bar_height
@@ -384,12 +397,12 @@ contains
if(my >= self%links(i)%location(2) .and. my <= self%links(i)%location(4) .and. &
mx >= self%links(i)%location(1) .and. mx <= self%links(i)%location(3)) then
- get_clicked_link = i
+ get_link_at_mouse = i
exit
end if
end do
- end function get_clicked_link
+ end function get_link_at_mouse
subroutine ag_prepare_for_layout(self)
use appgraphics
@@ -703,7 +716,7 @@ contains
class(appgraphics_renderer)::self
character(*), intent(out)::text
integer::ag_action
- integer::link_clicked
+ integer::link_clicked, link_under
integer::ignored
! For scrolling
@@ -731,8 +744,8 @@ contains
ignored = gettextboxcontents(self%address_id, text)
ag_action = render_action_goto
- case(ag_render_event_mouse)
- link_clicked = get_clicked_link(self)
+ case(ag_render_event_mouseclick)
+ link_clicked = get_link_at_mouse(self)
if(link_clicked > 0) then
text = self%links(link_clicked)%url
ag_action = render_action_goto
@@ -740,6 +753,16 @@ contains
call clearmouseclick(MOUSE_LB_UP)
+ case(ag_render_event_mousemove)
+ link_under = get_link_at_mouse(self)
+ if(link_under > 0) then
+ call self%report_status(self%links(link_under)%url)
+ else
+ call self%status_ready()
+ end if
+
+ call clearmouseclick(MOUSE_MOVE)
+
case(ag_render_event_scroll)
doclength = self%y - self%initial_y
self%y = (doclength * scroll_position) / (-100)