1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="tour-events" xml:lang="ko">
<info>
<link type="next" xref="tour-get_object"/>
<revision version="0.1" date="2013-06-17" status="stub"/>
<credit type="author copyright">
<name>Ekaterina Gerasimova</name>
<email its:translate="no">kittykat3756@gmail.com</email>
<years>2013</years>
</credit>
<credit type="author copyright">
<name>Gordon Hill</name>
<email its:translate="no">caseyweederman@gmail.com</email>
<years>2013</years>
</credit>
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
<desc>Lang으로 이벤트에 함수를 연결합니다.</desc>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>조성호</mal:name>
<mal:email>shcho@gnome.org</mal:email>
<mal:years>2016, 2017, 2018.</mal:years>
</mal:credit>
</info>
<title>동작 및 시그널</title>
<links type="prevnext" style="top"/>
<links type="series" style="floatend">
<title>그놈 시작하기</title>
</links>
<p>gtk에는 프로그램에서 활용할 수 있는 선 정의 이벤트 모음이 있습니다.</p>
<example>
<p>새 클래스로 <code>HelloWorld</code> 를 선언합니다.</p>
<code>
class HelloWorld {
</code>
<p>새 인스턴스를 만들 때 <code>constructor</code>를 호출합니다. <code>GtkApplication</code>를 만들고 <code>activate</code>를 기존의 gtk 이벤트 <code>_onActivate</code>에, <code>startup</code>을 <code>_onStartup</code>에 연결하십시오:</p>
<code>
constructor() {
this.application = new Gtk.Application();
this.application.connect('activate', this._onActivate.bind(this));
this.application.connect('startup', this._onStartup.bind(this));
}
</code>
<p>프로그램을 활성화하는 동안 창을 표시하십시오:</p>
<code>
_onActivate() {
this._window.show_all();
}
</code>
</example>
<links type="prevnext"/>
</page>
|