2e82025ce5
* BUG: Fix option dialog now that [...] can return specialized arrays. * BUG: Fix the list of control properties that must not be applied in the form editor. * NEW: Automatically converts Window.Toolbar constant to Window.Utility. * NEW: Setting the form Type property to Utility has a visible effect now. * BUG: The find balloon message is always displayed in the accurate field now. [GB.GTK] * BUG: Fix the initialization of editable combo-box when its List property is set. * NEW: The Window.Toolbar constant were replaced by Window.Utility. [GB.FORM] * NEW: Draw SidePanel little arrows in a more clever way. * BUG: Font grades are selectable again in the FontChooser control. [GB.FORM.MDI] * NEW: Toolbars have a configuration dialog now. This configuration dialog is displayed when you click on the toolbar handle. Beware, this is not finished! * NEW: Toolbar.Key is a new text property for identifying the toolbar. All toolbars having the same key will share the same configuration. * NEW: Toolbar.Text is a new text property that gives a visual name to the toolbar. [GB.QT] * BUG: Setting Control.Next or Control.Previous now forces the parent container to re-arrange itself. * NEW: The Window.Toolbar constant were replaced by Window.Utility. * NEW: ToolButton.AutoResize is a new property that makes the toolbutton automatically expand horizontally to fit its contents. * NEW: Button and ToggleButton got the same AutoResize property. * NEW: Remove the DrawingArea.BackColor property. [GB.QT4] * BUG: Setting Control.Next or Control.Previous now forces the parent container to re-arrange itself. * NEW: Remove the DrawingArea.BackColor property. * NEW: The Window.Toolbar constant were replaced by Window.Utility. git-svn-id: svn://localhost/gambas/trunk@1789 867c0c6c-44f3-4631-809d-bfa615b0a4ec
521 lines
9.6 KiB
Text
521 lines
9.6 KiB
Text
' Gambas class file
|
|
|
|
Static Private $hHandleH As Picture
|
|
Static Private $hHandleV As Picture
|
|
|
|
Private $iOrientation As Integer
|
|
Private $bFixed As Boolean
|
|
Private $W As Integer
|
|
Private $H As Integer
|
|
Private $bVisible As Boolean
|
|
Private $MX As Integer
|
|
Private $MY As Integer
|
|
Private $iMax As Integer
|
|
Private $iColor As Integer
|
|
Private $bOpened As Boolean
|
|
|
|
Private BUTTON_H As Integer = Desktop.Scale
|
|
Private BUTTON_W As Integer = 48
|
|
|
|
|
|
Static Public Sub _init()
|
|
|
|
$hHandleH = Picture["img/handle-h.png"]
|
|
$hHandleV = Picture["img/handle-v.png"]
|
|
|
|
End
|
|
|
|
|
|
Public Sub _new()
|
|
|
|
$bVisible = True
|
|
$iOrientation = Align.Top
|
|
|
|
End
|
|
|
|
|
|
Public Sub Form_Open()
|
|
|
|
$bOpened = True
|
|
RefreshAll
|
|
|
|
End
|
|
|
|
Private Sub GetLangOrientation(iOrientation As Integer) As Integer
|
|
|
|
If System.RightToLeft Then
|
|
If iOrientation = Align.Left Then
|
|
Return Align.Right
|
|
Else If iOrientation = Align.Right Then
|
|
Return Align.Left
|
|
Endif
|
|
Endif
|
|
|
|
Return iOrientation
|
|
|
|
End
|
|
|
|
|
|
Public Function GetOrientation() As Integer
|
|
|
|
Return GetLangOrientation($iOrientation)
|
|
|
|
End
|
|
|
|
Public Sub SetOrientation(iOrientation As Integer)
|
|
|
|
Select Case iOrientation
|
|
Case Align.Top, Align.Bottom
|
|
Case Align.Left, Align.Right
|
|
Case Else
|
|
Return
|
|
End Select
|
|
|
|
$iOrientation = GetLangOrientation(iOrientation)
|
|
RefreshArrow
|
|
RefreshPanel
|
|
|
|
End
|
|
|
|
Private Sub RefreshPanel()
|
|
|
|
Dim W As Integer
|
|
Dim W2 As Integer
|
|
Dim Y As Integer
|
|
Dim D As Integer
|
|
|
|
'IF NOT $bVisible THEN panSide.Hide
|
|
If Not $bOpened Then Return
|
|
|
|
Select Case $iOrientation
|
|
|
|
Case Align.Top, Align.Bottom
|
|
D = Me.ClientW
|
|
|
|
Case Else
|
|
D = Me.ClientH
|
|
|
|
End Select
|
|
|
|
'D = Max(0, D - 8)
|
|
|
|
If D < (BUTTON_W * 2 + 16) Then
|
|
W = Min(BUTTON_W, D - 16)
|
|
W2 = 0
|
|
Else
|
|
W = Min(BUTTON_W, D / 2)
|
|
W2 = Min(BUTTON_W, D - W)
|
|
Endif
|
|
|
|
Select Case $iOrientation
|
|
|
|
Case Align.Bottom, Align.Right
|
|
Y = 0
|
|
|
|
Case Align.Top
|
|
Y = Me.ClientH - BUTTON_H
|
|
|
|
Case Align.Left
|
|
Y = Me.ClientW - BUTTON_H
|
|
|
|
End Select
|
|
|
|
Select Case $iOrientation
|
|
|
|
Case Align.Top, Align.Bottom
|
|
|
|
panMove.Move(0, Y, Me.ClientW, BUTTON_H)
|
|
|
|
If W2 Then
|
|
btnSide.Move(0, 0, W, BUTTON_H)
|
|
btnSide2.Move(Me.ClientW - W2, 0, W2, BUTTON_H)
|
|
btnSide2.Show
|
|
Else
|
|
btnSide.Move(0, 0, W, BUTTON_H)
|
|
'btnSide.Move((D - W) / 2, Y, W, BUTTON_H)
|
|
btnSide2.Hide
|
|
Endif
|
|
|
|
' W2 = ME.ClientW - W - W2
|
|
' IF W2 > 0 THEN
|
|
' panMove.Move(W, Y, W2, BUTTON_H)
|
|
' panMove.Show
|
|
' ELSE
|
|
' panMove.Hide
|
|
' ENDIF
|
|
|
|
Case Else
|
|
|
|
panMove.Move(Y, 0, BUTTON_H, Me.ClientH)
|
|
|
|
If W2 Then
|
|
btnSide.Move(0, 0, BUTTON_H, W)
|
|
btnSide2.Move(0, Me.ClientH - W2, BUTTON_H, W2)
|
|
btnSide2.Show
|
|
Else
|
|
btnSide.Move(0, 0, BUTTON_H, W)
|
|
'btnSide.Move(Y, (D - W) / 2, BUTTON_H, W)
|
|
btnSide2.Hide
|
|
Endif
|
|
|
|
' W2 = ME.ClientH - W - W2
|
|
' IF W2 > 0 THEN
|
|
' panMove.Move(Y, W, BUTTON_H, W2)
|
|
' panMove.Show
|
|
' ELSE
|
|
' panMove.Hide
|
|
' ENDIF
|
|
|
|
End Select
|
|
|
|
Select Case $iOrientation
|
|
|
|
Case Align.Top
|
|
panSide.Move(0, 0, Me.ClientW, Me.ClientH - BUTTON_H)
|
|
|
|
Case Align.Bottom
|
|
panSide.Move(0, BUTTON_H, Me.ClientW, Me.ClientH - BUTTON_H)
|
|
|
|
Case Align.Left
|
|
panSide.Move(0, 0, Me.ClientW - BUTTON_H, Me.ClientH)
|
|
|
|
Case Align.Right
|
|
panSide.Move(BUTTON_H, 0, Me.ClientW - BUTTON_H, Me.ClientH)
|
|
|
|
End Select
|
|
|
|
'IF $bVisible THEN panSide.Show
|
|
|
|
'DEBUG $bVisible;; "(";; ME.X;; ME.Y;; ME.W;; ME.H;; ") (";; btnSide.X;; btnSide.Y;; btnSide.W;; btnSide.H;; btnSide.Visible;; ") (";; panSide.X;; panSide.Y;; panSide.W;; panSide.H;; panSide.Visible;; ")"
|
|
'STOP
|
|
|
|
End
|
|
|
|
Public Function GetContainer() As Panel
|
|
|
|
Return panSide
|
|
|
|
End
|
|
|
|
Private Sub GetParent() As SidePanel
|
|
|
|
Return Me.Parent
|
|
|
|
End
|
|
|
|
|
|
Public Sub Form_Resize()
|
|
|
|
'DEBUG ME.X;; ME.Y;; ME.W;; ME.H
|
|
RefreshPanel
|
|
GetParent()._Resize
|
|
|
|
End
|
|
|
|
Private Sub RefreshArrow()
|
|
|
|
Dim hPict As Picture
|
|
Dim hImage As Image
|
|
Dim sKey As String
|
|
Dim iType As Integer
|
|
|
|
If Not $bOpened Then Return
|
|
|
|
Select Case $iOrientation
|
|
Case Align.Top, Align.Bottom
|
|
If $bVisible Xor ($iOrientation = Align.Bottom) Then
|
|
sKey = "$side-top"
|
|
iType = Align.Top
|
|
'hPict = Picture["img/8/side-top.png"]
|
|
Else
|
|
sKey = "$side-bottom"
|
|
iType = Align.Bottom
|
|
'hPict = Picture["img/8/side-bottom.png"]
|
|
Endif
|
|
Case Align.Left, Align.Right
|
|
If $bVisible Xor ($iOrientation = Align.Right) Then
|
|
sKey = "$side-left"
|
|
iType = Align.Left
|
|
'hPict = Picture["img/8/side-left.png"]
|
|
Else
|
|
sKey = "$align-right"
|
|
iType = Align.Right
|
|
'hPict = Picture["img/8/side-right.png"]
|
|
Endif
|
|
End Select
|
|
|
|
hPict = Picture[sKey]
|
|
If Not hPict Then
|
|
hPict = New Picture(12, 12)
|
|
hPict.Fill(Color.White)
|
|
Draw.Begin(hPict)
|
|
Draw.Style.Arrow(0, 0, 12, 12, iType)
|
|
Draw.End
|
|
hImage = hPict.Image.Stretch(8, 8, True)
|
|
hImage.MakeTransparent(Color.White)
|
|
hPict = hImage.Picture
|
|
Picture[sKey] = hPict
|
|
Endif
|
|
|
|
btnSide.Picture = hPict
|
|
btnSide2.Picture = hPict
|
|
|
|
If $bVisible And Not $bFixed And Not Me.Parent.Design Then
|
|
panMove.Mouse = If(IsVertical(), Mouse.SplitV, Mouse.SplitH)
|
|
Else
|
|
panMove.Mouse = Mouse.Default
|
|
Endif
|
|
|
|
End
|
|
|
|
Private Sub RefreshAll()
|
|
|
|
If Not $bOpened Then Return
|
|
|
|
If $bVisible Then
|
|
panSide.Show 'Enabled = TRUE
|
|
If $W And If $H Then Me.Parent.Resize($W, $H)
|
|
Else
|
|
'DEBUG ME.Parent.W;; ME.CLientW
|
|
panSide.Hide 'Enabled = FALSE
|
|
Select Case $iOrientation
|
|
Case Align.Top, Align.Bottom
|
|
Me.Parent.H = BUTTON_H
|
|
Case Else
|
|
Me.Parent.W = BUTTON_H
|
|
End Select
|
|
Endif
|
|
|
|
RefreshArrow
|
|
RefreshPanel
|
|
|
|
End
|
|
|
|
|
|
Public Sub btnSide_Click()
|
|
|
|
If Me.Parent.Design Then Return
|
|
|
|
If $bVisible Then
|
|
|
|
GetParent()._Hide
|
|
|
|
$W = Me.Parent.Width
|
|
$H = Me.Parent.Height
|
|
$bVisible = False
|
|
RefreshAll
|
|
Action.Raise(Me.Parent)
|
|
|
|
Else
|
|
|
|
$bVisible = True
|
|
RefreshAll
|
|
Action.Raise(Me.Parent)
|
|
|
|
GetParent()._Show
|
|
|
|
Endif
|
|
|
|
End
|
|
|
|
Private Function IsVertical() As Boolean
|
|
|
|
Return $iOrientation = Align.Top Or $iOrientation = Align.Bottom
|
|
|
|
End
|
|
|
|
|
|
Public Sub panMove_MouseDown()
|
|
|
|
If Not $bVisible Then Return
|
|
If Me.Parent.Design Then Return
|
|
If $bFixed Then Return
|
|
|
|
$MX = Mouse.ScreenX - Me.Parent.W
|
|
|
|
Select Case $iOrientation
|
|
Case Align.Top
|
|
$MY = Mouse.ScreenY - Me.Parent.H
|
|
$iMax = Me.Parent.Parent.ClientH - Me.Parent.Y
|
|
Case Align.Bottom
|
|
$MY = Mouse.ScreenY + Me.H
|
|
$iMax = Me.Parent.Y + Me.Parent.H
|
|
Case Align.Left
|
|
$MX = Mouse.ScreenX - Me.Parent.W
|
|
$iMax = Me.Parent.Parent.ClientW - Me.Parent.X
|
|
Case Align.Right
|
|
$MX = Mouse.ScreenX + Me.W
|
|
$iMax = Me.Parent.X + Me.Parent.W
|
|
End Select
|
|
|
|
End
|
|
|
|
Private Function GetDim(H As Integer) As Integer
|
|
|
|
Dim iMin As Integer
|
|
|
|
iMin = Min($iMax, Max(BUTTON_H, 64))
|
|
|
|
If H < BUTTON_H Then
|
|
H = BUTTON_H
|
|
Else If H < iMin Then
|
|
H = iMin
|
|
Endif
|
|
|
|
Return H
|
|
|
|
End
|
|
|
|
|
|
Public Sub panMove_MouseMove()
|
|
|
|
Dim H As Integer
|
|
|
|
If Not Mouse.Left Then Return
|
|
If Not $bVisible Then Return
|
|
If Me.Parent.Design Then Return
|
|
If $bFixed Then Return
|
|
|
|
Select Case $iOrientation
|
|
Case Align.Top
|
|
Me.Parent.H = GetDim(Min($iMax, Mouse.ScreenY - $MY))
|
|
Case Align.Bottom
|
|
H = GetDim(Min($iMax, $MY - Mouse.ScreenY))
|
|
'H = Max(iMin, Min($iMax, $MY - Mouse.ScreenY))
|
|
Me.Parent.Move(Me.Parent.X, $iMax - H, Me.Parent.W, H)
|
|
Case Align.Left
|
|
Me.Parent.W = GetDim(Min($iMax, Mouse.ScreenX - $MX))
|
|
Case Align.Right
|
|
H = GetDim(Min($iMax, $MX - Mouse.ScreenX))
|
|
Me.Parent.Move($iMax - H, Me.Parent.Y, H, Me.Parent.H)
|
|
End Select
|
|
|
|
RefreshPanel
|
|
|
|
End
|
|
|
|
Public Function IsHidden() As Boolean
|
|
|
|
Return Not $bVisible
|
|
|
|
End
|
|
|
|
Public Sub SetHidden(bHidden As Boolean)
|
|
|
|
If bHidden = $bVisible Then btnSide_Click
|
|
|
|
End
|
|
|
|
Public Function GetDimension() As Integer
|
|
|
|
If IsVertical() Then
|
|
If Not $bVisible Then
|
|
Return $H
|
|
Else
|
|
Return Me.Parent.Height
|
|
Endif
|
|
Else
|
|
If Not $bVisible Then
|
|
Return $W
|
|
Else
|
|
Return Me.Parent.Width
|
|
Endif
|
|
Endif
|
|
|
|
End
|
|
|
|
Public Sub SetDimension(iDim As Integer)
|
|
|
|
If IsVertical() Then
|
|
If Not $bVisible Then
|
|
$H = iDim
|
|
Else
|
|
Me.Parent.Height = iDim
|
|
Endif
|
|
Else
|
|
If Not $bVisible Then
|
|
$W = iDim
|
|
Else
|
|
Me.Parent.Width = iDim
|
|
Endif
|
|
Endif
|
|
|
|
End
|
|
|
|
|
|
Public Function IsFixed() As Boolean
|
|
|
|
Return $bFixed
|
|
|
|
End
|
|
|
|
Public Sub SetFixed(bFixed As Boolean)
|
|
|
|
$bFixed = bFixed
|
|
RefreshArrow
|
|
|
|
End
|
|
|
|
Public Sub panMove_DblClick()
|
|
|
|
If $bVisible Then btnSide_Click
|
|
|
|
End
|
|
|
|
Public Function GetTooltip() As String
|
|
|
|
Return btnSide.ToolTip
|
|
|
|
End
|
|
|
|
Public Sub SetTooltip(Value As String)
|
|
|
|
btnSide.ToolTip = Value
|
|
btnSide2.ToolTip = Value
|
|
panMove.ToolTip = Value
|
|
|
|
End
|
|
|
|
Public Sub SetDesign()
|
|
|
|
RefreshArrow
|
|
RefreshPanel
|
|
|
|
End
|
|
|
|
|
|
' PUBLIC SUB panMove_Draw()
|
|
'
|
|
' IF IsVertical() THEN
|
|
' Draw.FillX = 0
|
|
' Draw.FillY = panMove.H / 2 - 2
|
|
' Draw.Tile($hHandleH, panMove.W * 0.1, panMove.H / 2 - 3, panMove.W * 0.8, 4)
|
|
' ELSE
|
|
' Draw.FillX = panMove.W / 2 - 2
|
|
' Draw.FillY = 0
|
|
' Draw.Tile($hHandleV, panMove.W / 2 - 3, panMove.H * 0.1, 4, panMove.H * 0.8)
|
|
' ENDIF
|
|
'
|
|
' END
|
|
|
|
Public Sub panMove_Enter()
|
|
|
|
$iColor = panMove.Background
|
|
|
|
If Not $bVisible Then Return
|
|
If $bFixed Then Return
|
|
If Me.Parent.Design Then Return
|
|
|
|
panMove.Background = Color.TextBackground
|
|
'btnSide.Background = Color.ButtonBackground
|
|
'btnSide2.Background = Color.ButtonBackground
|
|
|
|
End
|
|
|
|
Public Sub panMove_Leave()
|
|
|
|
panMove.Background = $iColor
|
|
'btnSide.Background = $iColor
|
|
'btnSide2.Background = $iColor
|
|
|
|
End
|