[DEVELOPMENT ENVIRONMENT]
* BUG: UTF-8 characters are allowed in project data file names now. [INTEPRETER] * NEW: Allocation debugging messages can be redirected to a log file. [GB.DB.FORM] * BUG: DataBrowser FBrowser form does not incorrectly override Form.Panel anymore. [GB.GTK] * BUG: TabStrip.Font now behaves as expected. * BUG: GridView Row and Column properties can be set independently. * BUG: Fix the container arrangement and the ClientX / ClientY properties. [GB.FORM] * OPT: FileView redraws were delayed so that they are optimized. * BUG: Balloon tried to not take the focus. [GB.QT] * BUG: Fix the GridView last column stretching. [GB.QT4] * NEW: The AutoResize property of Button, ToolButton and ToggleButton controls were implemented. * BUG: Button, ToolButton and ToggleButton now behave correctly when their font change. * OPT: Arrangement was optimized. * BUG: TabStrip ClientX, ClientY, ClientWidth and ClientHeight properties now return accurate values. [GB.QT4.EXT] * BUG: Editor now draws non-highlighted lines correctly. git-svn-id: svn://localhost/gambas/trunk@1868 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
a9788faff4
commit
e2c952c375
41 changed files with 566 additions and 367 deletions
app/src/gambas3
comp/src
gb.db.form
gb.form.mdi
gb.form
examples/examples/Database/Database
gb.gtk/src
gb.qt/src
gb.qt4/src
CButton.cppCButton.hCContainer.cppCContainer.hCMenu.cppCSplitter.cppCTabStrip.cppCWidget.cppCWidget.hCWindow.cpp
ext
main.cppmain
|
@ -2,6 +2,7 @@
|
|||
# Compiled with Gambas 2.99.0
|
||||
Title=Gambas 3
|
||||
Startup=Project
|
||||
StackTrace=1
|
||||
Icon=img/logo/new-logo.png
|
||||
Version=2.99.0
|
||||
VersionProgram=gbx3 -V
|
||||
|
|
|
@ -93,7 +93,7 @@ Public Const KEY_PROJECT As String = "$P"
|
|||
|
||||
Private Const CLASS_AUTH_CAR As String = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
Private Const CLASS_AUTH_FIRST_CAR As String = "abcdefghijklmnopqrstuvwxyz_"
|
||||
Private Const FILE_AUTH_CAR As String = "abcdefghijklmnopqrstuvwxyz0123456789-.+_"
|
||||
Private Const FILE_FORBIDDEN_CAR As String = "?*/~"
|
||||
|
||||
Private Const PROJECT_FILE As String = ".project"
|
||||
Private Const STARTUP_FILE As String = ".startup"
|
||||
|
@ -2803,9 +2803,14 @@ Public Function CheckFileName(sName As String, Optional sDir As String) As Strin
|
|||
|
||||
If Not sName Then Goto VOID_NAME
|
||||
|
||||
For iInd = 1 To Len(sName)
|
||||
If String.Left$(sName) = "." Then
|
||||
iInd = 1
|
||||
Goto BAD_CHAR
|
||||
Endif
|
||||
|
||||
If InStr(FILE_AUTH_CAR & "-._+()", LCase(Mid$(sName, iInd, 1))) = 0 Then Goto BAD_CHAR
|
||||
For iInd = 1 To String.Len(sName)
|
||||
|
||||
If InStr(FILE_FORBIDDEN_CAR, String.Mid$(sName, iInd, 1)) Then Goto BAD_CHAR
|
||||
|
||||
Next
|
||||
|
||||
|
@ -2821,7 +2826,7 @@ VOID_NAME:
|
|||
|
||||
BAD_CHAR:
|
||||
|
||||
Return ("This name contains a forbidden character:") & " [ " & Mid$(sName, iInd, 1) & " ]"
|
||||
Return ("This name contains a forbidden character:") & " [ " & String.Mid$(sName, iInd, 1) & " ]"
|
||||
|
||||
ALREADY_EXIST:
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Component]
|
||||
Key=gb.db.form
|
||||
Version=2.99.0
|
||||
Authors=Benoît Minisini
|
||||
Needs=Form
|
||||
Requires=gb.db,gb.form
|
||||
|
|
|
@ -10,11 +10,11 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: DataControl.class:83 DataView.class:198
|
||||
#: DataControl.class:83 DataView.class:200
|
||||
msgid "True"
|
||||
msgstr ""
|
||||
|
||||
#: DataControl.class:84 DataView.class:198
|
||||
#: DataControl.class:84 DataView.class:200
|
||||
msgid "False"
|
||||
msgstr ""
|
||||
|
||||
|
@ -62,34 +62,34 @@ msgstr ""
|
|||
msgid "End"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:107
|
||||
#: FMain.class:106
|
||||
msgid "Id"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:112
|
||||
#: FMain.class:111
|
||||
msgid "Color"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:117
|
||||
#: FMain.class:116
|
||||
msgid "First Name"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:122
|
||||
#: FMain.class:121
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:127
|
||||
#: FMain.class:126
|
||||
msgid "Birth"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:132
|
||||
#: FMain.class:131
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:137
|
||||
#: FMain.class:136
|
||||
msgid "Salary"
|
||||
msgstr ""
|
||||
|
||||
#: FMain.class:142
|
||||
#: FMain.class:141
|
||||
msgid "Comment"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.0
|
||||
Startup=Main
|
||||
Version=2.99.91
|
||||
Version=2.99.0
|
||||
VersionProgram=gbx3 -V
|
||||
Component=gb.gui
|
||||
Component=gb.form
|
||||
Component=gb.db
|
||||
Component=gb.db.form
|
||||
Authors=Benoît Minisini
|
||||
Environment="GB_GUI=gb.qt"
|
||||
Environment="GB_GUI=gb.qt4"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
|
|
|
@ -53,13 +53,13 @@ End
|
|||
|
||||
Private Function Control_Read() As Boolean
|
||||
|
||||
Return $hForm.Panel.Visible
|
||||
Return $hForm.ButtonPanel.Visible
|
||||
|
||||
End
|
||||
|
||||
Private Sub Control_Write(bVisible As Boolean)
|
||||
|
||||
$hForm.Panel.Visible = bVisible
|
||||
$hForm.ButtonPanel.Visible = bVisible
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -1,134 +1,136 @@
|
|||
' Gambas class file
|
||||
|
||||
EXPORT
|
||||
INHERITS UserControl
|
||||
Export
|
||||
Inherits UserControl
|
||||
|
||||
PUBLIC CONST _Properties AS String = "*,Mode{Select.None;Single;Multi}=None,Header{GridView.None;Horizontal;Vertical;Both}=Both,Grid,Highlight=True,Columns"
|
||||
PUBLIC CONST _DrawWith AS String = "GridView"
|
||||
Public Const _Properties As String = "*,Mode{Select.None;Single;Multi}=None,Header{GridView.None;Horizontal;Vertical;Both}=Both,Grid,Highlight=True,Columns"
|
||||
Public Const _DrawWith As String = "GridView"
|
||||
|
||||
EVENT Activate
|
||||
Event Activate
|
||||
|
||||
PROPERTY Mode AS Integer
|
||||
PROPERTY Header AS Integer
|
||||
PROPERTY Grid AS Boolean
|
||||
PROPERTY Highlight AS Boolean
|
||||
Property Mode As Integer
|
||||
Property Header As Integer
|
||||
Property Grid As Boolean
|
||||
Property Highlight As Boolean
|
||||
|
||||
'PROPERTY Connection AS Connection
|
||||
'PROPERTY Table AS String
|
||||
'PROPERTY Filter AS String
|
||||
PROPERTY Columns AS String[]
|
||||
PROPERTY READ Current AS Variant[]
|
||||
PROPERTY READ Count AS Integer
|
||||
PROPERTY READ Index AS Integer
|
||||
PROPERTY READ GridView AS GridView
|
||||
Property Columns As String[]
|
||||
Property Read Current As Variant[]
|
||||
Property Read Count As Integer
|
||||
Property Read Index As Integer
|
||||
Property Read GridView As GridView
|
||||
|
||||
'PRIVATE $hConn AS Connection
|
||||
PRIVATE $hCtrl AS GridView
|
||||
Private $hCtrl As GridView
|
||||
'PRIVATE $sTable AS String
|
||||
'PRIVATE $sFilter AS String
|
||||
PRIVATE $hTable AS DataTable
|
||||
PRIVATE $aColumns AS String[]
|
||||
PRIVATE $bCreate AS Boolean
|
||||
PRIVATE $bRefreshColumn AS Boolean
|
||||
PRIVATE $bNoActivate AS Boolean
|
||||
PRIVATE $iHighlight AS Integer
|
||||
PRIVATE $bHighlight AS Boolean
|
||||
Private $hTable As DataTable
|
||||
Private $aColumns As String[]
|
||||
Private $bCreate As Boolean
|
||||
Private $bRefreshColumn As Boolean
|
||||
Private $bNoActivate As Boolean
|
||||
Private $iHighlight As Integer
|
||||
Private $bHighlight As Boolean
|
||||
|
||||
PUBLIC SUB _new()
|
||||
Public Sub _new()
|
||||
|
||||
$hCtrl = NEW GridView(ME) AS "GridView"
|
||||
$hCtrl = New GridView(Me) As "GridView"
|
||||
$hCtrl.Header = GridView.Both
|
||||
'''$hCtrl.AutoResize = TRUE
|
||||
'''$hCtrl.Resizable = FALSE
|
||||
$hCtrl.Grid = FALSE
|
||||
$hCtrl.Grid = False
|
||||
Create()
|
||||
Refresh
|
||||
|
||||
$bHighlight = TRUE
|
||||
$bHighlight = True
|
||||
$iHighlight = Color.LightBackground
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB RefreshColumns()
|
||||
Private Sub RefreshColumns()
|
||||
|
||||
DIM iInd AS Integer
|
||||
DIM sTable AS String
|
||||
Dim iInd As Integer
|
||||
Dim sTable As String
|
||||
|
||||
IF Common.CheckDB() THEN RETURN
|
||||
IF NOT $bRefreshColumn THEN RETURN
|
||||
If Common.CheckDB() Then Return
|
||||
If Not $bRefreshColumn Then Return
|
||||
|
||||
$bRefreshColumn = FALSE
|
||||
$bRefreshColumn = False
|
||||
|
||||
sTable = $hTable.Name
|
||||
|
||||
IF NOT $aColumns OR IF $aColumns.Count = 0 THEN
|
||||
If Not $aColumns Or If $aColumns.Count = 0 Then
|
||||
$aColumns = DataConnection.GetFields(sTable)
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
'Object.Lock($hCtrl)
|
||||
$bNoActivate = TRUE
|
||||
$bNoActivate = True
|
||||
$hCtrl.Columns.Count = $aColumns.Count
|
||||
FOR iInd = 0 TO $aColumns.Max
|
||||
WITH DataConnection[sTable, $aColumns[iInd]]
|
||||
For iInd = 0 To $aColumns.Max
|
||||
With DataConnection[sTable, $aColumns[iInd]]
|
||||
'Debug .Name;; $hCtrl.Columns[iInd].Width;; .GetWidth($hCtrl)
|
||||
$hCtrl.Columns[iInd].Text = .Name
|
||||
$hCtrl.Columns[iInd].Width = .GetWidth($hCtrl)
|
||||
END WITH
|
||||
NEXT
|
||||
$bNoActivate = FALSE
|
||||
'Debug "--> "; $hCtrl.Columns[iInd].Width
|
||||
End With
|
||||
Next
|
||||
$bNoActivate = False
|
||||
'Object.Unlock($hCtrl)
|
||||
|
||||
IF $bCreate THEN Create()
|
||||
If $bCreate Then Create()
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE SUB Load()
|
||||
Private Sub Load()
|
||||
|
||||
DIM hSrc AS DataSource
|
||||
Dim hSrc As DataSource
|
||||
|
||||
IF Common.CheckDB() THEN RETURN
|
||||
If Common.CheckDB() Then Return
|
||||
|
||||
'TRY DB.Open
|
||||
|
||||
'IF NOT $sTable THEN
|
||||
hSrc = Common.GetSource(ME)
|
||||
IF hSrc THEN
|
||||
hSrc = Common.GetSource(Me)
|
||||
If hSrc Then
|
||||
$hTable = hSrc._GetTable()
|
||||
ENDIF
|
||||
Endif
|
||||
'ELSE
|
||||
' $hTable = NEW DataTable($sTable, $sFilter)
|
||||
'ENDIF
|
||||
|
||||
IF NOT $hTable THEN
|
||||
If Not $hTable Then
|
||||
$hCtrl.Rows.Count = 0
|
||||
RETURN
|
||||
ENDIF
|
||||
Return
|
||||
Endif
|
||||
|
||||
RefreshColumns
|
||||
'Object.Lock($hCtrl)
|
||||
$bNoActivate = TRUE
|
||||
$bNoActivate = True
|
||||
$hCtrl.Rows.Count = $hTable.Count
|
||||
$bNoActivate = FALSE
|
||||
$bNoActivate = False
|
||||
'Object.Unlock($hCtrl)
|
||||
|
||||
$hCtrl.Refresh
|
||||
|
||||
IF hSrc.Index < 0 THEN
|
||||
$bCreate = TRUE
|
||||
If hSrc.Index < 0 Then
|
||||
$bCreate = True
|
||||
$hCtrl.Rows.UnSelect
|
||||
ELSE
|
||||
Else
|
||||
$hCtrl.Row = hSrc.Index
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
ENDIF
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
Endif
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB Refresh()
|
||||
Public Sub Refresh()
|
||||
|
||||
Load
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
@ -160,49 +162,49 @@ END
|
|||
'
|
||||
' END
|
||||
|
||||
PRIVATE FUNCTION Columns_Read() AS String[]
|
||||
Private Function Columns_Read() As String[]
|
||||
|
||||
RETURN $aColumns.Copy()
|
||||
Return $aColumns.Copy()
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB Columns_Write(aCol AS String[])
|
||||
Private Sub Columns_Write(aCol As String[])
|
||||
|
||||
IF NOT aCol THEN
|
||||
$aColumns = NULL
|
||||
ELSE
|
||||
If Not aCol Then
|
||||
$aColumns = Null
|
||||
Else
|
||||
$aColumns = aCol.Copy()
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
$bRefreshColumn = TRUE
|
||||
$bRefreshColumn = True
|
||||
RefreshColumns
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB GridView_Data(Row AS Integer, Column AS Integer)
|
||||
Public Sub GridView_Data(Row As Integer, Column As Integer)
|
||||
|
||||
DIM rData AS Result
|
||||
DIM vVal AS Variant
|
||||
Dim rData As Result
|
||||
Dim vVal As Variant
|
||||
|
||||
rData = $hTable[Row]
|
||||
IF NOT rData THEN RETURN
|
||||
IF NOT rData.Available THEN RETURN
|
||||
If Not rData Then Return
|
||||
If Not rData.Available Then Return
|
||||
|
||||
IF $aColumns THEN
|
||||
If $aColumns Then
|
||||
vVal = rData[$aColumns[Column]]
|
||||
ELSE
|
||||
Else
|
||||
vVal = rData[Column]
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
IF IsBoolean(vVal) THEN
|
||||
If IsBoolean(vVal) Then
|
||||
$hCtrl.Data.Text = If(vVal, ("True"), ("False"))
|
||||
ELSE
|
||||
Else
|
||||
$hCtrl.Data.Text = Str(vVal)
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
IF $bHighlight AND IF Row AND 1 THEN $hCtrl.Data.Background = $iHighlight
|
||||
If $bHighlight And If Row And 1 Then $hCtrl.Data.Background = $iHighlight
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
' PUBLIC SUB GridView_Click()
|
||||
'
|
||||
|
@ -211,39 +213,39 @@ END
|
|||
' END
|
||||
|
||||
|
||||
PUBLIC SUB GridView_Change()
|
||||
Public Sub GridView_Change()
|
||||
|
||||
IF $bNoActivate THEN RETURN
|
||||
If $bNoActivate Then Return
|
||||
|
||||
$bCreate = FALSE
|
||||
RAISE Activate
|
||||
$bCreate = False
|
||||
Raise Activate
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE FUNCTION Mode_Read() AS Integer
|
||||
Private Function Mode_Read() As Integer
|
||||
|
||||
RETURN $hCtrl.Mode
|
||||
Return $hCtrl.Mode
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB Mode_Write(iMode AS Integer)
|
||||
Private Sub Mode_Write(iMode As Integer)
|
||||
|
||||
$hCtrl.Mode = iMode
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE FUNCTION Header_Read() AS Integer
|
||||
Private Function Header_Read() As Integer
|
||||
|
||||
RETURN $hCtrl.Header
|
||||
Return $hCtrl.Header
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB Header_Write(iHeader AS Integer)
|
||||
Private Sub Header_Write(iHeader As Integer)
|
||||
|
||||
$hCtrl.Header = iHeader
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
' PRIVATE FUNCTION Connection_Read() AS Connection
|
||||
'
|
||||
|
@ -260,137 +262,137 @@ END
|
|||
'
|
||||
' END
|
||||
'
|
||||
PRIVATE FUNCTION Current_Read() AS Variant[]
|
||||
Private Function Current_Read() As Variant[]
|
||||
|
||||
RETURN $hTable.GetKeys($hCtrl.Row)
|
||||
Return $hTable.GetKeys($hCtrl.Row)
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB MoveFirst()
|
||||
|
||||
TRY $hCtrl.Row = 0
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
$bCreate = FALSE
|
||||
|
||||
END
|
||||
Public Sub MoveFirst()
|
||||
|
||||
PUBLIC SUB MoveLast()
|
||||
Try $hCtrl.Row = 0
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
$bCreate = False
|
||||
|
||||
End
|
||||
|
||||
Public Sub MoveLast()
|
||||
|
||||
$hCtrl.Row = $hCtrl.Rows.Count - 1
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
$bCreate = FALSE
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
$bCreate = False
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB MoveNext()
|
||||
Public Sub MoveNext()
|
||||
|
||||
IF $bCreate THEN
|
||||
If $bCreate Then
|
||||
MoveFirst
|
||||
RETURN
|
||||
ENDIF
|
||||
IF $hCtrl.Row >= ($hCtrl.Rows.Count - 1) THEN RETURN
|
||||
IF $hCtrl.Row < 0 THEN RETURN
|
||||
INC $hCtrl.Row
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
Return
|
||||
Endif
|
||||
If $hCtrl.Row >= ($hCtrl.Rows.Count - 1) Then Return
|
||||
If $hCtrl.Row < 0 Then Return
|
||||
Inc $hCtrl.Row
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB MovePrevious()
|
||||
Public Sub MovePrevious()
|
||||
|
||||
IF $bCreate THEN
|
||||
If $bCreate Then
|
||||
MoveFirst
|
||||
RETURN
|
||||
ENDIF
|
||||
IF $hCtrl.Row <= 0 THEN RETURN
|
||||
DEC $hCtrl.Row
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
Return
|
||||
Endif
|
||||
If $hCtrl.Row <= 0 Then Return
|
||||
Dec $hCtrl.Row
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB MoveTo(Index AS Integer)
|
||||
Public Sub MoveTo(Index As Integer)
|
||||
|
||||
IF Index = $hCtrl.Row THEN RETURN
|
||||
If Index = $hCtrl.Row Then Return
|
||||
$hCtrl.Row = Index
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB Create()
|
||||
Public Sub Create()
|
||||
|
||||
$bCreate = TRUE
|
||||
$bCreate = True
|
||||
$hCtrl.Rows.UnSelect
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE FUNCTION Count_Read() AS Integer
|
||||
Private Function Count_Read() As Integer
|
||||
|
||||
RETURN $hCtrl.Rows.Count
|
||||
Return $hCtrl.Rows.Count
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE FUNCTION Index_Read() AS Integer
|
||||
Private Function Index_Read() As Integer
|
||||
|
||||
IF $bCreate THEN
|
||||
RETURN -1
|
||||
ELSE
|
||||
RETURN $hCtrl.Row
|
||||
ENDIF
|
||||
If $bCreate Then
|
||||
Return -1
|
||||
Else
|
||||
Return $hCtrl.Row
|
||||
Endif
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC FUNCTION Remove() AS Boolean
|
||||
Public Function Remove() As Boolean
|
||||
|
||||
Create()
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE FUNCTION GridView_Read() AS GridView
|
||||
Private Function GridView_Read() As GridView
|
||||
|
||||
RETURN $hCtrl
|
||||
Return $hCtrl
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB GridView_ColumnClick(Column AS Integer)
|
||||
Public Sub GridView_ColumnClick(Column As Integer)
|
||||
|
||||
DIM hSrc AS DataSource
|
||||
Dim hSrc As DataSource
|
||||
|
||||
hSrc = Common.GetSource(ME)
|
||||
IF NOT hSrc THEN RETURN
|
||||
hSrc = Common.GetSource(Me)
|
||||
If Not hSrc Then Return
|
||||
|
||||
IF hSrc.Sort <> $aColumns[Column] THEN
|
||||
If hSrc.Sort <> $aColumns[Column] Then
|
||||
hSrc.Sort = $aColumns[Column]
|
||||
ELSE
|
||||
Else
|
||||
hSrc.Sort = ""
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
$hCtrl.Refresh
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PRIVATE FUNCTION Grid_Read() AS Boolean
|
||||
Private Function Grid_Read() As Boolean
|
||||
|
||||
RETURN $hCtrl.Grid
|
||||
Return $hCtrl.Grid
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB Grid_Write(Value AS Boolean)
|
||||
Private Sub Grid_Write(Value As Boolean)
|
||||
|
||||
$hCtrl.Grid = Value
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE FUNCTION Highlight_Read() AS Boolean
|
||||
Private Function Highlight_Read() As Boolean
|
||||
|
||||
RETURN $bHighlight
|
||||
Return $bHighlight
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PRIVATE SUB Highlight_Write(Value AS Boolean)
|
||||
Private Sub Highlight_Write(Value As Boolean)
|
||||
|
||||
$bHighlight = Value
|
||||
|
||||
END
|
||||
End
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
' Gambas class file
|
||||
|
||||
Public Panel As Panel
|
||||
Public ButtonPanel As Panel
|
||||
Public DataView As DataView
|
||||
|
||||
Private $hSrc As DataSource
|
||||
|
@ -11,7 +11,7 @@ Private $W As Integer
|
|||
|
||||
Public Sub _new()
|
||||
|
||||
Panel = panBrowser
|
||||
ButtonPanel = panBrowser
|
||||
DataView = dvwBrowser
|
||||
dvwBrowser.Header = GridView.Horizontal
|
||||
$W = btnNew.W
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,64,84)
|
||||
MoveScaled(0,0,68,84)
|
||||
Text = ("")
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = 8
|
||||
Spacing = True
|
||||
Padding = 8
|
||||
{ DataCombo2 DataCombo
|
||||
MoveScaled(1,1,62,4)
|
||||
|
@ -16,21 +16,20 @@
|
|||
MoveScaled(1,5,62,68)
|
||||
Expand = True
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = 8
|
||||
Spacing = True
|
||||
Table = "test"
|
||||
{ DataBrowser1 DataBrowser
|
||||
MoveScaled(2,2,59,18)
|
||||
Expand = True
|
||||
Control = False
|
||||
Columns = ["id", "active", "firstname", "salary"]
|
||||
Orientation = Align.Top
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(2,21,59,46)
|
||||
Spacing = 8
|
||||
Spacing = True
|
||||
{ VBox2 VBox
|
||||
MoveScaled(1,1,12,35)
|
||||
Spacing = 8
|
||||
Spacing = True
|
||||
{ Label1 Label
|
||||
MoveScaled(1,3,9,4)
|
||||
Text = ("Id")
|
||||
|
@ -67,13 +66,13 @@
|
|||
{ VBox1 VBox
|
||||
MoveScaled(14,1,44,40)
|
||||
Expand = True
|
||||
Spacing = 8
|
||||
Spacing = True
|
||||
{ DataControl1 DataControl
|
||||
MoveScaled(1,3,30,4)
|
||||
MoveScaled(1,1,30,4)
|
||||
Field = "id"
|
||||
}
|
||||
{ DataCombo1 DataCombo
|
||||
MoveScaled(1,7,30,4)
|
||||
MoveScaled(1,6,30,4)
|
||||
Field = "color"
|
||||
Table = "color"
|
||||
Display = "french"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.0 (r1814)
|
||||
# Compiled with Gambas 2.99.0
|
||||
Startup=FTest
|
||||
StackTrace=1
|
||||
Version=2.99.0
|
||||
|
@ -9,7 +9,7 @@ Component=gb.form
|
|||
Component=gb.settings
|
||||
Component=gb.form.mdi
|
||||
Authors=Benoît Minisini
|
||||
Environment="GB_GUI=gb.qt"
|
||||
Environment="GB_GUI=gb.qt4"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Toggle = True
|
||||
}
|
||||
{ ToolBar1 ToolBar
|
||||
MoveScaled(1,1,127,4)
|
||||
MoveScaled(2,3,132,4)
|
||||
Expand = True
|
||||
Key = "main"
|
||||
Text = ("")
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
Visible = False
|
||||
}
|
||||
{ tabWorkspace TabStrip
|
||||
MoveScaled(2,7,56,51)
|
||||
MoveScaled(3,9,56,51)
|
||||
Visible = False
|
||||
Expand = True
|
||||
Arrangement = Arrange.Fill
|
||||
|
@ -22,7 +22,7 @@
|
|||
Background = Color.SelectedBackground
|
||||
Arrangement = Arrange.Horizontal
|
||||
AutoResize = True
|
||||
Spacing = 2
|
||||
Spacing = True
|
||||
Padding = 4
|
||||
{ imgIcon PictureBox
|
||||
MoveScaled(0,0,3,3)
|
||||
|
@ -68,18 +68,18 @@
|
|||
Border = Border.Plain
|
||||
}
|
||||
{ dwgBorder DrawingArea
|
||||
MoveScaled(16,6,15,11)
|
||||
MoveScaled(14,3,15,11)
|
||||
Background = Color.Background
|
||||
Border = Border.Raised
|
||||
}
|
||||
}
|
||||
{ panWorkspace Panel
|
||||
MoveScaled(27,43,28,25)
|
||||
MoveScaled(27,47,28,25)
|
||||
Arrangement = Arrange.Fill
|
||||
Padding = 1
|
||||
Border = Border.Raised
|
||||
{ picLogo PictureBox
|
||||
MoveScaled(5,4,19,19)
|
||||
MoveScaled(3,2,19,19)
|
||||
Visible = False
|
||||
Ignore = True
|
||||
}
|
||||
|
|
|
@ -784,6 +784,10 @@ _new
|
|||
m
|
||||
|
||||
|
||||
Refresh_Timer
|
||||
m
|
||||
|
||||
|
||||
Reload
|
||||
m
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ msgstr ""
|
|||
msgid "Strikeout"
|
||||
msgstr ""
|
||||
|
||||
#: FFontChooser.class:453 FileView.class:75
|
||||
#: FFontChooser.class:453 FileView.class:77
|
||||
msgid "Size"
|
||||
msgstr ""
|
||||
|
||||
|
@ -160,15 +160,15 @@ msgstr ""
|
|||
msgid "How quickly daft jumping zebras vex"
|
||||
msgstr ""
|
||||
|
||||
#: FileView.class:74
|
||||
#: FileView.class:76
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: FileView.class:77
|
||||
#: FileView.class:79
|
||||
msgid "Last modified"
|
||||
msgstr ""
|
||||
|
||||
#: FileView.class:184
|
||||
#: FileView.class:188
|
||||
msgid "&1 K"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.0 (r1814)
|
||||
Startup=FMain
|
||||
StackTrace=1
|
||||
Version=2.99.0
|
||||
VersionProgram=gbx3 -V
|
||||
Component=gb.gui
|
||||
|
|
|
@ -71,6 +71,7 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
|||
Dim X, Y, X1, Y1, X2, Y2, X3, Y3, Y4 As Integer
|
||||
Dim hWin As Window
|
||||
Dim sNew As String
|
||||
Dim hCtrl As Control
|
||||
|
||||
$X = $hCtrl.ScreenX
|
||||
$Y = $hCtrl.ScreenY
|
||||
|
@ -185,6 +186,8 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
|||
|
||||
Endif
|
||||
|
||||
hCtrl = Application.ActiveControl
|
||||
|
||||
If Not Me.Visible Then
|
||||
hWin = Application.ActiveWindow
|
||||
Me.Show
|
||||
|
@ -194,6 +197,8 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
|||
Me.Raise
|
||||
Endif
|
||||
|
||||
Try hCtrl.SetFocus
|
||||
|
||||
$dShow = Timer
|
||||
|
||||
End
|
||||
|
|
|
@ -38,6 +38,8 @@ Private $iSort As Integer
|
|||
Private $bAsc As Boolean = True
|
||||
Private $aFilter As String[]
|
||||
Private $hPict As Picture
|
||||
Private $hRefresh As Timer
|
||||
Private $bRefreshTriggered As Boolean
|
||||
|
||||
Static Public Sub _init()
|
||||
|
||||
|
@ -84,7 +86,9 @@ Public Sub _new()
|
|||
.Resizable = True
|
||||
End With
|
||||
|
||||
RefreshView
|
||||
$hRefresh = New Timer As "Refresh"
|
||||
|
||||
RefreshViewLater
|
||||
RefreshGrid
|
||||
|
||||
End
|
||||
|
@ -199,6 +203,24 @@ Catch
|
|||
|
||||
End
|
||||
|
||||
Private Sub RefreshViewLater()
|
||||
|
||||
If $bRefreshTriggered Then Return
|
||||
|
||||
$bRefreshTriggered = True
|
||||
$hRefresh.Trigger
|
||||
|
||||
End
|
||||
|
||||
Public Sub Refresh_Timer()
|
||||
|
||||
$bRefreshTriggered = False
|
||||
RefreshView
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
Public Sub Reload()
|
||||
|
||||
RefreshView
|
||||
|
@ -220,7 +242,7 @@ End
|
|||
Private Sub Dir_Write(sDir As String)
|
||||
|
||||
$sDir = sDir
|
||||
RefreshView
|
||||
RefreshViewLater
|
||||
|
||||
End
|
||||
|
||||
|
@ -234,7 +256,7 @@ Private Sub ShowHidden_Write(bShowHidden As Boolean)
|
|||
|
||||
If bShowHidden = $bShowHidden Then Return
|
||||
$bShowHidden = bShowHidden
|
||||
RefreshView
|
||||
RefreshViewLater
|
||||
|
||||
End
|
||||
|
||||
|
@ -247,7 +269,7 @@ End
|
|||
Private Sub ShowDirectory_Write(bShow As Boolean)
|
||||
|
||||
$bShowDir = bShow
|
||||
RefreshView
|
||||
RefreshViewLater
|
||||
|
||||
End
|
||||
|
||||
|
@ -318,7 +340,7 @@ Private Sub ShowDetailed_Write(bDetailed As Boolean)
|
|||
|
||||
Endif
|
||||
|
||||
RefreshView
|
||||
RefreshViewLater
|
||||
TakeSelection
|
||||
|
||||
End
|
||||
|
@ -474,7 +496,7 @@ End
|
|||
Private Sub Filter_Write(aFilter As String[])
|
||||
|
||||
$aFilter = aFilter
|
||||
RefreshView
|
||||
RefreshViewLater
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.0 (r1814)
|
||||
Startup=FMain
|
||||
Icon=database.png
|
||||
Version=0.0.1
|
||||
Library=gb.gui
|
||||
Library=gb.form
|
||||
Library=gb.db
|
||||
Library=gb.db.form
|
||||
Environment="GB_GUI=gb.qt"
|
||||
Component=gb.gui
|
||||
Component=gb.form
|
||||
Component=gb.db
|
||||
Component=gb.db.form
|
||||
Environment="GB_GUI=gb.gtk"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=fr
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
'PRIVATE $hConn AS NEW Connection
|
||||
|
||||
PUBLIC SUB Form_Open()
|
||||
Public Sub Form_Open()
|
||||
|
||||
WITH DataBrowser2.GridView
|
||||
With DataBrowser2.GridView
|
||||
.Columns[0].Text = "Color"
|
||||
END WITH
|
||||
End With
|
||||
|
||||
WITH DataBrowser1.GridView
|
||||
With DataBrowser1.GridView
|
||||
.Columns[0].Text = "Id"
|
||||
.Columns[0].Width = 48
|
||||
.Columns[1].Text = "Active"
|
||||
.Columns[2].Text = "Name"
|
||||
END WITH
|
||||
End With
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB DataControl6_Validate(Value AS Variant)
|
||||
Public Sub DataControl6_Validate(Value As Variant)
|
||||
|
||||
IF IsNull(Value) THEN RETURN
|
||||
IF Value < 0 OR Value > 10000 THEN
|
||||
STOP EVENT
|
||||
ENDIF
|
||||
If IsNull(Value) Then Return
|
||||
If Value < 0 Or Value > 10000 Then
|
||||
Stop Event
|
||||
Endif
|
||||
|
||||
END
|
||||
End
|
||||
|
|
|
@ -393,7 +393,7 @@ int gContainer::clientWidth()
|
|||
if (GTK_IS_SCROLLED_WINDOW(border))
|
||||
return (int)gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
||||
|
||||
return width() - getFrameWidth() - clientX();
|
||||
return width() - getFrameWidth() * 2;
|
||||
}
|
||||
|
||||
int gContainer::clientHeight()
|
||||
|
@ -423,7 +423,7 @@ int gContainer::clientHeight()
|
|||
if (GTK_IS_SCROLLED_WINDOW(border))
|
||||
return (int)gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
||||
|
||||
return height() - getFrameWidth() - clientY();
|
||||
return height() - getFrameWidth() * 2;
|
||||
}
|
||||
|
||||
void gContainer::insert(gControl *child)
|
||||
|
|
|
@ -1215,11 +1215,11 @@ void gGridView::getCursor(int *row,int *col)
|
|||
|
||||
void gGridView::setCursor(int row,int col)
|
||||
{
|
||||
if (row < 0 || row >= rowCount() || col < 0 || col > columnCount())
|
||||
{
|
||||
if (row < 0 || row >= rowCount())
|
||||
row = -1;
|
||||
|
||||
if (col < 0 || col >= columnCount())
|
||||
col = -1;
|
||||
}
|
||||
|
||||
if (row == cursor_row && col == cursor_col)
|
||||
return;
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
int count();
|
||||
gControl *child(int n);
|
||||
void updateColors();
|
||||
void updateFont();
|
||||
|
||||
GtkWidget *fix;
|
||||
GtkWidget *widget;
|
||||
|
@ -141,6 +142,7 @@ gTabStripPage::gTabStripPage(gTabStrip *tab)
|
|||
//gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
|
||||
|
||||
updateColors();
|
||||
updateFont();
|
||||
|
||||
g_signal_connect(G_OBJECT(widget),"button-press-event",G_CALLBACK(gTabStrip_buttonPress),(gpointer)parent);
|
||||
g_signal_connect(G_OBJECT(widget),"button-release-event",G_CALLBACK(gTabStrip_buttonRelease),(gpointer)parent);
|
||||
|
@ -179,6 +181,13 @@ void gTabStripPage::updateColors()
|
|||
set_gdk_fg_color(label, parent->foreground());
|
||||
}
|
||||
|
||||
void gTabStripPage::updateFont()
|
||||
{
|
||||
gFont *fnt = parent->font();
|
||||
gtk_widget_modify_font(widget, fnt ? fnt->desc() : NULL);
|
||||
gtk_widget_modify_font(label, fnt ? fnt->desc() : NULL);
|
||||
}
|
||||
|
||||
void gTabStripPage::setText(char *text)
|
||||
{
|
||||
char *buf;
|
||||
|
@ -583,3 +592,13 @@ gTabStripPage *gTabStrip::get(int ind)
|
|||
else
|
||||
return (gTabStripPage *)g_ptr_array_index(_pages, ind);
|
||||
}
|
||||
|
||||
void gTabStrip::setFont(gFont *font)
|
||||
{
|
||||
int i;
|
||||
|
||||
gControl::setFont(font);
|
||||
|
||||
for (i = 0; i < count(); i++)
|
||||
get(i)->updateFont();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ public:
|
|||
|
||||
virtual void setRealBackground(gColor color);
|
||||
virtual void setRealForeground(gColor color);
|
||||
|
||||
|
||||
virtual void setFont(gFont *ft);
|
||||
|
||||
//"Events"
|
||||
void (*onClick)(gTabStrip *sender);
|
||||
|
||||
|
|
|
@ -492,7 +492,6 @@ GB_DESC CToolButtonDesc[] =
|
|||
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
||||
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
||||
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||
//GB_PROPERTY("Stretch", "b", CTOOLBUTTON_stretch),
|
||||
|
||||
TOOLBUTTON_DESCRIPTION,
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ DECLARE_EVENT(EVENT_Insert);
|
|||
DECLARE_EVENT(EVENT_BeforeArrange);
|
||||
DECLARE_EVENT(EVENT_Arrange);
|
||||
|
||||
#if DEBUG_CONTAINER
|
||||
static int _count_move, _count_resize, _count_set_geom;
|
||||
#endif
|
||||
|
||||
static QWidget *get_widget(QObjectList *list)
|
||||
{
|
||||
for(;;)
|
||||
|
@ -65,19 +69,34 @@ static QWidget *get_widget(QObjectList *list)
|
|||
static void move_widget(QWidget *wid, int x, int y)
|
||||
{
|
||||
if (wid->x() != x || wid->y() != y)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_move++;
|
||||
#endif
|
||||
wid->move(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void resize_widget(QWidget *wid, int w, int h)
|
||||
{
|
||||
if (wid->width() != w || wid->height() != h)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_resize++;
|
||||
#endif
|
||||
wid->resize(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
||||
{
|
||||
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_set_geom++;
|
||||
#endif
|
||||
wid->setGeometry(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||
|
@ -110,14 +129,14 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
|||
#define GET_WIDGET_Y(_widget) (_widget)->y()
|
||||
#define GET_WIDGET_W(_widget) (_widget)->width()
|
||||
#define GET_WIDGET_H(_widget) (_widget)->height()
|
||||
/*#define MOVE_WIDGET(_widget, _x, _y) move_widget(_widget, x, y)
|
||||
#define MOVE_WIDGET(_widget, _x, _y) move_widget(_widget, x, y)
|
||||
#define RESIZE_WIDGET(_widget, _w, _h) resize_widget(_widget, w, h)
|
||||
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) move_resize_widget(_widget, _x, _y, _w, _h)*/
|
||||
#define MOVE_WIDGET(_widget, _x, _y) (_widget)->move(_x, _y)
|
||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) move_resize_widget(_widget, _x, _y, _w, _h)
|
||||
/*#define MOVE_WIDGET(_widget, _x, _y) (_widget)->move(_x, _y)
|
||||
#define RESIZE_WIDGET(_widget, _w, _h) (_widget)->resize(_w, _h)
|
||||
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) (_widget)->setGeometry(_x, _y, _w, _h)
|
||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) (_widget)->setGeometry(_x, _y, _w, _h)*/
|
||||
|
||||
#define INIT_CHECK_CHILDREN_LIST(_widget) \
|
||||
QObjectList *list = (QObjectList *)(_widget)->children(); \
|
||||
|
@ -145,10 +164,35 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
|||
|
||||
//THIS_ARRANGEMENT->dirty = FALSE;
|
||||
|
||||
#if DEBUG_CONTAINER
|
||||
#define FUNCTION_NAME CCONTAINER_arrange_real
|
||||
#else
|
||||
#define FUNCTION_NAME CCONTAINER_arrange
|
||||
#endif
|
||||
|
||||
#include "gb.form.arrangement.h"
|
||||
|
||||
#if DEBUG_CONTAINER
|
||||
void CCONTAINER_arrange(void *_object)
|
||||
{
|
||||
static int level = 0;
|
||||
|
||||
if (!level)
|
||||
{
|
||||
_count_move = _count_resize = _count_set_geom = 0;
|
||||
}
|
||||
|
||||
level++;
|
||||
CCONTAINER_arrange_real(_object);
|
||||
level--;
|
||||
|
||||
if (!level)
|
||||
{
|
||||
if (_count_move || _count_resize || _count_set_geom)
|
||||
qDebug("CCONTAINER_arrange: (%s %s): move = %d resize = %d setGeometry = %d", GB.GetClassName(THIS), THIS->widget.name, _count_move, _count_resize, _count_set_geom);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int max_w, max_h;
|
||||
|
||||
|
|
|
@ -314,6 +314,7 @@ QTable(0, 0, parent)
|
|||
_rows = 0;
|
||||
_cols = 0;
|
||||
_last_col_width = 0;
|
||||
//qDebug("MyTable: _last_col_width = %d", _last_col_width);
|
||||
_no_row = true;
|
||||
_no_col = true;
|
||||
_updating_last_column = false;
|
||||
|
@ -362,7 +363,10 @@ void MyTable::setColumnWidth(int col, int width)
|
|||
QTable::setColumnWidth(col, width);
|
||||
|
||||
if (col == (numCols() - 1) && !_updating_last_column)
|
||||
_last_col_width = columnWidth(numCols() - 1);
|
||||
{
|
||||
_last_col_width = width; //columnWidth(numCols() - 1);
|
||||
//qDebug("setColumnWidth: _last_col_width = %d", _last_col_width);
|
||||
}
|
||||
}
|
||||
|
||||
/*void MyTable::adjustColumn(int col)
|
||||
|
@ -444,7 +448,7 @@ void MyTable::setNumCols(int newCols)
|
|||
QTable::setNumCols(newCols);
|
||||
blockSignals(b);
|
||||
|
||||
_last_col_width = 0;
|
||||
//qDebug("setNumCols: _last_col_width = %d", _last_col_width);
|
||||
|
||||
if (newCols > col)
|
||||
{
|
||||
|
@ -458,6 +462,9 @@ void MyTable::setNumCols(int newCols)
|
|||
}
|
||||
|
||||
clearSelection();
|
||||
|
||||
_last_col_width = columnWidth(numCols() - 1);
|
||||
|
||||
emit currentChanged(-1, -1);
|
||||
}
|
||||
|
||||
|
@ -665,7 +672,10 @@ void MyTable::updateLastColumn()
|
|||
_updating_last_column = true;
|
||||
|
||||
if (!_last_col_width)
|
||||
{
|
||||
_last_col_width = columnWidth(n);
|
||||
//qDebug("updateLastColumn: _last_col_width = %d", _last_col_width);
|
||||
}
|
||||
|
||||
if (((columnPos(n) + _last_col_width) < visibleWidth()) && (columnWidth(n) != visibleWidth() - columnPos(n)))
|
||||
setColumnWidth(n, visibleWidth() - columnPos(n));
|
||||
|
|
|
@ -137,12 +137,12 @@ static void set_button(CBUTTON *_object, const char *text, bool resize = false)
|
|||
if (THIS->picture)
|
||||
{
|
||||
p = *(THIS->picture->pixmap);
|
||||
if (THIS->stretch)
|
||||
/*if (THIS->stretch)
|
||||
{
|
||||
if (size > 0)
|
||||
CWIDGET_iconset(icon, p, size);
|
||||
}
|
||||
else
|
||||
else*/
|
||||
CWIDGET_iconset(icon, p);
|
||||
WIDGET->setIcon(icon);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ static void set_button(CBUTTON *_object, const char *text, bool resize = false)
|
|||
WIDGET->setText(qtext);
|
||||
}
|
||||
|
||||
WIDGET->calcMinimumHeight();
|
||||
WIDGET->calcMinimumSize();
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,12 +183,12 @@ static void set_tool_button(CBUTTON *_object, const char *text, bool resize = fa
|
|||
p = *(THIS->picture->pixmap);
|
||||
|
||||
WIDGET_TOOL->setText(qtext);
|
||||
if (THIS->stretch)
|
||||
/*if (THIS->stretch)
|
||||
{
|
||||
if (size > 0)
|
||||
CWIDGET_iconset(icon, p, size);
|
||||
}
|
||||
else
|
||||
else*/
|
||||
CWIDGET_iconset(icon, p);
|
||||
|
||||
WIDGET_TOOL->setIcon(icon);
|
||||
|
@ -204,7 +204,7 @@ static void set_tool_button(CBUTTON *_object, const char *text, bool resize = fa
|
|||
}
|
||||
|
||||
//CWidget::resetTooltip((CWIDGET *)_object);
|
||||
WIDGET->calcMinimumHeight();
|
||||
WIDGET->calcMinimumSize();
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,6 +382,18 @@ BEGIN_PROPERTY(CBUTTON_radio)
|
|||
|
||||
END_PROPERTY
|
||||
|
||||
BEGIN_PROPERTY(CBUTTON_autoresize)
|
||||
|
||||
if (READ_PROPERTY)
|
||||
GB.ReturnBoolean(THIS->autoresize);
|
||||
else if (THIS->autoresize != VPROP(GB_BOOLEAN))
|
||||
{
|
||||
THIS->autoresize = VPROP(GB_BOOLEAN);
|
||||
WIDGET->calcMinimumSize();
|
||||
}
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
#if 0
|
||||
BEGIN_PROPERTY(CBUTTON_stretch)
|
||||
|
||||
|
@ -433,7 +445,7 @@ GB_DESC CButtonDesc[] =
|
|||
GB_PROPERTY("Default", "b", CBUTTON_default),
|
||||
GB_PROPERTY("Cancel", "b", CBUTTON_cancel),
|
||||
GB_PROPERTY("Value", "b", CBUTTON_value),
|
||||
//GB_PROPERTY("Stretch", "b", CBUTTON_stretch),
|
||||
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||
|
||||
BUTTON_DESCRIPTION,
|
||||
|
||||
|
@ -456,7 +468,7 @@ GB_DESC CToggleButtonDesc[] =
|
|||
//GB_PROPERTY("Flat", "b", CBUTTON_flat),
|
||||
GB_PROPERTY("Border", "b", CTOGGLEBUTTON_border),
|
||||
GB_PROPERTY("Radio", "b", CTOGGLEBUTTON_radio),
|
||||
//GB_PROPERTY("Stretch", "b", CTOGGLEBUTTON_stretch),
|
||||
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||
|
||||
TOGGLEBUTTON_DESCRIPTION,
|
||||
|
||||
|
@ -480,7 +492,7 @@ GB_DESC CToolButtonDesc[] =
|
|||
GB_PROPERTY("Toggle", "b", CTOOLBUTTON_toggle),
|
||||
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
||||
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
||||
//GB_PROPERTY("Stretch", "b", CTOOLBUTTON_stretch),
|
||||
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||
|
||||
TOOLBUTTON_DESCRIPTION,
|
||||
|
||||
|
@ -496,7 +508,7 @@ GB_DESC CToolButtonDesc[] =
|
|||
MyPushButton::MyPushButton(QWidget *parent) :
|
||||
QPushButton(parent)
|
||||
{
|
||||
calcMinimumHeight();
|
||||
calcMinimumSize();
|
||||
top = 0;
|
||||
}
|
||||
|
||||
|
@ -514,14 +526,17 @@ MyPushButton::~MyPushButton()
|
|||
return QSize(width(), height());
|
||||
}*/
|
||||
|
||||
void MyPushButton::fontChange(const QFont &font)
|
||||
void MyPushButton::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::fontChange(font);
|
||||
calcMinimumHeight();
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::FontChange)
|
||||
calcMinimumSize();
|
||||
}
|
||||
|
||||
void MyPushButton::calcMinimumHeight()
|
||||
void MyPushButton::calcMinimumSize()
|
||||
{
|
||||
CBUTTON *_object = (CBUTTON *)CWidget::get(this);
|
||||
|
||||
if (text().length() > 0)
|
||||
{
|
||||
QFontMetrics fm = fontMetrics();
|
||||
|
@ -530,6 +545,11 @@ void MyPushButton::calcMinimumHeight()
|
|||
else
|
||||
setMinimumHeight(0);
|
||||
|
||||
if (THIS->autoresize)
|
||||
setMinimumWidth(sizeHint().width());
|
||||
else
|
||||
setMinimumWidth(0);
|
||||
|
||||
//qDebug("%p: %s: %d", this, text().latin1(), minimumHeight());
|
||||
}
|
||||
|
||||
|
@ -544,20 +564,21 @@ void MyPushButton::resizeEvent(QResizeEvent *e)
|
|||
MyToolButton::MyToolButton(QWidget *parent) :
|
||||
QToolButton(parent)
|
||||
{
|
||||
calcMinimumHeight();
|
||||
calcMinimumSize();
|
||||
}
|
||||
|
||||
MyToolButton::~MyToolButton()
|
||||
{
|
||||
}
|
||||
|
||||
void MyToolButton::fontChange(const QFont &font)
|
||||
void MyToolButton::changeEvent(QEvent *e)
|
||||
{
|
||||
QToolButton::fontChange(font);
|
||||
calcMinimumHeight();
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::FontChange)
|
||||
calcMinimumSize();
|
||||
}
|
||||
|
||||
void MyToolButton::calcMinimumHeight()
|
||||
void MyToolButton::calcMinimumSize()
|
||||
{
|
||||
if (text().length() > 0)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef
|
|||
CPICTURE *picture;
|
||||
int last_size;
|
||||
unsigned radio : 1;
|
||||
unsigned stretch : 1;
|
||||
unsigned autoresize : 1;
|
||||
}
|
||||
CBUTTON;
|
||||
|
||||
|
@ -71,9 +71,8 @@ public:
|
|||
|
||||
MyPushButton(QWidget *parent);
|
||||
~MyPushButton();
|
||||
//QSize sizeHint(void) const;
|
||||
virtual void fontChange(const QFont &);
|
||||
void calcMinimumHeight();
|
||||
virtual void changeEvent(QEvent *e);
|
||||
void calcMinimumSize();
|
||||
virtual void resizeEvent(QResizeEvent *e);
|
||||
|
||||
CWINDOW *top;
|
||||
|
@ -88,9 +87,8 @@ public:
|
|||
|
||||
MyToolButton(QWidget *parent);
|
||||
~MyToolButton();
|
||||
//QSize sizeHint(void) const;
|
||||
virtual void fontChange(const QFont &);
|
||||
void calcMinimumHeight();
|
||||
virtual void changeEvent(QEvent *e);
|
||||
void calcMinimumSize();
|
||||
virtual void resizeEvent(QResizeEvent *e);
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ DECLARE_EVENT(EVENT_Insert);
|
|||
DECLARE_EVENT(EVENT_BeforeArrange);
|
||||
DECLARE_EVENT(EVENT_Arrange);
|
||||
|
||||
#if DEBUG_CONTAINER
|
||||
static int _count_move, _count_resize, _count_set_geom;
|
||||
#endif
|
||||
|
||||
static QWidget *get_next_widget(QObjectList &list, int &index)
|
||||
{
|
||||
QObject *ob;
|
||||
|
@ -70,27 +74,37 @@ static QWidget *get_next_widget(QObjectList &list, int &index)
|
|||
}
|
||||
}
|
||||
|
||||
static int _count = 0;
|
||||
|
||||
static void move_widget(QWidget *wid, int x, int y)
|
||||
{
|
||||
qDebug("%d", ++_count);
|
||||
if (wid->x() != x || wid->y() != y)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_move++;
|
||||
#endif
|
||||
wid->move(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void resize_widget(QWidget *wid, int w, int h)
|
||||
{
|
||||
qDebug("%d", ++_count);
|
||||
if (wid->width() != w || wid->height() != h)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_resize++;
|
||||
#endif
|
||||
wid->resize(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
||||
{
|
||||
qDebug("%d", ++_count);
|
||||
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
||||
{
|
||||
#if DEBUG_CONTAINER
|
||||
_count_set_geom++;
|
||||
#endif
|
||||
wid->setGeometry(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||
|
@ -113,7 +127,8 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
|||
#define IS_DESIGN(_object) (CWIDGET_test_flag(_object, WF_DESIGN) && CWIDGET_test_flag(_object, WF_DESIGN_LEADER))
|
||||
#define IS_WIDGET_VISIBLE(_widget) (_widget)->isVisible()
|
||||
|
||||
#define CAN_ARRANGE(_object) ((_object) && (IS_WIDGET_VISIBLE(GET_CONTAINER(_object)) || IS_WIDGET_VISIBLE(GET_WIDGET(_object))))
|
||||
#define CAN_ARRANGE(_object) ((_object) && ((CWIDGET *)(_object))->flag.shown)
|
||||
//(IS_WIDGET_VISIBLE(GET_CONTAINER(_object)) || IS_WIDGET_VISIBLE(GET_WIDGET(_object))))
|
||||
|
||||
#define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) \
|
||||
_x = (_widget)->contentsRect().x(); \
|
||||
|
@ -152,27 +167,36 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
|||
|
||||
#define DESKTOP_SCALE MAIN_scale
|
||||
|
||||
#if DEBUG_CONTAINER
|
||||
#define FUNCTION_NAME CCONTAINER_arrange_real
|
||||
#else
|
||||
#define FUNCTION_NAME CCONTAINER_arrange
|
||||
#endif
|
||||
|
||||
#include "gb.form.arrangement.h"
|
||||
|
||||
extern void qt_x11_set_global_double_buffer(bool);
|
||||
|
||||
/*void CCONTAINER_arrange(void *_object)
|
||||
#if DEBUG_CONTAINER
|
||||
void CCONTAINER_arrange(void *_object)
|
||||
{
|
||||
static int level = 0;
|
||||
|
||||
if (!level)
|
||||
qt_x11_set_global_double_buffer(false);
|
||||
{
|
||||
_count_move = _count_resize = _count_set_geom = 0;
|
||||
}
|
||||
|
||||
|
||||
level++;
|
||||
CCONTAINER_arrange2(_object);
|
||||
CCONTAINER_arrange_real(_object);
|
||||
level--;
|
||||
|
||||
if (!level)
|
||||
qt_x11_set_global_double_buffer(true);
|
||||
}*/
|
||||
|
||||
{
|
||||
if (_count_move || _count_resize || _count_set_geom)
|
||||
qDebug("CCONTAINER_arrange: (%s %s): move = %d resize = %d setGeometry = %d", GB.GetClassName(THIS), THIS->widget.name, _count_move, _count_resize, _count_set_geom);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int max_w, max_h;
|
||||
|
||||
|
@ -278,9 +302,18 @@ void MyContainer::resizeEvent(QResizeEvent *e)
|
|||
|
||||
void MyContainer::showEvent(QShowEvent *e)
|
||||
{
|
||||
void *_object = CWidget::get(this);
|
||||
//qDebug("MyContainer::showEvent %p %s", CWidget::get(this), GB.GetClassName(CWidget::get(this)));
|
||||
QFrame::showEvent(e);
|
||||
arrange_now(this);
|
||||
THIS->widget.flag.shown = TRUE;
|
||||
CCONTAINER_arrange(THIS);
|
||||
}
|
||||
|
||||
void MyContainer::hideEvent(QHideEvent *e)
|
||||
{
|
||||
void *_object = CWidget::get(this);
|
||||
QFrame::hideEvent(e);
|
||||
THIS->widget.flag.shown = FALSE;
|
||||
}
|
||||
|
||||
/*void MyContainer::childEvent(QChildEvent *e)
|
||||
|
@ -481,7 +514,7 @@ BEGIN_PROPERTY(CCONTAINER_y)
|
|||
|
||||
QRect r = getRect(THIS); // _CONTAINER);
|
||||
QPoint p(r.x(), r.y());
|
||||
|
||||
|
||||
GB.ReturnInteger(CONTAINER->mapTo(WIDGET, p).y());
|
||||
|
||||
END_PROPERTY
|
||||
|
|
|
@ -117,6 +117,7 @@ protected:
|
|||
virtual void resizeEvent(QResizeEvent *);
|
||||
//virtual void childEvent(QChildEvent *);
|
||||
virtual void showEvent(QShowEvent *);
|
||||
virtual void hideEvent(QHideEvent *);
|
||||
//virtual bool eventFilter(QObject *, QEvent *);
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ DECLARE_EVENT(EVENT_Hide);
|
|||
|
||||
DECLARE_METHOD(CCONTROL_window);
|
||||
DECLARE_METHOD(CCONTROL_name);
|
||||
DECLARE_METHOD(CMENU_hide);
|
||||
|
||||
static int check_menu(void *_object)
|
||||
{
|
||||
|
@ -81,8 +82,6 @@ static void delete_menu(CMENU *_object)
|
|||
if (THIS->deleted)
|
||||
return;
|
||||
|
||||
//qDebug("delete_menu: THIS = %p", _object);
|
||||
|
||||
if (THIS->menu)
|
||||
{
|
||||
delete THIS->menu;
|
||||
|
@ -91,9 +90,7 @@ static void delete_menu(CMENU *_object)
|
|||
|
||||
CMenu::dict.remove(ACTION);
|
||||
|
||||
//delete ACTION;
|
||||
THIS->widget.widget = 0;
|
||||
|
||||
THIS->deleted = true;
|
||||
}
|
||||
|
||||
|
@ -426,13 +423,18 @@ END_METHOD
|
|||
BEGIN_METHOD_VOID(CMENU_clear)
|
||||
|
||||
int i;
|
||||
CMENU *menu;
|
||||
|
||||
if (THIS->menu)
|
||||
{
|
||||
QList<QAction *> list = THIS->menu->actions();
|
||||
|
||||
for (i = 0; i < list.count(); i++)
|
||||
delete_menu(CMenu::dict[list.at(i)]);
|
||||
{
|
||||
menu = CMenu::dict[list.at(i)];
|
||||
delete ((QAction *)(menu->widget.widget));
|
||||
delete_menu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
END_METHOD
|
||||
|
|
|
@ -64,10 +64,10 @@ BEGIN_METHOD(CHSPLIT_new, GB_OBJECT parent)
|
|||
wid->setOrientation(Qt::Horizontal);
|
||||
wid->setOpaqueResize(true);
|
||||
|
||||
CWIDGET_new(wid, (void *)_object);
|
||||
|
||||
THIS->container = wid;
|
||||
|
||||
CWIDGET_new(wid, (void *)_object);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
||||
|
@ -75,13 +75,12 @@ BEGIN_METHOD(CVSPLIT_new, GB_OBJECT parent)
|
|||
|
||||
QSplitter *wid = new MySplitter(QCONTAINER(VARG(parent)));
|
||||
|
||||
CWIDGET_new(wid, (void *)_object);
|
||||
|
||||
THIS->container = wid;
|
||||
|
||||
wid->setOrientation(Qt::Vertical);
|
||||
wid->setOpaqueResize(true);
|
||||
wid->show();
|
||||
|
||||
CWIDGET_new(wid, (void *)_object);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
|
|
@ -151,13 +151,14 @@ void MyTabWidget::setEnabled(bool e)
|
|||
|
||||
void MyTabWidget::forceLayout()
|
||||
{
|
||||
/*bool b = isVisible();
|
||||
bool b = isVisible();
|
||||
QShowEvent e;
|
||||
|
||||
setWState(WState_Visible);
|
||||
setAttribute(Qt::WA_WState_Visible, true);
|
||||
qApp->sendEvent(this, &e);
|
||||
if (!b)
|
||||
clearWState(WState_Visible);*/
|
||||
setAttribute(Qt::WA_WState_Visible, false);
|
||||
|
||||
//qDebug("Y = %d", tabBar()->height());
|
||||
}
|
||||
|
||||
|
|
|
@ -191,24 +191,24 @@ static void set_name(CWIDGET *_object, const char *name)
|
|||
GB.NewString(&THIS->name, name, 0);
|
||||
}
|
||||
|
||||
static CWIDGET *get_parent_control(CWIDGET *_object)
|
||||
void *CWIDGET_get_parent(void *_object)
|
||||
{
|
||||
QWidget *parent = WIDGET->parentWidget();
|
||||
QWidget *parent = WIDGET->parentWidget();
|
||||
|
||||
if (!parent || WIDGET->isWindow())
|
||||
return NULL;
|
||||
else
|
||||
return CWidget::get(parent);
|
||||
if (!parent || (GB.Is(THIS, CLASS_Window) && ((CWINDOW *)_object)->toplevel))
|
||||
return NULL;
|
||||
else
|
||||
return CWidget::get(parent);
|
||||
}
|
||||
|
||||
static void arrange_parent(CWIDGET *_object)
|
||||
{
|
||||
CWIDGET *parent = get_parent_control(THIS); //CWidget::get(WIDGET->parentWidget());
|
||||
if (parent)
|
||||
CCONTAINER_arrange(parent);
|
||||
void *parent = CWIDGET_get_parent(THIS);
|
||||
if (!parent)
|
||||
return;
|
||||
CCONTAINER_arrange(parent);
|
||||
}
|
||||
|
||||
|
||||
void CWIDGET_update_design(CWIDGET *_object)
|
||||
{
|
||||
if (!CWIDGET_test_flag(THIS, WF_DESIGN) && !CWIDGET_test_flag(THIS, WF_DESIGN_LEADER))
|
||||
|
@ -261,13 +261,10 @@ void CWIDGET_new(QWidget *w, void *_object, bool no_show, bool no_filter, bool n
|
|||
//THIS->flag.fillBackground = GB.Is(THIS, CLASS_Container);
|
||||
w->setAutoFillBackground(THIS->flag.fillBackground);
|
||||
|
||||
CCONTAINER_insert_child(THIS);
|
||||
|
||||
CCONTAINER_insert_child(THIS);
|
||||
|
||||
if (!no_show)
|
||||
{
|
||||
THIS->flag.visible = true;
|
||||
w->show();
|
||||
}
|
||||
CWIDGET_set_visible(THIS, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -624,42 +621,46 @@ END_METHOD
|
|||
|
||||
static bool is_visible(void *_object)
|
||||
{
|
||||
return THIS->flag.visible; //|| !QWIDGET(_object)->isHidden();
|
||||
return THIS->flag.visible; // || !QWIDGET(_object)->isHidden();
|
||||
}
|
||||
|
||||
|
||||
static void set_visible(void *_object, bool v)
|
||||
void CWIDGET_set_visible(CWIDGET *_object, bool v)
|
||||
{
|
||||
THIS->flag.visible = v;
|
||||
if (THIS->flag.visible)
|
||||
{
|
||||
QWIDGET(_object)->show();
|
||||
if (GB.Is(THIS, CLASS_Container))
|
||||
CCONTAINER_arrange(THIS);
|
||||
}
|
||||
else
|
||||
QWIDGET(_object)->hide();
|
||||
|
||||
arrange_parent(THIS);
|
||||
arrange_parent(THIS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BEGIN_PROPERTY(CCONTROL_visible)
|
||||
|
||||
if (READ_PROPERTY)
|
||||
GB.ReturnBoolean(is_visible(THIS));
|
||||
else
|
||||
set_visible(THIS, VPROP(GB_BOOLEAN));
|
||||
CWIDGET_set_visible(THIS, VPROP(GB_BOOLEAN));
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
|
||||
BEGIN_METHOD_VOID(CCONTROL_show)
|
||||
|
||||
set_visible(THIS, true);
|
||||
CWIDGET_set_visible(THIS, true);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
||||
BEGIN_METHOD_VOID(CCONTROL_hide)
|
||||
|
||||
set_visible(THIS, false);
|
||||
CWIDGET_set_visible(THIS, false);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
@ -972,7 +973,7 @@ static QWidget *get_color_widget(QWidget *w)
|
|||
|
||||
int get_real_background(CWIDGET *_object)
|
||||
{
|
||||
CWIDGET *parent = get_parent_control(THIS);
|
||||
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||
if (THIS->bg == COLOR_DEFAULT && parent)
|
||||
return get_real_background(parent);
|
||||
else
|
||||
|
@ -981,7 +982,7 @@ int get_real_background(CWIDGET *_object)
|
|||
|
||||
int get_real_foreground(CWIDGET *_object)
|
||||
{
|
||||
CWIDGET *parent = get_parent_control(THIS);
|
||||
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||
if (THIS->fg == COLOR_DEFAULT && parent)
|
||||
return get_real_foreground(parent);
|
||||
else
|
||||
|
@ -998,7 +999,7 @@ void CWIDGET_reset_color(CWIDGET *_object)
|
|||
|
||||
if (THIS->bg == COLOR_DEFAULT && THIS->fg == COLOR_DEFAULT)
|
||||
{
|
||||
CWIDGET *parent = get_parent_control(THIS);
|
||||
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||
if (parent)
|
||||
w->setPalette(parent->widget->palette());
|
||||
else
|
||||
|
@ -1108,7 +1109,7 @@ END_PROPERTY
|
|||
|
||||
BEGIN_PROPERTY(CCONTROL_parent)
|
||||
|
||||
GB.ReturnObject(get_parent_control(THIS));
|
||||
GB.ReturnObject(CWIDGET_get_parent(THIS));
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
|
@ -1206,7 +1207,7 @@ END_METHOD
|
|||
BEGIN_METHOD(CCONTROL_reparent, GB_OBJECT container; GB_INTEGER x; GB_INTEGER y)
|
||||
|
||||
QPoint p(WIDGET->pos());
|
||||
bool showIt = !WIDGET->isHidden();
|
||||
bool show;
|
||||
|
||||
if (!MISSING(x) && !MISSING(y))
|
||||
{
|
||||
|
@ -1217,9 +1218,12 @@ BEGIN_METHOD(CCONTROL_reparent, GB_OBJECT container; GB_INTEGER x; GB_INTEGER y)
|
|||
if (GB.CheckObject(VARG(container)))
|
||||
return;
|
||||
|
||||
show = is_visible(THIS);
|
||||
CWIDGET_set_visible(THIS, false);
|
||||
WIDGET->setParent(QCONTAINER(VARG(container)));
|
||||
WIDGET->move(p);
|
||||
if (showIt) WIDGET->show();
|
||||
CCONTAINER_insert_child(THIS);
|
||||
CWIDGET_set_visible(THIS, show);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ typedef
|
|||
unsigned notified : 1;
|
||||
unsigned visible : 1;
|
||||
unsigned fillBackground : 1;
|
||||
unsigned _reserved : 10;
|
||||
unsigned shown : 1; // for containers
|
||||
unsigned _reserved : 9;
|
||||
} flag;
|
||||
GB_VARIANT_VALUE tag;
|
||||
char *name;
|
||||
|
@ -69,7 +70,7 @@ typedef
|
|||
struct {
|
||||
CWIDGET widget;
|
||||
QWidget *container;
|
||||
int arrangement;
|
||||
int32_t arrangement;
|
||||
}
|
||||
CCONTAINER;
|
||||
|
||||
|
@ -186,6 +187,8 @@ void CWIDGET_set_color(CWIDGET *_object, int bg, int fg);
|
|||
void CWIDGET_reset_color(CWIDGET *_object);
|
||||
int CWIDGET_get_background(CWIDGET *_object);
|
||||
int CWIDGET_get_foreground(CWIDGET *_object);
|
||||
void *CWIDGET_get_parent(void *_object);
|
||||
void CWIDGET_set_visible(CWIDGET *_object, bool v);
|
||||
|
||||
void CACTION_register(void *control, const char *key);
|
||||
void CACTION_raise(void *control);
|
||||
|
|
|
@ -281,7 +281,7 @@ static void show_later(CWINDOW *_object)
|
|||
if (!THIS->hidden && WIDGET)
|
||||
{
|
||||
if (!emit_open_event(THIS))
|
||||
WIDGET->show();
|
||||
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||
}
|
||||
GB.Unref(POINTER(&_object));
|
||||
}
|
||||
|
@ -377,8 +377,10 @@ BEGIN_METHOD(CWINDOW_new, GB_OBJECT parent)
|
|||
CWindow::list.append(THIS);
|
||||
CWindow::count = CWindow::list.count();
|
||||
|
||||
#if DEBUG_WINDOW
|
||||
qDebug("CWindow::count = %d (%p %s %s)", CWindow::count, _object, THIS->widget.name, THIS->embedded ? "E" : "W");
|
||||
|
||||
#endif
|
||||
|
||||
if (CWINDOW_Main == 0)
|
||||
{
|
||||
//qDebug("CWINDOW_Main -> %p", THIS);
|
||||
|
@ -601,7 +603,7 @@ BEGIN_METHOD_VOID(CWINDOW_raise)
|
|||
if (!THIS->toplevel)
|
||||
{
|
||||
if (!WIDGET->isVisible())
|
||||
WIDGET->show();
|
||||
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||
WIDGET->raise();
|
||||
}
|
||||
else
|
||||
|
@ -622,7 +624,7 @@ BEGIN_METHOD_VOID(CWINDOW_show)
|
|||
|
||||
if (!THIS->toplevel)
|
||||
{
|
||||
WIDGET->show();
|
||||
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||
#ifndef NO_X_WINDOW
|
||||
if (THIS->xembed)
|
||||
XEMBED->show();
|
||||
|
@ -646,7 +648,7 @@ BEGIN_METHOD_VOID(CWINDOW_hide)
|
|||
do_close(THIS, 0);
|
||||
}
|
||||
else
|
||||
WINDOW->hide();
|
||||
CWIDGET_set_visible((CWIDGET *)THIS, false);
|
||||
|
||||
END_METHOD
|
||||
|
||||
|
@ -1514,7 +1516,9 @@ static void remove_window_check_quit(CWINDOW *ob)
|
|||
CWindow::list.removeAll(ob);
|
||||
|
||||
CWindow::count = CWindow::list.count();
|
||||
#if DEBUG_WINDOW
|
||||
qDebug("~MyMainWindow: CWindow::count = %d (%p %s %s)", CWindow::count, ob, ob->widget.name, ob->embedded ? "E" : "W");
|
||||
#endif
|
||||
|
||||
MAIN_check_quit();
|
||||
}
|
||||
|
@ -2099,7 +2103,9 @@ static bool closeAll()
|
|||
CWINDOW *win;
|
||||
int i;
|
||||
|
||||
#if DEBUG_WINDOW
|
||||
qDebug("CLOSE ALL");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < list.count(); i++)
|
||||
{
|
||||
|
@ -2351,7 +2357,7 @@ void MyMainWindow::doReparent(QWidget *parent, Qt::WindowFlags f, const QPoint &
|
|||
}
|
||||
if (active)
|
||||
{
|
||||
qDebug("doReparent: setActiveWindow");
|
||||
//qDebug("doReparent: setActiveWindow");
|
||||
setActiveWindow();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -593,7 +593,8 @@ void GEditor::paintCell(QPainter * painter, int row, int)
|
|||
|
||||
p.fillRect(0, 0, cellWidth(), cellHeight(), color);
|
||||
|
||||
p.setFont(painter->font());
|
||||
p.setFont(font());
|
||||
//p.setFont(painter->font());
|
||||
//p.translate(-ur.left(), 0);
|
||||
|
||||
// Procedure separation
|
||||
|
|
|
@ -493,7 +493,9 @@ static void unrelease_grab()
|
|||
|
||||
static bool must_quit(void)
|
||||
{
|
||||
#if DEBUG_WINDOW
|
||||
qDebug("must_quit: Window = %d Watch = %d in_event_loop = %d", CWindow::count, CWatch::count, in_event_loop);
|
||||
#endif
|
||||
return CWindow::count == 0 && CWatch::count == 0 && in_event_loop;
|
||||
}
|
||||
|
||||
|
@ -630,7 +632,7 @@ static void hook_timer(GB_TIMER *timer, bool on)
|
|||
{
|
||||
if (timer->id)
|
||||
{
|
||||
delete (MyTimer *)(timer->id);
|
||||
((MyTimer *)(timer->id))->deleteLater();
|
||||
timer->id = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,8 +196,11 @@ static void post_event(void *object, int event)
|
|||
|
||||
PUBLIC void EVENT_post_event(void *object, int event)
|
||||
{
|
||||
if (!GB_CanRaise(object, event))
|
||||
/*if (!GB_CanRaise(object, event))
|
||||
{
|
||||
fprintf(stderr, "EVENT_post_event: cannot raise event\n");
|
||||
return;
|
||||
}*/
|
||||
|
||||
GB_Ref(object);
|
||||
post((void (*)())post_event, 2, (intptr_t)object, (intptr_t)event);
|
||||
|
|
|
@ -36,6 +36,7 @@ EXTERN int MEMORY_count;
|
|||
#if DEBUG_MEMORY
|
||||
|
||||
EXTERN int MEMORY_size;
|
||||
EXTERN FILE *MEMORY_log;
|
||||
|
||||
#define ALLOC(_ptr, _size, _src) MEMORY_alloc((void *)_ptr, _size, _src)
|
||||
#define ALLOC_ZERO(_ptr, _size, _src) MEMORY_alloc_zero((void *)_ptr, _size, _src)
|
||||
|
|
|
@ -57,7 +57,8 @@ PUBLIC int MEMORY_size = 0;
|
|||
|
||||
static int _id = 0;
|
||||
ALLOC *_alloc = NULL;
|
||||
extern void DEBUG_where(void);
|
||||
extern char *DEBUG_get_current_position(void);
|
||||
FILE *MEMORY_log;
|
||||
|
||||
#elif OPTIMIZE_MEMORY
|
||||
|
||||
|
@ -70,25 +71,30 @@ int THROW_MEMORY()
|
|||
|
||||
PUBLIC void MEMORY_init(void)
|
||||
{
|
||||
/*mcheck(NULL);*/
|
||||
/*#if DEBUG_MEMORY
|
||||
# ifdef __GNU_LIBRARY__
|
||||
mtrace();
|
||||
if (getenv("LD_PRELOAD"))
|
||||
unsetenv("MALLOC_TRACE");
|
||||
mcheck(NULL);
|
||||
# endif
|
||||
#endif*/
|
||||
#if DEBUG_MEMORY
|
||||
char path[256];
|
||||
sprintf(path, "/tmp/gambas-memory-%d-%d.log", getuid(), getpid());
|
||||
MEMORY_log = fopen(path, "w+");
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void MEMORY_exit(void)
|
||||
{
|
||||
#if DEBUG_MEMORY
|
||||
while (_alloc)
|
||||
{
|
||||
fprintf(stderr, "<%d>\n", _alloc->id);
|
||||
_alloc = _alloc->next;
|
||||
}
|
||||
if (MEMORY_count)
|
||||
{
|
||||
fprintf(MEMORY_log, "\n*************************************************\n");
|
||||
fprintf(MEMORY_log, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
|
||||
while (_alloc)
|
||||
{
|
||||
fprintf(MEMORY_log, "<%d>\n", _alloc->id);
|
||||
_alloc = _alloc->next;
|
||||
}
|
||||
}
|
||||
fclose(MEMORY_log);
|
||||
#else
|
||||
if (MEMORY_count)
|
||||
fprintf(stderr, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -120,9 +126,11 @@ PUBLIC void MEMORY_alloc(void *p_ptr, size_t size, const char *src)
|
|||
MEMORY_size += size;
|
||||
|
||||
#ifndef DO_NOT_PRINT_MEMORY
|
||||
DEBUG_where();
|
||||
fprintf(stderr, "<%d> %s: MEMORY_alloc(%d) -> %p\n", _id, src, (int)size, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(stderr);
|
||||
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||
fprintf(MEMORY_log, "<%d> %s: MEMORY_alloc(%d) -> %p\n", _id, src, (int)size, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(MEMORY_log);
|
||||
//if (_id == 1621)
|
||||
// sleep(60);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
@ -185,9 +193,9 @@ PUBLIC void MEMORY_realloc(void *p_ptr, size_t size, const char *src)
|
|||
alloc->next->prev = alloc;
|
||||
|
||||
#ifndef DO_NOT_PRINT_MEMORY
|
||||
DEBUG_where();
|
||||
fprintf(stderr, "<%d> %s: MEMORY_realloc(%p, %d) -> %p\n", alloc->id, src, *((void **)p_ptr), (int)size, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(stderr);
|
||||
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||
fprintf(MEMORY_log, "<%d> %s: MEMORY_realloc(%p, %d) -> %p\n", alloc->id, src, *((void **)p_ptr), (int)size, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(MEMORY_log);
|
||||
#endif
|
||||
|
||||
*((void **)p_ptr) = (char *)alloc + sizeof(ALLOC);
|
||||
|
@ -224,9 +232,9 @@ PUBLIC void MEMORY_free(void *p_ptr, const char *src)
|
|||
_alloc = alloc->next;
|
||||
|
||||
#ifndef DO_NOT_PRINT_MEMORY
|
||||
DEBUG_where();
|
||||
fprintf(stderr, "<%d> %s: MEMORY_free(%p)\n", alloc->id, src, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(stderr);
|
||||
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||
fprintf(MEMORY_log, "<%d> %s: MEMORY_free(%p)\n", alloc->id, src, (char *)alloc + sizeof(ALLOC));
|
||||
fflush(MEMORY_log);
|
||||
#endif
|
||||
|
||||
MEMORY_size -= alloc->size;
|
||||
|
|
Loading…
Reference in a new issue