Skip to content

Commit 22a7ccc

Browse files
committed
Initial Release
0 parents  commit 22a7ccc

23 files changed

+5106
-0
lines changed

.component

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[Component]
2+
Key=CheckedListBox
3+
Version=1.0.0
4+
Authors=RealityRipple Software
5+
Needs=Form

.directory

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Desktop Entry]
2+
Icon=./.icon.png

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#---- Gambas files to ignore (v5)
2+
*.gambas
3+
.lock
4+
*~
5+
core
6+
core.*
7+
vgcore
8+
vgcore.*
9+
.kdbg*
10+
.*.prof
11+
.lang/*.pot
12+
.gambas/*
13+
.settings
14+
.startup
15+
.list
16+
.info
17+
#----

.hidden/CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* Fri Feb 07 2020 Andrew Sachen <[email protected]> 1.0.0
2+
- Initial release
3+

.hidden/control/checkedlistbox.png

175 Bytes
Loading

.icon.png

6.68 KB
Loading

.project

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Gambas Project File 3.0
2+
Title=Checked ListBox Control
3+
Startup=Main
4+
Icon=.hidden/control/checkedlistbox.png
5+
Version=1.0.0
6+
Component=gb.image
7+
Component=gb.gui
8+
Description="Gambas Component providing a Listbox Control with Checkboxes for each item."
9+
Authors="RealityRipple Software"
10+
TabSize=2
11+
Language=en_US
12+
KeepDebugInfo=0
13+
Type=Component
14+
SourcePath=/home/andy/Documents/Gambas/Packages/CheckedListBox
15+
Maintainer=Andrew Sachen
16+
Vendor=RealityRipple
17+
VendorPrefix=rrs
18+
19+
Url=realityripple.com
20+
License=Public Domain
21+
Prefix=1
22+
PackageName=gambas3-rrs-checkedlistbox-1.0.0
23+
CreateEachDirectory=1
24+
RuntimeVersion="3.13"
25+
Packager=1
26+
Systems=autotools,debian,fedora,mageia,suse,slackware,ubuntu
27+
SameDependencies=1
28+
SameFiles=1
29+
Groups=debian:"devel"
30+
Groups=fedora:"Development/Libraries"
31+
Groups=mageia:"Development/Basic"
32+
Groups=slackware:"Development/Libraries"
33+
Groups=suse:"Development/Libraries/Other"
34+
Groups=ubuntu:"devel"
35+
Tags=Development,TextTools
36+
GambasVersion=3.14
37+
WebSite=https://realityripple.com
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
' Gambas class file
2+
3+
Private $aChk As New Integer[]
4+
5+
' Private Sub Dump()
6+
'
7+
' Dim I As Integer
8+
' '
9+
' ' Print System.Backtrace.Join(" ")
10+
' '
11+
' Print "Checked = ";
12+
' For I = 0 To $aChk.Max Step 2
13+
' Print "["; $aChk[I]; ","; $aChk[I + 1]; "] ";
14+
' Next
15+
' Print
16+
'
17+
' End
18+
' '
19+
20+
Public Sub SetChecked(aChk As Integer[])
21+
22+
$aChk = aChk
23+
24+
End
25+
26+
Public Sub Copy() As CheckedGridViewChecked
27+
28+
Dim hChk As CheckedGridViewChecked = New CheckedGridViewChecked
29+
30+
hChk.SetChecked($aChk.Copy())
31+
Return hChk
32+
33+
End
34+
35+
Public Sub Check(iStart As Integer, Optional iLength As Integer = 1)
36+
37+
Dim I, S, L As Integer
38+
39+
For I = 0 To $aChk.Max Step 2
40+
41+
S = $aChk[I]
42+
L = $aChk[I + 1]
43+
44+
If iStart >= S And If iStart <= (S + L) Then
45+
$aChk[I + 1] = iStart + iLength - S
46+
'Dump
47+
Return
48+
Else If (iStart + iLength) >= S And If (iStart + iLength) <= (S + L) Then
49+
$aChk[I + 1] += $aChk[I] - iStart
50+
$aChk[I] = iStart
51+
'Dump
52+
Return
53+
Endif
54+
55+
Next
56+
57+
$aChk.Add(iStart)
58+
$aChk.Add(iLength)
59+
'Dump
60+
61+
End
62+
63+
Public Sub UnCheck(iStart As Integer, Optional iLength As Integer = 1)
64+
65+
Dim I, S, L As Integer
66+
67+
I = 0
68+
While I < $aChk.Count
69+
70+
S = $aChk[I]
71+
L = $aChk[I + 1]
72+
73+
If (iStart + iLength) > S And If iStart < (S + L) Then
74+
75+
If iStart <= S And If (iStart + iLength) >= (S + L) Then
76+
$aChk.Remove(I, 2)
77+
Continue
78+
Endif
79+
80+
If iStart <= S Then
81+
$aChk[I + 1] -= iStart + iLength - S
82+
$aChk[I] = iStart + iLength
83+
Else If (iStart + iLength) >= (S + L) Then
84+
$aChk[I + 1] = iStart - S
85+
Else
86+
$aChk[I + 1] = iStart - S
87+
$aChk.Add(iStart + iLength)
88+
$aChk.Add(S + L - iStart - iLength)
89+
Endif
90+
91+
Endif
92+
93+
I += 2
94+
Wend
95+
'Dump
96+
97+
End
98+
99+
Public Sub UnCheckAll()
100+
101+
$aChk.Clear
102+
'Dump
103+
104+
End
105+
106+
Public Sub IsChecked(iIndex As Integer) As Boolean
107+
108+
Dim I, S, L As Integer
109+
110+
For I = 0 To $aChk.Max Step 2
111+
112+
S = $aChk[I]
113+
L = $aChk[I + 1]
114+
115+
If iIndex >= S And iIndex < (S + L) Then Return True
116+
117+
Next
118+
119+
End
120+
121+
Public Function _GetCheckedRows(iCount As Integer) As Integer[]
122+
123+
Dim aRet As New Integer[]
124+
Dim I, J, S, L As Integer
125+
126+
For I = 0 To $aChk.Max Step 2
127+
S = $aChk[I]
128+
L = $aChk[I + 1]
129+
130+
For J = 0 To L - 1
131+
If (S + J) >= iCount Then Break
132+
aRet.Add(S + J)
133+
Next
134+
Next
135+
136+
Return aRet
137+
138+
End
139+
140+
Public Sub InsertRows(iStart As Integer, iLength As Integer)
141+
142+
Dim I, S, L As Integer
143+
144+
For I = 0 To $aChk.Max Step 2
145+
146+
S = $aChk[i]
147+
L = $aChk[I + 1]
148+
149+
If iStart <= S Then
150+
$aChk[I] += iLength
151+
Else If iStart <= (S + L) Then
152+
$aChk[I + 1] = iStart - S
153+
$aChk.Add(iStart + iLength)
154+
$aChk.Add(L - (iStart - S))
155+
Endif
156+
157+
Next
158+
159+
'Dump
160+
161+
End
162+
163+
Public Sub RemoveRows(iStart As Integer, iLength As Integer)
164+
165+
Dim I, S, L As Integer
166+
167+
I = 0
168+
While I < $aChk.Count
169+
170+
S = $aChk[I]
171+
L = $aChk[I + 1]
172+
173+
If (iStart + iLength) <= S Then
174+
$aChk[I] -= iLength
175+
Else If iStart >= (S + L) Then
176+
Else
177+
If iStart < S Then
178+
iLength -= (S - iStart)
179+
$aChk[I] = iStart
180+
Endif
181+
$aChk[I + 1] -= iLength - (iStart - S)
182+
Endif
183+
184+
If $aChk[I + 1] <= 0 Then
185+
$aChk.Remove(I, 2)
186+
Else
187+
I += 2
188+
Endif
189+
190+
Wend
191+
192+
'Dump
193+
194+
End

0 commit comments

Comments
 (0)