Quellcode durchsuchen

Image window now reconsiders the need for scrollbars after every resize event

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7240 8c9fc860-2736-0410-a75d-ab315db34111
skoster vor 8 Jahren
Ursprung
Commit
7a05baa4a8
1 geänderte Dateien mit 19 neuen und 0 gelöschten Zeilen
  1. 19 0
      source/WMStandardComponents.Mod

+ 19 - 0
source/WMStandardComponents.Mod

@@ -2876,6 +2876,25 @@ TYPE
 			dx := 0;  dy := 0
 		END Init;
 		
+		PROCEDURE Resized*;
+		BEGIN			
+			Resized^;
+			IF img.width > bounds.GetWidth() THEN
+				dx := img.width - bounds.GetWidth();
+				hScrollbar.visible.Set(TRUE)
+			ELSE
+				dx := 0;
+				hScrollbar.visible.Set(FALSE)
+			END;
+			IF img.height > bounds.GetHeight() THEN
+				dy := img.height - bounds.GetHeight();
+				vScrollbar.visible.Set(TRUE)
+			ELSE
+				dx := 0;
+				vScrollbar.visible.Set(FALSE)
+			END;
+		END Resized;
+		
 		PROCEDURE GetOffsets*(VAR x,y: LONGINT); (*returns offset caused by scrollbars*)
 		BEGIN
 			x :=-( dx * hScrollbar.pos.Get() DIV 100);