~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-jp/style.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# text (display styles) widget demo (called by 'widget')
 
3
#
 
4
 
 
5
# toplevel widget ��¸�ߤ���к������
 
6
if defined?($style_demo) && $style_demo
 
7
  $style_demo.destroy 
 
8
  $style_demo = nil
 
9
end
 
10
 
 
11
# demo �Ѥ� toplevel widget ������
 
12
$style_demo = TkToplevel.new {|w|
 
13
  title("Text Demonstration - Display Styles")
 
14
  iconname("style")
 
15
  positionWindow(w)
 
16
}
 
17
 
 
18
# frame ����
 
19
TkFrame.new($style_demo) {|frame|
 
20
  TkButton.new(frame) {
 
21
    #text 'λ��'
 
22
    text '�Ĥ���'
 
23
    command proc{
 
24
      tmppath = $style_demo
 
25
      $style_demo = nil
 
26
      tmppath.destroy
 
27
    }
 
28
  }.pack('side'=>'left', 'expand'=>'yes')
 
29
 
 
30
  TkButton.new(frame) {
 
31
    text '�����ɻ���'
 
32
    command proc{showCode 'style'}
 
33
  }.pack('side'=>'left', 'expand'=>'yes')
 
34
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
 
35
 
 
36
# text ����
 
37
TkText.new($style_demo){|t|
 
38
  # ����
 
39
  setgrid 'true'
 
40
  width  70
 
41
  height 32
 
42
  wrap 'word'
 
43
  TkScrollbar.new($style_demo) {|s|
 
44
    pack('side'=>'right', 'fill'=>'y')
 
45
    command proc{|*args| t.yview(*args)}
 
46
    t.yscrollcommand proc{|first,last| s.set first,last}
 
47
  }
 
48
  pack('expand'=>'yes', 'fill'=>'both')
 
49
 
 
50
  # �ƥ����ȥ������� (�ե���ȴ�Ϣ)
 
51
  style_tag_bold = TkTextTag.new(t, 'font'=>'-*-Courier-Bold-O-Normal--*-120-*-*-*-*-*-*')
 
52
  style_tag_big = TkTextTag.new(t, 'font'=>'-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*', 'kanjifont'=>$msg_kanji_font)
 
53
    style_tag_verybig = TkTextTag.new(t, 'font'=>'-*-Helvetica-Bold-R-Normal--*-240-*-*-*-*-*-*')
 
54
#    style_tag_small = TkTextTag.new(t, 'font'=>'-Adobe-Helvetica-Bold-R-Normal-*-100-*', 'kanjifont'=>$kanji_font)
 
55
    style_tag_small = TkTextTag.new(t, 'font'=>'-Adobe-Helvetica-Bold-R-Normal-*-100-*')
 
56
###
 
57
#  case($tk_version)
 
58
#  when /^4.*/
 
59
#    style_tag_big = TkTextTag.new(t, 'font'=>'-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*', 'kanjifont'=>$msg_kanji_font)
 
60
#    style_tag_small = TkTextTag.new(t, 'font'=>'-Adobe-Helvetica-Bold-R-Normal-*-100-*', 'kanjifont'=>$kanji_font)
 
61
#  when /^8.*/
 
62
#    unless $style_demo_do_first
 
63
#      $style_demo_do_first = true
 
64
#      Tk.tk_call('font', 'create', '@bigascii', 
 
65
#                '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*')
 
66
#      Tk.tk_call('font', 'create', '@smallascii', 
 
67
#                '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*')
 
68
#      Tk.tk_call('font', 'create', '@cBigFont', 
 
69
#                '-compound', '@bigascii @msg_knj')
 
70
#      Tk.tk_call('font', 'create', '@cSmallFont', 
 
71
#                '-compound', '@smallascii @kanji')
 
72
#    end
 
73
#    style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont')
 
74
#    style_tag_small = TkTextTag.new(t, 'font'=>'@cSmallFont')
 
75
#  end
 
76
 
 
77
  # �ƥ����ȥ������� (������꡼�մ�Ϣ)
 
78
  if TkWinfo.depth($root).to_i > 1
 
79
    style_tag_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce')
 
80
    style_tag_color2 = TkTextTag.new(t, 'foreground'=>'red')
 
81
    style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1)
 
82
    style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1)
 
83
  else
 
84
    style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 
 
85
                                     'foreground'=>'white')
 
86
    style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 
 
87
                                     'foreground'=>'white')
 
88
    style_tag_raised = TkTextTag.new(t, 'background'=>'white', 
 
89
                                     'relief'=>'raised', 'borderwidth'=>1)
 
90
    style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 
 
91
                                     'relief'=>'sunken', 'borderwidth'=>1)
 
92
  end
 
93
 
 
94
  # �ƥ����ȥ������� (����¾)
 
95
  if $tk_version =~ /^4\.[01]/
 
96
    style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', 
 
97
                                        'borderwidth'=>0, 
 
98
                                        'bgstipple'=>'gray25')
 
