OSDN Git Service

Ring 1.10 以来となる開発環境の日本語ローカライズ版 (評価版) を追加 (ノートパッド、フォームデザイナー、対話型実行環境、ファイルの検索)。
[ring-lang-081/ring.git] / applications / build / ja-jp / formdesigner / controls / qlabel.ring
1 /*
2 **      Project : Form Designer 
3 **      File Purpose :  QLabel Control
4 **      Date : 2017.04.29
5 **      Author :  Mahmoud Fayed <msfclipper@yahoo.com>
6 */
7
8 package formdesigner
9
10 class FormDesigner_QLabel from QLabel
11
12         nTextAlign = 0
13
14         CreateCommonAttributes()
15         CreateMoveResizeCornersAttributes()
16
17         func TextAlign
18                 return nTextAlign
19
20         func SetTextAlign nIndex
21                 nTextAlign = nIndex
22                 Switch nIndex {
23                         case 0
24                                 setalignment(Qt_AlignLeft |  Qt_AlignVCenter )
25                         case 1
26                                 setalignment(Qt_AlignHCenter |  Qt_AlignVCenter )
27                         case 2
28                                 setalignment(Qt_AlignRight |  Qt_AlignVCenter )
29                 }
30
31         func AddObjectProperties  oDesigner
32                 AddObjectCommonProperties(oDesigner)
33                 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_TEXT, # "Text"
34                                                 False)
35                 oDesigner.oView.AddPropertyCombobox(T_FORMDESIGNER_ATTRIBUTE_TEXTALIGN, # "Text Align"
36                         [T_FORMDESIGNER_ATTRIBUTE_TEXTALIGNLEFT, # "Left"
37                         T_FORMDESIGNER_ATTRIBUTE_TEXTALIGNCENTER,# "Center" 
38                         T_FORMDESIGNER_ATTRIBUTE_TEXTALIGNRIGHT] # "Right"
39                         )
40
41         func DisplayProperties oDesigner
42                 DisplayCommonProperties(oDesigner)
43                 oPropertiesTable = oDesigner.oView.oPropertiesTable
44                 oPropertiesTable.Blocksignals(True)
45                 # Set the Text
46                         oPropertiesTable.item(C_AFTERCOMMON,1).settext(text())
47                 # Text Align
48                         oWidget = oPropertiesTable.cellwidget(C_AFTERCOMMON+1,1)
49                         oCombo = new qCombobox
50                         oCombo.pObject = oWidget.pObject
51                         oCombo.BlockSignals(True)
52                         oCombo.setCurrentIndex(nTextAlign)
53                         oCombo.BlockSignals(False)
54                 oPropertiesTable.Blocksignals(False)
55
56         func UpdateProperties oDesigner,nRow,nCol,cValue
57                 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
58                 if nRow = C_AFTERCOMMON {
59                         setText(cValue)
60                 }
61
62         func ComboItemAction oDesigner,nRow
63                 nTextAlignPos = C_AFTERCOMMON+1
64                 if nRow = nTextAlignPos  {              # Text Align
65                         oWidget = oDesigner.oView.oPropertiesTable.cellwidget(nTextAlignPos,1)
66                         oCombo = new qCombobox
67                         oCombo.pObject = oWidget.pObject
68                         nIndex = oCombo.CurrentIndex()
69                         setTextAlign(nIndex)
70                 }
71
72         func ObjectDataAsString oDesigner,nTabsCount
73                 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
74                 cTabs = std_copy(char(9),nTabsCount)
75                 cOutput += "," + nl + cTabs + ' :text =  "' + oDesigner.PrepareStringForFormFile(Text()) + '"'
76                 cOutput += "," + nl + cTabs + ' :textalign =  ' + TextAlign()
77                 return cOutput
78
79         func GenerateCustomCode oDesigner
80                 cOutput = 'setText("#{f1}")' + nl + 'setAlignment(#{f2})'
81                 cOutput = substr(cOutput,"#{f1}",oDesigner.PrepareStringForFormFile(text()))
82                 Switch nTextAlign {
83                         case 0
84                                 cOutput = substr(cOutput,"#{f2}","Qt_AlignLeft |  Qt_AlignVCenter")
85                         case 1
86                                 cOutput = substr(cOutput,"#{f2}","Qt_AlignHCenter |  Qt_AlignVCenter" )
87                         case 2
88                                 cOutput = substr(cOutput,"#{f2}","Qt_AlignRight |  Qt_AlignVCenter" )
89                 }
90                 return cOutput
91
92         func RestoreProperties oDesigner,Item
93                 RestoreCommonProperties(oDesigner,item)
94                 itemdata = item[:data]
95                 setText(itemdata[:text])
96                 setTextAlign(0+itemdata[:textalign])