OSDN Git Service

a4f3bcc38e128d50254af2b37dcff14e91f0c182
[ring-lang-081/ring.git] / applications / build / ja-jp / formdesigner / controls / qhyperlink.ring
1 /*
2 **      Project : Form Designer 
3 **      File Purpose :  QHyperLink Control
4 **      Date : 2017.04.29
5 **      Author :  Mahmoud Fayed <msfclipper@yahoo.com>
6 */
7
8 package formdesigner
9
10 class FormDesigner_QHyperLink from QLabel
11
12         CreateCommonAttributes()
13         CreateMoveResizeCornersAttributes()
14
15         cLink = "http://www.ring-lang.net"
16         cText = "Ring Language Website"
17
18         func LinkValue
19                 return cLink
20
21         func SetLinkValue cValue
22                 cLink = cValue
23
24         func TextValue
25                 return cText
26
27         func SetTextValue cValue
28                 cText = cValue
29                 cOutput = '<a href="#{f1}">#{f2}</a>'
30                 cOutput = substr(cOutput,"#{f1}",LinkValue())
31                 cOutput = substr(cOutput,"#{f2}",TextValue())
32                 setText(cOutput)
33
34         func AddObjectProperties  oDesigner
35                 AddObjectCommonProperties(oDesigner)
36                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_LINK,False) # "Link"
37                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXT,False) # "Text"
38
39         func DisplayProperties oDesigner
40                 DisplayCommonProperties(oDesigner)
41                 oPropertiesTable = oDesigner.oView.oPropertiesTable
42                 oPropertiesTable.Blocksignals(True)
43                 # Set the Link Value
44                         oPropertiesTable.item(C_AFTERCOMMON,1).settext(LinkValue())
45                 # Set the Text Value
46                         oPropertiesTable.item(C_AFTERCOMMON+1,1).settext(TextValue())
47                 oPropertiesTable.Blocksignals(False)
48                 setTextValue(cText)
49
50         func UpdateProperties oDesigner,nRow,nCol,cValue
51                 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
52                 switch nRow {
53                         case C_AFTERCOMMON
54                                 setLinkValue(cValue)
55                         case C_AFTERCOMMON + 1
56                                 setTextValue(cValue)
57                 }
58
59         func ObjectDataAsString oDesigner,nTabsCount
60                 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
61                 cTabs = std_copy(char(9),nTabsCount)
62                 cOutput += "," + nl + cTabs + ' :Link =  "' + oDesigner.PrepareStringForFormFile(LinkValue()) + '"'
63                 cOutput += "," + nl + cTabs + ' :Text =  "' + oDesigner.PrepareStringForFormFile(TextValue()) + '"'
64                 return cOutput
65
66         func GenerateCustomCode oDesigner
67                 cOutput = `setText('<a href="#{f1}">#{f2}</a>')` + nl
68                 cOutput = substr(cOutput,"#{f1}",oDesigner.PrepareStringForFormFile(LinkValue()))
69                 cOutput = substr(cOutput,"#{f2}",TextValue())
70                 return cOutput
71
72         func RestoreProperties oDesigner,Item
73                 RestoreCommonProperties(oDesigner,item)
74                 itemdata = item[:data]
75                 setLinkValue(itemdata[:Link])
76                 setTextValue(itemdata[:Text])