62 GetClientRect(nsw32_cw->
hWnd, &rc);
68 ShowScrollBar(nsw32_cw->
hWnd, SB_BOTH, TRUE);
69 si.cbSize =
sizeof(SCROLLINFO);
70 si.fMask = SIF_RANGE | SIF_PAGE;
74 SetScrollInfo(nsw32_cw->
hWnd, SB_HORZ, &si, TRUE);
75 si.cbSize =
sizeof(SCROLLINFO);
76 si.fMask = SIF_RANGE | SIF_PAGE;
80 SetScrollInfo(nsw32_cw->
hWnd, SB_VERT, &si, TRUE);
83 ShowScrollBar(nsw32_cw->
hWnd, SB_VERT, FALSE);
84 ShowScrollBar(nsw32_cw->
hWnd, SB_HORZ, TRUE);
85 si.cbSize =
sizeof(SCROLLINFO);
86 si.fMask = SIF_RANGE | SIF_PAGE;
90 SetScrollInfo(nsw32_cw->
hWnd, SB_HORZ, &si, TRUE);
96 ShowScrollBar(nsw32_cw->
hWnd, SB_HORZ, FALSE);
97 ShowScrollBar(nsw32_cw->
hWnd, SB_VERT, TRUE);
98 si.cbSize =
sizeof(SCROLLINFO);
99 si.fMask = SIF_RANGE | SIF_PAGE;
102 si.nPage = rc.bottom;
103 SetScrollInfo(nsw32_cw->
hWnd, SB_VERT, &si, TRUE);
106 ShowScrollBar(nsw32_cw->
hWnd, SB_BOTH, FALSE);
126 si.cbSize =
sizeof(si);
128 GetScrollInfo(hwnd, SB_HORZ, &si);
130 GetScrollInfo(hwnd, SB_VERT, &si);
133 BeginPaint(hwnd, &ps);
138 clip.x0 = ps.rcPaint.left + scrollx;
139 clip.y0 = ps.rcPaint.top + scrolly;
140 clip.x1 = ps.rcPaint.right + scrollx;
141 clip.y1 = ps.rcPaint.bottom + scrolly;
143 nsw32_cw->
draw(nsw32_cw, scrollx, scrolly, &
clip);
158 NSLOG(netsurf, INFO,
"VSCROLL");
160 si.cbSize =
sizeof(si);
162 GetScrollInfo(hwnd, SB_VERT, &si);
165 switch (LOWORD(wparam)) {
183 usi.nPos -= si.nPage;
187 usi.nPos += si.nPage;
191 usi.nPos = si.nTrackPos;
198 if (usi.nPos < si.nMin) {
201 if (usi.nPos > si.nMax) {
205 SetScrollInfo(hwnd, SB_VERT, &usi, TRUE);
233 NSLOG(netsurf, INFO,
"VSCROLL");
235 si.cbSize =
sizeof(si);
237 GetScrollInfo(hwnd, SB_HORZ, &si);
240 switch (LOWORD(wparam)) {
250 usi.nPos -= si.nPage;
254 usi.nPos += si.nPage;
258 usi.nPos = si.nTrackPos;
265 if (usi.nPos < si.nMin) {
268 if (usi.nPos > si.nMax) {
272 SetScrollInfo(hwnd, SB_HORZ, &usi, TRUE);
296 si.cbSize =
sizeof(si);
298 GetScrollInfo(hwnd, SB_HORZ, &si);
300 GetScrollInfo(hwnd, SB_VERT, &si);
303 nsw32_cw->
mouse(nsw32_cw, button, x, y);
316 si.cbSize =
sizeof(si);
318 GetScrollInfo(hwnd, SB_HORZ, &si);
320 GetScrollInfo(hwnd, SB_VERT, &si);
323 nsw32_cw->
mouse(nsw32_cw, button, x, y);
330 nsw32_cw->
close(nsw32_cw);
342static LRESULT CALLBACK
350 nsw32_cw = GetProp(hwnd, TEXT(
"CoreWnd"));
351 if (nsw32_cw != NULL) {
368 GET_X_LPARAM(lparam),
369 GET_Y_LPARAM(lparam),
374 GET_X_LPARAM(lparam),
375 GET_Y_LPARAM(lparam),
380 GET_X_LPARAM(lparam),
381 GET_Y_LPARAM(lparam),
386 GET_X_LPARAM(lparam),
387 GET_Y_LPARAM(lparam),
395 return DefWindowProc(hwnd, msg, wparam, lparam);
414 RECT *redrawrectp = NULL;
421 si.cbSize =
sizeof(si);
423 GetScrollInfo(nsw32_cw->
hWnd, SB_HORZ, &si);
424 redrawrect.left = (long)
rect->
x0 - si.nPos;
425 redrawrect.right = (
long)
rect->
x1 - si.nPos;
427 GetScrollInfo(nsw32_cw->
hWnd, SB_VERT, &si);
428 redrawrect.top = (long)
rect->
y0 - si.nPos;
429 redrawrect.bottom = (
long)
rect->
y1 - si.nPos;
431 redrawrectp = &redrawrect;
434 RedrawWindow(nsw32_cw->
hWnd,
437 RDW_INVALIDATE | RDW_NOERASE);
490 GetClientRect(nsw32_cw->
hWnd, &rc);
532 if (hWndParent != NULL) {
533 dwStyle = WS_CHILDWINDOW |
537 dwStyle = WS_OVERLAPPEDWINDOW |
545 NSLOG(netsurf, INFO,
"creating hInstance %p core window", hInstance);
546 nsw32_cw->
hWnd = CreateWindowEx(0,
558 if (nsw32_cw->
hWnd == NULL) {
559 NSLOG(netsurf, INFO,
"Window create failed");
563 SetProp(nsw32_cw->
hWnd, TEXT(
"CoreWnd"), (HANDLE)nsw32_cw);
567 si.cbSize =
sizeof(si);
570 SetScrollInfo(nsw32_cw->
hWnd, SB_VERT, &si, FALSE);
571 SetScrollInfo(nsw32_cw->
hWnd, SB_HORZ, &si, FALSE);
590 wc.cbSize =
sizeof(WNDCLASSEX);
595 wc.hInstance = hInstance;
598 wc.hbrBackground = (HBRUSH)(COLOR_MENU + 1);
599 wc.lpszMenuName = NULL;
603 if (RegisterClassEx(&wc) == 0) {
core_window_drag_status
drag status passed to drag_status callback
nserror
Enumeration of error codes.
@ NSERROR_INIT_FAILED
Initialisation failed.
@ NSERROR_NOT_IMPLEMENTED
Functionality is not implemented.
@ NSERROR_NOMEM
Memory exhaustion.
Core mouse and pointer states.
browser_mouse_state
Mouse state: 1 is primary mouse button.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
auxillary button pressed
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Interface to key press operations.
#define NSLOG(catname, level, logmsg, args...)
Localised message support (interface).
Interface to utility string handling.
Core user interface window function table.
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
nserror(* close)(struct nsw32_corewindow *nsw32_cw)
callback for window close event
const char * title
window title
core_window_drag_status drag_status
drag status set by core
nserror(* mouse)(struct nsw32_corewindow *nsw32_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on nsw32 core window
int content_width
content width
int content_height
content height
nserror(* draw)(struct nsw32_corewindow *nsw32_cw, int scrollx, int scrolly, struct rect *r)
callback to draw on drawable area of nsw32 core window
UTF-8 manipulation functions (interface).
void win_perror(const char *lpszFunction)
static LRESULT nsw32_corewindow_close(struct nsw32_corewindow *nsw32_cw)
static const char windowclassname_corewindow[]
struct core_window_table nsw32_cw_cb_table
static nserror nsw32_cw_set_scroll(struct core_window *cw, int x, int y)
static nserror nsw32_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
static nserror nsw32_cw_get_window_dimensions(const struct core_window *cw, int *width, int *height)
Callback from the core to obtain the window viewport dimensions.
static LRESULT nsw32_corewindow_paint(struct nsw32_corewindow *nsw32_cw, HWND hwnd)
Handle paint messages.
static LRESULT nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw, HWND hwnd, WPARAM wparam)
static nserror nsw32_cw_invalidate_area(struct core_window *cw, const struct rect *rect)
callback from core to request an invalidation of a window area.
nserror nsw32_corewindow_init(HINSTANCE hInstance, HWND hWndParent, struct nsw32_corewindow *nsw32_cw)
initialise elements of nsw32 core window.
nserror nsw32_create_corewindow_class(HINSTANCE hInstance)
static LRESULT nsw32_corewindow_mousedown(struct nsw32_corewindow *nsw32_cw, HWND hwnd, int x, int y, browser_mouse_state button)
nserror nsw32_corewindow_fini(struct nsw32_corewindow *nsw32_cw)
finalise elements of nsw32 core window.
struct core_window_table * win32_core_window_table
static void update_scrollbars(struct nsw32_corewindow *nsw32_cw)
update the scrollbar visibility and size
static LRESULT nsw32_corewindow_mouseup(struct nsw32_corewindow *nsw32_cw, HWND hwnd, int x, int y, browser_mouse_state button)
static LRESULT CALLBACK nsw32_window_corewindow_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
callback for core window win32 events
static LRESULT nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw, HWND hwnd, WPARAM wparam)
static nserror nsw32_cw_update_size(struct core_window *cw, int width, int height)
Callback from the core to update the content area size.
static nserror nsw32_cw_get_scroll(const struct core_window *cw, int *x, int *y)
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.