OSDN Git Service

Ring 1.10 以来となる開発環境の日本語ローカライズ版 (評価版) を追加 (ノートパッド、フォームデザイナー、対話型実行環境、ファイルの検索)。
[ring-lang-081/ring.git] / applications / formdesigner / source / controls / qprogressbar.ring
1 /*
2 **      Project : Form Designer 
3 **      File Purpose :  QProgressbar Control
4 **      Date : 2017.04.29
5 **      Author :  Mahmoud Fayed <msfclipper@yahoo.com>
6 */
7
8 package formdesigner
9
10 class FormDesigner_QProgressbar from QLineEdit
11
12         CreateCommonAttributes()
13         CreateMoveResizeCornersAttributes()
14
15         nOrientation = 0
16
17         cMinimum = ""
18         cMaximum = ""
19         cRange = ""
20         cValue = ""
21
22         cvalueChangedEvent = ""
23
24         func OrientationValue
25                 return nOrientation
26
27         func SetOrientationValue nIndex
28                 nOrientation = nIndex
29
30         func MinimumValue
31                 return cMinimum
32
33         func SetMinimumValue Value
34                 cMinimum = Value
35
36         func MaximumValue
37                 return cMaximum
38
39         func SetMaximumValue Value
40                 cMaximum = Value
41
42         func RangeValue
43                 return cRange
44
45         func SetRangeValue Value
46                 cRange = Value
47
48         func ValueValue
49                 return cValue
50
51         func SetValueValue Value
52                 cValue = Value
53
54         func SetvalueChangedEventCode cValue
55                 cvalueChangedEvent = cValue
56
57         func valueChangedEventCode
58                 return cvalueChangedEvent
59
60         func AddObjectProperties  oDesigner
61                 AddObjectCommonProperties(oDesigner)
62                 oDesigner.oView.AddPropertyCombobox(T_FORMDESIGNER_ATTRIBUTE_SETORIENTATION,[T_FORMDESIGNER_ATTRIBUTE_HORIZONTAL,T_FORMDESIGNER_ATTRIBUTE_VERTICAL]) # "Set Orientation" "Horizontal" "Vertical"
63                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETMINIMUM,False)                  # "Set Minimum"
64                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETMAXIMUM,False)                  # "Set Maximum"
65                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETRANGE,False)                    # "Set Range"
66                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETVALUE,False)                    # "Set Value"
67                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_VALUECHANGEDEVENT,False)           # "valueChangedEvent"
68
69         func DisplayProperties oDesigner
70                 DisplayCommonProperties(oDesigner)
71                 oPropertiesTable = oDesigner.oView.oPropertiesTable
72                 oPropertiesTable.Blocksignals(True)
73                 # Orientation
74                         oWidget = oPropertiesTable.cellwidget(C_AFTERCOMMON,1)
75                         oCombo = new qCombobox
76                         oCombo.pObject = oWidget.pObject
77                         oCombo.BlockSignals(True)
78                         oCombo.setCurrentIndex(OrientationValue())
79                         oCombo.BlockSignals(False)
80                 # Minimum, Maximum, Range and Value
81                         oPropertiesTable.item(C_AFTERCOMMON+1,1).settext(MinimumValue())
82                         oPropertiesTable.item(C_AFTERCOMMON+2,1).settext(MaximumValue())
83                         oPropertiesTable.item(C_AFTERCOMMON+3,1).settext(RangeValue())
84                         oPropertiesTable.item(C_AFTERCOMMON+4,1).settext(ValueValue())
85                 oPropertiesTable.item(C_AFTERCOMMON+5,1).settext(valueChangedEventcode())
86                 oPropertiesTable.Blocksignals(False)
87                 # Set the object name
88                         setText(oDesigner.oModel.GetObjectName(self))
89
90         func ComboItemAction oDesigner,nRow
91                 nOrientationPos = C_AFTERCOMMON
92                 if nRow = nOrientationPos  {            # Orientation
93                         oWidget = oDesigner.oView.oPropertiesTable.cellwidget(nOrientationPos,1)
94                         oCombo = new qCombobox
95                         oCombo.pObject = oWidget.pObject
96                         nIndex = oCombo.CurrentIndex()
97                         setOrientationValue(nIndex)
98                 }
99
100         func UpdateProperties oDesigner,nRow,nCol,cValue
101                 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
102                 if nCol = 1 {
103                         switch nRow {
104                                 case C_AFTERCOMMON+1
105                                         setMinimumValue(cValue)
106                                 case C_AFTERCOMMON+2
107                                         setMaximumValue(cValue)
108                                 case C_AFTERCOMMON+3
109                                         setRangeValue(cValue)
110                                 case C_AFTERCOMMON+4
111                                         setValueValue(cValue)
112                                 case C_AFTERCOMMON+5
113                                         setvalueChangedEventCode(cValue)
114
115                         }
116                 }
117                 # Set the object name
118                         setText(oDesigner.oModel.GetObjectName(self))
119
120         func ObjectDataAsString oDesigner,nTabsCount
121                 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
122                 cTabs = std_copy(char(9),nTabsCount)
123                 cOutput += "," + nl + cTabs + ' :orientation =  ' + OrientationValue()
124                 cOutput += "," + nl + cTabs + ' :minimum =  "' + oDesigner.PrepareStringForFormFile(MinimumValue())  + '"'
125                 cOutput += "," + nl + cTabs + ' :maximum =  "' + oDesigner.PrepareStringForFormFile(MaximumValue())  + '"'
126                 cOutput += "," + nl + cTabs + ' :range =  "' + oDesigner.PrepareStringForFormFile(RangeValue())  + '"'
127                 cOutput += "," + nl + cTabs + ' :value =  "' + oDesigner.PrepareStringForFormFile(ValueValue())  + '"'
128                 cOutput += "," + nl + cTabs + ' :setvalueChangedEvent =  "' + oDesigner.PrepareStringForFormFile(valueChangedEventCode()) + '"'
129                 return cOutput
130
131         func GenerateCustomCode oDesigner
132                 cOutput = ""
133                 cOutput += 'setOrientation(#{f1})' + nl
134                 cOutput = substr(cOutput,"#{f1}",""+(OrientationValue()+1))
135                 if Minimumvalue() != NULL {
136                         cOutput += 'setMinimum(#{f1})' + nl
137                         cOutput = substr(cOutput,"#{f1}",""+MinimumValue())
138                 }
139                 if Maximumvalue() != NULL {
140                         cOutput += 'setMaximum(#{f1})' + nl
141                         cOutput = substr(cOutput,"#{f1}",""+MaximumValue())
142                 }
143                 if Rangevalue() != NULL {
144                         cOutput += 'setRange(#{f1})' + nl
145                         cOutput = substr(cOutput,"#{f1}",""+RangeValue())
146                 }
147                 if ValueValue() != NULL {
148                         cOutput += 'setValue(#{f1})' + nl
149                         cOutput = substr(cOutput,"#{f1}",""+ValueValue())
150                 }
151                 cOutput += 'setvalueChangedEvent("#{f1}")' + nl
152                 cOutput = PrepareEvent(cOutput,valueChangedEventCode(),"#{f1}")
153                 cOutput = substr(cOutput,"#{f1}",valueChangedEventCode())
154                 return cOutput
155
156         func RestoreProperties oDesigner,Item
157                 RestoreCommonProperties(oDesigner,item)
158                 itemdata = item[:data]
159                 setOrientationValue(0+itemdata[:orientation])
160                 setMinimumValue(itemdata[:minimum])
161                 setMaximumValue(itemdata[:maximum])
162                 setRangeValue(itemdata[:range])
163                 setValueValue(itemdata[:value])
164                 SetvalueChangedEventCode(itemdata[:setvalueChangedEvent])
165