Skip to content

Commit 3d6af2c

Browse files
v1.0.2-beta-1
1 parent f6c4a5d commit 3d6af2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2142
-20305
lines changed

Distro/Atual/hcbasic.dll

0 Bytes
Binary file not shown.

Distro/Atual/hcbasic.pdb

0 Bytes
Binary file not shown.

Distro/Exemplos/gui.hcb

Lines changed: 96 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,120 @@
1-
' Este é um protótipo
1+
' Arquivo de teste
22
Imports System
33
Imports System.Drawing
44
Imports System.Forms
55
Imports VGA
66

7+
Module Info
8+
Dim InfoForm as Control
9+
Dim Info1Label as Control
10+
Dim Info2Label as Control
11+
Dim Info3Label as Control
12+
13+
Public Sub Exibe
14+
Form.Initialize InfoForm
15+
InfoForm.Left = 300
16+
InfoForm.Top = 30
17+
InfoForm.Width = 300
18+
InfoForm.Height = 110
19+
InfoForm.Text = "Informacoes"
20+
21+
Label.Initialize Info1Label
22+
Info1Label.Top = 5
23+
Info1Label.Left = 5
24+
Info1Label.Width = 290
25+
Info1Label.Height = 15
26+
Info1Label.Text = "- Apenas suporta letras e numeros"
27+
Info1Label.Visible = 1
28+
Control.Add InfoForm, Info1Label
29+
30+
Label.Initialize Info2Label
31+
Info2Label.Top = 25
32+
Info2Label.Left = 5
33+
Info2Label.Width = 290
34+
Info2Label.Height = 15
35+
Info2Label.Text = "- Campo de texto simples"
36+
Info2Label.Visible = 1
37+
Control.Add InfoForm, Info2Label
38+
39+
Label.Initialize Info3Label
40+
Info3Label.Top = 45
41+
Info3Label.Left = 5
42+
Info3Label.Width = 290
43+
Info3Label.Height = 15
44+
Info3Label.Text = "- Navegacao apenas usando tecla TAB"
45+
Info3Label.Visible = 1
46+
Control.Add InfoForm, Info3Label
47+
48+
Control.Show InfoForm
49+
End
50+
End
51+
752
Module Program
853

9-
' Os controles devem ser declarados no modulo
1054
Dim MainForm as Control
1155
Dim HelloWorldLabel as Control
1256
Dim OkButton as Control
57+
Dim TempTextBox as Control
58+
Dim TempText as String
59+
Dim CopiaButton as Control
1360
Dim HelloWorldText as String
1461

1562
Public Sub Main(args as String)
16-
' O Driver de Video deve ser iniciado
63+
1764
VGA.Mode640x480x2
18-
' O Motor de Aplicação deve ser iniciado
1965
Application.Initialize
2066

21-
' Os controles devem ser criados e inicializados
2267
Form.Initialize MainForm
2368
MainForm.Top = 30
2469
MainForm.Left = 10
2570
MainForm.Width = 200
26-
MainForm.Height = 100
27-
MainForm.Text = "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"
71+
MainForm.Height = 110
72+
MainForm.Text = "Navegue usando TAB"
2873

2974
Label.Initialize HelloWorldLabel
3075
String.Copy HelloWorldText, "HELLO WORLD"
3176
HelloWorldLabel.Text = HelloWorldText
3277
HelloWorldLabel.Top = 8
3378
HelloWorldLabel.Left = 4
34-
HelloWorldLabel.Width = 170
79+
HelloWorldLabel.Width = 200
3580
HelloWorldLabel.Height = 10
3681
HelloWorldLabel.Visible = 1
3782
Control.Add MainForm, HelloWorldLabel
3883

3984
Button.Initialize OkButton
40-
OkButton.Text = "Enter para SAIR"
85+
OkButton.Text = "Enter aqui para SAIR"
4186
OkButton.Top = 21
4287
OkButton.Left = 4
43-
OkButton.Width = 150
88+
OkButton.Width = 190
4489
OkButton.Height = 20
4590
OkButton.Visible = 1
4691
OkButton.OnKeyPress = AddressOf(OkButton_OnKeyPress)
4792
OkButton.OnClick = AddressOf(OkButton_OnClick)
4893
Control.Add MainForm, OkButton
4994