99
  else
 
100
    style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', 
 
101
                                        'borderwidth'=>0, 
 
102
                                        'bgstipple'=>'gray12')
 
103
  end
 
104
  style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50')
 
105
  style_tag_underline = TkTextTag.new(t, 'underline'=>'on')
 
106
  style_tag_overstrike = TkTextTag.new(t, 'overstrike'=>'on')
 
107
  style_tag_right  = TkTextTag.new(t, 'justify'=>'right')
 
108
  style_tag_center = TkTextTag.new(t, 'justify'=>'center')
 
109
  style_tag_super = TkTextTag.new(t, 'offset'=>'4p', 'font'=>'-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*')
 
110
  style_tag_sub = TkTextTag.new(t, 'offset'=>'-2p', 'font'=>'-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*')
 
111
  style_tag_margins = TkTextTag.new(t, 'lmargin1'=>'12m', 'lmargin2'=>'6m',
 
112
                                    'rmargin'=>'10m')
 
113
  style_tag_spacing = TkTextTag.new(t, 'spacing1'=>'10p', 'spacing2'=>'2p',
 
114
                                    'lmargin1'=>'12m', 'lmargin2'=>'6m',
 
115
                                    'rmargin'=>'10m')
 
116
 
 
117
  # �ƥ���������
 
