[DEVELOPMENT ENVIRONMENT]
* NEW: Project property dialog: New project arguments interface. * NEW: Debugger: The project arguments is now selectable with a popup menu. * BUG: Fix position history behaviour. [INTERPRETER] * NEW: Object.Type(), Object.Class() and Object.Is() now work with invalid objects. [GB.FORM] * NEW: Completion: Support for TextArea editor. * NEW: Completion: Editor property is now writable. * NEW: TableView: Raise a new Hide event when the editor is hidden. [GB.FORM.EDITOR] * NEW: TextEditor: CursorAt() is a new method that returns the cursor screen position from a line and a column. [GB.GTK] * NEW: TextBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: ComboBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: TextArea: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. [GB.GTK3] * NEW: TextBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: ComboBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: TextArea: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. [GB.GUI.BASE] * BUG: GridView: Newlines in cells with WordWrap property set are now taken into account correctly. [GB.QT4] * NEW: TextBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: ComboBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: TextArea: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. [GB.QT5] * NEW: TextBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: ComboBox: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. * NEW: TextArea: CursorAt() is a new method that returns the cursor screen position from a text position. The CursorPos property has been removed. git-svn-id: svn://localhost/gambas/trunk@7825 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
40bc4ec9ec
commit
2a3ecf982d
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ Component=gb.util
|
||||
Description="Integrated Development Environment for Gambas"
|
||||
Authors="Benoît Minisini\nFabien Bodard\nCharlie Reinl\nJosé Luis Redrejo\nRobert Rowe\nTobias Boege"
|
||||
Arguments=[["-t","/home/benoit/gambas/3.0/trunk/app/src/gambas3"]]
|
||||
CurrentArgument=1
|
||||
CurrentArgument=0
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
@ -53,5 +53,5 @@ Groups=slackware:"Development/Languages"
|
||||
Menus=ubuntu:"Applications/Amateur Radio"
|
||||
Categories=ubuntu:"Audio;AudioVideo"
|
||||
Groups=ubuntu:"devel"
|
||||
Tags=Database,Development,GUIDesigner,IDE,MySQL,PostgreSQL,SQLite
|
||||
Tags=Database,Development,GUIDesigner,IDE,MySQL,PostgreSQL,SQLite,Test
|
||||
WebSite=http://gambas.sourceforge.net
|
||||
|
@ -897,9 +897,12 @@ Private Sub Start(sCmd As String)
|
||||
|
||||
aExec.Add(File.Dir(SConv(Project.Path)))
|
||||
|
||||
If Project.Arguments.Count And If Project.CurrentArgument < Project.Arguments.Count Then
|
||||
aExec.Add("--")
|
||||
aExec.Insert(Project.Arguments[Project.CurrentArgument])
|
||||
If Project.Arguments.Count Then
|
||||
iPos = Project.CurrentArgument - 1
|
||||
If iPos >= 0 And If iPos < Project.Arguments.Count Then
|
||||
aExec.Add("--")
|
||||
aExec.Insert(Project.Arguments[iPos])
|
||||
Endif
|
||||
Endif
|
||||
|
||||
If bValgrind Then
|
||||
|
@ -2683,3 +2683,41 @@ Public Sub panDebug_Hide()
|
||||
FDebugButton.OnVisibilityChange
|
||||
|
||||
End
|
||||
|
||||
Public Sub mnuRunWith_Show()
|
||||
|
||||
Dim hMenu As Menu
|
||||
Dim I As Integer
|
||||
|
||||
mnuRunWith.Children.Clear
|
||||
|
||||
hMenu = New Menu(mnuRunWith) As "runWithNoArg"
|
||||
hMenu.Text = ("No argument")
|
||||
hMenu.Radio = True
|
||||
If Project.CurrentArgument = 0 Then hMenu.Value = True
|
||||
|
||||
hMenu = New Menu(mnuRunWith)
|
||||
|
||||
For I = 0 To Project.Arguments.Max
|
||||
hMenu = New Menu(mnuRunWith) As "runWithArg"
|
||||
hMenu.Text = Project.ArgumentToString(Project.Arguments[I])
|
||||
hMenu.Radio = True
|
||||
hMenu.Tag = I + 1
|
||||
If Project.CurrentArgument = I + 1 Then hMenu.Value = True
|
||||
Next
|
||||
|
||||
End
|
||||
|
||||
Public Sub runWithNoArg_Click()
|
||||
|
||||
Project.CurrentArgument = 0
|
||||
Project.WriteProject
|
||||
|
||||
End
|
||||
|
||||
Public Sub runWithArg_Click()
|
||||
|
||||
Project.CurrentArgument = Last.Tag
|
||||
Project.WriteProject
|
||||
|
||||
End
|
||||
|
@ -208,6 +208,16 @@
|
||||
Picture = Picture["icon:/small/play"]
|
||||
Shortcut = "F5"
|
||||
}
|
||||
{ mnuRunWith Menu
|
||||
Text = ("Run with")
|
||||
{ mnuRunWithNoArg Menu
|
||||
Text = ("No argument")
|
||||
Radio = True
|
||||
Checked = True
|
||||
}
|
||||
}
|
||||
{ Menu36 Menu
|
||||
}
|
||||
{ mnuUseTerminal Menu
|
||||
Action = "terminal"
|
||||
Text = Shortcut(("Use terminal emulator"), "t")
|
||||
@ -899,45 +909,47 @@
|
||||
Action = "compile-all"
|
||||
Picture = Picture["icon:/small/make-all"]
|
||||
}
|
||||
{ btnGo ToolButton
|
||||
MoveScaled(70,0,4,4)
|
||||
{ btnGo MenuButton
|
||||
MoveScaled(70,0,6,4)
|
||||
ToolTip = ("Run")
|
||||
Action = "start"
|
||||
Picture = Picture["icon:/small/play"]
|
||||
Border = False
|
||||
Menu = "mnuRunWith"
|
||||
}
|
||||
{ btnPause ToolButton
|
||||
MoveScaled(73,0,4,4)
|
||||
MoveScaled(75,0,4,4)
|
||||
ToolTip = ("Pause")
|
||||
Action = "pause"
|
||||
Picture = Picture["icon:/small/pause"]
|
||||
}
|
||||
{ btnStop ToolButton
|
||||
MoveScaled(76,0,4,4)
|
||||
MoveScaled(78,0,4,4)
|
||||
ToolTip = ("Stop")
|
||||
Action = "stop"
|
||||
Picture = Picture["icon:/small/stop"]
|
||||
}
|
||||
{ btnStep ToolButton
|
||||
MoveScaled(79,0,4,4)
|
||||
MoveScaled(81,0,4,4)
|
||||
ToolTip = ("Step")
|
||||
Action = "step"
|
||||
Picture = Picture["icon:/small/end"]
|
||||
}
|
||||
{ btnForward ToolButton
|
||||
MoveScaled(82,0,4,4)
|
||||
MoveScaled(84,0,4,4)
|
||||
ToolTip = ("Forward")
|
||||
Action = "forward"
|
||||
Picture = Picture["icon:/small/forward"]
|
||||
}
|
||||
{ btnFrom ToolButton
|
||||
MoveScaled(84,0,4,4)
|
||||
MoveScaled(86,0,4,4)
|
||||
ToolTip = ("Finish current function")
|
||||
Action = "return"
|
||||
Picture = Picture["icon:/small/eject"]
|
||||
}
|
||||
{ btnUntil ToolButton mnuUntil
|
||||
Name = "btnUntil"
|
||||
MoveScaled(87,0,4,4)
|
||||
MoveScaled(89,0,4,4)
|
||||
ToolTip = ("Run until current line")
|
||||
Action = "until"
|
||||
Picture = Picture["icon:/small/jump"]
|
||||
|
@ -2269,9 +2269,12 @@ Public Sub OpenFile(sPath As String, Optional iLine As Integer, Optional iColumn
|
||||
hForm = Files[sPath]
|
||||
If Not hForm Then Return
|
||||
|
||||
ShowFile(hForm)
|
||||
|
||||
CPosition.Disable
|
||||
Try ShowFile(hForm)
|
||||
If Error Then
|
||||
CPosition.Enable
|
||||
Error.Raise(Error.Text)
|
||||
Endif
|
||||
|
||||
If iLine Then
|
||||
Try hForm.GotoCenter(iLine - 1, iColumn)
|
||||
@ -6355,3 +6358,22 @@ Public Sub RevertFile(sPath As String)
|
||||
Dec Application.Busy
|
||||
|
||||
End
|
||||
|
||||
Public Sub ArgumentToString(aArg As String[]) As String
|
||||
|
||||
Dim sResult As String
|
||||
Dim sArg As String
|
||||
|
||||
For Each sArg In aArg
|
||||
If sResult Then sResult &= " "
|
||||
If InStr(sArg, " ") Or If InStr(sArg, Chr$(34)) Then
|
||||
sResult &= Chr$(34) & Replace(sArg, Chr$(34), Chr$(34) & Chr$(34)) & Chr$(34)
|
||||
Else
|
||||
sResult &= sArg
|
||||
Endif
|
||||
Next
|
||||
|
||||
Return sResult
|
||||
|
||||
End
|
||||
|
||||
|
142
app/src/gambas3/.src/Project/ArgListBox.class
Normal file
142
app/src/gambas3/.src/Project/ArgListBox.class
Normal file
@ -0,0 +1,142 @@
|
||||
' Gambas class file
|
||||
|
||||
Inherits DrawingArea
|
||||
|
||||
Event Activate
|
||||
Event Cancel
|
||||
|
||||
Property Text As String
|
||||
|
||||
Static Private $hComp As FileCompletion
|
||||
|
||||
Private $hTextBox As TextBox
|
||||
|
||||
Public Sub _new()
|
||||
|
||||
$hTextBox = New TextBox(Me) As "TextBox"
|
||||
$hTextBox.Border = False
|
||||
AutoResize
|
||||
|
||||
Me.Proxy = $hTextBox
|
||||
|
||||
End
|
||||
|
||||
Private Sub AutoResize()
|
||||
|
||||
Me.Resize(Me.Font.TextWidth($hTextBox.Text) + Desktop.Scale * 2, Desktop.Scale * 3)
|
||||
$hTextBox.Move(1, 1, Me.W - 2, Me.H - 2)
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Function Text_Read() As String
|
||||
|
||||
Return $hTextBox.Text
|
||||
|
||||
End
|
||||
|
||||
Private Sub Text_Write(Value As String)
|
||||
|
||||
$hTextBox.Text = Value
|
||||
|
||||
End
|
||||
|
||||
Public Sub TextBox_Change()
|
||||
|
||||
AutoResize
|
||||
|
||||
End
|
||||
|
||||
Public Sub TextBox_GotFocus()
|
||||
|
||||
If Not $hComp Then
|
||||
$hComp = New FileCompletion(Last)
|
||||
Else
|
||||
$hComp.Editor = Last
|
||||
Endif
|
||||
|
||||
Me.Border = Border.Plain
|
||||
|
||||
End
|
||||
|
||||
Public Sub TextBox_LostFocus()
|
||||
|
||||
Me.Border = Border.None
|
||||
|
||||
End
|
||||
|
||||
Public Sub TextBox_KeyPress()
|
||||
|
||||
Dim hArg As ArgListBox
|
||||
|
||||
If Key.Normal Then
|
||||
|
||||
If Key.Code = Key.Left Then
|
||||
|
||||
If $hTextBox.Pos = 0 Then
|
||||
hArg = Me.Previous
|
||||
If hArg And If Object.IsValid(hArg) Then
|
||||
hArg.SetFocus
|
||||
hArg.MoveEnd
|
||||
Stop Event
|
||||
Endif
|
||||
Endif
|
||||
|
||||
Else If Key.Code = Key.Right Then
|
||||
|
||||
If $hTextBox.Pos = $hTextBox.Length Then
|
||||
hArg = Me.Next
|
||||
If hArg Then
|
||||
hArg.SetFocus
|
||||
hArg.MoveBegin
|
||||
Stop Event
|
||||
Endif
|
||||
Endif
|
||||
|
||||
Else If Key.Code = Key.Return Or If Key.Code = Key.Enter Then
|
||||
|
||||
Raise Activate
|
||||
Stop Event
|
||||
|
||||
Else If Key.Code = Key.Delete Then
|
||||
|
||||
If $hTextBox.Length = 0 Then
|
||||
Me.Delete
|
||||
Stop Event
|
||||
Endif
|
||||
|
||||
Else If Key.Code = Key.Backspace Then
|
||||
|
||||
If $hTextBox.Length = 0 Then
|
||||
hArg = Me.Previous
|
||||
Me.Delete
|
||||
If hArg And If Object.IsValid(hArg) Then
|
||||
hArg.SetFocus
|
||||
hArg.MoveEnd
|
||||
Endif
|
||||
Stop Event
|
||||
Endif
|
||||
|
||||
Else If Key.Code = Key.Escape Then
|
||||
|
||||
Raise Cancel
|
||||
Stop Event
|
||||
|
||||
Endif
|
||||
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub MoveBegin()
|
||||
|
||||
$hTextBox.Pos = 0
|
||||
|
||||
End
|
||||
|
||||
Public Sub MoveEnd()
|
||||
|
||||
$hTextBox.Pos = $hTextBox.Length
|
||||
|
||||
End
|
||||
|
170
app/src/gambas3/.src/Project/ArgListEditor.class
Normal file
170
app/src/gambas3/.src/Project/ArgListEditor.class
Normal file
@ -0,0 +1,170 @@
|
||||
' Gambas class file
|
||||
|
||||
Export
|
||||
|
||||
Inherits UserControl
|
||||
|
||||
Event Click
|
||||
|
||||
Property Selected As Boolean
|
||||
|
||||
Private $hPanel As DrawingArea
|
||||
Private $bSelected As Boolean
|
||||
|
||||
Public Sub _new()
|
||||
|
||||
Me._Arrangement = Arrange.Fill
|
||||
|
||||
$hPanel = New DrawingArea(Me) As "Panel"
|
||||
$hPanel.Background = Color.TextBackground
|
||||
$hPanel.Foreground = Color.TextForeground
|
||||
$hPanel.Arrangement = Arrange.LeftRight
|
||||
'$hPanel.Spacing = True
|
||||
$hPanel.Margin = True
|
||||
|
||||
Set(Null)
|
||||
|
||||
End
|
||||
|
||||
Private Sub Add(Optional sArg As String)
|
||||
|
||||
Dim hArg As ArgListBox
|
||||
|
||||
hArg = New ArgListBox($hPanel) As "ArgListBox"
|
||||
hArg.Text = sArg
|
||||
|
||||
End
|
||||
|
||||
Public Sub Set(aArg As String[])
|
||||
|
||||
Dim sArg As String
|
||||
|
||||
$hPanel.Children.Clear
|
||||
|
||||
If aArg Then
|
||||
For Each sArg In aArg
|
||||
Add(sArg)
|
||||
Next
|
||||
Endif
|
||||
|
||||
Add()
|
||||
|
||||
ResizePanel
|
||||
|
||||
End
|
||||
|
||||
Public Sub Get() As String[]
|
||||
|
||||
Dim aArg As New String[]
|
||||
Dim I As Integer
|
||||
Dim hArg As ArgListBox
|
||||
|
||||
For I = 0 To $hPanel.Children.Count - 1
|
||||
hArg = $hPanel.Children[I]
|
||||
aArg.Add(hArg.Text)
|
||||
Next
|
||||
|
||||
While Not aArg[aArg.Max]
|
||||
aArg.Remove(aArg.Max)
|
||||
If aArg.Count = 0 Then Break
|
||||
Wend
|
||||
|
||||
Return aArg
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Sub ResizePanel()
|
||||
|
||||
Dim H As Integer
|
||||
|
||||
With $hPanel.Children[$hPanel.Children.Count - 1]
|
||||
H = .Y + .H + Desktop.Scale
|
||||
End With
|
||||
|
||||
H = Max(H, Desktop.Scale * 5)
|
||||
|
||||
Me.H = H
|
||||
|
||||
End
|
||||
|
||||
Public Sub Panel_Arrange()
|
||||
|
||||
ResizePanel
|
||||
|
||||
End
|
||||
|
||||
Public Sub SetFocus()
|
||||
|
||||
Dim hArg As ArgListBox
|
||||
|
||||
Try hArg = $hPanel.Children[$hPanel.Children.Count - 1]
|
||||
If Not hArg Or If hArg.Text Then Add()
|
||||
|
||||
$hPanel.Children[$hPanel.Children.Count - 1].SetFocus
|
||||
|
||||
Raise Click
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub Panel_MouseDown()
|
||||
|
||||
SetFocus
|
||||
|
||||
End
|
||||
|
||||
Private Function Selected_Read() As Boolean
|
||||
|
||||
Return $bSelected
|
||||
|
||||
End
|
||||
|
||||
Private Sub Selected_Write(Value As Boolean)
|
||||
|
||||
If $bSelected = Value Then Return
|
||||
$bSelected = Value
|
||||
$hPanel.Refresh
|
||||
|
||||
End
|
||||
|
||||
Public Sub Panel_Draw()
|
||||
|
||||
If $bSelected Then
|
||||
Paint.Rectangle(1, 1, Paint.W - 2, Paint.H - 2)
|
||||
Paint.LineWidth = 2
|
||||
Paint.Background = Color.SelectedBackground
|
||||
Paint.Stroke
|
||||
Else
|
||||
Paint.Rectangle(0.5, 0.5, Paint.W - 1, Paint.H - 1)
|
||||
Paint.LineWidth = 1
|
||||
Paint.Background = Color.LightForeground
|
||||
Paint.Stroke
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub ArgListBox_GotFocus()
|
||||
|
||||
Raise Click
|
||||
|
||||
End
|
||||
|
||||
Public Sub ArgListBox_Activate()
|
||||
|
||||
Dim hArg As ArgListBox
|
||||
|
||||
hArg = Last
|
||||
If Not hArg.Next And If hArg.Text Then Add()
|
||||
Try hArg.Next.SetFocus
|
||||
|
||||
End
|
||||
|
||||
Public Sub ArgListBox_Cancel()
|
||||
|
||||
Me.Selected = False
|
||||
Me.Parent.SetFocus
|
||||
|
||||
End
|
||||
|
||||
|
@ -8,7 +8,6 @@ Private $sIcon As String
|
||||
|
||||
Private $bCanInitComponents As Boolean
|
||||
|
||||
Private $aArg As String[][]
|
||||
Private $aEnv As String[]
|
||||
|
||||
Private $aComponents As String[]
|
||||
@ -24,7 +23,6 @@ Private $aNeed As String[]
|
||||
Private $aRequire As String[]
|
||||
Private $aExclude As String[]
|
||||
Private $aImplement As String[]
|
||||
Private $hComp As FileCompletion
|
||||
Private $iCurrentLibrary As Integer
|
||||
|
||||
Static Public Function Run() As Boolean
|
||||
@ -127,23 +125,15 @@ Public Sub Form_Activate()
|
||||
End
|
||||
|
||||
Private Sub InitEnvironment()
|
||||
|
||||
Dim I As Integer
|
||||
|
||||
$aArg = Project.Arguments.Copy()
|
||||
For I = 0 To $aArg.Max
|
||||
$aArg[I] = $aArg[I].Copy()
|
||||
|
||||
Dim aArg As String[]
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
|
||||
svwArgList.Children.Clear
|
||||
For Each aArg In Project.Arguments
|
||||
hArgListEditor = New ArgListEditor(svwArgList) As "ArgListEditor"
|
||||
hArgListEditor.Set(aArg)
|
||||
Next
|
||||
$aArg.Add([])
|
||||
|
||||
CleanUpArgument
|
||||
|
||||
Object.Lock(cmbArgument)
|
||||
cmbArgument.Index = Project.CurrentArgument
|
||||
Object.Unlock(cmbArgument)
|
||||
cmbArgument_Click
|
||||
|
||||
$hComp = New FileCompletion(lstArgument.Editor)
|
||||
|
||||
tvwEnv.Columns.Count = 2
|
||||
tvwEnv.Columns[0].Text = ("Variable")
|
||||
@ -161,7 +151,9 @@ End
|
||||
Private Sub SaveEnvironment()
|
||||
|
||||
Dim iInd As Integer
|
||||
Dim iArg As Integer
|
||||
Dim aArgList As String[][]
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
Dim aArg As String[]
|
||||
|
||||
tvwEnv.Save
|
||||
|
||||
@ -173,12 +165,14 @@ Private Sub SaveEnvironment()
|
||||
Endif
|
||||
Wend
|
||||
|
||||
iArg = cmbArgument.Index
|
||||
UpdateArgument
|
||||
If iArg < 0 Or If iArg >= $aArg.Count Then iArg = $aArg.Max
|
||||
aArgList = New String[][]
|
||||
For Each hArgListEditor In svwArgList.Children
|
||||
aArg = hArgListEditor.Get()
|
||||
If aArg.Count = 0 Then Continue
|
||||
aArgList.Add(aArg)
|
||||
Next
|
||||
|
||||
Project.CurrentArgument = iArg
|
||||
Project.Arguments = $aArg.Copy(0, $aArg.Max)
|
||||
Project.Arguments = aArgList
|
||||
|
||||
Project.Environment = $aEnv
|
||||
|
||||
@ -1184,85 +1178,184 @@ Public Sub gvwLibrary_Select()
|
||||
|
||||
End
|
||||
|
||||
Public Sub cmbArgument_Click()
|
||||
' Public Sub btnNewArgument_Click()
|
||||
'
|
||||
' Dim aArg As String[]
|
||||
'
|
||||
' tbvArgument.Save
|
||||
'
|
||||
' aArg = New String[]
|
||||
' $aArg.Add(aArg)
|
||||
'
|
||||
' tbvArgument.Rows.Count = $aArg.Count
|
||||
'
|
||||
' tbvArgument.Row = $aArg.Max
|
||||
' tbvArgument.Edit
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub tbvArgument_Click()
|
||||
'
|
||||
' btnMoveDownArg.Enabled = tbvArgument.Row >= 0 And tbvArgument.Row < $aArg.Max
|
||||
' btnMoveUpArg.Enabled = tbvArgument.Row > 0
|
||||
' tbvArgument.EditWith(txtArgument)
|
||||
' $hComp = New FileCompletion(txtArgument)
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub tbvArgument_Save(Row As Integer, (Column) As Integer, Value As String)
|
||||
'
|
||||
' $aArg[Row] = ArgumentFromString(Value)
|
||||
' tbvArgument.Rows[Row].Height = -1
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub tbvArgument_Hide()
|
||||
'
|
||||
' btnMoveDownArg.Enabled = False
|
||||
' btnMoveUpArg.Enabled = False
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub btnMoveUpArg_Click()
|
||||
'
|
||||
' tbvArgument.Save
|
||||
' Swap $aArg[tbvArgument.Row], $aArg[tbvArgument.Row - 1]
|
||||
' tbvArgument.Refresh
|
||||
' UpdateArguments
|
||||
' Dec tbvArgument.Row
|
||||
' tbvArgument_Click
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub btnMoveDownArg_Click()
|
||||
'
|
||||
' tbvArgument.Save
|
||||
' Swap $aArg[tbvArgument.Row], $aArg[tbvArgument.Row + 1]
|
||||
' tbvArgument.Refresh
|
||||
' UpdateArguments
|
||||
' Inc tbvArgument.Row
|
||||
' tbvArgument_Click
|
||||
'
|
||||
' End
|
||||
'
|
||||
' Public Sub tbvArgument_Insert()
|
||||
'
|
||||
' btnNewArgument_Click
|
||||
'
|
||||
' End
|
||||
|
||||
lstArgument.List = $aArg[cmbArgument.Index]
|
||||
lstArgument.SetFocus
|
||||
Private Sub UpdateArgButtons()
|
||||
|
||||
Dim iCurrent As Integer
|
||||
|
||||
iCurrent = GetCurrentArgListEditor()
|
||||
|
||||
btnMoveDownArg.Enabled = iCurrent >= 0 And iCurrent < svwArgList.Children.Count - 1
|
||||
btnMoveUpArg.Enabled = iCurrent > 0
|
||||
btnRemoveArgument.Enabled = iCurrent >= 0
|
||||
|
||||
End
|
||||
|
||||
Private Sub CleanUpArgument()
|
||||
Public Sub ArgListEditor_Click()
|
||||
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
Dim hChild As ArgListEditor
|
||||
|
||||
hArgListEditor = Last
|
||||
If hArgListEditor.Selected Then Return
|
||||
|
||||
For Each hChild In svwArgList.Children
|
||||
hChild.Selected = hChild = hArgListEditor
|
||||
Next
|
||||
|
||||
UpdateArgButtons
|
||||
|
||||
End
|
||||
|
||||
Private Sub GetCurrentArgListEditor() As Integer
|
||||
|
||||
Dim I As Integer
|
||||
Dim hChild As ArgListEditor
|
||||
|
||||
I = 0
|
||||
While I < $aArg.Max
|
||||
If $aArg[I].Count = 0 Then
|
||||
$aArg.Remove(I)
|
||||
Else
|
||||
Inc I
|
||||
Endif
|
||||
Wend
|
||||
|
||||
Object.Lock(cmbArgument)
|
||||
cmbArgument.Clear
|
||||
For I = 0 To $aArg.Max
|
||||
cmbArgument.Add("")
|
||||
UpdateArgument(I)
|
||||
For I = 0 To svwArgList.Children.Count - 1
|
||||
hChild = svwArgList.Children[I]
|
||||
If hChild.Selected Then Return I
|
||||
Next
|
||||
Object.Unlock(cmbArgument)
|
||||
cmbArgument.Index = cmbArgument.Count - 1
|
||||
|
||||
Return -1
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Sub UpdateArgument(Optional iInd As Integer = -1)
|
||||
Public Sub btnNewArgument_Click()
|
||||
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
|
||||
hArgListEditor = New ArgListEditor(svwArgList) As "ArgListEditor"
|
||||
hArgListEditor.SetFocus
|
||||
|
||||
Dim sArg As String
|
||||
|
||||
If iInd < 0 Then iInd = cmbArgument.Index
|
||||
|
||||
sArg = $aArg[iInd].Join(" ")
|
||||
If Not sArg Then
|
||||
If iInd < $aArg.Max Then
|
||||
CleanUpArgument
|
||||
Return
|
||||
Endif
|
||||
Else If iInd = $aArg.Max Then
|
||||
$aArg.Add([])
|
||||
cmbArgument.Add("")
|
||||
Endif
|
||||
|
||||
If Not sArg Then sArg = ("No argument")
|
||||
If $aArg.Count >= 2 Then sArg = CStr(iInd + 1) & " ‣ " & sArg
|
||||
cmbArgument[iInd].Text = sArg
|
||||
|
||||
cmbArgument.Enabled = cmbArgument.Count >= 2
|
||||
btnRemoveArgument.Enabled = cmbArgument.Index < cmbArgument.Count - 1
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnRemoveArgument_Click()
|
||||
|
||||
Dim iCurrent As Integer
|
||||
|
||||
iCurrent = GetCurrentArgListEditor()
|
||||
If iCurrent < 0 Then Return
|
||||
|
||||
lstArgument.List = Null
|
||||
svwArgList.Children[iCurrent].Delete
|
||||
|
||||
End
|
||||
|
||||
Private Sub UnselectArgList()
|
||||
|
||||
Dim I As Integer
|
||||
Dim hChild As ArgListEditor
|
||||
|
||||
End
|
||||
|
||||
Public Sub lstArgument_Change()
|
||||
|
||||
$aArg[cmbArgument.Index] = lstArgument.List
|
||||
UpdateArgument
|
||||
For I = 0 To svwArgList.Children.Count - 1
|
||||
hChild = svwArgList.Children[I]
|
||||
hChild.Selected = False
|
||||
Next
|
||||
|
||||
UpdateArgButtons
|
||||
|
||||
End
|
||||
|
||||
Public Sub lstArgument_GotFocus()
|
||||
Public Sub svwArgList_GotFocus()
|
||||
|
||||
btnOK.Default = False
|
||||
UnselectArgList
|
||||
|
||||
End
|
||||
|
||||
Public Sub lstArgument_LostFocus()
|
||||
Public Sub btnMoveUpArg_Click()
|
||||
|
||||
btnOK.Default = True
|
||||
Dim iCurrent As Integer
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
|
||||
iCurrent = GetCurrentArgListEditor()
|
||||
If iCurrent <= 0 Then Return
|
||||
|
||||
hArgListEditor = svwArgList.Children[iCurrent]
|
||||
hArgListEditor.Next = svwArgList.Children[iCurrent - 1]
|
||||
hArgListEditor.SetFocus
|
||||
|
||||
UpdateArgButtons
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnMoveDownArg_Click()
|
||||
|
||||
Dim iCurrent As Integer
|
||||
Dim hArgListEditor As ArgListEditor
|
||||
|
||||
iCurrent = GetCurrentArgListEditor()
|
||||
If iCurrent < 0 Or If iCurrent >= svwArgList.Children.Count - 1 Then Return
|
||||
|
||||
hArgListEditor = svwArgList.Children[iCurrent]
|
||||
hArgListEditor.Next = svwArgList.Children[iCurrent + 1].Next
|
||||
hArgListEditor.SetFocus
|
||||
|
||||
UpdateArgButtons
|
||||
|
||||
End
|
||||
|
@ -491,22 +491,39 @@
|
||||
}
|
||||
Index = 5
|
||||
Text = ("Arguments")
|
||||
{ panArgList HBox
|
||||
MoveScaled(4,2,71,4)
|
||||
{ svwArgList ScrollView
|
||||
MoveScaled(2,1,80,40)
|
||||
Background = Color.TextBackground
|
||||
Expand = True
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
{ cmbArgument ComboBox
|
||||
MoveScaled(0,0,54,4)
|
||||
Expand = True
|
||||
ReadOnly = True
|
||||
Margin = True
|
||||
ScrollBar = Scroll.Vertical
|
||||
}
|
||||
{ HBox2 HBox
|
||||
MoveScaled(3,47,77,4)
|
||||
Spacing = True
|
||||
{ btnNewArgument Button
|
||||
MoveScaled(0,0,16,4)
|
||||
Text = ("Insert")
|
||||
Picture = Picture["icon:/small/add"]
|
||||
}
|
||||
{ btnRemoveArgument Button
|
||||
MoveScaled(60,0,5,4)
|
||||
MoveScaled(17,0,16,4)
|
||||
Enabled = False
|
||||
Text = ("Remove")
|
||||
Picture = Picture["icon:/small/remove"]
|
||||
}
|
||||
}
|
||||
{ lstArgument ListEditor
|
||||
MoveScaled(3,11,80,53)
|
||||
Expand = True
|
||||
{ btnMoveUpArg Button
|
||||
MoveScaled(34,0,6,4)
|
||||
Enabled = False
|
||||
Picture = Picture["icon:/small/up"]
|
||||
}
|
||||
{ btnMoveDownArg Button
|
||||
MoveScaled(41,0,6,4)
|
||||
Enabled = False
|
||||
Picture = Picture["icon:/small/down"]
|
||||
}
|
||||
}
|
||||
Index = 6
|
||||
Text = ("Options")
|
||||
|
@ -473,6 +473,10 @@ ToPos
|
||||
m
|
||||
Point
|
||||
[(Line)i(Column)i]
|
||||
CursorAt
|
||||
m
|
||||
Point
|
||||
[(Line)i(Column)i]
|
||||
ToColumn
|
||||
m
|
||||
i
|
||||
|
@ -3048,6 +3048,18 @@ Public Sub ToPos(Optional ({Line}) As Integer, Column As Integer) As Point
|
||||
|
||||
End
|
||||
|
||||
Public Sub CursorAt(Optional ({Line}) As Integer, Column As Integer) As Point
|
||||
|
||||
If IsMissing({Line}) Then
|
||||
{Line} = $Y
|
||||
If IsMissing(Column) Then Column = $X
|
||||
Endif
|
||||
|
||||
Return ToPos({Line}, Column)
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
Public Sub ToColumn(X As Integer, Y As Integer) As Integer
|
||||
|
||||
@ -4751,4 +4763,3 @@ Private Sub ClearCacheText()
|
||||
$cCacheText.Clear
|
||||
|
||||
End
|
||||
|
||||
|
@ -429,8 +429,8 @@ p
|
||||
i
|
||||
|
||||
Editor
|
||||
r
|
||||
TextBox
|
||||
p
|
||||
Control
|
||||
|
||||
_new
|
||||
m
|
||||
@ -3190,6 +3190,10 @@ s
|
||||
:
|
||||
|
||||
|
||||
:Hide
|
||||
:
|
||||
|
||||
|
||||
Editor
|
||||
r
|
||||
Control
|
||||
|
@ -1,14 +1,14 @@
|
||||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.8.90
|
||||
Title=More controls for graphical components
|
||||
Startup=FTestColorChooser
|
||||
Startup=FTestCompletion
|
||||
Version=3.8.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
Component=gb.gui
|
||||
Component=gb.settings
|
||||
Authors="Benoît Minisini"
|
||||
Environment="GB_GUI=gb.gtk3"
|
||||
Environment="GB_GUI=gb.qt5"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
|
@ -9,7 +9,7 @@ Public Icons As String[]
|
||||
Public Start As Integer
|
||||
|
||||
Property Delay As Integer
|
||||
Property Read Editor As TextBox
|
||||
Property Editor As Control
|
||||
|
||||
Private $hObserver As Observer
|
||||
Private $hTimer As Timer
|
||||
@ -20,19 +20,19 @@ Private $bExplicit As Boolean
|
||||
Private $hObsWindow As Observer
|
||||
Private $iHeight As Integer
|
||||
|
||||
Private Sub FindTextBox(hCtrl As Control) As Control
|
||||
Private Sub FindEditor(hCtrl As Control) As Control
|
||||
|
||||
If hCtrl Is Container Then
|
||||
For Each hCtrl In Container(hCtrl).Children
|
||||
If hCtrl Is TextBox Then Return hCtrl
|
||||
If hCtrl Is TextBox Or If hCtrl Is TextArea Then Return hCtrl
|
||||
Next
|
||||
Else If hCtrl Is TextBox Then
|
||||
Else If hCtrl Is TextBox Or If hCtrl Is TextArea Then
|
||||
Return hCtrl
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Private Sub GetTextBox() As TextBox
|
||||
Private Sub GetEditor() As Object
|
||||
|
||||
Return $hObserver.Object
|
||||
|
||||
@ -40,16 +40,26 @@ End
|
||||
|
||||
Public Sub _new(hCtrl As Control)
|
||||
|
||||
hCtrl = FindTextBox(hCtrl)
|
||||
$hTimer = New Timer As "Timer"
|
||||
$hTimer.Delay = 350
|
||||
|
||||
Attach(hCtrl)
|
||||
|
||||
End
|
||||
|
||||
Private Sub Attach(hCtrl As Control)
|
||||
|
||||
hCtrl = FindEditor(hCtrl)
|
||||
If Not hCtrl Then Error.Raise("Unable to find TextBox or TextArea")
|
||||
|
||||
HideList
|
||||
|
||||
$hObserver = New Observer(hCtrl) As "TextBox"
|
||||
$hWatcher = New Watcher(hCtrl) As "TextBox"
|
||||
|
||||
$hTimer = New Timer As "Timer"
|
||||
$hTimer.Delay = 350
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub Open()
|
||||
|
||||
HideList
|
||||
@ -131,38 +141,39 @@ End
|
||||
|
||||
Private Sub MovePopup()
|
||||
|
||||
Dim hCtrl As TextBox
|
||||
Dim X As Integer
|
||||
Dim Y As Integer
|
||||
Dim hCtrl As Object
|
||||
Dim hPos As Point
|
||||
|
||||
If Not $hPopup Then Return
|
||||
|
||||
hCtrl = GetTextBox()
|
||||
X = hCtrl.Font.TextWidth(String.Left(hCtrl.Text, Start))
|
||||
Y = hCtrl.ScreenY + hCtrl.H
|
||||
hCtrl = GetEditor()
|
||||
hPos = hCtrl.CursorAt(Start)
|
||||
|
||||
'X = hCtrl.Font.TextWidth(String.Left(hCtrl.Text, Start))
|
||||
'Y = hCtrl.ScreenY + hCtrl.H
|
||||
|
||||
$hPopup.Move(hCtrl.ScreenX + X, Y, Desktop.Scale * 48, $iHeight)
|
||||
$hPopup.Move(hCtrl.ScreenX + hPos.X, hCtrl.ScreenY + hPos.Y, Desktop.Scale * 48, $iHeight)
|
||||
|
||||
End
|
||||
|
||||
Public Sub Timer_Timer()
|
||||
|
||||
Dim aList As String[]
|
||||
Dim hCtrl As TextBox
|
||||
Dim hCtrl As Control
|
||||
Dim hPanel As Panel
|
||||
|
||||
'Debug
|
||||
Dim hEditor As Object
|
||||
|
||||
$hTimer.Stop
|
||||
|
||||
List = Null
|
||||
Me.Fill(GetTextBox().Text, $bExplicit)
|
||||
hEditor = GetEditor()
|
||||
Me.Fill(String.Left(hEditor.Text, hEditor.Pos), $bExplicit)
|
||||
aList = List
|
||||
|
||||
$bExplicit = False
|
||||
If Not aList Or If aList.Count = 0 Then Return
|
||||
|
||||
hCtrl = GetTextBox()
|
||||
hCtrl = GetEditor()
|
||||
Object.Lock(hCtrl)
|
||||
|
||||
If Not $hPopup Then
|
||||
@ -206,7 +217,7 @@ End
|
||||
|
||||
' Public Sub Popup_Activate()
|
||||
'
|
||||
' With GetTextBox()
|
||||
' With GetEditor()
|
||||
' .Window.Show
|
||||
' .SetFocus
|
||||
' End With
|
||||
@ -221,13 +232,13 @@ End
|
||||
|
||||
Public Sub TextBox_Move()
|
||||
|
||||
HideList
|
||||
MovePopup
|
||||
|
||||
End
|
||||
|
||||
Public Sub TextBox_Resize()
|
||||
|
||||
HideList
|
||||
MovePopup
|
||||
|
||||
End
|
||||
|
||||
@ -252,8 +263,8 @@ End
|
||||
|
||||
Public Sub GridView_GotFocus()
|
||||
|
||||
GetTextBox().Window.Activate
|
||||
GetTextBox().SetFocus
|
||||
GetEditor().Window.Activate
|
||||
GetEditor().SetFocus
|
||||
|
||||
End
|
||||
|
||||
@ -271,13 +282,16 @@ End
|
||||
|
||||
Public Sub GridView_MouseUp()
|
||||
|
||||
Dim hCtrl As TextBox
|
||||
Dim hCtrl As Object
|
||||
Dim sElt As String
|
||||
|
||||
If $hList.Row < 0 Then Return
|
||||
Try sElt = List[$hList.Row]
|
||||
If Error Then Return
|
||||
|
||||
hCtrl = GetEditor()
|
||||
|
||||
hCtrl = GetTextBox()
|
||||
|
||||
Try hCtrl.Text = String.Left(hCtrl.Text, Start) & List[$hList.Row]
|
||||
Try hCtrl.Text = String.Left(hCtrl.Text, Start) & sElt & String.Mid(hCtrl.Text, hCtrl.Pos + 1)
|
||||
Try hCtrl.Pos = Start + String.Len(sElt)
|
||||
HideList
|
||||
'hCtrl.SetFocus
|
||||
Raise Activate
|
||||
@ -298,7 +312,7 @@ Public Sub Fill(Text As String, Explicit As Boolean)
|
||||
|
||||
End
|
||||
|
||||
Private Function Editor_Read() As TextBox
|
||||
Private Function Editor_Read() As Control
|
||||
|
||||
Return $hObserver.Object
|
||||
|
||||
@ -309,3 +323,9 @@ Public Sub Window_Move()
|
||||
MovePopup
|
||||
|
||||
End
|
||||
|
||||
Private Sub Editor_Write(Value As Control)
|
||||
|
||||
Attach(Value)
|
||||
|
||||
End
|
||||
|
@ -10,6 +10,7 @@ Public Const _Similar As String = "GridView"
|
||||
Event Save(Row As Integer, Column As Integer, Value As String)
|
||||
Event Insert
|
||||
Event Click
|
||||
Event Hide
|
||||
|
||||
Property Read Editor As Control
|
||||
Property NoKeyboard As Boolean
|
||||
@ -104,6 +105,7 @@ Private Sub HideEditor(Optional bNoSave As Boolean) As Boolean
|
||||
$hPanel.Hide
|
||||
$hEditor.Hide
|
||||
$hEditor = Null
|
||||
Raise Hide
|
||||
Endif
|
||||
Endif
|
||||
|
||||
@ -152,7 +154,7 @@ Private Sub MoveEditor()
|
||||
Endif
|
||||
|
||||
$hPanel.Move(X, Y, W, H)
|
||||
$hEditor.Move(P, 0, W - P * 2, H)
|
||||
$hEditor.Move(P, P, W - P * 2, H - P * 2)
|
||||
$hPanel.Background = Style.BackgroundOf($hEditor)
|
||||
|
||||
$hEditor.Font = Me.Font
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.8.90
|
||||
Title=gb.gui.base
|
||||
Startup=FListBox
|
||||
Startup=FGridView
|
||||
Version=3.8.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
|
@ -318,7 +318,7 @@ Private Sub DrawCell(X As Integer, Y As Integer, W As Integer, H As Integer, iRo
|
||||
|
||||
If .Text Then
|
||||
If .WordWrap Then
|
||||
Paint.DrawRichText(Html(.Text), X, Y, W, H, .Alignment)
|
||||
Paint.DrawRichText(Replace(Html(.Text), "\n", "<br>"), X, Y, W, H, .Alignment)
|
||||
Else
|
||||
Paint.DrawText(.Text, X, Y, W, H, .Alignment)
|
||||
Endif
|
||||
@ -2190,7 +2190,7 @@ Public Sub _GetPreferredHeight(iRow As Integer) As Integer
|
||||
Endif
|
||||
Else If .Text Then
|
||||
If .WordWrap Then
|
||||
H += hFont.RichTextHeight(Html(.Text), WT)
|
||||
H += hFont.RichTextHeight(Replace(Html(.Text), "\n", "<br>"), WT)
|
||||
Else
|
||||
H += hFont.TextHeight(.Text)
|
||||
Endif
|
||||
|
@ -74,19 +74,19 @@ Public Sub Form_Open()
|
||||
End With
|
||||
|
||||
|
||||
gvwInfo[6, 1].Background = Color.Yellow
|
||||
gvwInfo[6, 1].Border = New Border '.Copy() 'New Border 'hBorderLeft.Copy()
|
||||
With gvwInfo[6, 1].Border
|
||||
.SlashStyle = Border.Dotted
|
||||
.SlashColor = Color.Red
|
||||
.SlashWidth = 4
|
||||
.BackSlashStyle = Border.Double + Border.Dashed
|
||||
.BackSlashColor = Color.Red
|
||||
.BackSlashWidth = 4
|
||||
.Color = Color.Green
|
||||
.Margin = 8
|
||||
.Padding = 8
|
||||
End With
|
||||
' gvwInfo[6, 1].Background = Color.Yellow
|
||||
' gvwInfo[6, 1].Border = New Border '.Copy() 'New Border 'hBorderLeft.Copy()
|
||||
' With gvwInfo[6, 1].Border
|
||||
' .SlashStyle = Border.Dotted
|
||||
' .SlashColor = Color.Red
|
||||
' .SlashWidth = 4
|
||||
' .BackSlashStyle = Border.Double + Border.Dashed
|
||||
' .BackSlashColor = Color.Red
|
||||
' .BackSlashWidth = 4
|
||||
' .Color = Color.Green
|
||||
' .Margin = 8
|
||||
' .Padding = 8
|
||||
' End With
|
||||
|
||||
|
||||
'gvwInfo.Columns[1].Alignment = Align.Right
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,72,68)
|
||||
Font = Font["Monospace,Italic,12"]
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Margin = True
|
||||
@ -25,7 +24,6 @@
|
||||
Expand = True
|
||||
Border = False
|
||||
Mode = Select.Multiple
|
||||
Padding = 0
|
||||
ShowCursor = True
|
||||
Header = GridView.Both
|
||||
Sorted = True
|
||||
|
@ -1,4 +1,4 @@
|
||||
FListBox
|
||||
FGridView
|
||||
gb.gui.base
|
||||
0
|
||||
0
|
||||
|
@ -283,7 +283,7 @@ gw = {
|
||||
var div;
|
||||
var div_br;
|
||||
|
||||
if (elt.gw_mandatory)
|
||||
if (elt == undefined || elt.gw_mandatory)
|
||||
return;
|
||||
|
||||
elt.gw_mandatory = div = document.createElement('div');
|
||||
|
@ -1,23 +1,23 @@
|
||||
/***************************************************************************
|
||||
|
||||
CTextArea.cpp
|
||||
CTextArea.cpp
|
||||
|
||||
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
|
||||
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -151,7 +151,7 @@ END_PROPERTY
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
.TextArea.Selection
|
||||
.TextArea.Selection
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -278,7 +278,7 @@ END_METHOD
|
||||
|
||||
BEGIN_METHOD_VOID(CTEXTAREA_selected)
|
||||
|
||||
GB.ReturnBoolean(TEXTAREA->isSelected());
|
||||
GB.ReturnBoolean(TEXTAREA->isSelected());
|
||||
|
||||
END_METHOD
|
||||
|
||||
@ -293,76 +293,76 @@ BEGIN_PROPERTY(TextArea_Alignment)
|
||||
END_PROPERTY
|
||||
|
||||
|
||||
BEGIN_PROPERTY(TextArea_CursorPos)
|
||||
BEGIN_METHOD(TextArea_CursorAt, GB_INTEGER pos)
|
||||
|
||||
int x, y;
|
||||
WIDGET->getCursorPos(&x, &y);
|
||||
WIDGET->getCursorPos(&x, &y, VARGOPT(pos, -1));
|
||||
GB.ReturnObject(GEOM.CreatePoint(x, y));
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
GB_DESC CTextAreaSelectionDesc[] =
|
||||
{
|
||||
GB_DECLARE(".TextArea.Selection", 0), GB_VIRTUAL_CLASS(),
|
||||
GB_DECLARE(".TextArea.Selection", 0), GB_VIRTUAL_CLASS(),
|
||||
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_sel_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_sel_length),
|
||||
GB_PROPERTY_READ("Start", "i", CTEXTAREA_sel_start),
|
||||
GB_PROPERTY_READ("Pos", "i", CTEXTAREA_sel_start),
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_sel_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_sel_length),
|
||||
GB_PROPERTY_READ("Start", "i", CTEXTAREA_sel_start),
|
||||
GB_PROPERTY_READ("Pos", "i", CTEXTAREA_sel_start),
|
||||
|
||||
GB_METHOD("Hide", 0, CTEXTAREA_sel_clear, 0),
|
||||
GB_METHOD("Hide", 0, CTEXTAREA_sel_clear, 0),
|
||||
|
||||
GB_END_DECLARE
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
||||
GB_DESC CTextAreaDesc[] =
|
||||
{
|
||||
GB_DECLARE("TextArea", sizeof(CTEXTAREA)), GB_INHERITS("Control"),
|
||||
GB_DECLARE("TextArea", sizeof(CTEXTAREA)), GB_INHERITS("Control"),
|
||||
|
||||
GB_METHOD("_new", 0, CTEXTAREA_new, "(Parent)Container;"),
|
||||
GB_METHOD("_new", 0, CTEXTAREA_new, "(Parent)Container;"),
|
||||
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_length),
|
||||
GB_PROPERTY("ReadOnly", "b", CTEXTAREA_read_only),
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_length),
|
||||
GB_PROPERTY("ReadOnly", "b", CTEXTAREA_read_only),
|
||||
|
||||
GB_PROPERTY("ScrollBar", "i", CTEXTAREA_scrollbar),
|
||||
GB_PROPERTY("Wrap", "b", CTEXTAREA_wrap),
|
||||
GB_PROPERTY("Border", "b", CTEXTAREA_border),
|
||||
GB_PROPERTY("Alignment", "i", TextArea_Alignment),
|
||||
GB_PROPERTY("ScrollBar", "i", CTEXTAREA_scrollbar),
|
||||
GB_PROPERTY("Wrap", "b", CTEXTAREA_wrap),
|
||||
GB_PROPERTY("Border", "b", CTEXTAREA_border),
|
||||
GB_PROPERTY("Alignment", "i", TextArea_Alignment),
|
||||
|
||||
GB_PROPERTY("Line", "i", CTEXTAREA_line),
|
||||
GB_PROPERTY("Column", "i", CTEXTAREA_column),
|
||||
GB_PROPERTY("Pos", "i", CTEXTAREA_pos),
|
||||
GB_PROPERTY("Line", "i", CTEXTAREA_line),
|
||||
GB_PROPERTY("Column", "i", CTEXTAREA_column),
|
||||
GB_PROPERTY("Pos", "i", CTEXTAREA_pos),
|
||||
|
||||
GB_PROPERTY_SELF("Selection", ".TextArea.Selection"),
|
||||
GB_METHOD("Select", NULL, CTEXTAREA_sel_select, "[(Start)i(Length)i]"),
|
||||
GB_METHOD("SelectAll", NULL, CTEXTAREA_sel_all, NULL),
|
||||
GB_METHOD("Unselect", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
GB_PROPERTY_SELF("Selection", ".TextArea.Selection"),
|
||||
GB_METHOD("Select", NULL, CTEXTAREA_sel_select, "[(Start)i(Length)i]"),
|
||||
GB_METHOD("SelectAll", NULL, CTEXTAREA_sel_all, NULL),
|
||||
GB_METHOD("Unselect", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
GB_PROPERTY_READ("Selected", "b", CTEXTAREA_selected),
|
||||
|
||||
GB_METHOD("Clear", NULL, CTEXTAREA_clear, NULL),
|
||||
GB_METHOD("Insert", NULL, CTEXTAREA_insert, "(Text)s"),
|
||||
GB_METHOD("Clear", NULL, CTEXTAREA_clear, NULL),
|
||||
GB_METHOD("Insert", NULL, CTEXTAREA_insert, "(Text)s"),
|
||||
|
||||
GB_METHOD("Copy", NULL, CTEXTAREA_copy, NULL),
|
||||
GB_METHOD("Cut", NULL, CTEXTAREA_cut, NULL),
|
||||
GB_METHOD("Paste", NULL, CTEXTAREA_paste, NULL),
|
||||
GB_METHOD("Undo", NULL, CTEXTAREA_undo, NULL),
|
||||
GB_METHOD("Redo", NULL, CTEXTAREA_redo, NULL),
|
||||
GB_METHOD("Copy", NULL, CTEXTAREA_copy, NULL),
|
||||
GB_METHOD("Cut", NULL, CTEXTAREA_cut, NULL),
|
||||
GB_METHOD("Paste", NULL, CTEXTAREA_paste, NULL),
|
||||
GB_METHOD("Undo", NULL, CTEXTAREA_undo, NULL),
|
||||
GB_METHOD("Redo", NULL, CTEXTAREA_redo, NULL),
|
||||
|
||||
GB_METHOD("ToPos", "i", CTEXTAREA_to_pos, "(Line)i(Column)i"),
|
||||
GB_METHOD("ToLine", "i", CTEXTAREA_to_line, "(Pos)i"),
|
||||
GB_METHOD("ToColumn", "i", CTEXTAREA_to_col, "(Pos)i"),
|
||||
GB_METHOD("ToPos", "i", CTEXTAREA_to_pos, "(Line)i(Column)i"),
|
||||
GB_METHOD("ToLine", "i", CTEXTAREA_to_line, "(Pos)i"),
|
||||
GB_METHOD("ToColumn", "i", CTEXTAREA_to_col, "(Pos)i"),
|
||||
|
||||
GB_METHOD("EnsureVisible", NULL, CTEXTAREA_ensure_visible, NULL),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextArea_CursorPos),
|
||||
GB_METHOD("EnsureVisible", NULL, CTEXTAREA_ensure_visible, NULL),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Cursor", NULL, NULL, &EVENT_Cursor),
|
||||
|
||||
TEXTAREA_DESCRIPTION,
|
||||
GB_METHOD("CursorAt", "Point", TextArea_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Cursor", NULL, NULL, &EVENT_Cursor),
|
||||
|
||||
TEXTAREA_DESCRIPTION,
|
||||
|
||||
GB_END_DECLARE
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
||||
#if 0
|
||||
@ -420,82 +420,82 @@ END_PROPERTY
|
||||
|
||||
GB_DESC CTextEditFormatDesc[] =
|
||||
{
|
||||
GB_DECLARE(".TextEditFormat", 0), GB_VIRTUAL_CLASS(),
|
||||
GB_DECLARE(".TextEditFormat", 0), GB_VIRTUAL_CLASS(),
|
||||
|
||||
GB_PROPERTY("Alignment", "i", CTEXTEDIT_format_alignment),
|
||||
//GB_PROPERTY("Position", "i", CTEXTEDIT_format_position),
|
||||
GB_PROPERTY("Font", "Font", CTEXTEDIT_format_font),
|
||||
GB_PROPERTY("Color", "i", CTEXTEDIT_format_color),
|
||||
|
||||
GB_END_DECLARE
|
||||
GB_PROPERTY("Alignment", "i", CTEXTEDIT_format_alignment),
|
||||
//GB_PROPERTY("Position", "i", CTEXTEDIT_format_position),
|
||||
GB_PROPERTY("Font", "Font", CTEXTEDIT_format_font),
|
||||
GB_PROPERTY("Color", "i", CTEXTEDIT_format_color),
|
||||
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
||||
GB_DESC CTextEditSelectionDesc[] =
|
||||
{
|
||||
GB_DECLARE(".TextEditSelection", 0), GB_VIRTUAL_CLASS(),
|
||||
GB_DECLARE(".TextEditSelection", 0), GB_VIRTUAL_CLASS(),
|
||||
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_sel_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_sel_length),
|
||||
GB_PROPERTY_READ("Start", "i", CTEXTAREA_sel_start),
|
||||
GB_METHOD("Hide", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_sel_text),
|
||||
GB_PROPERTY_READ("Length", "i", CTEXTAREA_sel_length),
|
||||
GB_PROPERTY_READ("Start", "i", CTEXTAREA_sel_start),
|
||||
GB_METHOD("Hide", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
|
||||
GB_END_DECLARE
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
||||
|
||||
GB_DESC CTextEditDesc[] =
|
||||
{
|
||||
GB_DECLARE("TextEdit", sizeof(CTEXTAREA)), GB_INHERITS("Control"),
|
||||
GB_DECLARE("TextEdit", sizeof(CTEXTAREA)), GB_INHERITS("Control"),
|
||||
|
||||
GB_METHOD("_new", NULL, CTEXTEDIT_new, "(Parent)Container;"),
|
||||
GB_METHOD("_new", NULL, CTEXTEDIT_new, "(Parent)Container;"),
|
||||
|
||||
GB_PROPERTY("ReadOnly", "b", CTEXTAREA_read_only),
|
||||
|
||||
GB_METHOD("Clear", NULL, CTEXTAREA_clear, NULL),
|
||||
GB_PROPERTY("ReadOnly", "b", CTEXTAREA_read_only),
|
||||
|
||||
GB_METHOD("Clear", NULL, CTEXTAREA_clear, NULL),
|
||||
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_text),
|
||||
GB_METHOD("Insert", NULL, CTEXTAREA_insert, "(Text)s"),
|
||||
GB_PROPERTY("Text", "s", CTEXTAREA_text),
|
||||
GB_METHOD("Insert", NULL, CTEXTAREA_insert, "(Text)s"),
|
||||
|
||||
GB_PROPERTY("Paragraph", "i", CTEXTAREA_line),
|
||||
GB_PROPERTY("Index", "i", CTEXTAREA_column),
|
||||
GB_PROPERTY("Pos", "i", CTEXTAREA_pos),
|
||||
GB_PROPERTY("Paragraph", "i", CTEXTAREA_line),
|
||||
GB_PROPERTY("Index", "i", CTEXTAREA_column),
|
||||
GB_PROPERTY("Pos", "i", CTEXTAREA_pos),
|
||||
|
||||
GB_METHOD("ToPos", "i", CTEXTAREA_to_pos, "(Paragraph)i(Index)i"),
|
||||
GB_METHOD("ToParagraph", "i", CTEXTAREA_to_line, "(Pos)i"),
|
||||
GB_METHOD("ToIndex", "i", CTEXTAREA_to_col, "(Pos)i"),
|
||||
GB_METHOD("ToPos", "i", CTEXTAREA_to_pos, "(Paragraph)i(Index)i"),
|
||||
GB_METHOD("ToParagraph", "i", CTEXTAREA_to_line, "(Pos)i"),
|
||||
GB_METHOD("ToIndex", "i", CTEXTAREA_to_col, "(Pos)i"),
|
||||
|
||||
GB_METHOD("EnsureVisible", NULL, CTEXTAREA_ensure_visible, NULL),
|
||||
GB_METHOD("EnsureVisible", NULL, CTEXTAREA_ensure_visible, NULL),
|
||||
|
||||
GB_PROPERTY_SELF("Selection", ".TextEditSelection"),
|
||||
GB_METHOD("Select", NULL, CTEXTAREA_sel_select, "[(Start)i(Length)i]"),
|
||||
GB_METHOD("SelectAll", NULL, CTEXTAREA_sel_all, NULL),
|
||||
GB_METHOD("Unselect", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
GB_PROPERTY_SELF("Selection", ".TextEditSelection"),
|
||||
GB_METHOD("Select", NULL, CTEXTAREA_sel_select, "[(Start)i(Length)i]"),
|
||||
GB_METHOD("SelectAll", NULL, CTEXTAREA_sel_all, NULL),
|
||||
GB_METHOD("Unselect", NULL, CTEXTAREA_sel_clear, NULL),
|
||||
GB_PROPERTY_READ("Selected", "b", CTEXTAREA_selected),
|
||||
|
||||
GB_METHOD("Copy", NULL, CTEXTAREA_copy, NULL),
|
||||
GB_METHOD("Cut", NULL, CTEXTAREA_cut, NULL),
|
||||
GB_METHOD("Paste", NULL, CTEXTAREA_paste, NULL),
|
||||
GB_METHOD("Undo", NULL, CTEXTAREA_undo, NULL),
|
||||
GB_METHOD("Redo", NULL, CTEXTAREA_redo, NULL),
|
||||
|
||||
GB_PROPERTY("Border", "b", CTEXTAREA_border),
|
||||
GB_PROPERTY("ScrollBar", "i", CTEXTAREA_scrollbar),
|
||||
GB_METHOD("Copy", NULL, CTEXTAREA_copy, NULL),
|
||||
GB_METHOD("Cut", NULL, CTEXTAREA_cut, NULL),
|
||||
GB_METHOD("Paste", NULL, CTEXTAREA_paste, NULL),
|
||||
GB_METHOD("Undo", NULL, CTEXTAREA_undo, NULL),
|
||||
GB_METHOD("Redo", NULL, CTEXTAREA_redo, NULL),
|
||||
|
||||
GB_PROPERTY("Border", "b", CTEXTAREA_border),
|
||||
GB_PROPERTY("ScrollBar", "i", CTEXTAREA_scrollbar),
|
||||
|
||||
GB_PROPERTY("ScrollX", "i", CTEXTEDIT_scroll_x),
|
||||
GB_PROPERTY("ScrollY", "i", CTEXTEDIT_scroll_y),
|
||||
|
||||
GB_PROPERTY("TextWidth", "i", CTEXTEDIT_text_width),
|
||||
GB_PROPERTY("TextHeight", "i", CTEXTEDIT_text_height),
|
||||
GB_PROPERTY("ScrollX", "i", CTEXTEDIT_scroll_x),
|
||||
GB_PROPERTY("ScrollY", "i", CTEXTEDIT_scroll_y),
|
||||
|
||||
GB_PROPERTY("TextWidth", "i", CTEXTEDIT_text_width),
|
||||
GB_PROPERTY("TextHeight", "i", CTEXTEDIT_text_height),
|
||||
|
||||
GB_PROPERTY_SELF("Format", ".TextEditFormat"),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Cursor", NULL, NULL, &EVENT_Cursor),
|
||||
GB_EVENT("Link", NULL, "(Path)s", &EVENT_Link),
|
||||
GB_PROPERTY_SELF("Format", ".TextEditFormat"),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Cursor", NULL, NULL, &EVENT_Cursor),
|
||||
GB_EVENT("Link", NULL, "(Path)s", &EVENT_Link),
|
||||
|
||||
TEXTEDIT_DESCRIPTION,
|
||||
TEXTEDIT_DESCRIPTION,
|
||||
|
||||
GB_END_DECLARE
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -168,12 +168,12 @@ BEGIN_METHOD_VOID(CTEXTBOX_selected)
|
||||
END_METHOD
|
||||
|
||||
|
||||
BEGIN_PROPERTY(TextBox_CursorPos)
|
||||
BEGIN_METHOD(TextBox_CursorAt, GB_INTEGER pos)
|
||||
|
||||
int x, y;
|
||||
|
||||
CHECK_COMBOBOX();
|
||||
TEXTBOX->getCursorPos(&x, &y);
|
||||
TEXTBOX->getCursorPos(&x, &y, VARGOPT(pos, -1));
|
||||
GB.ReturnObject(GEOM.CreatePoint(x, y));
|
||||
|
||||
END_PROPERTY
|
||||
@ -470,7 +470,7 @@ GB_DESC CTextBoxDesc[] =
|
||||
GB_METHOD("Clear", 0, CTEXTBOX_clear, 0),
|
||||
GB_METHOD("Insert", 0, CTEXTBOX_insert, "(Text)s"),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextBox_CursorPos),
|
||||
GB_METHOD("CursorAt", "Point", TextBox_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_EVENT("Change", 0, 0, &EVENT_Change),
|
||||
GB_EVENT("Activate", 0, 0, &EVENT_Activate),
|
||||
@ -525,7 +525,7 @@ GB_DESC CComboBoxDesc[] =
|
||||
GB_PROPERTY_READ("Current", ".ComboBox.Item", CCOMBOBOX_current),
|
||||
GB_PROPERTY("Index", "i", CCOMBOBOX_index),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextBox_CursorPos),
|
||||
GB_METHOD("CursorAt", "Point", TextBox_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_EVENT("Change", 0, 0, &EVENT_Change),
|
||||
GB_EVENT("Activate", 0, 0, &EVENT_Activate),
|
||||
|
@ -1035,11 +1035,11 @@ int gTextArea::minimumHeight() const
|
||||
}
|
||||
#endif
|
||||
|
||||
void gTextArea::getCursorPos(int *x, int *y)
|
||||
void gTextArea::getCursorPos(int *x, int *y, int pos)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
int f = getFrameWidth();
|
||||
GtkTextIter *iter = getIterAt();
|
||||
GtkTextIter *iter = getIterAt(pos);
|
||||
|
||||
gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), iter, &rect);
|
||||
gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_WIDGET, rect.x, rect.y + rect.height, x, y);
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
void redo();
|
||||
void clear();
|
||||
|
||||
void getCursorPos(int *x, int *y);
|
||||
void getCursorPos(int *x, int *y, int pos);
|
||||
|
||||
void emitCursor();
|
||||
|
||||
|
@ -484,15 +484,15 @@ GtkIMContext *gTextBox::getInputMethod()
|
||||
}
|
||||
|
||||
|
||||
void gTextBox::getCursorPos(int *x, int *y)
|
||||
void gTextBox::getCursorPos(int *x, int *y, int pos)
|
||||
{
|
||||
int px, py, p;
|
||||
int px, py;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle rect;
|
||||
|
||||
layout = gtk_entry_get_layout(GTK_ENTRY(entry));
|
||||
p = gtk_entry_text_index_to_layout_index(GTK_ENTRY(entry), position());
|
||||
pango_layout_get_cursor_pos(layout, p, &rect, NULL);
|
||||
pos = gtk_entry_text_index_to_layout_index(GTK_ENTRY(entry), pos < 0 ? position() : pos);
|
||||
pango_layout_get_cursor_pos(layout, pos, &rect, NULL);
|
||||
|
||||
gtk_entry_get_layout_offsets(GTK_ENTRY(entry), &px, &py);
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void selectAll();
|
||||
bool hasEntry() const { return entry != 0; }
|
||||
|
||||
void getCursorPos(int *x, int *y);
|
||||
void getCursorPos(int *x, int *y, int pos);
|
||||
|
||||
//"Signals"
|
||||
void (*onChange)(gTextBox *sender);
|
||||
|
@ -582,9 +582,15 @@ BEGIN_PROPERTY(TextArea_Border)
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
BEGIN_PROPERTY(TextArea_CursorPos)
|
||||
BEGIN_METHOD(TextArea_CursorAt, GB_INTEGER pos)
|
||||
|
||||
QRect rect = WIDGET->cursorRect();
|
||||
QRect rect;
|
||||
QTextCursor cursor = WIDGET->textCursor();
|
||||
|
||||
if (!MISSING(pos))
|
||||
cursor.setPosition(VARG(pos));
|
||||
|
||||
rect = WIDGET->cursorRect(cursor);
|
||||
|
||||
GB.ReturnObject(GEOM.CreatePoint(rect.x() + WIDGET->viewport()->x(), rect.bottom() + WIDGET->viewport()->y()));
|
||||
|
||||
@ -645,7 +651,7 @@ GB_DESC CTextAreaDesc[] =
|
||||
GB_METHOD("ToLine", "i", CTEXTAREA_to_line, "(Pos)i"),
|
||||
GB_METHOD("ToColumn", "i", CTEXTAREA_to_col, "(Pos)i"),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextArea_CursorPos),
|
||||
GB_METHOD("CursorAt", "Point", TextArea_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_METHOD("EnsureVisible", NULL, CTEXTAREA_ensure_visible, NULL),
|
||||
|
||||
|
@ -204,12 +204,24 @@ BEGIN_PROPERTY(TextBox_MaxLength)
|
||||
END_PROPERTY
|
||||
|
||||
|
||||
BEGIN_PROPERTY(TextBox_CursorPos)
|
||||
BEGIN_METHOD(TextBox_CursorAt, GB_INTEGER pos)
|
||||
|
||||
QRect rect;
|
||||
int save = -1;
|
||||
|
||||
GET_TEXT_BOX();
|
||||
|
||||
if (!MISSING(pos))
|
||||
{
|
||||
save = textbox->cursorPosition();
|
||||
textbox->setCursorPosition(VARG(pos));
|
||||
}
|
||||
|
||||
// Hack to call cursorRect()
|
||||
QRect rect = textbox->inputMethodQuery(Qt::ImMicroFocus).toRect();
|
||||
rect = textbox->inputMethodQuery(Qt::ImMicroFocus).toRect();
|
||||
|
||||
if (save >= 0)
|
||||
textbox->setCursorPosition(save);
|
||||
|
||||
GB.ReturnObject(GEOM.CreatePoint((rect.left() + rect.right()) / 2 + 1, rect.bottom()));
|
||||
|
||||
@ -867,7 +879,7 @@ GB_DESC CTextBoxDesc[] =
|
||||
GB_METHOD("Clear", NULL, TextBox_Clear, NULL),
|
||||
GB_METHOD("Insert", NULL, TextBox_Insert, "(Text)s"),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextBox_CursorPos),
|
||||
GB_METHOD("CursorAt", "Point", TextBox_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Activate", NULL, NULL, &EVENT_Activate),
|
||||
@ -927,7 +939,7 @@ GB_DESC CComboBoxDesc[] =
|
||||
GB_PROPERTY_READ("Current", ".ComboBox.Item", ComboBox_Current),
|
||||
GB_PROPERTY("Index", "i", ComboBox_Index),
|
||||
|
||||
GB_PROPERTY_READ("CursorPos", "Point", TextBox_CursorPos),
|
||||
GB_METHOD("CursorAt", "Point", TextBox_CursorAt, "[(Pos)i]"),
|
||||
|
||||
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
||||
GB_EVENT("Activate", NULL, NULL, &EVENT_Activate),
|
||||
|
@ -49,6 +49,17 @@ static void error(int code, CLASS *class, const char *name)
|
||||
GB_Error((char *)(intptr_t)code, CLASS_get_name(class), name);
|
||||
}
|
||||
|
||||
static bool check_null(void *object)
|
||||
{
|
||||
if (!object)
|
||||
{
|
||||
GB_Error((char *)E_NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//---- Components ---------------------------------------------------------
|
||||
|
||||
BEGIN_METHOD(Components_get, GB_STRING name)
|
||||
@ -565,7 +576,7 @@ BEGIN_METHOD(Object_Class, GB_OBJECT object)
|
||||
|
||||
void *object = VARG(object);
|
||||
|
||||
if (GB_CheckObject(object))
|
||||
if (check_null(object))
|
||||
return;
|
||||
|
||||
GB_ReturnObject(OBJECT_class(object));
|
||||
@ -577,7 +588,7 @@ BEGIN_METHOD(Object_Type, GB_OBJECT object)
|
||||
|
||||
void *object = VARG(object);
|
||||
|
||||
if (GB_CheckObject(object))
|
||||
if (check_null(object))
|
||||
return;
|
||||
|
||||
GB_ReturnConstZeroString(OBJECT_class(object)->name);
|
||||
@ -590,7 +601,7 @@ BEGIN_METHOD(Object_Is, GB_OBJECT object; GB_STRING class)
|
||||
void *object = VARG(object);
|
||||
CLASS *class = CLASS_look(STRING(class), LENGTH(class));
|
||||
|
||||
if (GB_CheckObject(object))
|
||||
if (check_null(object))
|
||||
return;
|
||||
|
||||
if (!class)
|
||||
@ -757,7 +768,7 @@ BEGIN_METHOD(Object_SizeOf, GB_OBJECT object)
|
||||
|
||||
void *object = VARG(object);
|
||||
|
||||
if (GB_CheckObject(object))
|
||||
if (check_null(object))
|
||||
return;
|
||||
|
||||
GB_ReturnInteger(CLASS_sizeof(OBJECT_class(object)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user