50-
' Deve ser iniciado o gerenciador de aplicação que tomará conta dos eventos
95+
TextBox.Initialize TempTextBox
96+
String.Copy TempText, "Digite seu nome aqui"
97+
TempTextBox.Text = TempText
98+
TempTextBox.Top = 43
99+
TempTextBox.Left = 4
100+
TempTextBox.Width = 190
101+
TempTextBox.Height = 20
102+
TempTextBox.Visible = 1
103+
TempTextBox.OnKeyPress = AddressOf(TempTextBox_OnKeyPress)
104+
Control.Add MainForm, TempTextBox
105+
106+
Button.Initialize CopiaButton
107+
CopiaButton.Text = "Aplicar Texto"
108+
CopiaButton.Top = 66
109+
CopiaButton.Left = 4
110+
CopiaButton.Width = 190
111+
CopiaButton.Height = 20
112+
CopiaButton.Visible = 1
113+
CopiaButton.OnClick = AddressOf(CopiaButton_OnClick)
114+
Control.Add MainForm, CopiaButton
115+
116+
Info.Exibe
117+
51118
Application.Run MainForm
52119

53120
Graphics.Mode80x25x16
@@ -67,4 +134,21 @@ Module Program
67134
Application.Exit 0
68135
End
69136

70-
End
137+
Sub DizHello
138+
String.Copy HelloWorldText, "Hello "
139+
String.Concat HelloWorldText, TempText
140+
Control.Redraw HelloWorldLabel
141+
End
142+
143+
Sub TempTextBox_OnKeyPress(ctrl as Control, e as KeyboardEventArgs)
144+
If e.AsciiChar == 13 Then
145+
DizHello
146+
e.Cancel = 1
147+
End
148+
End
149+
150+
Sub CopiaButton_OnClick(ctrl as Control, e as MouseEventArgs)
151+
DizHello
152+
End
153+
154+
end

Distro/Linux64/Plataformas/8086-DOS/System.OS.hcb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ module OS
119119
Catch Error
120120
Console.WriteLine "Ocorreu um erro não tratado"
121121
EscreveErro:
122+
asm "mov ax, 0x3"
123+
asm "int 0x10"
122124
Console.Write ErrorFile()
123125
Console.Write ": "
124126
Console.WriteUInt16 ErrorLine()

Distro/Linux64/Plataformas/8086/System.Forms.hcb

Lines changed: 106 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Module Control
9393
ctrl.PaddingTop = 0
9494
ctrl.Text = ""
9595
ctrl.Value = 0
96+
ctrl.CalcVisible = 0
9697
End
9798

9899
Sub GenericControlPaint(ctrl as Control)
@@ -147,6 +148,8 @@ Module Control
147148

148149
Public Sub Add(ctrl as Control, child as Control)
149150
Dim tmp as PtrByteArray
151+
Dim parent as Control
152+
parent = ctrl
150153
If ctrl.HasChild Then
151154
#tmp = #ctrl.Child
152155
@tmp = @ctrl.Child
@@ -162,11 +165,15 @@ Module Control
162165
#tmp = #child
163166
@tmp = @child
164167
ctrl.NextControl = tmp
168+
child.HasParent = 1
169+
child.Parent = parent
165170
Else
166171
ctrl.HasChild = 1
167172
#tmp = #child
168173
@tmp = @child
169174
ctrl.Child = tmp
175+
child.HasParent = 1
176+
child.Parent = parent
170177
End
171178
End
172179

@@ -264,8 +271,9 @@ Module Control
264271
Dim old as Control
265272
old = Application.CurrentFocus
266273
If #old <> 0 Then
267-
ctrl.HasFocus = 0
268-
ctrl.ControlFocusChanged.Invoke 0
274+
old.HasFocus = 0
275+
old.ControlFocusChanged.Invoke 0
276+
If old.RedrawOnFocusChanged Then Redraw old
269277
End
270278
Application.CurrentFocus = ctrl
271279
ctrl.HasFocus = 1
@@ -274,7 +282,49 @@ Module Control
274282
End
275283

