2 ** Project : Form Designer
3 ** File Purpose : QTextEdit Control
5 ** Author : Mahmoud Fayed <msfclipper@yahoo.com>
10 # We use QLineEdit as parent - We need just the looking (not functionality)
11 class FormDesigner_QTextEdit from QLineEdit
13 CreateCommonAttributes()
14 CreateMoveResizeCornersAttributes()
18 ccopyAvailableEvent = ""
19 ccurrentCharFormatChangedEvent = ""
20 ccursorPositionChangedEvent = ""
21 credoAvailableEvent = ""
22 cselectionChangedEvent = ""
23 ctextChangedEvent = ""
24 cundoAvailableEvent = ""
31 func SetTextValue value
34 func SetcopyAvailableEventCode cValue
35 ccopyAvailableEvent = cValue
37 func copyAvailableEventCode
38 return ccopyAvailableEvent
40 func SetcurrentCharFormatChangedEventCode cValue
41 ccurrentCharFormatChangedEvent = cValue
43 func currentCharFormatChangedEventCode
44 return ccurrentCharFormatChangedEvent
46 func SetcursorPositionChangedEventCode cValue
47 ccursorPositionChangedEvent = cValue
49 func cursorPositionChangedEventCode
50 return ccursorPositionChangedEvent
52 func SetredoAvailableEventCode cValue
53 credoAvailableEvent = cValue
55 func redoAvailableEventCode
56 return credoAvailableEvent
58 func SetselectionChangedEventCode cValue
59 cselectionChangedEvent = cValue
61 func selectionChangedEventCode
62 return cselectionChangedEvent
64 func SettextChangedEventCode cValue
65 ctextChangedEvent = cValue
67 func textChangedEventCode
68 return ctextChangedEvent
70 func SetundoAvailableEventCode cValue
71 cundoAvailableEvent = cValue
73 func undoAvailableEventCode
74 return cundoAvailableEvent
76 func AddObjectProperties oDesigner
77 AddObjectCommonProperties(oDesigner)
78 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXT,False) # "Text"
79 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_COPYAVAILABLEEVENT,False) # "copyAvailableEvent"
80 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_CURRENTCHARFORMATCHANGEDEVENT,False) # "currentCharFormatChangedEvent"
81 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_CURSORPOSITIONCHANGEDEVENT,False) # "cursorPositionChangedEvent"
82 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_REDOAVAIABLEEVENT,False) # "redoAvailableEvent"
83 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SELECTIONCHANGEDEVENT,False) # "selectionChangedEvent"
84 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXTCHANGEDEVENT,False) # "textChangedEvent"
85 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_UNDOAVAILABLEEVENT,False) # "undoAvailableEvent"
87 func DisplayProperties oDesigner
88 DisplayCommonProperties(oDesigner)
89 oPropertiesTable = oDesigner.oView.oPropertiesTable
90 oPropertiesTable.Blocksignals(True)
92 oPropertiesTable.item(C_AFTERCOMMON,1).settext(TextValue())
93 oPropertiesTable.item(C_AFTERCOMMON+1,1).settext(copyAvailableEventcode())
94 oPropertiesTable.item(C_AFTERCOMMON+2,1).settext(currentCharFormatChangedEventcode())
95 oPropertiesTable.item(C_AFTERCOMMON+3,1).settext(cursorPositionChangedEventcode())
96 oPropertiesTable.item(C_AFTERCOMMON+4,1).settext(redoAvailableEventcode())
97 oPropertiesTable.item(C_AFTERCOMMON+5,1).settext(selectionChangedEventcode())
98 oPropertiesTable.item(C_AFTERCOMMON+6,1).settext(textChangedEventcode())
99 oPropertiesTable.item(C_AFTERCOMMON+7,1).settext(undoAvailableEventcode())
100 oPropertiesTable.Blocksignals(False)
101 # Set the object name
102 setText(oDesigner.oModel.GetObjectName(self))
104 func UpdateProperties oDesigner,nRow,nCol,cValue
105 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
111 setcopyAvailableEventCode(cValue)
113 setcurrentCharFormatChangedEventCode(cValue)
115 setcursorPositionChangedEventCode(cValue)
117 setredoAvailableEventCode(cValue)
119 setselectionChangedEventCode(cValue)
121 settextChangedEventCode(cValue)
123 setundoAvailableEventCode(cValue)
126 # Set the object name
127 setText(oDesigner.oModel.GetObjectName(self))
129 func ObjectDataAsString oDesigner,nTabsCount
130 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
131 cTabs = std_copy(char(9),nTabsCount)
132 cOutput += "," + nl + cTabs + ' :text = "' + oDesigner.PrepareStringForFormFile(TextValue()) + '"'
133 cOutput += "," + nl + cTabs + ' :setcopyAvailableEvent = "' + oDesigner.PrepareStringForFormFile(copyAvailableEventCode()) + '"'
134 cOutput += "," + nl + cTabs + ' :setcurrentCharFormatChangedEvent = "' + oDesigner.PrepareStringForFormFile(currentCharFormatChangedEventCode()) + '"'
135 cOutput += "," + nl + cTabs + ' :setcursorPositionChangedEvent = "' + oDesigner.PrepareStringForFormFile(cursorPositionChangedEventCode()) + '"'
136 cOutput += "," + nl + cTabs + ' :setredoAvailableEvent = "' + oDesigner.PrepareStringForFormFile(redoAvailableEventCode()) + '"'
137 cOutput += "," + nl + cTabs + ' :setselectionChangedEvent = "' + oDesigner.PrepareStringForFormFile(selectionChangedEventCode()) + '"'
138 cOutput += "," + nl + cTabs + ' :settextChangedEvent = "' + oDesigner.PrepareStringForFormFile(textChangedEventCode()) + '"'
139 cOutput += "," + nl + cTabs + ' :setundoAvailableEvent = "' + oDesigner.PrepareStringForFormFile(undoAvailableEventCode()) + '"'
142 func GenerateCustomCode oDesigner
144 cOutput += 'setText("#{f1}")' + nl
145 cOutput = substr(cOutput,"#{f1}",oDesigner.PrepareStringForFormFile(textValue()))
146 cOutput += 'setcopyAvailableEvent("#{f1}")' + nl
147 cOutput = PrepareEvent(cOutput,copyAvailableEventCode(),"#{f1}")
148 cOutput = substr(cOutput,"#{f1}",copyAvailableEventCode())
149 cOutput += 'setcurrentCharFormatChangedEvent("#{f1}")' + nl
150 cOutput = PrepareEvent(cOutput,currentCharFormatChangedEventCode(),"#{f1}")
151 cOutput = substr(cOutput,"#{f1}",currentCharFormatChangedEventCode())
152 cOutput += 'setcursorPositionChangedEvent("#{f1}")' + nl
153 cOutput = PrepareEvent(cOutput,cursorPositionChangedEventCode(),"#{f1}")
154 cOutput = substr(cOutput,"#{f1}",cursorPositionChangedEventCode())
155 cOutput += 'setredoAvailableEvent("#{f1}")' + nl
156 cOutput = PrepareEvent(cOutput,redoAvailableEventCode(),"#{f1}")
157 cOutput = substr(cOutput,"#{f1}",redoAvailableEventCode())
158 cOutput += 'setselectionChangedEvent("#{f1}")' + nl
159 cOutput = PrepareEvent(cOutput,selectionChangedEventCode(),"#{f1}")
160 cOutput = substr(cOutput,"#{f1}",selectionChangedEventCode())
161 cOutput += 'settextChangedEvent("#{f1}")' + nl
162 cOutput = PrepareEvent(cOutput,textChangedEventCode(),"#{f1}")
163 cOutput = substr(cOutput,"#{f1}",textChangedEventCode())
164 cOutput += 'setundoAvailableEvent("#{f1}")' + nl
165 cOutput = PrepareEvent(cOutput,undoAvailableEventCode(),"#{f1}")
166 cOutput = substr(cOutput,"#{f1}",undoAvailableEventCode())
169 func RestoreProperties oDesigner,Item
170 RestoreCommonProperties(oDesigner,item)
171 itemdata = item[:data]
172 setTextValue(itemdata[:text])
173 setText(oDesigner.oModel.GetObjectName(self))
174 SetcopyAvailableEventCode(itemdata[:setcopyAvailableEvent])
175 SetcurrentCharFormatChangedEventCode(itemdata[:setcurrentCharFormatChangedEvent])
176 SetcursorPositionChangedEventCode(itemdata[:setcursorPositionChangedEvent])
177 SetredoAvailableEventCode(itemdata[:setredoAvailableEvent])
178 SetselectionChangedEventCode(itemdata[:setselectionChangedEvent])
179 SettextChangedEventCode(itemdata[:settextChangedEvent])
180 SetundoAvailableEventCode(itemdata[:setundoAvailableEvent])