118
  insert('end', '���Τ褦�˥ƥ����� widget �Ͼ�����͡��ʥ��������ɽ�����뤳��
 
119
���Ǥ��ޤ���')
 
120
  insert('end', '����', style_tag_big)
 
121
  insert('end', '�Ȥ����ᥫ�˥���ǥ���ȥ����뤵��ޤ���
 
122
�����Ȥϥƥ����� widget ��Τ���ʸ�� (���ϰ�)���Ф���Ŭ�ѤǤ���
 
123
ñ�ʤ�̾���Τ��ȤǤ����������͡���ɽ���������������Ǥ��ޤ���
 
124
���ꤹ��ȡ����Υ����ΤĤ���ʸ���ϻ��ꤷ�����������ɽ�������
 
125
�褦�ˤʤ�ޤ������ѤǤ���ɽ����������ϼ����̤�Ǥ���
 
126
')
 
127
  insert('end', '
 
128
1. �ե����', style_tag_big)
 
129
  insert('end', '    �ɤ�� X �Υե���ȤǤ�Ȥ��ޤ���')
 
130
  insert('end', 'large', style_tag_verybig)
 
131
  insert('end', '
 
132
�Ȥ�')
 
133
#  insert('end', '������', style_tag_small)
 
134
  insert('end', 'small', style_tag_small)
 
135
  insert('end', '�Ȥ���
 
136
')
 
137
  insert('end', '
 
138
2. ��', style_tag_big)
 
139
  insert('end', '  ')
 
140
  insert('end', '�طʿ�', style_tag_color1)
 
141
  insert('end', '��')
 
142
  insert('end', '���ʿ�', style_tag_color2)
 
143
  insert('end', '��')
 
144
  insert('end', 'ξ��', style_tag_color1, style_tag_color2)
 
145
  insert('end', '�Ȥ��Ѥ��뤳�Ȥ��Ǥ��ޤ���
 
146
')
 
147
  insert('end', '
 
148
3. �֤���', style_tag_big)
 
149
  insert('end', '  ���Τ褦������κݤ�')
 
150
  insert('end', '�طʤ�', style_tag_bgstipple)
 
151
  insert('end', 'ʸ����', style_tag_fgstipple)
 
152
  insert('end', 'ñ�ʤ��ɤ�Ĥ֤�
 
153
�Ǥʤ����֤�����Ȥ����Ȥ��Ǥ��ޤ���
 
154
')
 
155
  insert('end', '
 
156
4. ����', style_tag_big)
 
157
  insert('end', '  ���Τ褦��')
 
158
  insert('end', 'ʸ���˲��������', style_tag_underline)
 
159
  insert('end', '���Ȥ��Ǥ��ޤ���
 
160
')
 
161
  insert('end', '
 
162
5. �Ǥ��ä���', style_tag_big)
 
163
  insert('end', '  ���Τ褦��')
 
164
  insert('end', 'ʸ���˽Ťͤ��������', style_tag_overstrike)
 
165
  insert('end', '���Ȥ��Ǥ��ޤ���
 
166
')
 
167
  insert('end', '
 
168
6. 3D ����', style_tag_big)
 
169
  insert('end', '  �طʤ��Ȥ�Ĥ��ơ�ʸ����')
 
170
  insert('end', '���ӽФ�', style_tag_raised)
 
171
  insert('end', '�褦�ˤ�����')
 
172
  insert('end', '����', style_tag_sunken)
 
173
  insert('end', '
 
174
�褦�ˤǤ��ޤ���
 
175
')
 
176
  insert('end', '
 
177
7. ��·��', style_tag_big)
 
178
  insert('end', ' ���Τ褦�˹Ԥ�
 
179
')
 
180
  insert('end', '����·������
 
181
')
 
182
  insert('end', '����·������
 
183
', style_tag_right)
 
184
  insert('end', '�����·������Ǥ��ޤ���
 
185
', style_tag_center)
 
186
  insert('end', '
 
187
8. ���դ�ʸ����ź��', style_tag_big)
 
188
  insert('end', '  10')
 
189
  insert('end', 'n', style_tag_super)
 
190
  insert('end', ' �Τ褦�˸��դ�ʸ���θ��̤䡢')
 
191
  insert('end', '
 
192
X')
 
193
  insert('end', 'i', style_tag_sub)
 
194
  insert('end', '�Τ褦��ź���θ��̤�Ф����Ȥ��Ǥ��ޤ���
 
195
')
 
196
  insert('end', '
 
197
9. �ޡ�����', style_tag_big)
 
198
  insert('end', '�ƥ����Ȥκ�¦��;ʬ�ʶ�����֤����Ȥ��Ǥ��ޤ�:
 
199
')
 
200
  insert('end', '��������ϥޡ�����λ�����Ǥ��������꡼��', 
 
201
         style_tag_margins)
 
202
  insert('end', '����ޤ��֤����ɽ������Ƥ���1�ԤΥƥ����ȤǤ���', 
 
203
         style_tag_margins)
 
204
  insert('end', '��¦�ˤ�2����Υޡ����������ޤ���', style_tag_margins)
 
205
  insert('end', '1���ܤ��Ф����Τȡ�', style_tag_margins)
 
206
  insert('end', '2���ܰʹߤ�Ϣ³�����ޡ�����', style_tag_margins)
 
207
  insert('end', '�Ǥ����ޤ���¦�ˤ�ޡ����󤬤���ޤ���', style_tag_margins)
 
208
  insert('end', '�Ԥ��ޤ��֤����֤���뤿��˻��Ѥ��뤳�Ȥ��Ǥ��ޤ���
 
209
', style_tag_margins)
 
210
  insert('end', '
 
211
10. ���ڡ�����', style_tag_big)
 
212
  insert('end', '3�ĤΥѥ�᡼���ǹԤΥ��ڡ����󥰤�')
 
213
  insert('end', '���椹
 
214
�뤳�Ȥ��Ǥ��ޤ���Spacing1�ǡ��Ԥ�')
 
215
  insert('end', '��ˤɤΤ��餤�ζ��֤��֤�����
 
216
spacing3')
 
217
  insert('end', '�ǹԤβ��ˤɤΤ��餤�ζ��֤��֤�����')
 
218
  insert('end', '�Ԥ��ޤ��֤���Ƥ���ʤ�
 
219
�С�spacing2�ǡ�')
 
220
  insert('end', '�ƥ����ȹԤ��������Ƥ���Ԥδ֤ˤɤΤ��餤')
 
221
  insert('end', '�ζ��֤���
 
222
�����򼨤��ޤ���
 
223
')
 
224
  insert('end', '�����Υ���ǥ�Ȥ��줿����ϤɤΤ褦��', 
 
225
         style_tag_spacing)
 
226
  insert('end', '���ڡ����󥰤����Ԥ���Τ��򼨤��ޤ���', 
 
227
         style_tag_spacing)
 
228
  insert('end', '������ϼºݤϥƥ�����widget', style_tag_spacing)
 
229
  insert('end', '��1�Ԥǡ�widget�ˤ�ä��ޤ���ޤ�Ƥ��ޤ���
 
230
', style_tag_spacing)
 
231
  insert('end', 'Spacing1�Ϥ��Υƥ����ȤǤ�10point��', style_tag_spacing)
 
232
  insert('end', '���ꤵ��Ƥ��ޤ���', style_tag_spacing)
 
233
  insert('end', '����ˤ�ꡢ����δ֤��礭�ʴֳ֤�', style_tag_spacing)
 
234
  insert('end', '¸�ߤ��Ƥ��ޤ���', style_tag_spacing)
 
235
  insert('end', 'Spacing2��2point�����ꤵ��Ƥ��ޤ���', style_tag_spacing)
 
236
  insert('end', '������������ˤۤ�ξ����ֳ֤�¸�ߤ��Ƥ��ޤ���', 
 
237
         style_tag_spacing)
 
238
  insert('end', 'Spacing3�Ϥ�����Ǥϻ��Ѥ���Ƥ��ޤ���
 
239
', style_tag_spacing)
 
240
  insert('end', '�ֳ֤��ɤ��ˤ��뤫�򸫤�����С������������', 
 
241
         style_tag_spacing)
 
242
  insert('end', '�ʤ��ǥƥ����Ȥ����򤷤Ƥ��������������', style_tag_spacing)
 
243
  insert('end', 'ȿž������ʬ�ˤ�;ʬ�ˤȤ�줿�ֳ֤�', style_tag_spacing)
 
244
  insert('end', '�ޤޤ�Ƥ��ޤ���
 
245
', style_tag_spacing)
 
246
 
 
247
}
 
248