summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-03-20 18:50:35 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-03-20 18:50:35 +0300
commit2e98fcfccb79d443911f56c2b5210b5361c65d5c (patch)
tree8f5e54b515ac262ceacfaa928d48fb896d2e60fb
parentcae907edff0c068b7a0fc60c9a2cab6015ae5c74 (diff)
mouse cursors & url clicking
-rw-r--r--plugins/NewStory/src/history_control.cpp24
-rw-r--r--plugins/NewStory/src/webpage.cpp9
2 files changed, 30 insertions, 3 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index ee714e2771..b49ddf9adc 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -1367,6 +1367,9 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
auto *pItem = data->LoadItem(idx);
+ litehtml::position::vector redraw_boxes;
+ pItem->m_doc->on_lbutton_down(pt.x, pt.y, pt.x, pt.y, redraw_boxes);
+
if (wParam & MK_CONTROL) {
data->ToggleSelection(idx, idx);
data->SetCaret(idx);
@@ -1389,8 +1392,13 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_LBUTTONUP:
pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
idx = data->GetItemFromPixel(pt.y);
- if (idx >= 0)
+ if (idx >= 0) {
data->selStart = -1;
+
+ auto *pItem = data->LoadItem(idx);
+ litehtml::position::vector redraw_boxes;
+ pItem->m_doc->on_lbutton_up(pt.x, pt.y, pt.x, pt.y, redraw_boxes);
+ }
break;
case WM_LBUTTONDBLCLK:
@@ -1417,6 +1425,16 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SetFocus(hwnd);
return 0;
+ case WM_MOUSELEAVE:
+ pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ idx = data->GetItemFromPixel(pt.y);
+ if (idx >= 0) {
+ auto *pItem = data->LoadItem(idx);
+ litehtml::position::vector redraw_boxes;
+ pItem->m_doc->on_mouse_leave(redraw_boxes);
+ }
+ break;
+
case WM_MOUSEMOVE:
pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
idx = data->GetItemFromPixel(pt.y);
@@ -1425,6 +1443,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
data->SetSelection(data->selStart, idx);
InvalidateRect(hwnd, 0, FALSE);
}
+
+ auto *pItem = data->LoadItem(idx);
+ litehtml::position::vector redraw_boxes;
+ pItem->m_doc->on_mouse_over(pt.x, pt.y, pt.x, pt.y, redraw_boxes);
}
break;
diff --git a/plugins/NewStory/src/webpage.cpp b/plugins/NewStory/src/webpage.cpp
index b3f2b70b0a..a959fce923 100644
--- a/plugins/NewStory/src/webpage.cpp
+++ b/plugins/NewStory/src/webpage.cpp
@@ -42,8 +42,9 @@ void NSWebPage::load_image(const char *, const char *, bool)
{
}
-void NSWebPage::on_anchor_click(const char *, const litehtml::element::ptr &)
+void NSWebPage::on_anchor_click(const char *pszUtl, const litehtml::element::ptr &)
{
+ Utils_OpenUrl(pszUtl);
}
void NSWebPage::set_base_url(const char *)
@@ -58,6 +59,10 @@ void NSWebPage::set_clip(const litehtml::position &, const litehtml::border_radi
{
}
-void NSWebPage::set_cursor(const char *)
+void NSWebPage::set_cursor(const char *pszCursor)
{
+ if (!mir_strcmp(pszCursor, "pointer"))
+ SetCursor(LoadCursor(NULL, IDC_HAND));
+ else
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
}