276284
Public Sub ProcessKeyboard(ctrl as Control, e as KeyboardEventArgs)
277-
ctrl.ControlKeyboardInteracion.Invoke e
285+
If e.AsciiChar == 9 Then
286+
Dim next as Control
287+
next = ctrl
288+
While next.HasNextControl
289+
next = ctrl.NextControl
290+
If next.Focusable Then
291+
Focus next
292+
Return
293+
End
294+
End
295+
If ctrl.HasParent Then
296+
Dim i as UInt16
297+
Dim max as UInt16
298+
max = Count(ctrl.Parent)
299+
For i = 1 to max
300+
next = Item(ctrl.Parent, i)
301+
If next.Focusable Then
302+
Focus next
303+
Return
304+
End
305+
End
306+
End
307+
Else
308+
ctrl.ControlKeyboardInteracion.Invoke e
309+
End
310+
End
311+
312+
Public Sub Show(ctrl as Control)
313+
If ctrl.HasParent == 0 Then
314+
Add Screen.ScreenControl, ctrl
315+
End
316+
ctrl.Visible = 1
317+
Dim parent as Control
318+
parent = ctrl.Parent
319+
If parent.CalcVisible Then Redraw ctrl
320+
End
321+
322+
Public Sub Hide(ctrl as Control)
323+
If ctrl.HasParent == 0 Then Return
324+
ctrl.Visible = 0
325+
Dim parent as Control
326+
parent = ctrl.Parent
327+
If parent.CalcVisible Then Redraw parent
278328
End
279329

280330
End
@@ -289,15 +339,68 @@ Module Screen
289339
ScreenControl.Width = Graphics.GetWidth()
290340
ScreenControl.Height = Graphics.GetHeight()
291341
ScreenControl.Visible = 1
342+
ScreenControl.CalcVisible = 0
292343
ScreenControl.ControlPaint = AddressOf(ControlPaint)
293344
End
294345

295346
Sub ControlPaint(ctrl as Control)
347+
ScreenControl.CalcVisible = 1
296348
Graphics.ClearScreen SystemColors.BackgroundColor()
297349
Control.DrawChildren ctrl
298350
End
299351
End
300352

353+
Module TextBox
354+
Public Sub Initialize(ctrl as Control)
355+
Control.Initialize ctrl
356+
ctrl.ControlPaint = AddressOf(ControlPaint)
357+
ctrl.ControlKeyboardInteracion = AddressOf(ControlKeyboardInteracion)
358+
End
359+
360+
Sub ControlKeyboardInteracion(ctrl as Control, e as KeyboardEventArgs)
361+
If e.Pressed Then
362+
Dim ptr as PtrByteArray
363+
Dim len as UInt16
364+
e.Cancel = 0
365+
ctrl.OnKeyPress.Invoke e
366+
If e.Cancel == 0 Then
367+
If e.AsciiChar == 8 Then
368+
ptr = ctrl.Text
369+
len = String.Length(ctrl.Text)
370+
If len > 0 Then
371+
@ptr = @ptr + len
372+
ptr = 0
373+
Control.Redraw ctrl
374+
End
375+
Return
376+
End
377+
If (e.AsciiChar <> 13) AndAlso (e.AsciiChar <> 10) Then
378+
Dim txt as String
379+
len = String.Length(ctrl.Text)
380+
ptr = ctrl.Text
381+
If ptr < (len + 2) Then Return
382+
txt = New
383+
ptr = txt
384+
@ptr++
385+
ptr = e.AsciiChar
386+
@ptr++
387+
ptr = 0
388+
String.Concat ctrl.Text, txt
389+
Control.Redraw ctrl
390+
End
391+
End
392+
Else
393+
ctrl.OnKeyRelease.Invoke e
394+
End
395+
End
396+
397+
Sub ControlPaint(ctrl as Control)
398+
Graphics.DrawRectangle ctrl.CalcX1, ctrl.CalcY1, ctrl.CalcX2, ctrl.CalcY2, SystemColors.WindowBorderColor(), SystemColors.WindowColor()
399+
If ctrl.HasFocus <> 0 Then Graphics.DrawLine ctrl.CalcX1 + 4, ctrl.CalcY2 - 2, ctrl.CalcX2 - 4, Ctrl.CalcY2 - 2, SystemColors.WindowBorderColor()
400+
Graphics.DrawText ctrl.Font, ctrl.Text, ctrl.CalcX1 + 4, ctrl.CalcY1 + 4, ctrl.CalcX2 - 4, ctrl.CalcY2 - 4, SystemColors.TextColor(), 1
401+
End
402+
End
403+
301404
Module Button
302405
Public Sub Initialize(ctrl as Control)
303406
Control.Initialize ctrl

0 commit comments

Comments
 (0)