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

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-jp/text.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 (basic facilities) widget demo (called by 'widget')
 
3
#
 
4
 
 
5
# toplevel widget ��¸�ߤ���к������
 
6
if defined?($text_demo) && $text_demo
 
7
  $text_demo.destroy 
 
8
  $text_demo = nil
 
9
end
 
10
 
 
11
# demo �Ѥ� toplevel widget ������
 
12
$text_demo = TkToplevel.new {|w|
 
13
  title("Text Demonstration - Basic Facilities")
 
14
  iconname("text")
 
15
  positionWindow(w)
 
16
}
 
17
 
 
18
# version check
 
19
if ((Tk::TK_VERSION.split('.').collect{|n| n.to_i} <=> [8,4]) < 0)
 
20
  undo_support = false
 
21
else
 
22
  undo_support = true
 
23
end
 
24
 
 
25
# frame ����
 
26
TkFrame.new($text_demo) {|frame|
 
27
  TkButton.new(frame) {
 
28
    #text 'λ��'
 
29
    text '�Ĥ���'
 
30
    command proc{
 
31
      tmppath = $text_demo
 
32
      $text_demo = nil
 
33
      tmppath.destroy
 
34
    }
 
35
  }.pack('side'=>'left', 'expand'=>'yes')
 
36
 
 
37
  TkButton.new(frame) {
 
38
    text '�����ɻ���'
 
39
    command proc{showCode 'text'}
 
40
  }.pack('side'=>'left', 'expand'=>'yes')
 
41
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
 
42
 
 
43
# text ����
 
44
TkText.new($text_demo){|t|
 
45
  # ����
 
46
  relief 'sunken'
 
47
  bd 2
 
48
  setgrid 1
 
49
  height 30
 
50
  TkScrollbar.new($text_demo) {|s|
 
51
    pack('side'=>'right', 'fill'=>'y')
 
52
    command proc{|*args| t.yview(*args)}
 
53
    t.yscrollcommand proc{|first,last| s.set first,last}
 
54
  }
 
55
  pack('expand'=>'yes', 'fill'=>'both')
 
56
 
 
57
  # �ƥ���������
 
58
  insert('0.0', <<EOT)
 
59
���Υ�����ɥ��ϥƥ����� widget �Ǥ���1�Ԥޤ��Ϥ���ʾ�Υƥ����Ȥ�ɽ
 
60
�����Խ����뤳�Ȥ��Ǥ��ޤ����ʲ��ϥƥ����� widget �ǤǤ������ˤĤ���
 
61
�ޤȤ᤿��ΤǤ���
 
62
 
 
63
1. ���������롣����������С��ǥƥ����Ȥ�ɽ����ʬ��ư�������Ȥ��Ǥ��ޤ���
 
64
 
 
65
2. ������˥󥰡��ƥ����ȤΥ�����ɥ��ǥޥ����ܥ���2 (��ܥ����) ��
 
66
���ƾ岼�˥ɥ�å����Ƥ�����������������ȥƥ����Ȥ���®�ǥɥ�å����졢
 
67
���Ƥ򤶤ä�į��뤳�Ȥ��Ǥ��ޤ���
 
68
 
 
69
3. �ƥ����Ȥ��������ޥ����ܥ���1 (���ܥ���) �򲡤���������������򥻥�
 
70
�Ȥ��Ƥ���ƥ����Ȥ����Ϥ��Ƥ������������Ϥ�����Τ� widget ������ޤ���
 
71
 
 
72
4. ���򡣤����ϰϤ�ʸ�������򤹤�ˤϥޥ����ܥ���1 �򲡤����ɥ�å���
 
73
�Ƥ������������٥ܥ����Υ�����顢���եȥ����򲡤��ʤ���ܥ���1 �򲡤�
 
74
���Ȥ������ϰϤ�Ĵ�����Ǥ��ޤ�������������ϰϤκǸ��ޥ������������
 
75
�Ǥ�ᤤ���֤˥ꥻ�åȤ����ܥ����Υ�����˥ޥ�����ɥ�å����뤳�ȤǤ�
 
76
��������ϰϤ�Ĵ���Ǥ��ޤ������֥륯��å��ǥ�ɤ򡢤ޤ��ȥ�ץ륯���
 
77
���ǹ����Τ����򤹤뤳�Ȥ��Ǥ��ޤ���
 
78
 
 
79
5. �õ���ִ����ƥ����Ȥ�õ��ˤϡ��õ����ʸ�������򤷤ƥХå�
 
80
���ڡ������ǥ꡼�ȥ��������Ϥ��Ƥ������������뤤�ϡ��������ƥ����Ȥ�
 
81
���Ϥ�������򤵤줿�ƥ����Ȥ��ִ�����ޤ���
 
82
 
 
83
6. ������ʬ�Υ��ԡ���������ʬ�򤳤Υ�����ɥ�����Τɤ����˥��ԡ�����
 
84
�ˤϡ��ޤ����ԡ��������������(�����ǡ����뤤���̤Υ��ץꥱ��������)
 
85
�����ܥ��� 2 �򥯥�å����ơ�������������ΰ��֤˥��ԡ����Ƥ���������
 
86
 
 
87
7. �Խ����ƥ����� widget �� Emacs �Υ����Х���ɤ˲ä���ɸ��Ū�ʤ� Motif
 
88
���Խ���ǽ�򥵥ݡ��Ȥ��Ƥ��ޤ����Хå����ڡ����ȥ���ȥ�����-H ������
 
89
��������κ�¦��ʸ���������ޤ����ǥ꡼�ȥ����ȥ���ȥ�����-D ������
 
90
��������α�¦��ʸ���������ޤ���Meta-�Хå����ڡ������������������
 
91
��¦��ñ���������Meta-D ��������������κ�¦��ñ��������ޤ���
 
92
����ȥ�����-K �������������뤫������ޤǤ����������ΰ��֤˲���
 
93
�����ʤ��ä����ϡ����Ԥ������ޤ���#{
 
94
      if undo_support
 
95
        undo_text = "Control-z �ϺǸ�˹Ԥä��ѹ��μ��ä�(undo)��Ԥ���"
 
96
        case $tk_platform['platform']
 
97
        when "unix", "macintosh"
 
98
          undo_text << "Control-Shift-z"
 
99
        else # 'windows'
 
100
          undo_text << "Control-y"
 
101
        end
 
102
        undo_text << "��undo�����ѹ��κ�Ŭ��(redo)��Ԥ��ޤ���"
 
103
      else
 
104
        ""
 
105
      end
 
106
}
 
107
 
 
108
 
 
109
8. ������ɥ��Υꥵ���������� widget �� "setGrid" ���ץ����򥪥�ˤ�
 
110
�Ƥ���ޤ��Τǡ�������ɥ���ꥵ����������ˤϹ⤵�����Ͼ��ʸ�����ʸ
 
111
�����������ܤˤʤ�ޤ����ޤ���������ɥ��򶹤��������ˤ�Ĺ���Ԥ���ư
 
112
Ū���ޤ��֤��졢������Ƥ����Ƥ�������褦�ˤʤäƤ��ޤ���
 
113
EOT
 
114
 
 
115
  set_insert('0.0')
 
116
}
 
117