60 lines
2.3 KiB
Plaintext
60 lines
2.3 KiB
Plaintext
MODULE Browser;
|
|
IMPORT OS, Desktop;
|
|
|
|
VAR browserRunning: CHAR;
|
|
browserWindow: ARRAY 36 OF CHAR;
|
|
browserIcons: ARRAY 31 OF Fox32OSButtonWidget;
|
|
|
|
PROCEDURE BrowserMain(diskId, iconX, iconY: INT; desktopWin: PTR;);
|
|
VAR i, x, y, w, h: INT;
|
|
BEGIN
|
|
browserRunning := 1;
|
|
|
|
(* create the window and fill it with white *)
|
|
new_window(PTROF(browserWindow), "Fetcher", 384, 192, 64, 64, 0, PTROF(browserIcons));
|
|
fill_window(0FFFFFFFFH, PTROF(browserWindow));
|
|
(*draw_widgets_to_window(PTROF(browserWindow));*)
|
|
|
|
WHILE browserRunning DO
|
|
GetNextWindowEvent(PTROF(browserWindow));
|
|
|
|
(* mouse click event *)
|
|
IF eventArgs[0] = PTROF(EVENT_TYPE_MOUSE_CLICK) THEN
|
|
IF (eventArgs[1] <| 8) & (eventArgs[2] <| 16) THEN
|
|
destroy_window(PTROF(browserWindow));
|
|
browserRunning := 0;
|
|
IF desktopWin # 0 THEN
|
|
(* draw the retracting box animation *)
|
|
i := 0;
|
|
WHILE i < 16 DO
|
|
x := RSH(GETSHORT(PTROF(browserWindow) + 20) *| (16 - i) + iconX *| i, 4);
|
|
y := RSH(GETSHORT(PTROF(browserWindow) + 22) *| (16 - i) + iconY *| i, 4);
|
|
w := RSH(384 *| (16 - i) + 32 *| i,4);
|
|
h := RSH(192 *| (16 - i) + 32 *| i,4);
|
|
DrawWireframeBox(get_window_overlay_number(desktopWin), x, y, w, h, 020F0F0F0H);
|
|
Eep(5);
|
|
draw_filled_rectangle_to_overlay(x, y, w, h, 0, get_window_overlay_number(desktopWin));
|
|
i := i + 1;
|
|
END;
|
|
DrawDesktopIcons(desktopWin);
|
|
END;
|
|
ELSIF eventArgs[2] <| 16 THEN
|
|
start_dragging_window(PTROF(browserWindow));
|
|
END;
|
|
handle_widget_click(PTROF(browserWindow), eventArgs[1], eventArgs[2]);
|
|
|
|
(* button click event *)
|
|
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_BUTTON_CLICK) THEN
|
|
HandleIconClick(eventArgs[1]);
|
|
END;
|
|
|
|
save_state_and_yield_task();
|
|
END;
|
|
END;
|
|
|
|
PROCEDURE HandleIconClick(buttonId: INT;);
|
|
BEGIN
|
|
(* TODO *)
|
|
END;
|
|
END.
|