mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2024-11-09 09:40:27 +01:00
Window widths/heights named correctly
This commit is contained in:
parent
b366037e72
commit
ec5f97eecf
@ -15,15 +15,15 @@ const
|
||||
RED_BUTTON = 4000;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
|
||||
begin
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -31,7 +31,7 @@ begin
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Color Buttons', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Color Buttons', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
DrawButton(10, 20, 50, 30, COLOR_RED, 0, RED_BUTTON);
|
||||
DrawButton(70, 20, 50, 30, COLOR_GREEN, 0, GREEN_BUTTON);
|
||||
|
@ -51,7 +51,7 @@ asm
|
||||
end;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
TargaFile: PTargaFile;
|
||||
Image: Pointer;
|
||||
FileSize: LongWord;
|
||||
@ -69,10 +69,10 @@ begin
|
||||
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -80,7 +80,7 @@ begin
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Draw Image', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Draw Image', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
with TargaFile.Header do
|
||||
DrawImage(Image^, 30, 20, Width, Height);
|
||||
|
@ -71,7 +71,7 @@ asm
|
||||
end;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
BitmapFile1, BitmapFile2, BitmapFile3: PBitmapFile;
|
||||
Image1, Image2, Image3: Pointer;
|
||||
Padding1, Padding2, Padding3: LongWord;
|
||||
@ -116,10 +116,10 @@ begin
|
||||
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := 340;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := 340;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -128,7 +128,7 @@ begin
|
||||
begin
|
||||
BeginDraw;
|
||||
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Draw Image Extended', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Draw Image Extended', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
|
||||
(* these image files was saved with 'flip row order' parameter *)
|
||||
|
@ -4,16 +4,16 @@ uses
|
||||
KolibriOS;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom, CurX, CurY: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight, CurX, CurY: Integer;
|
||||
Key: TKeyboardInput;
|
||||
|
||||
begin
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
CurX := 0;
|
||||
@ -26,7 +26,7 @@ begin
|
||||
CurX := 0;
|
||||
CurY := 0;
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Please type text to draw', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Please type text to draw', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
EndDraw;
|
||||
end;
|
||||
|
@ -4,23 +4,24 @@ uses
|
||||
KolibriOS;
|
||||
|
||||
var
|
||||
Window, Rectangle: TRect;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
Rect: TRect;
|
||||
Point: TPoint;
|
||||
begin
|
||||
with Window, GetScreenSize do
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
with Rectangle do
|
||||
with Rect do
|
||||
begin
|
||||
Left := 10;
|
||||
Top := 10;
|
||||
Right := Window.Right - 20;
|
||||
Bottom := Window.Bottom - 40;
|
||||
Right := WndWidth - 20;
|
||||
Bottom := WndHeight - 40;
|
||||
end;
|
||||
|
||||
SetEventMask(EM_REDRAW + EM_BUTTON + EM_MOUSE);
|
||||
@ -31,11 +32,10 @@ begin
|
||||
begin
|
||||
BeginDraw;
|
||||
|
||||
with Window do
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Get Pixel', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Get Pixel', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
|
||||
with Rectangle do
|
||||
with Rect do
|
||||
begin
|
||||
DrawLine(Left, Top, Left, Bottom, 0);
|
||||
DrawLine(Right, Top, Right, Bottom, 0);
|
||||
@ -48,7 +48,7 @@ begin
|
||||
MOUSE_EVENT:
|
||||
begin
|
||||
Point := GetMousePos;
|
||||
with Rectangle, Point do
|
||||
with Rect, Point do
|
||||
DrawRectangle(Left + 1, Top + 1, Right - Left - 1, Bottom - Top - 1, GetPixel(X, Y));
|
||||
end;
|
||||
BUTTON_EVENT:
|
||||
|
@ -4,15 +4,15 @@ uses
|
||||
KolibriOS;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
|
||||
begin
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -20,7 +20,7 @@ begin
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Hello!', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Hello!', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
EndDraw;
|
||||
end;
|
||||
@ -28,6 +28,6 @@ begin
|
||||
GetKey;
|
||||
BUTTON_EVENT:
|
||||
if GetButton.ID = 1 then
|
||||
Break;
|
||||
TerminateThread;
|
||||
end;
|
||||
end.
|
||||
|
@ -17,23 +17,23 @@ type
|
||||
TRGBTripleArray = array[0..0] of TRGBTriple;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
Screen: TSize;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
ScreenSize: TSize;
|
||||
Image, Preview: PRGBTripleArray;
|
||||
|
||||
function Red(A, B: LongWord): LongWord;
|
||||
begin
|
||||
Red := Image[(Screen.Width * B + A)].Red;
|
||||
Red := Image[(ScreenSize.Width * B + A)].Red;
|
||||
end;
|
||||
|
||||
function Green(A, B: LongWord): LongWord;
|
||||
begin
|
||||
Green := Image[(Screen.Width * B + A)].Green;
|
||||
Green := Image[(ScreenSize.Width * B + A)].Green;
|
||||
end;
|
||||
|
||||
function Blue(A, B: LongWord): LongWord;
|
||||
begin
|
||||
Blue := Image[(Screen.Width * B + A)].Blue;
|
||||
Blue := Image[(ScreenSize.Width * B + A)].Blue;
|
||||
end;
|
||||
|
||||
procedure ResizeImage;
|
||||
@ -41,12 +41,12 @@ var
|
||||
A, B, I: LongWord;
|
||||
begin
|
||||
A := 0;
|
||||
while A < Screen.Width do
|
||||
while A < ScreenSize.Width do
|
||||
begin
|
||||
B := 0;
|
||||
while B < Screen.Height do
|
||||
while B < ScreenSize.Height do
|
||||
begin
|
||||
I := ((Screen.Width div 2) * B + A) div 2;
|
||||
I := ((ScreenSize.Width div 2) * B + A) div 2;
|
||||
Preview[i].Red := (Red(A, B) + Red(A+ 1, B) + Red(A, B + 1) + Red(A + 1, B + 1)) div 4;
|
||||
Preview[i].Green := (Green(A, B) + Green(A + 1, B) + Green(A, B + 1) + Green(A + 1, B + 1)) div 4;
|
||||
Preview[i].Blue := (Blue(A, B) + Blue(A + 1, B) + Blue(A, B + 1) + Blue(A + 1, B + 1)) div 4;
|
||||
@ -59,14 +59,14 @@ end;
|
||||
begin
|
||||
HeapInit;
|
||||
|
||||
Screen := GetScreenSize;
|
||||
ScreenSize := GetScreenSize;
|
||||
|
||||
with Screen do
|
||||
with ScreenSize do
|
||||
begin
|
||||
Right := BORDER_SIZE * 2 + Width div 2 - 1;
|
||||
Bottom := BORDER_SIZE + GetSkinHeight + Height div 2 - 1;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := BORDER_SIZE * 2 + Width div 2 - 1;
|
||||
WndHeight := BORDER_SIZE + GetSkinHeight + Height div 2 - 1;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
|
||||
Image := HeapAllocate(Width * Height * 3);
|
||||
Preview := HeapAllocate(Width * Height * 3 div 2);
|
||||
@ -80,9 +80,9 @@ begin
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Screenshot', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Screenshot', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION + WS_TRANSPARENT_FILL, CAPTION_MOVABLE);
|
||||
with Screen do
|
||||
with ScreenSize do
|
||||
DrawImage(Preview^, 0, 0, Width div 2, Height div 2);
|
||||
EndDraw;
|
||||
end;
|
||||
|
@ -63,7 +63,7 @@ asm
|
||||
end;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
|
||||
ArrowBitmapFile, PointBitmapFile, WaitBitmapFile: PBitmapFile;
|
||||
ArrowBitmap, PointBitmap, WaitBitmap: Pointer;
|
||||
@ -91,10 +91,10 @@ begin
|
||||
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -103,7 +103,7 @@ begin
|
||||
begin
|
||||
BeginDraw;
|
||||
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Set Cursor', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Set Cursor', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
|
||||
DrawText( 8, 8, 'Click on picture buttons', 0, $00FFFFFF, DT_CP866_8x16 + DT_FILL_OPAQUE + DT_ZSTRING, 0);
|
||||
|
@ -4,16 +4,16 @@ uses
|
||||
KolibriOS;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
X, Y: Integer;
|
||||
|
||||
begin
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := 180;
|
||||
Bottom := 180;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := 180;
|
||||
WndHeight := 180;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -22,7 +22,7 @@ begin
|
||||
begin
|
||||
BeginDraw;
|
||||
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Set Pixel', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Set Pixel', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
|
||||
for Y := 0 to 50 do
|
||||
|
@ -52,15 +52,17 @@ begin
|
||||
end;
|
||||
|
||||
var
|
||||
Left, Right, Top, Bottom: Integer;
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
|
||||
begin
|
||||
with GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
WndWidth := Width div 4;
|
||||
if WndWidth < 280 then
|
||||
WndWidth := 280; // to center the prompt
|
||||
WndHeight := Height div 4;
|
||||
WndLeft := (Width - WndWidth) div 2;
|
||||
WndTop := (Height - WndHeight) div 2;
|
||||
end;
|
||||
|
||||
while True do
|
||||
@ -68,7 +70,7 @@ begin
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Set Window Position', $00FFFFFF,
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Set Window Position', $00FFFFFF,
|
||||
WS_SKINNED_SIZABLE + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
DrawText(24, 26, 'Use arrow keys(Left, Right, Up, Down)', $00000000, $00FFFFFF, DT_ZSTRING, 0);
|
||||
DrawText(24, 35, 'to move the window.', $00000000, $00FFFFFF, DT_ZSTRING, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user